porffor 0.1.0 → 0.2.0-77e30e8

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 (658) hide show
  1. package/README.md +184 -204
  2. package/compiler/2c.js +377 -0
  3. package/compiler/builtins/base64.js +91 -91
  4. package/compiler/builtins.js +19 -13
  5. package/compiler/codeGen.js +1313 -418
  6. package/compiler/decompile.js +35 -9
  7. package/compiler/embedding.js +9 -5
  8. package/compiler/encoding.js +8 -2
  9. package/compiler/index.js +55 -17
  10. package/compiler/log.js +15 -0
  11. package/compiler/opt.js +357 -258
  12. package/compiler/parse.js +24 -1
  13. package/compiler/prototype.js +263 -56
  14. package/compiler/sections.js +51 -8
  15. package/compiler/wasmSpec.js +3 -0
  16. package/compiler/wrap.js +21 -7
  17. package/package.json +6 -1
  18. package/porf.cmd +1 -1
  19. package/rhemyn/README.md +37 -0
  20. package/rhemyn/compile.js +214 -0
  21. package/rhemyn/parse.js +321 -0
  22. package/rhemyn/test/parse.js +59 -0
  23. package/runner/index.js +54 -31
  24. package/runner/info.js +37 -2
  25. package/runner/profile.js +1 -2
  26. package/runner/repl.js +13 -11
  27. package/runner/results.json +1 -0
  28. package/runner/transform.js +15 -36
  29. package/runner/version.js +10 -0
  30. package/CNAME +0 -1
  31. package/index.html +0 -1264
  32. package/logo.png +0 -0
  33. package/sw.js +0 -26
  34. package/test/array_1.js +0 -8
  35. package/test/array_push.js +0 -8
  36. package/test/assignop_1.js +0 -15
  37. package/test/bitwise_1.js +0 -6
  38. package/test/bool_1.js +0 -3
  39. package/test/boolean.js +0 -6
  40. package/test/break_1.js +0 -6
  41. package/test/break_2.js +0 -12
  42. package/test/conditional_1.js +0 -3
  43. package/test/conditional_2.js +0 -4
  44. package/test/console_1.js +0 -2
  45. package/test/continue_1.js +0 -6
  46. package/test/continue_2.js +0 -10
  47. package/test/empty.js +0 -1
  48. package/test/ending_exp_1.js +0 -2
  49. package/test/ending_exp_2.js +0 -6
  50. package/test/eq_1.js +0 -4
  51. package/test/eq_2.js +0 -4
  52. package/test/eq_3.js +0 -5
  53. package/test/export_1.js +0 -9
  54. package/test/factorial.js +0 -3
  55. package/test/fibonacci.js +0 -16
  56. package/test/float_div0.js +0 -2
  57. package/test/float_frac.js +0 -2
  58. package/test/float_isfinite.js +0 -29
  59. package/test/float_isinteger.js +0 -13
  60. package/test/float_isnan.js +0 -20
  61. package/test/float_issafeinteger.js +0 -11
  62. package/test/float_large.js +0 -2
  63. package/test/float_math_funcs.js +0 -24
  64. package/test/float_math_random.js +0 -6
  65. package/test/float_nan.js +0 -3
  66. package/test/float_number_values.js +0 -12
  67. package/test/for_1.js +0 -4
  68. package/test/for_2.js +0 -4
  69. package/test/func_1.js +0 -16
  70. package/test/func_2.js +0 -6
  71. package/test/func_3.js +0 -10
  72. package/test/global_1.js +0 -8
  73. package/test/global_2.js +0 -10
  74. package/test/if_1.js +0 -6
  75. package/test/if_2.js +0 -9
  76. package/test/if_3.js +0 -7
  77. package/test/iife_1.js +0 -8
  78. package/test/iife_2.js +0 -8
  79. package/test/index.js +0 -93
  80. package/test/int_number_values.js +0 -6
  81. package/test/logic_1.js +0 -7
  82. package/test/logic_2.js +0 -7
  83. package/test/math_1.js +0 -6
  84. package/test/math_2.js +0 -12
  85. package/test/math_3.js +0 -6
  86. package/test/number_func.js +0 -4
  87. package/test/return_1.js +0 -8
  88. package/test/return_2.js +0 -11
  89. package/test/tailcall_1.js +0 -10
  90. package/test/throw_1.js +0 -2
  91. package/test/throw_2.js +0 -4
  92. package/test/throw_3.js +0 -2
  93. package/test/throw_4.js +0 -3
  94. package/test/try_1.js +0 -7
  95. package/test/unary_1.js +0 -4
  96. package/test/unary_2.js +0 -5
  97. package/test/unary_3.js +0 -6
  98. package/test/unary_4.js +0 -12
  99. package/test/unary_5.js +0 -8
  100. package/test/undefined_1.js +0 -8
  101. package/test/undefined_2.js +0 -10
  102. package/test/updateexp_1.js +0 -9
  103. package/test/vars_1.js +0 -5
  104. package/test/vars_2.js +0 -9
  105. package/test/while_1.js +0 -6
  106. package/test262/compare.js +0 -30
  107. package/test262/index.js +0 -314
  108. package/test262/node_modules/.bin/esparse +0 -12
  109. package/test262/node_modules/.bin/esparse.cmd +0 -17
  110. package/test262/node_modules/.bin/esparse.ps1 +0 -28
  111. package/test262/node_modules/.bin/esvalidate +0 -12
  112. package/test262/node_modules/.bin/esvalidate.cmd +0 -17
  113. package/test262/node_modules/.bin/esvalidate.ps1 +0 -28
  114. package/test262/node_modules/.bin/js-yaml +0 -12
  115. package/test262/node_modules/.bin/js-yaml.cmd +0 -17
  116. package/test262/node_modules/.bin/js-yaml.ps1 +0 -28
  117. package/test262/node_modules/.package-lock.json +0 -0
  118. package/test262/node_modules/@nodelib/fs.scandir/LICENSE +0 -21
  119. package/test262/node_modules/@nodelib/fs.scandir/README.md +0 -171
  120. package/test262/node_modules/@nodelib/fs.scandir/out/adapters/fs.d.ts +0 -20
  121. package/test262/node_modules/@nodelib/fs.scandir/out/adapters/fs.js +0 -19
  122. package/test262/node_modules/@nodelib/fs.scandir/out/constants.d.ts +0 -4
  123. package/test262/node_modules/@nodelib/fs.scandir/out/constants.js +0 -17
  124. package/test262/node_modules/@nodelib/fs.scandir/out/index.d.ts +0 -12
  125. package/test262/node_modules/@nodelib/fs.scandir/out/index.js +0 -26
  126. package/test262/node_modules/@nodelib/fs.scandir/out/providers/async.d.ts +0 -7
  127. package/test262/node_modules/@nodelib/fs.scandir/out/providers/async.js +0 -104
  128. package/test262/node_modules/@nodelib/fs.scandir/out/providers/common.d.ts +0 -1
  129. package/test262/node_modules/@nodelib/fs.scandir/out/providers/common.js +0 -13
  130. package/test262/node_modules/@nodelib/fs.scandir/out/providers/sync.d.ts +0 -5
  131. package/test262/node_modules/@nodelib/fs.scandir/out/providers/sync.js +0 -54
  132. package/test262/node_modules/@nodelib/fs.scandir/out/settings.d.ts +0 -20
  133. package/test262/node_modules/@nodelib/fs.scandir/out/settings.js +0 -24
  134. package/test262/node_modules/@nodelib/fs.scandir/out/types/index.d.ts +0 -20
  135. package/test262/node_modules/@nodelib/fs.scandir/out/types/index.js +0 -2
  136. package/test262/node_modules/@nodelib/fs.scandir/out/utils/fs.d.ts +0 -2
  137. package/test262/node_modules/@nodelib/fs.scandir/out/utils/fs.js +0 -19
  138. package/test262/node_modules/@nodelib/fs.scandir/out/utils/index.d.ts +0 -2
  139. package/test262/node_modules/@nodelib/fs.scandir/out/utils/index.js +0 -5
  140. package/test262/node_modules/@nodelib/fs.scandir/package.json +0 -44
  141. package/test262/node_modules/@nodelib/fs.stat/LICENSE +0 -21
  142. package/test262/node_modules/@nodelib/fs.stat/README.md +0 -126
  143. package/test262/node_modules/@nodelib/fs.stat/out/adapters/fs.d.ts +0 -13
  144. package/test262/node_modules/@nodelib/fs.stat/out/adapters/fs.js +0 -17
  145. package/test262/node_modules/@nodelib/fs.stat/out/index.d.ts +0 -12
  146. package/test262/node_modules/@nodelib/fs.stat/out/index.js +0 -26
  147. package/test262/node_modules/@nodelib/fs.stat/out/providers/async.d.ts +0 -4
  148. package/test262/node_modules/@nodelib/fs.stat/out/providers/async.js +0 -36
  149. package/test262/node_modules/@nodelib/fs.stat/out/providers/sync.d.ts +0 -3
  150. package/test262/node_modules/@nodelib/fs.stat/out/providers/sync.js +0 -23
  151. package/test262/node_modules/@nodelib/fs.stat/out/settings.d.ts +0 -16
  152. package/test262/node_modules/@nodelib/fs.stat/out/settings.js +0 -16
  153. package/test262/node_modules/@nodelib/fs.stat/out/types/index.d.ts +0 -4
  154. package/test262/node_modules/@nodelib/fs.stat/out/types/index.js +0 -2
  155. package/test262/node_modules/@nodelib/fs.stat/package.json +0 -37
  156. package/test262/node_modules/@nodelib/fs.walk/LICENSE +0 -21
  157. package/test262/node_modules/@nodelib/fs.walk/README.md +0 -215
  158. package/test262/node_modules/@nodelib/fs.walk/out/index.d.ts +0 -14
  159. package/test262/node_modules/@nodelib/fs.walk/out/index.js +0 -34
  160. package/test262/node_modules/@nodelib/fs.walk/out/providers/async.d.ts +0 -12
  161. package/test262/node_modules/@nodelib/fs.walk/out/providers/async.js +0 -30
  162. package/test262/node_modules/@nodelib/fs.walk/out/providers/index.d.ts +0 -4
  163. package/test262/node_modules/@nodelib/fs.walk/out/providers/index.js +0 -9
  164. package/test262/node_modules/@nodelib/fs.walk/out/providers/stream.d.ts +0 -12
  165. package/test262/node_modules/@nodelib/fs.walk/out/providers/stream.js +0 -34
  166. package/test262/node_modules/@nodelib/fs.walk/out/providers/sync.d.ts +0 -10
  167. package/test262/node_modules/@nodelib/fs.walk/out/providers/sync.js +0 -14
  168. package/test262/node_modules/@nodelib/fs.walk/out/readers/async.d.ts +0 -30
  169. package/test262/node_modules/@nodelib/fs.walk/out/readers/async.js +0 -97
  170. package/test262/node_modules/@nodelib/fs.walk/out/readers/common.d.ts +0 -7
  171. package/test262/node_modules/@nodelib/fs.walk/out/readers/common.js +0 -31
  172. package/test262/node_modules/@nodelib/fs.walk/out/readers/reader.d.ts +0 -6
  173. package/test262/node_modules/@nodelib/fs.walk/out/readers/reader.js +0 -11
  174. package/test262/node_modules/@nodelib/fs.walk/out/readers/sync.d.ts +0 -15
  175. package/test262/node_modules/@nodelib/fs.walk/out/readers/sync.js +0 -59
  176. package/test262/node_modules/@nodelib/fs.walk/out/settings.d.ts +0 -30
  177. package/test262/node_modules/@nodelib/fs.walk/out/settings.js +0 -26
  178. package/test262/node_modules/@nodelib/fs.walk/out/types/index.d.ts +0 -8
  179. package/test262/node_modules/@nodelib/fs.walk/out/types/index.js +0 -2
  180. package/test262/node_modules/@nodelib/fs.walk/package.json +0 -44
  181. package/test262/node_modules/argparse/CHANGELOG.md +0 -185
  182. package/test262/node_modules/argparse/LICENSE +0 -21
  183. package/test262/node_modules/argparse/README.md +0 -257
  184. package/test262/node_modules/argparse/index.js +0 -3
  185. package/test262/node_modules/argparse/lib/action/append/constant.js +0 -47
  186. package/test262/node_modules/argparse/lib/action/append.js +0 -53
  187. package/test262/node_modules/argparse/lib/action/count.js +0 -40
  188. package/test262/node_modules/argparse/lib/action/help.js +0 -47
  189. package/test262/node_modules/argparse/lib/action/store/constant.js +0 -43
  190. package/test262/node_modules/argparse/lib/action/store/false.js +0 -27
  191. package/test262/node_modules/argparse/lib/action/store/true.js +0 -26
  192. package/test262/node_modules/argparse/lib/action/store.js +0 -50
  193. package/test262/node_modules/argparse/lib/action/subparsers.js +0 -149
  194. package/test262/node_modules/argparse/lib/action/version.js +0 -47
  195. package/test262/node_modules/argparse/lib/action.js +0 -146
  196. package/test262/node_modules/argparse/lib/action_container.js +0 -482
  197. package/test262/node_modules/argparse/lib/argparse.js +0 -14
  198. package/test262/node_modules/argparse/lib/argument/error.js +0 -50
  199. package/test262/node_modules/argparse/lib/argument/exclusive.js +0 -54
  200. package/test262/node_modules/argparse/lib/argument/group.js +0 -75
  201. package/test262/node_modules/argparse/lib/argument_parser.js +0 -1161
  202. package/test262/node_modules/argparse/lib/const.js +0 -21
  203. package/test262/node_modules/argparse/lib/help/added_formatters.js +0 -87
  204. package/test262/node_modules/argparse/lib/help/formatter.js +0 -795
  205. package/test262/node_modules/argparse/lib/namespace.js +0 -76
  206. package/test262/node_modules/argparse/lib/utils.js +0 -57
  207. package/test262/node_modules/argparse/package.json +0 -34
  208. package/test262/node_modules/braces/CHANGELOG.md +0 -184
  209. package/test262/node_modules/braces/LICENSE +0 -21
  210. package/test262/node_modules/braces/README.md +0 -593
  211. package/test262/node_modules/braces/index.js +0 -170
  212. package/test262/node_modules/braces/lib/compile.js +0 -57
  213. package/test262/node_modules/braces/lib/constants.js +0 -57
  214. package/test262/node_modules/braces/lib/expand.js +0 -113
  215. package/test262/node_modules/braces/lib/parse.js +0 -333
  216. package/test262/node_modules/braces/lib/stringify.js +0 -32
  217. package/test262/node_modules/braces/lib/utils.js +0 -112
  218. package/test262/node_modules/braces/package.json +0 -77
  219. package/test262/node_modules/esprima/ChangeLog +0 -235
  220. package/test262/node_modules/esprima/LICENSE.BSD +0 -21
  221. package/test262/node_modules/esprima/README.md +0 -46
  222. package/test262/node_modules/esprima/bin/esparse.js +0 -139
  223. package/test262/node_modules/esprima/bin/esvalidate.js +0 -236
  224. package/test262/node_modules/esprima/dist/esprima.js +0 -6709
  225. package/test262/node_modules/esprima/package.json +0 -112
  226. package/test262/node_modules/fast-glob/LICENSE +0 -21
  227. package/test262/node_modules/fast-glob/README.md +0 -859
  228. package/test262/node_modules/fast-glob/out/index.d.ts +0 -40
  229. package/test262/node_modules/fast-glob/out/index.js +0 -102
  230. package/test262/node_modules/fast-glob/out/managers/tasks.d.ts +0 -22
  231. package/test262/node_modules/fast-glob/out/managers/tasks.js +0 -110
  232. package/test262/node_modules/fast-glob/out/providers/async.d.ts +0 -9
  233. package/test262/node_modules/fast-glob/out/providers/async.js +0 -23
  234. package/test262/node_modules/fast-glob/out/providers/filters/deep.d.ts +0 -16
  235. package/test262/node_modules/fast-glob/out/providers/filters/deep.js +0 -62
  236. package/test262/node_modules/fast-glob/out/providers/filters/entry.d.ts +0 -16
  237. package/test262/node_modules/fast-glob/out/providers/filters/entry.js +0 -63
  238. package/test262/node_modules/fast-glob/out/providers/filters/error.d.ts +0 -8
  239. package/test262/node_modules/fast-glob/out/providers/filters/error.js +0 -15
  240. package/test262/node_modules/fast-glob/out/providers/matchers/matcher.d.ts +0 -33
  241. package/test262/node_modules/fast-glob/out/providers/matchers/matcher.js +0 -45
  242. package/test262/node_modules/fast-glob/out/providers/matchers/partial.d.ts +0 -4
  243. package/test262/node_modules/fast-glob/out/providers/matchers/partial.js +0 -38
  244. package/test262/node_modules/fast-glob/out/providers/provider.d.ts +0 -19
  245. package/test262/node_modules/fast-glob/out/providers/provider.js +0 -48
  246. package/test262/node_modules/fast-glob/out/providers/stream.d.ts +0 -11
  247. package/test262/node_modules/fast-glob/out/providers/stream.js +0 -31
  248. package/test262/node_modules/fast-glob/out/providers/sync.d.ts +0 -9
  249. package/test262/node_modules/fast-glob/out/providers/sync.js +0 -23
  250. package/test262/node_modules/fast-glob/out/providers/transformers/entry.d.ts +0 -8
  251. package/test262/node_modules/fast-glob/out/providers/transformers/entry.js +0 -26
  252. package/test262/node_modules/fast-glob/out/readers/async.d.ts +0 -10
  253. package/test262/node_modules/fast-glob/out/readers/async.js +0 -35
  254. package/test262/node_modules/fast-glob/out/readers/reader.d.ts +0 -15
  255. package/test262/node_modules/fast-glob/out/readers/reader.js +0 -33
  256. package/test262/node_modules/fast-glob/out/readers/stream.d.ts +0 -14
  257. package/test262/node_modules/fast-glob/out/readers/stream.js +0 -55
  258. package/test262/node_modules/fast-glob/out/readers/sync.d.ts +0 -12
  259. package/test262/node_modules/fast-glob/out/readers/sync.js +0 -43
  260. package/test262/node_modules/fast-glob/out/settings.d.ts +0 -164
  261. package/test262/node_modules/fast-glob/out/settings.js +0 -57
  262. package/test262/node_modules/fast-glob/out/types/index.d.ts +0 -31
  263. package/test262/node_modules/fast-glob/out/types/index.js +0 -2
  264. package/test262/node_modules/fast-glob/out/utils/array.d.ts +0 -2
  265. package/test262/node_modules/fast-glob/out/utils/array.js +0 -22
  266. package/test262/node_modules/fast-glob/out/utils/errno.d.ts +0 -2
  267. package/test262/node_modules/fast-glob/out/utils/errno.js +0 -7
  268. package/test262/node_modules/fast-glob/out/utils/fs.d.ts +0 -4
  269. package/test262/node_modules/fast-glob/out/utils/fs.js +0 -19
  270. package/test262/node_modules/fast-glob/out/utils/index.d.ts +0 -8
  271. package/test262/node_modules/fast-glob/out/utils/index.js +0 -17
  272. package/test262/node_modules/fast-glob/out/utils/path.d.ts +0 -13
  273. package/test262/node_modules/fast-glob/out/utils/path.js +0 -68
  274. package/test262/node_modules/fast-glob/out/utils/pattern.d.ts +0 -47
  275. package/test262/node_modules/fast-glob/out/utils/pattern.js +0 -188
  276. package/test262/node_modules/fast-glob/out/utils/stream.d.ts +0 -4
  277. package/test262/node_modules/fast-glob/out/utils/stream.js +0 -17
  278. package/test262/node_modules/fast-glob/out/utils/string.d.ts +0 -2
  279. package/test262/node_modules/fast-glob/out/utils/string.js +0 -11
  280. package/test262/node_modules/fast-glob/package.json +0 -81
  281. package/test262/node_modules/fastq/.github/dependabot.yml +0 -11
  282. package/test262/node_modules/fastq/.github/workflows/ci.yml +0 -50
  283. package/test262/node_modules/fastq/LICENSE +0 -13
  284. package/test262/node_modules/fastq/README.md +0 -309
  285. package/test262/node_modules/fastq/bench.js +0 -66
  286. package/test262/node_modules/fastq/example.js +0 -14
  287. package/test262/node_modules/fastq/example.mjs +0 -11
  288. package/test262/node_modules/fastq/index.d.ts +0 -37
  289. package/test262/node_modules/fastq/package.json +0 -52
  290. package/test262/node_modules/fastq/queue.js +0 -289
  291. package/test262/node_modules/fastq/test/example.ts +0 -81
  292. package/test262/node_modules/fastq/test/promise.js +0 -248
  293. package/test262/node_modules/fastq/test/test.js +0 -566
  294. package/test262/node_modules/fastq/test/tsconfig.json +0 -11
  295. package/test262/node_modules/fill-range/LICENSE +0 -21
  296. package/test262/node_modules/fill-range/README.md +0 -237
  297. package/test262/node_modules/fill-range/index.js +0 -249
  298. package/test262/node_modules/fill-range/package.json +0 -69
  299. package/test262/node_modules/glob-parent/CHANGELOG.md +0 -110
  300. package/test262/node_modules/glob-parent/LICENSE +0 -15
  301. package/test262/node_modules/glob-parent/README.md +0 -137
  302. package/test262/node_modules/glob-parent/index.js +0 -42
  303. package/test262/node_modules/glob-parent/package.json +0 -48
  304. package/test262/node_modules/graceful-fs/LICENSE +0 -15
  305. package/test262/node_modules/graceful-fs/README.md +0 -143
  306. package/test262/node_modules/graceful-fs/clone.js +0 -23
  307. package/test262/node_modules/graceful-fs/graceful-fs.js +0 -448
  308. package/test262/node_modules/graceful-fs/legacy-streams.js +0 -118
  309. package/test262/node_modules/graceful-fs/package.json +0 -53
  310. package/test262/node_modules/graceful-fs/polyfills.js +0 -355
  311. package/test262/node_modules/is-extglob/LICENSE +0 -21
  312. package/test262/node_modules/is-extglob/README.md +0 -107
  313. package/test262/node_modules/is-extglob/index.js +0 -20
  314. package/test262/node_modules/is-extglob/package.json +0 -69
  315. package/test262/node_modules/is-glob/LICENSE +0 -21
  316. package/test262/node_modules/is-glob/README.md +0 -206
  317. package/test262/node_modules/is-glob/index.js +0 -150
  318. package/test262/node_modules/is-glob/package.json +0 -81
  319. package/test262/node_modules/is-number/LICENSE +0 -21
  320. package/test262/node_modules/is-number/README.md +0 -187
  321. package/test262/node_modules/is-number/index.js +0 -18
  322. package/test262/node_modules/is-number/package.json +0 -82
  323. package/test262/node_modules/js-yaml/CHANGELOG.md +0 -557
  324. package/test262/node_modules/js-yaml/LICENSE +0 -21
  325. package/test262/node_modules/js-yaml/README.md +0 -299
  326. package/test262/node_modules/js-yaml/bin/js-yaml.js +0 -132
  327. package/test262/node_modules/js-yaml/dist/js-yaml.js +0 -3989
  328. package/test262/node_modules/js-yaml/dist/js-yaml.min.js +0 -1
  329. package/test262/node_modules/js-yaml/index.js +0 -7
  330. package/test262/node_modules/js-yaml/lib/js-yaml/common.js +0 -59
  331. package/test262/node_modules/js-yaml/lib/js-yaml/dumper.js +0 -850
  332. package/test262/node_modules/js-yaml/lib/js-yaml/exception.js +0 -43
  333. package/test262/node_modules/js-yaml/lib/js-yaml/loader.js +0 -1644
  334. package/test262/node_modules/js-yaml/lib/js-yaml/mark.js +0 -76
  335. package/test262/node_modules/js-yaml/lib/js-yaml/schema/core.js +0 -18
  336. package/test262/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +0 -25
  337. package/test262/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +0 -28
  338. package/test262/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +0 -17
  339. package/test262/node_modules/js-yaml/lib/js-yaml/schema/json.js +0 -25
  340. package/test262/node_modules/js-yaml/lib/js-yaml/schema.js +0 -108
  341. package/test262/node_modules/js-yaml/lib/js-yaml/type/binary.js +0 -138
  342. package/test262/node_modules/js-yaml/lib/js-yaml/type/bool.js +0 -35
  343. package/test262/node_modules/js-yaml/lib/js-yaml/type/float.js +0 -116
  344. package/test262/node_modules/js-yaml/lib/js-yaml/type/int.js +0 -173
  345. package/test262/node_modules/js-yaml/lib/js-yaml/type/js/function.js +0 -93
  346. package/test262/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +0 -60
  347. package/test262/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +0 -28
  348. package/test262/node_modules/js-yaml/lib/js-yaml/type/map.js +0 -8
  349. package/test262/node_modules/js-yaml/lib/js-yaml/type/merge.js +0 -12
  350. package/test262/node_modules/js-yaml/lib/js-yaml/type/null.js +0 -34
  351. package/test262/node_modules/js-yaml/lib/js-yaml/type/omap.js +0 -44
  352. package/test262/node_modules/js-yaml/lib/js-yaml/type/pairs.js +0 -53
  353. package/test262/node_modules/js-yaml/lib/js-yaml/type/seq.js +0 -8
  354. package/test262/node_modules/js-yaml/lib/js-yaml/type/set.js +0 -29
  355. package/test262/node_modules/js-yaml/lib/js-yaml/type/str.js +0 -8
  356. package/test262/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +0 -88
  357. package/test262/node_modules/js-yaml/lib/js-yaml/type.js +0 -61
  358. package/test262/node_modules/js-yaml/lib/js-yaml.js +0 -39
  359. package/test262/node_modules/js-yaml/package.json +0 -49
  360. package/test262/node_modules/klaw/CHANGELOG.md +0 -62
  361. package/test262/node_modules/klaw/LICENSE +0 -15
  362. package/test262/node_modules/klaw/README.md +0 -252
  363. package/test262/node_modules/klaw/package.json +0 -40
  364. package/test262/node_modules/klaw/src/index.js +0 -56
  365. package/test262/node_modules/merge2/LICENSE +0 -21
  366. package/test262/node_modules/merge2/README.md +0 -144
  367. package/test262/node_modules/merge2/index.js +0 -144
  368. package/test262/node_modules/merge2/package.json +0 -43
  369. package/test262/node_modules/micromatch/LICENSE +0 -21
  370. package/test262/node_modules/micromatch/README.md +0 -1011
  371. package/test262/node_modules/micromatch/index.js +0 -467
  372. package/test262/node_modules/micromatch/package.json +0 -119
  373. package/test262/node_modules/picomatch/CHANGELOG.md +0 -136
  374. package/test262/node_modules/picomatch/LICENSE +0 -21
  375. package/test262/node_modules/picomatch/README.md +0 -708
  376. package/test262/node_modules/picomatch/index.js +0 -3
  377. package/test262/node_modules/picomatch/lib/constants.js +0 -179
  378. package/test262/node_modules/picomatch/lib/parse.js +0 -1091
  379. package/test262/node_modules/picomatch/lib/picomatch.js +0 -342
  380. package/test262/node_modules/picomatch/lib/scan.js +0 -391
  381. package/test262/node_modules/picomatch/lib/utils.js +0 -64
  382. package/test262/node_modules/picomatch/package.json +0 -81
  383. package/test262/node_modules/queue-microtask/LICENSE +0 -20
  384. package/test262/node_modules/queue-microtask/README.md +0 -90
  385. package/test262/node_modules/queue-microtask/index.d.ts +0 -2
  386. package/test262/node_modules/queue-microtask/index.js +0 -9
  387. package/test262/node_modules/queue-microtask/package.json +0 -55
  388. package/test262/node_modules/reusify/.coveralls.yml +0 -1
  389. package/test262/node_modules/reusify/.travis.yml +0 -28
  390. package/test262/node_modules/reusify/LICENSE +0 -22
  391. package/test262/node_modules/reusify/README.md +0 -145
  392. package/test262/node_modules/reusify/benchmarks/createNoCodeFunction.js +0 -30
  393. package/test262/node_modules/reusify/benchmarks/fib.js +0 -13
  394. package/test262/node_modules/reusify/benchmarks/reuseNoCodeFunction.js +0 -38
  395. package/test262/node_modules/reusify/package.json +0 -45
  396. package/test262/node_modules/reusify/reusify.js +0 -33
  397. package/test262/node_modules/reusify/test.js +0 -66
  398. package/test262/node_modules/run-parallel/LICENSE +0 -20
  399. package/test262/node_modules/run-parallel/README.md +0 -85
  400. package/test262/node_modules/run-parallel/index.js +0 -51
  401. package/test262/node_modules/run-parallel/package.json +0 -58
  402. package/test262/node_modules/sprintf-js/LICENSE +0 -24
  403. package/test262/node_modules/sprintf-js/README.md +0 -88
  404. package/test262/node_modules/sprintf-js/bower.json +0 -14
  405. package/test262/node_modules/sprintf-js/demo/angular.html +0 -20
  406. package/test262/node_modules/sprintf-js/dist/angular-sprintf.min.js +0 -4
  407. package/test262/node_modules/sprintf-js/dist/angular-sprintf.min.js.map +0 -1
  408. package/test262/node_modules/sprintf-js/dist/angular-sprintf.min.map +0 -1
  409. package/test262/node_modules/sprintf-js/dist/sprintf.min.js +0 -4
  410. package/test262/node_modules/sprintf-js/dist/sprintf.min.js.map +0 -1
  411. package/test262/node_modules/sprintf-js/dist/sprintf.min.map +0 -1
  412. package/test262/node_modules/sprintf-js/gruntfile.js +0 -36
  413. package/test262/node_modules/sprintf-js/package.json +0 -22
  414. package/test262/node_modules/sprintf-js/src/angular-sprintf.js +0 -18
  415. package/test262/node_modules/sprintf-js/src/sprintf.js +0 -208
  416. package/test262/node_modules/sprintf-js/test/test.js +0 -82
  417. package/test262/node_modules/test262-stream/.jshintignore +0 -2
  418. package/test262/node_modules/test262-stream/.jshintrc +0 -6
  419. package/test262/node_modules/test262-stream/.travis.yml +0 -5
  420. package/test262/node_modules/test262-stream/CONTRIBUTING.md +0 -37
  421. package/test262/node_modules/test262-stream/LICENSE-MICROSOFT.txt +0 -27
  422. package/test262/node_modules/test262-stream/LICENSE.txt +0 -27
  423. package/test262/node_modules/test262-stream/README.md +0 -71
  424. package/test262/node_modules/test262-stream/lib/builder.js +0 -46
  425. package/test262/node_modules/test262-stream/lib/compile.js +0 -24
  426. package/test262/node_modules/test262-stream/lib/create-scenarios.js +0 -29
  427. package/test262/node_modules/test262-stream/lib/index.js +0 -187
  428. package/test262/node_modules/test262-stream/lib/test-file.js +0 -150
  429. package/test262/node_modules/test262-stream/package.json +0 -26
  430. package/test262/node_modules/test262-stream/test/collateral/invalid-missing-harness/fake-test262/test/a-test-file.js +0 -16
  431. package/test262/node_modules/test262-stream/test/collateral/invalid-version-other-accepted/fake-test262/harness/assert.js +0 -17
  432. package/test262/node_modules/test262-stream/test/collateral/invalid-version-other-accepted/fake-test262/harness/doneprintHandle.js +0 -6
  433. package/test262/node_modules/test262-stream/test/collateral/invalid-version-other-accepted/fake-test262/harness/sta.js +0 -12
  434. package/test262/node_modules/test262-stream/test/collateral/invalid-version-other-accepted/fake-test262/package.json +0 -3
  435. package/test262/node_modules/test262-stream/test/collateral/invalid-version-other-accepted/fake-test262/test/strict.js +0 -9
  436. package/test262/node_modules/test262-stream/test/collateral/invalid-version-unsupported/fake-test262/harness/assert.js +0 -17
  437. package/test262/node_modules/test262-stream/test/collateral/invalid-version-unsupported/fake-test262/harness/doneprintHandle.js +0 -6
  438. package/test262/node_modules/test262-stream/test/collateral/invalid-version-unsupported/fake-test262/harness/sta.js +0 -12
  439. package/test262/node_modules/test262-stream/test/collateral/invalid-version-unsupported/fake-test262/package.json +0 -3
  440. package/test262/node_modules/test262-stream/test/collateral/invalid-version-unsupported/fake-test262/test/strict.js +0 -9
  441. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-content/test/asyncNegative_default.js +0 -49
  442. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-content/test/asyncNegative_strict_mode.js +0 -50
  443. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-content/test/async_default.js +0 -48
  444. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-content/test/async_strict_mode.js +0 -49
  445. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-content/test/bothStrict_default.js +0 -46
  446. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-content/test/bothStrict_strict_mode.js +0 -47
  447. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-content/test/error_default.js +0 -39
  448. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-content/test/error_strict_mode.js +0 -40
  449. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-content/test/module_default.js +0 -37
  450. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-content/test/module_strict_mode.js +0 -38
  451. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-content/test/negative-empty_default.js +0 -37
  452. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-content/test/negative-empty_strict_mode.js +0 -38
  453. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-content/test/noStrict_default.js +0 -36
  454. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-content/test/rawNoStrict_default.js +0 -14
  455. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-content/test/rawStrict_default.js +0 -15
  456. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-content/test/strict_strict_mode.js +0 -41
  457. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-metadata/test/asyncNegative_default.json +0 -22
  458. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-metadata/test/asyncNegative_strict_mode.json +0 -22
  459. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-metadata/test/async_default.json +0 -18
  460. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-metadata/test/async_strict_mode.json +0 -18
  461. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-metadata/test/bothStrict_default.json +0 -24
  462. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-metadata/test/bothStrict_strict_mode.json +0 -24
  463. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-metadata/test/error_default.json +0 -19
  464. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-metadata/test/error_strict_mode.json +0 -19
  465. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-metadata/test/module_default.json +0 -17
  466. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-metadata/test/module_strict_mode.json +0 -17
  467. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-metadata/test/negative-empty_default.json +0 -19
  468. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-metadata/test/negative-empty_strict_mode.json +0 -19
  469. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-metadata/test/noStrict_default.json +0 -17
  470. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-metadata/test/rawNoStrict_default.json +0 -14
  471. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-metadata/test/rawStrict_default.json +0 -14
  472. package/test262/node_modules/test262-stream/test/collateral/valid-default/expected-metadata/test/strict_strict_mode.json +0 -21
  473. package/test262/node_modules/test262-stream/test/collateral/valid-default/fake-test262/harness/assert.js +0 -17
  474. package/test262/node_modules/test262-stream/test/collateral/valid-default/fake-test262/harness/doneprintHandle.js +0 -6
  475. package/test262/node_modules/test262-stream/test/collateral/valid-default/fake-test262/harness/sta.js +0 -12
  476. package/test262/node_modules/test262-stream/test/collateral/valid-default/fake-test262/test/async.js +0 -10
  477. package/test262/node_modules/test262-stream/test/collateral/valid-default/fake-test262/test/asyncNegative.js +0 -11
  478. package/test262/node_modules/test262-stream/test/collateral/valid-default/fake-test262/test/bothStrict.js +0 -15
  479. package/test262/node_modules/test262-stream/test/collateral/valid-default/fake-test262/test/error.js +0 -8
  480. package/test262/node_modules/test262-stream/test/collateral/valid-default/fake-test262/test/module.js +0 -6
  481. package/test262/node_modules/test262-stream/test/collateral/valid-default/fake-test262/test/module_FIXTURE.js +0 -2
  482. package/test262/node_modules/test262-stream/test/collateral/valid-default/fake-test262/test/negative-empty.js +0 -6
  483. package/test262/node_modules/test262-stream/test/collateral/valid-default/fake-test262/test/noStrict.js +0 -5
  484. package/test262/node_modules/test262-stream/test/collateral/valid-default/fake-test262/test/rawNoStrict.js +0 -14
  485. package/test262/node_modules/test262-stream/test/collateral/valid-default/fake-test262/test/rawStrict.js +0 -15
  486. package/test262/node_modules/test262-stream/test/collateral/valid-default/fake-test262/test/strict.js +0 -9
  487. package/test262/node_modules/test262-stream/test/collateral/valid-extra-files/expected-content/test/bothStrict_default.js +0 -46
  488. package/test262/node_modules/test262-stream/test/collateral/valid-extra-files/expected-content/test/bothStrict_strict_mode.js +0 -47
  489. package/test262/node_modules/test262-stream/test/collateral/valid-extra-files/expected-metadata/test/bothStrict_default.json +0 -24
  490. package/test262/node_modules/test262-stream/test/collateral/valid-extra-files/expected-metadata/test/bothStrict_strict_mode.json +0 -24
  491. package/test262/node_modules/test262-stream/test/collateral/valid-extra-files/fake-test262/harness/assert.js +0 -17
  492. package/test262/node_modules/test262-stream/test/collateral/valid-extra-files/fake-test262/harness/doneprintHandle.js +0 -6
  493. package/test262/node_modules/test262-stream/test/collateral/valid-extra-files/fake-test262/harness/sta.js +0 -12
  494. package/test262/node_modules/test262-stream/test/collateral/valid-extra-files/fake-test262/test/bothStrict.js +0 -15
  495. package/test262/node_modules/test262-stream/test/collateral/valid-extra-files/fake-test262/test/zzz-0_FIXTURE.js +0 -2
  496. package/test262/node_modules/test262-stream/test/collateral/valid-extra-files/fake-test262/test/zzz-1_FIXTURE.js +0 -2
  497. package/test262/node_modules/test262-stream/test/collateral/valid-extra-files/fake-test262/test/zzz-2_FIXTURE.js +0 -2
  498. package/test262/node_modules/test262-stream/test/collateral/valid-extra-files/fake-test262/test/zzz-3_FIXTURE.js +0 -2
  499. package/test262/node_modules/test262-stream/test/collateral/valid-extra-files/fake-test262/test/zzz-4_FIXTURE.js +0 -2
  500. package/test262/node_modules/test262-stream/test/collateral/valid-extra-files/fake-test262/test/zzz-5_FIXTURE.js +0 -2
  501. package/test262/node_modules/test262-stream/test/collateral/valid-extra-files/fake-test262/test/zzz-6_FIXTURE.js +0 -2
  502. package/test262/node_modules/test262-stream/test/collateral/valid-extra-files/fake-test262/test/zzz-7_FIXTURE.js +0 -2
  503. package/test262/node_modules/test262-stream/test/collateral/valid-extra-files/fake-test262/test/zzz-8_FIXTURE.js +0 -2
  504. package/test262/node_modules/test262-stream/test/collateral/valid-extra-files/fake-test262/test/zzz-9_FIXTURE.txt +0 -2
  505. package/test262/node_modules/test262-stream/test/collateral/valid-insertionindex-with-copyright/expected-content/test/raw_default.js +0 -15
  506. package/test262/node_modules/test262-stream/test/collateral/valid-insertionindex-with-copyright/expected-content/test/runtime_default.js +0 -38
  507. package/test262/node_modules/test262-stream/test/collateral/valid-insertionindex-with-copyright/expected-content/test/runtime_strict_mode.js +0 -39
  508. package/test262/node_modules/test262-stream/test/collateral/valid-insertionindex-with-copyright/expected-metadata/test/raw_default.json +0 -14
  509. package/test262/node_modules/test262-stream/test/collateral/valid-insertionindex-with-copyright/expected-metadata/test/runtime_default.json +0 -15
  510. package/test262/node_modules/test262-stream/test/collateral/valid-insertionindex-with-copyright/expected-metadata/test/runtime_strict_mode.json +0 -15
  511. package/test262/node_modules/test262-stream/test/collateral/valid-insertionindex-with-copyright/fake-test262/harness/assert.js +0 -17
  512. package/test262/node_modules/test262-stream/test/collateral/valid-insertionindex-with-copyright/fake-test262/harness/sta.js +0 -12
  513. package/test262/node_modules/test262-stream/test/collateral/valid-insertionindex-with-copyright/fake-test262/test/raw.js +0 -15
  514. package/test262/node_modules/test262-stream/test/collateral/valid-insertionindex-with-copyright/fake-test262/test/runtime.js +0 -7
  515. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-content/test/asyncNegative_default.js +0 -11
  516. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-content/test/asyncNegative_strict_mode.js +0 -12
  517. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-content/test/async_default.js +0 -10
  518. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-content/test/async_strict_mode.js +0 -11
  519. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-content/test/bothStrict_default.js +0 -15
  520. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-content/test/bothStrict_strict_mode.js +0 -16
  521. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-content/test/error_default.js +0 -8
  522. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-content/test/error_strict_mode.js +0 -9
  523. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-content/test/module_default.js +0 -6
  524. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-content/test/module_strict_mode.js +0 -7
  525. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-content/test/negative-empty_default.js +0 -6
  526. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-content/test/negative-empty_strict_mode.js +0 -7
  527. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-content/test/noStrict_default.js +0 -5
  528. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-content/test/rawNoStrict_default.js +0 -14
  529. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-content/test/rawStrict_default.js +0 -15
  530. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-content/test/strict_strict_mode.js +0 -10
  531. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-metadata/test/asyncNegative_default.json +0 -18
  532. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-metadata/test/asyncNegative_strict_mode.json +0 -18
  533. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-metadata/test/async_default.json +0 -14
  534. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-metadata/test/async_strict_mode.json +0 -14
  535. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-metadata/test/bothStrict_default.json +0 -21
  536. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-metadata/test/bothStrict_strict_mode.json +0 -21
  537. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-metadata/test/error_default.json +0 -16
  538. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-metadata/test/error_strict_mode.json +0 -16
  539. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-metadata/test/module_default.json +0 -14
  540. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-metadata/test/module_strict_mode.json +0 -14
  541. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-metadata/test/negative-empty_default.json +0 -16
  542. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-metadata/test/negative-empty_strict_mode.json +0 -16
  543. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-metadata/test/noStrict_default.json +0 -14
  544. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-metadata/test/rawNoStrict_default.json +0 -14
  545. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-metadata/test/rawStrict_default.json +0 -14
  546. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/expected-metadata/test/strict_strict_mode.json +0 -18
  547. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/fake-test262/harness/assert.js +0 -17
  548. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/fake-test262/harness/doneprintHandle.js +0 -6
  549. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/fake-test262/harness/sta.js +0 -12
  550. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/fake-test262/test/async.js +0 -10
  551. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/fake-test262/test/asyncNegative.js +0 -11
  552. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/fake-test262/test/bothStrict.js +0 -15
  553. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/fake-test262/test/error.js +0 -8
  554. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/fake-test262/test/module.js +0 -6
  555. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/fake-test262/test/module_FIXTURE.js +0 -2
  556. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/fake-test262/test/negative-empty.js +0 -6
  557. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/fake-test262/test/noStrict.js +0 -5
  558. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/fake-test262/test/rawNoStrict.js +0 -14
  559. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/fake-test262/test/rawStrict.js +0 -15
  560. package/test262/node_modules/test262-stream/test/collateral/valid-omit-runtime/fake-test262/test/strict.js +0 -9
  561. package/test262/node_modules/test262-stream/test/collateral/valid-version-ignored/expected-content/test/strict_strict_mode.js +0 -41
  562. package/test262/node_modules/test262-stream/test/collateral/valid-version-ignored/expected-metadata/test/strict_strict_mode.json +0 -21
  563. package/test262/node_modules/test262-stream/test/collateral/valid-version-ignored/fake-test262/harness/assert.js +0 -17
  564. package/test262/node_modules/test262-stream/test/collateral/valid-version-ignored/fake-test262/harness/doneprintHandle.js +0 -6
  565. package/test262/node_modules/test262-stream/test/collateral/valid-version-ignored/fake-test262/harness/sta.js +0 -12
  566. package/test262/node_modules/test262-stream/test/collateral/valid-version-ignored/fake-test262/package.json +0 -3
  567. package/test262/node_modules/test262-stream/test/collateral/valid-version-ignored/fake-test262/test/strict.js +0 -9
  568. package/test262/node_modules/test262-stream/test/collateral/valid-version-supported/expected-content/test/strict_strict_mode.js +0 -41
  569. package/test262/node_modules/test262-stream/test/collateral/valid-version-supported/expected-metadata/test/strict_strict_mode.json +0 -21
  570. package/test262/node_modules/test262-stream/test/collateral/valid-version-supported/fake-test262/harness/assert.js +0 -17
  571. package/test262/node_modules/test262-stream/test/collateral/valid-version-supported/fake-test262/harness/doneprintHandle.js +0 -6
  572. package/test262/node_modules/test262-stream/test/collateral/valid-version-supported/fake-test262/harness/sta.js +0 -12
  573. package/test262/node_modules/test262-stream/test/collateral/valid-version-supported/fake-test262/package.json +0 -3
  574. package/test262/node_modules/test262-stream/test/collateral/valid-version-supported/fake-test262/test/strict.js +0 -9
  575. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/expected-content/test/missing-raw-flag_default.js +0 -44
  576. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/expected-content/test/missing-raw-flag_strict_mode.js +0 -45
  577. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/expected-content/test/raw-with-ls-and-license-on-same-line_default.js +0 -20
  578. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/expected-content/test/raw-with-ls-multiline-block_default.js +0 -18
  579. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/expected-content/test/raw-with-ls_default.js +0 -17
  580. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/expected-content/test/raw-with-ps-and-license-on-same-line_default.js +0 -20
  581. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/expected-content/test/raw-with-ps-multiline-block_default.js +0 -18
  582. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/expected-content/test/raw-with-ps_default.js +0 -17
  583. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/expected-content/test/rawWithLicense_default.js +0 -21
  584. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/expected-content/test/raw_default.js +0 -17
  585. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/expected-metadata/test/missing-raw-flag_default.json +0 -22
  586. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/expected-metadata/test/missing-raw-flag_strict_mode.json +0 -22
  587. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/expected-metadata/test/raw-with-ls-and-license-on-same-line_default.json +0 -21
  588. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/expected-metadata/test/raw-with-ls-multiline-block_default.json +0 -21
  589. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/expected-metadata/test/raw-with-ls_default.json +0 -21
  590. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/expected-metadata/test/raw-with-ps-and-license-on-same-line_default.json +0 -21
  591. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/expected-metadata/test/raw-with-ps-multiline-block_default.json +0 -21
  592. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/expected-metadata/test/raw-with-ps_default.json +0 -21
  593. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/expected-metadata/test/rawWithLicense_default.json +0 -21
  594. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/expected-metadata/test/raw_default.json +0 -21
  595. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/fake-test262/harness/assert.js +0 -17
  596. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/fake-test262/harness/doneprintHandle.js +0 -6
  597. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/fake-test262/harness/sta.js +0 -12
  598. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/fake-test262/test/missing-raw-flag.js +0 -13
  599. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/fake-test262/test/raw-with-ls-and-license-on-same-line.js +0 -20
  600. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/fake-test262/test/raw-with-ls-multiline-block.js +0 -18
  601. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/fake-test262/test/raw-with-ls.js +0 -17
  602. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/fake-test262/test/raw-with-ps-and-license-on-same-line.js +0 -20
  603. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/fake-test262/test/raw-with-ps-multiline-block.js +0 -18
  604. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/fake-test262/test/raw-with-ps.js +0 -17
  605. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/fake-test262/test/raw.js +0 -17
  606. package/test262/node_modules/test262-stream/test/collateral/valid-with-hashbang/fake-test262/test/rawWithLicense.js +0 -21
  607. package/test262/node_modules/test262-stream/test/collateral/valid-with-includes/custom-includes/assert.js +0 -17
  608. package/test262/node_modules/test262-stream/test/collateral/valid-with-includes/custom-includes/doneprintHandle.js +0 -9
  609. package/test262/node_modules/test262-stream/test/collateral/valid-with-includes/custom-includes/sta.js +0 -13
  610. package/test262/node_modules/test262-stream/test/collateral/valid-with-includes/expected-content/test/async_default.js +0 -52
  611. package/test262/node_modules/test262-stream/test/collateral/valid-with-includes/expected-content/test/async_strict_mode.js +0 -53
  612. package/test262/node_modules/test262-stream/test/collateral/valid-with-includes/expected-content/test/bothStrict_default.js +0 -47
  613. package/test262/node_modules/test262-stream/test/collateral/valid-with-includes/expected-content/test/bothStrict_strict_mode.js +0 -48
  614. package/test262/node_modules/test262-stream/test/collateral/valid-with-includes/expected-metadata/test/async_default.json +0 -18
  615. package/test262/node_modules/test262-stream/test/collateral/valid-with-includes/expected-metadata/test/async_strict_mode.json +0 -18
  616. package/test262/node_modules/test262-stream/test/collateral/valid-with-includes/expected-metadata/test/bothStrict_default.json +0 -24
  617. package/test262/node_modules/test262-stream/test/collateral/valid-with-includes/expected-metadata/test/bothStrict_strict_mode.json +0 -24
  618. package/test262/node_modules/test262-stream/test/collateral/valid-with-includes/fake-test262/harness/assert.js +0 -17
  619. package/test262/node_modules/test262-stream/test/collateral/valid-with-includes/fake-test262/harness/doneprintHandle.js +0 -6
  620. package/test262/node_modules/test262-stream/test/collateral/valid-with-includes/fake-test262/test/async.js +0 -10
  621. package/test262/node_modules/test262-stream/test/collateral/valid-with-includes/fake-test262/test/bothStrict.js +0 -15
  622. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/expected-content/test/async/asyncNegative_default.js +0 -49
  623. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/expected-content/test/async/asyncNegative_strict_mode.js +0 -50
  624. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/expected-content/test/async/async_default.js +0 -48
  625. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/expected-content/test/async/async_strict_mode.js +0 -49
  626. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/expected-content/test/bothStrict_default.js +0 -46
  627. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/expected-content/test/bothStrict_strict_mode.js +0 -47
  628. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/expected-content/test/strict/no/noStrict_default.js +0 -36
  629. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/expected-content/test/strict/no/rawNoStrict_default.js +0 -14
  630. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/expected-metadata/test/async/asyncNegative_default.json +0 -22
  631. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/expected-metadata/test/async/asyncNegative_strict_mode.json +0 -22
  632. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/expected-metadata/test/async/async_default.json +0 -18
  633. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/expected-metadata/test/async/async_strict_mode.json +0 -18
  634. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/expected-metadata/test/bothStrict_default.json +0 -24
  635. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/expected-metadata/test/bothStrict_strict_mode.json +0 -24
  636. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/expected-metadata/test/strict/no/noStrict_default.json +0 -17
  637. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/expected-metadata/test/strict/no/rawNoStrict_default.json +0 -14
  638. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/fake-test262/harness/assert.js +0 -17
  639. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/fake-test262/harness/doneprintHandle.js +0 -6
  640. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/fake-test262/harness/sta.js +0 -12
  641. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/fake-test262/test/async/async.js +0 -10
  642. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/fake-test262/test/async/asyncNegative.js +0 -11
  643. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/fake-test262/test/bothStrict.js +0 -15
  644. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/fake-test262/test/error.js +0 -8
  645. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/fake-test262/test/negative-empty.js +0 -6
  646. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/fake-test262/test/strict/no/noStrict.js +0 -5
  647. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/fake-test262/test/strict/no/rawNoStrict.js +0 -14
  648. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/fake-test262/test/strict/rawStrict.js +0 -15
  649. package/test262/node_modules/test262-stream/test/collateral/valid-with-paths/fake-test262/test/strict/strict.js +0 -9
  650. package/test262/node_modules/test262-stream/test/test.js +0 -319
  651. package/test262/node_modules/to-regex-range/LICENSE +0 -21
  652. package/test262/node_modules/to-regex-range/README.md +0 -305
  653. package/test262/node_modules/to-regex-range/index.js +0 -288
  654. package/test262/node_modules/to-regex-range/package.json +0 -88
  655. package/test262/package-lock.json +0 -279
  656. package/test262/package.json +0 -6
  657. package/test262/prelude.js +0 -75
  658. package/test262/results.json +0 -1
@@ -1,1161 +0,0 @@
1
- /**
2
- * class ArgumentParser
3
- *
4
- * Object for parsing command line strings into js objects.
5
- *
6
- * Inherited from [[ActionContainer]]
7
- **/
8
- 'use strict';
9
-
10
- var util = require('util');
11
- var format = require('util').format;
12
- var Path = require('path');
13
- var sprintf = require('sprintf-js').sprintf;
14
-
15
- // Constants
16
- var c = require('./const');
17
-
18
- var $$ = require('./utils');
19
-
20
- var ActionContainer = require('./action_container');
21
-
22
- // Errors
23
- var argumentErrorHelper = require('./argument/error');
24
-
25
- var HelpFormatter = require('./help/formatter');
26
-
27
- var Namespace = require('./namespace');
28
-
29
-
30
- /**
31
- * new ArgumentParser(options)
32
- *
33
- * Create a new ArgumentParser object.
34
- *
35
- * ##### Options:
36
- * - `prog` The name of the program (default: Path.basename(process.argv[1]))
37
- * - `usage` A usage message (default: auto-generated from arguments)
38
- * - `description` A description of what the program does
39
- * - `epilog` Text following the argument descriptions
40
- * - `parents` Parsers whose arguments should be copied into this one
41
- * - `formatterClass` HelpFormatter class for printing help messages
42
- * - `prefixChars` Characters that prefix optional arguments
43
- * - `fromfilePrefixChars` Characters that prefix files containing additional arguments
44
- * - `argumentDefault` The default value for all arguments
45
- * - `addHelp` Add a -h/-help option
46
- * - `conflictHandler` Specifies how to handle conflicting argument names
47
- * - `debug` Enable debug mode. Argument errors throw exception in
48
- * debug mode and process.exit in normal. Used for development and
49
- * testing (default: false)
50
- *
51
- * See also [original guide][1]
52
- *
53
- * [1]:http://docs.python.org/dev/library/argparse.html#argumentparser-objects
54
- **/
55
- function ArgumentParser(options) {
56
- if (!(this instanceof ArgumentParser)) {
57
- return new ArgumentParser(options);
58
- }
59
- var self = this;
60
- options = options || {};
61
-
62
- options.description = (options.description || null);
63
- options.argumentDefault = (options.argumentDefault || null);
64
- options.prefixChars = (options.prefixChars || '-');
65
- options.conflictHandler = (options.conflictHandler || 'error');
66
- ActionContainer.call(this, options);
67
-
68
- options.addHelp = typeof options.addHelp === 'undefined' || !!options.addHelp;
69
- options.parents = options.parents || [];
70
- // default program name
71
- options.prog = (options.prog || Path.basename(process.argv[1]));
72
- this.prog = options.prog;
73
- this.usage = options.usage;
74
- this.epilog = options.epilog;
75
- this.version = options.version;
76
-
77
- this.debug = (options.debug === true);
78
-
79
- this.formatterClass = (options.formatterClass || HelpFormatter);
80
- this.fromfilePrefixChars = options.fromfilePrefixChars || null;
81
- this._positionals = this.addArgumentGroup({ title: 'Positional arguments' });
82
- this._optionals = this.addArgumentGroup({ title: 'Optional arguments' });
83
- this._subparsers = null;
84
-
85
- // register types
86
- function FUNCTION_IDENTITY(o) {
87
- return o;
88
- }
89
- this.register('type', 'auto', FUNCTION_IDENTITY);
90
- this.register('type', null, FUNCTION_IDENTITY);
91
- this.register('type', 'int', function (x) {
92
- var result = parseInt(x, 10);
93
- if (isNaN(result)) {
94
- throw new Error(x + ' is not a valid integer.');
95
- }
96
- return result;
97
- });
98
- this.register('type', 'float', function (x) {
99
- var result = parseFloat(x);
100
- if (isNaN(result)) {
101
- throw new Error(x + ' is not a valid float.');
102
- }
103
- return result;
104
- });
105
- this.register('type', 'string', function (x) {
106
- return '' + x;
107
- });
108
-
109
- // add help and version arguments if necessary
110
- var defaultPrefix = (this.prefixChars.indexOf('-') > -1) ? '-' : this.prefixChars[0];
111
- if (options.addHelp) {
112
- this.addArgument(
113
- [ defaultPrefix + 'h', defaultPrefix + defaultPrefix + 'help' ],
114
- {
115
- action: 'help',
116
- defaultValue: c.SUPPRESS,
117
- help: 'Show this help message and exit.'
118
- }
119
- );
120
- }
121
- if (typeof this.version !== 'undefined') {
122
- this.addArgument(
123
- [ defaultPrefix + 'v', defaultPrefix + defaultPrefix + 'version' ],
124
- {
125
- action: 'version',
126
- version: this.version,
127
- defaultValue: c.SUPPRESS,
128
- help: "Show program's version number and exit."
129
- }
130
- );
131
- }
132
-
133
- // add parent arguments and defaults
134
- options.parents.forEach(function (parent) {
135
- self._addContainerActions(parent);
136
- if (typeof parent._defaults !== 'undefined') {
137
- for (var defaultKey in parent._defaults) {
138
- if (parent._defaults.hasOwnProperty(defaultKey)) {
139
- self._defaults[defaultKey] = parent._defaults[defaultKey];
140
- }
141
- }
142
- }
143
- });
144
- }
145
-
146
- util.inherits(ArgumentParser, ActionContainer);
147
-
148
- /**
149
- * ArgumentParser#addSubparsers(options) -> [[ActionSubparsers]]
150
- * - options (object): hash of options see [[ActionSubparsers.new]]
151
- *
152
- * See also [subcommands][1]
153
- *
154
- * [1]:http://docs.python.org/dev/library/argparse.html#sub-commands
155
- **/
156
- ArgumentParser.prototype.addSubparsers = function (options) {
157
- if (this._subparsers) {
158
- this.error('Cannot have multiple subparser arguments.');
159
- }
160
-
161
- options = options || {};
162
- options.debug = (this.debug === true);
163
- options.optionStrings = [];
164
- options.parserClass = (options.parserClass || ArgumentParser);
165
-
166
-
167
- if (!!options.title || !!options.description) {
168
-
169
- this._subparsers = this.addArgumentGroup({
170
- title: (options.title || 'subcommands'),
171
- description: options.description
172
- });
173
- delete options.title;
174
- delete options.description;
175
-
176
- } else {
177
- this._subparsers = this._positionals;
178
- }
179
-
180
- // prog defaults to the usage message of this parser, skipping
181
- // optional arguments and with no "usage:" prefix
182
- if (!options.prog) {
183
- var formatter = this._getFormatter();
184
- var positionals = this._getPositionalActions();
185
- var groups = this._mutuallyExclusiveGroups;
186
- formatter.addUsage(this.usage, positionals, groups, '');
187
- options.prog = formatter.formatHelp().trim();
188
- }
189
-
190
- // create the parsers action and add it to the positionals list
191
- var ParsersClass = this._popActionClass(options, 'parsers');
192
- var action = new ParsersClass(options);
193
- this._subparsers._addAction(action);
194
-
195
- // return the created parsers action
196
- return action;
197
- };
198
-
199
- ArgumentParser.prototype._addAction = function (action) {
200
- if (action.isOptional()) {
201
- this._optionals._addAction(action);
202
- } else {
203
- this._positionals._addAction(action);
204
- }
205
- return action;
206
- };
207
-
208
- ArgumentParser.prototype._getOptionalActions = function () {
209
- return this._actions.filter(function (action) {
210
- return action.isOptional();
211
- });
212
- };
213
-
214
- ArgumentParser.prototype._getPositionalActions = function () {
215
- return this._actions.filter(function (action) {
216
- return action.isPositional();
217
- });
218
- };
219
-
220
-
221
- /**
222
- * ArgumentParser#parseArgs(args, namespace) -> Namespace|Object
223
- * - args (array): input elements
224
- * - namespace (Namespace|Object): result object
225
- *
226
- * Parsed args and throws error if some arguments are not recognized
227
- *
228
- * See also [original guide][1]
229
- *
230
- * [1]:http://docs.python.org/dev/library/argparse.html#the-parse-args-method
231
- **/
232
- ArgumentParser.prototype.parseArgs = function (args, namespace) {
233
- var argv;
234
- var result = this.parseKnownArgs(args, namespace);
235
-
236
- args = result[0];
237
- argv = result[1];
238
- if (argv && argv.length > 0) {
239
- this.error(
240
- format('Unrecognized arguments: %s.', argv.join(' '))
241
- );
242
- }
243
- return args;
244
- };
245
-
246
- /**
247
- * ArgumentParser#parseKnownArgs(args, namespace) -> array
248
- * - args (array): input options
249
- * - namespace (Namespace|Object): result object
250
- *
251
- * Parse known arguments and return tuple of result object
252
- * and unknown args
253
- *
254
- * See also [original guide][1]
255
- *
256
- * [1]:http://docs.python.org/dev/library/argparse.html#partial-parsing
257
- **/
258
- ArgumentParser.prototype.parseKnownArgs = function (args, namespace) {
259
- var self = this;
260
-
261
- // args default to the system args
262
- args = args || process.argv.slice(2);
263
-
264
- // default Namespace built from parser defaults
265
- namespace = namespace || new Namespace();
266
-
267
- self._actions.forEach(function (action) {
268
- if (action.dest !== c.SUPPRESS) {
269
- if (!$$.has(namespace, action.dest)) {
270
- if (action.defaultValue !== c.SUPPRESS) {
271
- var defaultValue = action.defaultValue;
272
- if (typeof action.defaultValue === 'string') {
273
- defaultValue = self._getValue(action, defaultValue);
274
- }
275
- namespace[action.dest] = defaultValue;
276
- }
277
- }
278
- }
279
- });
280
-
281
- Object.keys(self._defaults).forEach(function (dest) {
282
- namespace[dest] = self._defaults[dest];
283
- });
284
-
285
- // parse the arguments and exit if there are any errors
286
- try {
287
- var res = this._parseKnownArgs(args, namespace);
288
-
289
- namespace = res[0];
290
- args = res[1];
291
- if ($$.has(namespace, c._UNRECOGNIZED_ARGS_ATTR)) {
292
- args = $$.arrayUnion(args, namespace[c._UNRECOGNIZED_ARGS_ATTR]);
293
- delete namespace[c._UNRECOGNIZED_ARGS_ATTR];
294
- }
295
- return [ namespace, args ];
296
- } catch (e) {
297
- this.error(e);
298
- }
299
- };
300
-
301
- ArgumentParser.prototype._parseKnownArgs = function (argStrings, namespace) {
302
- var self = this;
303
-
304
- var extras = [];
305
-
306
- // replace arg strings that are file references
307
- if (this.fromfilePrefixChars !== null) {
308
- argStrings = this._readArgsFromFiles(argStrings);
309
- }
310
- // map all mutually exclusive arguments to the other arguments
311
- // they can't occur with
312
- // Python has 'conflicts = action_conflicts.setdefault(mutex_action, [])'
313
- // though I can't conceive of a way in which an action could be a member
314
- // of two different mutually exclusive groups.
315
-
316
- function actionHash(action) {
317
- // some sort of hashable key for this action
318
- // action itself cannot be a key in actionConflicts
319
- // I think getName() (join of optionStrings) is unique enough
320
- return action.getName();
321
- }
322
-
323
- var conflicts, key;
324
- var actionConflicts = {};
325
-
326
- this._mutuallyExclusiveGroups.forEach(function (mutexGroup) {
327
- mutexGroup._groupActions.forEach(function (mutexAction, i, groupActions) {
328
- key = actionHash(mutexAction);
329
- if (!$$.has(actionConflicts, key)) {
330
- actionConflicts[key] = [];
331
- }
332
- conflicts = actionConflicts[key];
333
- conflicts.push.apply(conflicts, groupActions.slice(0, i));
334
- conflicts.push.apply(conflicts, groupActions.slice(i + 1));
335
- });
336
- });
337
-
338
- // find all option indices, and determine the arg_string_pattern
339
- // which has an 'O' if there is an option at an index,
340
- // an 'A' if there is an argument, or a '-' if there is a '--'
341
- var optionStringIndices = {};
342
-
343
- var argStringPatternParts = [];
344
-
345
- argStrings.forEach(function (argString, argStringIndex) {
346
- if (argString === '--') {
347
- argStringPatternParts.push('-');
348
- while (argStringIndex < argStrings.length) {
349
- argStringPatternParts.push('A');
350
- argStringIndex++;
351
- }
352
- } else {
353
- // otherwise, add the arg to the arg strings
354
- // and note the index if it was an option
355
- var pattern;
356
- var optionTuple = self._parseOptional(argString);
357
- if (!optionTuple) {
358
- pattern = 'A';
359
- } else {
360
- optionStringIndices[argStringIndex] = optionTuple;
361
- pattern = 'O';
362
- }
363
- argStringPatternParts.push(pattern);
364
- }
365
- });
366
- var argStringsPattern = argStringPatternParts.join('');
367
-
368
- var seenActions = [];
369
- var seenNonDefaultActions = [];
370
-
371
-
372
- function takeAction(action, argumentStrings, optionString) {
373
- seenActions.push(action);
374
- var argumentValues = self._getValues(action, argumentStrings);
375
-
376
- // error if this argument is not allowed with other previously
377
- // seen arguments, assuming that actions that use the default
378
- // value don't really count as "present"
379
- if (argumentValues !== action.defaultValue) {
380
- seenNonDefaultActions.push(action);
381
- if (actionConflicts[actionHash(action)]) {
382
- actionConflicts[actionHash(action)].forEach(function (actionConflict) {
383
- if (seenNonDefaultActions.indexOf(actionConflict) >= 0) {
384
- throw argumentErrorHelper(
385
- action,
386
- format('Not allowed with argument "%s".', actionConflict.getName())
387
- );
388
- }
389
- });
390
- }
391
- }
392
-
393
- if (argumentValues !== c.SUPPRESS) {
394
- action.call(self, namespace, argumentValues, optionString);
395
- }
396
- }
397
-
398
- function consumeOptional(startIndex) {
399
- // get the optional identified at this index
400
- var optionTuple = optionStringIndices[startIndex];
401
- var action = optionTuple[0];
402
- var optionString = optionTuple[1];
403
- var explicitArg = optionTuple[2];
404
-
405
- // identify additional optionals in the same arg string
406
- // (e.g. -xyz is the same as -x -y -z if no args are required)
407
- var actionTuples = [];
408
-
409
- var args, argCount, start, stop;
410
-
411
- for (;;) {
412
- if (!action) {
413
- extras.push(argStrings[startIndex]);
414
- return startIndex + 1;
415
- }
416
- if (explicitArg) {
417
- argCount = self._matchArgument(action, 'A');
418
-
419
- // if the action is a single-dash option and takes no
420
- // arguments, try to parse more single-dash options out
421
- // of the tail of the option string
422
- var chars = self.prefixChars;
423
- if (argCount === 0 && chars.indexOf(optionString[1]) < 0) {
424
- actionTuples.push([ action, [], optionString ]);
425
- optionString = optionString[0] + explicitArg[0];
426
- var newExplicitArg = explicitArg.slice(1) || null;
427
- var optionalsMap = self._optionStringActions;
428
-
429
- if (Object.keys(optionalsMap).indexOf(optionString) >= 0) {
430
- action = optionalsMap[optionString];
431
- explicitArg = newExplicitArg;
432
- } else {
433
- throw argumentErrorHelper(action, sprintf('ignored explicit argument %r', explicitArg));
434
- }
435
- } else if (argCount === 1) {
436
- // if the action expect exactly one argument, we've
437
- // successfully matched the option; exit the loop
438
- stop = startIndex + 1;
439
- args = [ explicitArg ];
440
- actionTuples.push([ action, args, optionString ]);
441
- break;
442
- } else {
443
- // error if a double-dash option did not use the
444
- // explicit argument
445
- throw argumentErrorHelper(action, sprintf('ignored explicit argument %r', explicitArg));
446
- }
447
- } else {
448
- // if there is no explicit argument, try to match the
449
- // optional's string arguments with the following strings
450
- // if successful, exit the loop
451
-
452
- start = startIndex + 1;
453
- var selectedPatterns = argStringsPattern.substr(start);
454
-
455
- argCount = self._matchArgument(action, selectedPatterns);
456
- stop = start + argCount;
457
-
458
-
459
- args = argStrings.slice(start, stop);
460
-
461
- actionTuples.push([ action, args, optionString ]);
462
- break;
463
- }
464
-
465
- }
466
-
467
- // add the Optional to the list and return the index at which
468
- // the Optional's string args stopped
469
- if (actionTuples.length < 1) {
470
- throw new Error('length should be > 0');
471
- }
472
- for (var i = 0; i < actionTuples.length; i++) {
473
- takeAction.apply(self, actionTuples[i]);
474
- }
475
- return stop;
476
- }
477
-
478
- // the list of Positionals left to be parsed; this is modified
479
- // by consume_positionals()
480
- var positionals = self._getPositionalActions();
481
-
482
- function consumePositionals(startIndex) {
483
- // match as many Positionals as possible
484
- var selectedPattern = argStringsPattern.substr(startIndex);
485
- var argCounts = self._matchArgumentsPartial(positionals, selectedPattern);
486
-
487
- // slice off the appropriate arg strings for each Positional
488
- // and add the Positional and its args to the list
489
- for (var i = 0; i < positionals.length; i++) {
490
- var action = positionals[i];
491
- var argCount = argCounts[i];
492
- if (typeof argCount === 'undefined') {
493
- continue;
494
- }
495
- var args = argStrings.slice(startIndex, startIndex + argCount);
496
-
497
- startIndex += argCount;
498
- takeAction(action, args);
499
- }
500
-
501
- // slice off the Positionals that we just parsed and return the
502
- // index at which the Positionals' string args stopped
503
- positionals = positionals.slice(argCounts.length);
504
- return startIndex;
505
- }
506
-
507
- // consume Positionals and Optionals alternately, until we have
508
- // passed the last option string
509
- var startIndex = 0;
510
- var position;
511
-
512
- var maxOptionStringIndex = -1;
513
-
514
- Object.keys(optionStringIndices).forEach(function (position) {
515
- maxOptionStringIndex = Math.max(maxOptionStringIndex, parseInt(position, 10));
516
- });
517
-
518
- var positionalsEndIndex, nextOptionStringIndex;
519
-
520
- while (startIndex <= maxOptionStringIndex) {
521
- // consume any Positionals preceding the next option
522
- nextOptionStringIndex = null;
523
- for (position in optionStringIndices) {
524
- if (!optionStringIndices.hasOwnProperty(position)) { continue; }
525
-
526
- position = parseInt(position, 10);
527
- if (position >= startIndex) {
528
- if (nextOptionStringIndex !== null) {
529
- nextOptionStringIndex = Math.min(nextOptionStringIndex, position);
530
- } else {
531
- nextOptionStringIndex = position;
532
- }
533
- }
534
- }
535
-
536
- if (startIndex !== nextOptionStringIndex) {
537
- positionalsEndIndex = consumePositionals(startIndex);
538
- // only try to parse the next optional if we didn't consume
539
- // the option string during the positionals parsing
540
- if (positionalsEndIndex > startIndex) {
541
- startIndex = positionalsEndIndex;
542
- continue;
543
- } else {
544
- startIndex = positionalsEndIndex;
545
- }
546
- }
547
-
548
- // if we consumed all the positionals we could and we're not
549
- // at the index of an option string, there were extra arguments
550
- if (!optionStringIndices[startIndex]) {
551
- var strings = argStrings.slice(startIndex, nextOptionStringIndex);
552
- extras = extras.concat(strings);
553
- startIndex = nextOptionStringIndex;
554
- }
555
- // consume the next optional and any arguments for it
556
- startIndex = consumeOptional(startIndex);
557
- }
558
-
559
- // consume any positionals following the last Optional
560
- var stopIndex = consumePositionals(startIndex);
561
-
562
- // if we didn't consume all the argument strings, there were extras
563
- extras = extras.concat(argStrings.slice(stopIndex));
564
-
565
- // if we didn't use all the Positional objects, there were too few
566
- // arg strings supplied.
567
- if (positionals.length > 0) {
568
- self.error('too few arguments');
569
- }
570
-
571
- // make sure all required actions were present
572
- self._actions.forEach(function (action) {
573
- if (action.required) {
574
- if (seenActions.indexOf(action) < 0) {
575
- self.error(format('Argument "%s" is required', action.getName()));
576
- }
577
- }
578
- });
579
-
580
- // make sure all required groups have one option present
581
- var actionUsed = false;
582
- self._mutuallyExclusiveGroups.forEach(function (group) {
583
- if (group.required) {
584
- actionUsed = group._groupActions.some(function (action) {
585
- return seenNonDefaultActions.indexOf(action) !== -1;
586
- });
587
-
588
- // if no actions were used, report the error
589
- if (!actionUsed) {
590
- var names = [];
591
- group._groupActions.forEach(function (action) {
592
- if (action.help !== c.SUPPRESS) {
593
- names.push(action.getName());
594
- }
595
- });
596
- names = names.join(' ');
597
- var msg = 'one of the arguments ' + names + ' is required';
598
- self.error(msg);
599
- }
600
- }
601
- });
602
-
603
- // return the updated namespace and the extra arguments
604
- return [ namespace, extras ];
605
- };
606
-
607
- ArgumentParser.prototype._readArgsFromFiles = function (argStrings) {
608
- // expand arguments referencing files
609
- var self = this;
610
- var fs = require('fs');
611
- var newArgStrings = [];
612
- argStrings.forEach(function (argString) {
613
- if (self.fromfilePrefixChars.indexOf(argString[0]) < 0) {
614
- // for regular arguments, just add them back into the list
615
- newArgStrings.push(argString);
616
- } else {
617
- // replace arguments referencing files with the file content
618
- try {
619
- var argstrs = [];
620
- var filename = argString.slice(1);
621
- var content = fs.readFileSync(filename, 'utf8');
622
- content = content.trim().split('\n');
623
- content.forEach(function (argLine) {
624
- self.convertArgLineToArgs(argLine).forEach(function (arg) {
625
- argstrs.push(arg);
626
- });
627
- argstrs = self._readArgsFromFiles(argstrs);
628
- });
629
- newArgStrings.push.apply(newArgStrings, argstrs);
630
- } catch (error) {
631
- return self.error(error.message);
632
- }
633
- }
634
- });
635
- return newArgStrings;
636
- };
637
-
638
- ArgumentParser.prototype.convertArgLineToArgs = function (argLine) {
639
- return [ argLine ];
640
- };
641
-
642
- ArgumentParser.prototype._matchArgument = function (action, regexpArgStrings) {
643
-
644
- // match the pattern for this action to the arg strings
645
- var regexpNargs = new RegExp('^' + this._getNargsPattern(action));
646
- var matches = regexpArgStrings.match(regexpNargs);
647
- var message;
648
-
649
- // throw an exception if we weren't able to find a match
650
- if (!matches) {
651
- switch (action.nargs) {
652
- /*eslint-disable no-undefined*/
653
- case undefined:
654
- case null:
655
- message = 'Expected one argument.';
656
- break;
657
- case c.OPTIONAL:
658
- message = 'Expected at most one argument.';
659
- break;
660
- case c.ONE_OR_MORE:
661
- message = 'Expected at least one argument.';
662
- break;
663
- default:
664
- message = 'Expected %s argument(s)';
665
- }
666
-
667
- throw argumentErrorHelper(
668
- action,
669
- format(message, action.nargs)
670
- );
671
- }
672
- // return the number of arguments matched
673
- return matches[1].length;
674
- };
675
-
676
- ArgumentParser.prototype._matchArgumentsPartial = function (actions, regexpArgStrings) {
677
- // progressively shorten the actions list by slicing off the
678
- // final actions until we find a match
679
- var self = this;
680
- var result = [];
681
- var actionSlice, pattern, matches;
682
- var i, j;
683
-
684
- function getLength(string) {
685
- return string.length;
686
- }
687
-
688
- for (i = actions.length; i > 0; i--) {
689
- pattern = '';
690
- actionSlice = actions.slice(0, i);
691
- for (j = 0; j < actionSlice.length; j++) {
692
- pattern += self._getNargsPattern(actionSlice[j]);
693
- }
694
-
695
- pattern = new RegExp('^' + pattern);
696
- matches = regexpArgStrings.match(pattern);
697
-
698
- if (matches && matches.length > 0) {
699
- // need only groups
700
- matches = matches.splice(1);
701
- result = result.concat(matches.map(getLength));
702
- break;
703
- }
704
- }
705
-
706
- // return the list of arg string counts
707
- return result;
708
- };
709
-
710
- ArgumentParser.prototype._parseOptional = function (argString) {
711
- var action, optionString, argExplicit, optionTuples;
712
-
713
- // if it's an empty string, it was meant to be a positional
714
- if (!argString) {
715
- return null;
716
- }
717
-
718
- // if it doesn't start with a prefix, it was meant to be positional
719
- if (this.prefixChars.indexOf(argString[0]) < 0) {
720
- return null;
721
- }
722
-
723
- // if the option string is present in the parser, return the action
724
- if (this._optionStringActions[argString]) {
725
- return [ this._optionStringActions[argString], argString, null ];
726
- }
727
-
728
- // if it's just a single character, it was meant to be positional
729
- if (argString.length === 1) {
730
- return null;
731
- }
732
-
733
- // if the option string before the "=" is present, return the action
734
- if (argString.indexOf('=') >= 0) {
735
- optionString = argString.split('=', 1)[0];
736
- argExplicit = argString.slice(optionString.length + 1);
737
-
738
- if (this._optionStringActions[optionString]) {
739
- action = this._optionStringActions[optionString];
740
- return [ action, optionString, argExplicit ];
741
- }
742
- }
743
-
744
- // search through all possible prefixes of the option string
745
- // and all actions in the parser for possible interpretations
746
- optionTuples = this._getOptionTuples(argString);
747
-
748
- // if multiple actions match, the option string was ambiguous
749
- if (optionTuples.length > 1) {
750
- var optionStrings = optionTuples.map(function (optionTuple) {
751
- return optionTuple[1];
752
- });
753
- this.error(format(
754
- 'Ambiguous option: "%s" could match %s.',
755
- argString, optionStrings.join(', ')
756
- ));
757
- // if exactly one action matched, this segmentation is good,
758
- // so return the parsed action
759
- } else if (optionTuples.length === 1) {
760
- return optionTuples[0];
761
- }
762
-
763
- // if it was not found as an option, but it looks like a negative
764
- // number, it was meant to be positional
765
- // unless there are negative-number-like options
766
- if (argString.match(this._regexpNegativeNumber)) {
767
- if (!this._hasNegativeNumberOptionals.some(Boolean)) {
768
- return null;
769
- }
770
- }
771
- // if it contains a space, it was meant to be a positional
772
- if (argString.search(' ') >= 0) {
773
- return null;
774
- }
775
-
776
- // it was meant to be an optional but there is no such option
777
- // in this parser (though it might be a valid option in a subparser)
778
- return [ null, argString, null ];
779
- };
780
-
781
- ArgumentParser.prototype._getOptionTuples = function (optionString) {
782
- var result = [];
783
- var chars = this.prefixChars;
784
- var optionPrefix;
785
- var argExplicit;
786
- var action;
787
- var actionOptionString;
788
-
789
- // option strings starting with two prefix characters are only split at
790
- // the '='
791
- if (chars.indexOf(optionString[0]) >= 0 && chars.indexOf(optionString[1]) >= 0) {
792
- if (optionString.indexOf('=') >= 0) {
793
- var optionStringSplit = optionString.split('=', 1);
794
-
795
- optionPrefix = optionStringSplit[0];
796
- argExplicit = optionStringSplit[1];
797
- } else {
798
- optionPrefix = optionString;
799
- argExplicit = null;
800
- }
801
-
802
- for (actionOptionString in this._optionStringActions) {
803
- if (actionOptionString.substr(0, optionPrefix.length) === optionPrefix) {
804
- action = this._optionStringActions[actionOptionString];
805
- result.push([ action, actionOptionString, argExplicit ]);
806
- }
807
- }
808
-
809
- // single character options can be concatenated with their arguments
810
- // but multiple character options always have to have their argument
811
- // separate
812
- } else if (chars.indexOf(optionString[0]) >= 0 && chars.indexOf(optionString[1]) < 0) {
813
- optionPrefix = optionString;
814
- argExplicit = null;
815
- var optionPrefixShort = optionString.substr(0, 2);
816
- var argExplicitShort = optionString.substr(2);
817
-
818
- for (actionOptionString in this._optionStringActions) {
819
- if (!$$.has(this._optionStringActions, actionOptionString)) continue;
820
-
821
- action = this._optionStringActions[actionOptionString];
822
- if (actionOptionString === optionPrefixShort) {
823
- result.push([ action, actionOptionString, argExplicitShort ]);
824
- } else if (actionOptionString.substr(0, optionPrefix.length) === optionPrefix) {
825
- result.push([ action, actionOptionString, argExplicit ]);
826
- }
827
- }
828
-
829
- // shouldn't ever get here
830
- } else {
831
- throw new Error(format('Unexpected option string: %s.', optionString));
832
- }
833
- // return the collected option tuples
834
- return result;
835
- };
836
-
837
- ArgumentParser.prototype._getNargsPattern = function (action) {
838
- // in all examples below, we have to allow for '--' args
839
- // which are represented as '-' in the pattern
840
- var regexpNargs;
841
-
842
- switch (action.nargs) {
843
- // the default (null) is assumed to be a single argument
844
- case undefined:
845
- case null:
846
- regexpNargs = '(-*A-*)';
847
- break;
848
- // allow zero or more arguments
849
- case c.OPTIONAL:
850
- regexpNargs = '(-*A?-*)';
851
- break;
852
- // allow zero or more arguments
853
- case c.ZERO_OR_MORE:
854
- regexpNargs = '(-*[A-]*)';
855
- break;
856
- // allow one or more arguments
857
- case c.ONE_OR_MORE:
858
- regexpNargs = '(-*A[A-]*)';
859
- break;
860
- // allow any number of options or arguments
861
- case c.REMAINDER:
862
- regexpNargs = '([-AO]*)';
863
- break;
864
- // allow one argument followed by any number of options or arguments
865
- case c.PARSER:
866
- regexpNargs = '(-*A[-AO]*)';
867
- break;
868
- // all others should be integers
869
- default:
870
- regexpNargs = '(-*' + $$.repeat('-*A', action.nargs) + '-*)';
871
- }
872
-
873
- // if this is an optional action, -- is not allowed
874
- if (action.isOptional()) {
875
- regexpNargs = regexpNargs.replace(/-\*/g, '');
876
- regexpNargs = regexpNargs.replace(/-/g, '');
877
- }
878
-
879
- // return the pattern
880
- return regexpNargs;
881
- };
882
-
883
- //
884
- // Value conversion methods
885
- //
886
-
887
- ArgumentParser.prototype._getValues = function (action, argStrings) {
888
- var self = this;
889
-
890
- // for everything but PARSER args, strip out '--'
891
- if (action.nargs !== c.PARSER && action.nargs !== c.REMAINDER) {
892
- argStrings = argStrings.filter(function (arrayElement) {
893
- return arrayElement !== '--';
894
- });
895
- }
896
-
897
- var value, argString;
898
-
899
- // optional argument produces a default when not present
900
- if (argStrings.length === 0 && action.nargs === c.OPTIONAL) {
901
-
902
- value = (action.isOptional()) ? action.constant : action.defaultValue;
903
-
904
- if (typeof (value) === 'string') {
905
- value = this._getValue(action, value);
906
- this._checkValue(action, value);
907
- }
908
-
909
- // when nargs='*' on a positional, if there were no command-line
910
- // args, use the default if it is anything other than None
911
- } else if (argStrings.length === 0 && action.nargs === c.ZERO_OR_MORE &&
912
- action.optionStrings.length === 0) {
913
-
914
- value = (action.defaultValue || argStrings);
915
- this._checkValue(action, value);
916
-
917
- // single argument or optional argument produces a single value
918
- } else if (argStrings.length === 1 &&
919
- (!action.nargs || action.nargs === c.OPTIONAL)) {
920
-
921
- argString = argStrings[0];
922
- value = this._getValue(action, argString);
923
- this._checkValue(action, value);
924
-
925
- // REMAINDER arguments convert all values, checking none
926
- } else if (action.nargs === c.REMAINDER) {
927
- value = argStrings.map(function (v) {
928
- return self._getValue(action, v);
929
- });
930
-
931
- // PARSER arguments convert all values, but check only the first
932
- } else if (action.nargs === c.PARSER) {
933
- value = argStrings.map(function (v) {
934
- return self._getValue(action, v);
935
- });
936
- this._checkValue(action, value[0]);
937
-
938
- // all other types of nargs produce a list
939
- } else {
940
- value = argStrings.map(function (v) {
941
- return self._getValue(action, v);
942
- });
943
- value.forEach(function (v) {
944
- self._checkValue(action, v);
945
- });
946
- }
947
-
948
- // return the converted value
949
- return value;
950
- };
951
-
952
- ArgumentParser.prototype._getValue = function (action, argString) {
953
- var result;
954
-
955
- var typeFunction = this._registryGet('type', action.type, action.type);
956
- if (typeof typeFunction !== 'function') {
957
- var message = format('%s is not callable', typeFunction);
958
- throw argumentErrorHelper(action, message);
959
- }
960
-
961
- // convert the value to the appropriate type
962
- try {
963
- result = typeFunction(argString);
964
-
965
- // ArgumentTypeErrors indicate errors
966
- // If action.type is not a registered string, it is a function
967
- // Try to deduce its name for inclusion in the error message
968
- // Failing that, include the error message it raised.
969
- } catch (e) {
970
- var name = null;
971
- if (typeof action.type === 'string') {
972
- name = action.type;
973
- } else {
974
- name = action.type.name || action.type.displayName || '<function>';
975
- }
976
- var msg = format('Invalid %s value: %s', name, argString);
977
- if (name === '<function>') { msg += '\n' + e.message; }
978
- throw argumentErrorHelper(action, msg);
979
- }
980
- // return the converted value
981
- return result;
982
- };
983
-
984
- ArgumentParser.prototype._checkValue = function (action, value) {
985
- // converted value must be one of the choices (if specified)
986
- var choices = action.choices;
987
- if (choices) {
988
- // choise for argument can by array or string
989
- if ((typeof choices === 'string' || Array.isArray(choices)) &&
990
- choices.indexOf(value) !== -1) {
991
- return;
992
- }
993
- // choise for subparsers can by only hash
994
- if (typeof choices === 'object' && !Array.isArray(choices) && choices[value]) {
995
- return;
996
- }
997
-
998
- if (typeof choices === 'string') {
999
- choices = choices.split('').join(', ');
1000
- } else if (Array.isArray(choices)) {
1001
- choices = choices.join(', ');
1002
- } else {
1003
- choices = Object.keys(choices).join(', ');
1004
- }
1005
- var message = format('Invalid choice: %s (choose from [%s])', value, choices);
1006
- throw argumentErrorHelper(action, message);
1007
- }
1008
- };
1009
-
1010
- //
1011
- // Help formatting methods
1012
- //
1013
-
1014
- /**
1015
- * ArgumentParser#formatUsage -> string
1016
- *
1017
- * Return usage string
1018
- *
1019
- * See also [original guide][1]
1020
- *
1021
- * [1]:http://docs.python.org/dev/library/argparse.html#printing-help
1022
- **/
1023
- ArgumentParser.prototype.formatUsage = function () {
1024
- var formatter = this._getFormatter();
1025
- formatter.addUsage(this.usage, this._actions, this._mutuallyExclusiveGroups);
1026
- return formatter.formatHelp();
1027
- };
1028
-
1029
- /**
1030
- * ArgumentParser#formatHelp -> string
1031
- *
1032
- * Return help
1033
- *
1034
- * See also [original guide][1]
1035
- *
1036
- * [1]:http://docs.python.org/dev/library/argparse.html#printing-help
1037
- **/
1038
- ArgumentParser.prototype.formatHelp = function () {
1039
- var formatter = this._getFormatter();
1040
-
1041
- // usage
1042
- formatter.addUsage(this.usage, this._actions, this._mutuallyExclusiveGroups);
1043
-
1044
- // description
1045
- formatter.addText(this.description);
1046
-
1047
- // positionals, optionals and user-defined groups
1048
- this._actionGroups.forEach(function (actionGroup) {
1049
- formatter.startSection(actionGroup.title);
1050
- formatter.addText(actionGroup.description);
1051
- formatter.addArguments(actionGroup._groupActions);
1052
- formatter.endSection();
1053
- });
1054
-
1055
- // epilog
1056
- formatter.addText(this.epilog);
1057
-
1058
- // determine help from format above
1059
- return formatter.formatHelp();
1060
- };
1061
-
1062
- ArgumentParser.prototype._getFormatter = function () {
1063
- var FormatterClass = this.formatterClass;
1064
- var formatter = new FormatterClass({ prog: this.prog });
1065
- return formatter;
1066
- };
1067
-
1068
- //
1069
- // Print functions
1070
- //
1071
-
1072
- /**
1073
- * ArgumentParser#printUsage() -> Void
1074
- *
1075
- * Print usage
1076
- *
1077
- * See also [original guide][1]
1078
- *
1079
- * [1]:http://docs.python.org/dev/library/argparse.html#printing-help
1080
- **/
1081
- ArgumentParser.prototype.printUsage = function () {
1082
- this._printMessage(this.formatUsage());
1083
- };
1084
-
1085
- /**
1086
- * ArgumentParser#printHelp() -> Void
1087
- *
1088
- * Print help
1089
- *
1090
- * See also [original guide][1]
1091
- *
1092
- * [1]:http://docs.python.org/dev/library/argparse.html#printing-help
1093
- **/
1094
- ArgumentParser.prototype.printHelp = function () {
1095
- this._printMessage(this.formatHelp());
1096
- };
1097
-
1098
- ArgumentParser.prototype._printMessage = function (message, stream) {
1099
- if (!stream) {
1100
- stream = process.stdout;
1101
- }
1102
- if (message) {
1103
- stream.write('' + message);
1104
- }
1105
- };
1106
-
1107
- //
1108
- // Exit functions
1109
- //
1110
-
1111
- /**
1112
- * ArgumentParser#exit(status=0, message) -> Void
1113
- * - status (int): exit status
1114
- * - message (string): message
1115
- *
1116
- * Print message in stderr/stdout and exit program
1117
- **/
1118
- ArgumentParser.prototype.exit = function (status, message) {
1119
- if (message) {
1120
- if (status === 0) {
1121
- this._printMessage(message);
1122
- } else {
1123
- this._printMessage(message, process.stderr);
1124
- }
1125
- }
1126
-
1127
- process.exit(status);
1128
- };
1129
-
1130
- /**
1131
- * ArgumentParser#error(message) -> Void
1132
- * - err (Error|string): message
1133
- *
1134
- * Error method Prints a usage message incorporating the message to stderr and
1135
- * exits. If you override this in a subclass,
1136
- * it should not return -- it should
1137
- * either exit or throw an exception.
1138
- *
1139
- **/
1140
- ArgumentParser.prototype.error = function (err) {
1141
- var message;
1142
- if (err instanceof Error) {
1143
- if (this.debug === true) {
1144
- throw err;
1145
- }
1146
- message = err.message;
1147
- } else {
1148
- message = err;
1149
- }
1150
- var msg = format('%s: error: %s', this.prog, message) + c.EOL;
1151
-
1152
- if (this.debug === true) {
1153
- throw new Error(msg);
1154
- }
1155
-
1156
- this.printUsage(process.stderr);
1157
-
1158
- return this.exit(2, msg);
1159
- };
1160
-
1161
- module.exports = ArgumentParser;