summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LICENSE51
-rw-r--r--Makefile9
-rw-r--r--test/doctool/test-doctool-html.js14
-rw-r--r--tools/doc/html.js333
l---------tools/doc/node_modules/.bin/esparse1
l---------tools/doc/node_modules/.bin/esvalidate1
l---------tools/doc/node_modules/.bin/js-yaml1
-rw-r--r--tools/doc/node_modules/argparse/LICENSE21
-rw-r--r--tools/doc/node_modules/argparse/README.md255
-rw-r--r--tools/doc/node_modules/argparse/index.js3
-rw-r--r--tools/doc/node_modules/argparse/lib/action.js146
-rw-r--r--tools/doc/node_modules/argparse/lib/action/append.js53
-rw-r--r--tools/doc/node_modules/argparse/lib/action/append/constant.js47
-rw-r--r--tools/doc/node_modules/argparse/lib/action/count.js40
-rw-r--r--tools/doc/node_modules/argparse/lib/action/help.js47
-rw-r--r--tools/doc/node_modules/argparse/lib/action/store.js50
-rw-r--r--tools/doc/node_modules/argparse/lib/action/store/constant.js43
-rw-r--r--tools/doc/node_modules/argparse/lib/action/store/false.js27
-rw-r--r--tools/doc/node_modules/argparse/lib/action/store/true.js26
-rw-r--r--tools/doc/node_modules/argparse/lib/action/subparsers.js149
-rw-r--r--tools/doc/node_modules/argparse/lib/action/version.js47
-rw-r--r--tools/doc/node_modules/argparse/lib/action_container.js482
-rw-r--r--tools/doc/node_modules/argparse/lib/argparse.js14
-rw-r--r--tools/doc/node_modules/argparse/lib/argument/error.js50
-rw-r--r--tools/doc/node_modules/argparse/lib/argument/exclusive.js53
-rw-r--r--tools/doc/node_modules/argparse/lib/argument/group.js74
-rw-r--r--tools/doc/node_modules/argparse/lib/argument_parser.js1161
-rw-r--r--tools/doc/node_modules/argparse/lib/const.js21
-rw-r--r--tools/doc/node_modules/argparse/lib/help/added_formatters.js87
-rw-r--r--tools/doc/node_modules/argparse/lib/help/formatter.js795
-rw-r--r--tools/doc/node_modules/argparse/lib/namespace.js76
-rw-r--r--tools/doc/node_modules/argparse/lib/utils.js57
-rw-r--r--tools/doc/node_modules/argparse/package.json74
-rw-r--r--tools/doc/node_modules/esprima/LICENSE.BSD21
-rw-r--r--tools/doc/node_modules/esprima/README.md46
-rwxr-xr-xtools/doc/node_modules/esprima/bin/esparse.js139
-rwxr-xr-xtools/doc/node_modules/esprima/bin/esvalidate.js236
-rw-r--r--tools/doc/node_modules/esprima/dist/esprima.js6700
-rw-r--r--tools/doc/node_modules/esprima/package.json141
-rw-r--r--tools/doc/node_modules/js-yaml/LICENSE21
-rw-r--r--tools/doc/node_modules/js-yaml/README.md313
-rwxr-xr-xtools/doc/node_modules/js-yaml/bin/js-yaml.js132
-rw-r--r--tools/doc/node_modules/js-yaml/dist/js-yaml.js3905
-rw-r--r--tools/doc/node_modules/js-yaml/dist/js-yaml.min.js1
-rw-r--r--tools/doc/node_modules/js-yaml/index.js7
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml.js39
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/common.js59
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/dumper.js819
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/exception.js43
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/loader.js1598
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/mark.js76
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/schema.js108
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/schema/core.js18
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/schema/default_full.js25
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js28
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js17
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/schema/json.js25
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/type.js61
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/type/binary.js138
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/type/bool.js35
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/type/float.js116
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/type/int.js173
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/type/js/function.js86
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js60
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js28
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/type/map.js8
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/type/merge.js12
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/type/null.js34
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/type/omap.js44
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/type/pairs.js53
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/type/seq.js8
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/type/set.js29
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/type/str.js8
-rw-r--r--tools/doc/node_modules/js-yaml/lib/js-yaml/type/timestamp.js88
-rw-r--r--tools/doc/node_modules/js-yaml/package.json96
-rw-r--r--tools/doc/node_modules/marked/.npmignore2
-rw-r--r--tools/doc/node_modules/marked/.travis.yml5
-rw-r--r--tools/doc/node_modules/marked/Gulpfile.js22
-rw-r--r--tools/doc/node_modules/marked/bower.json24
-rw-r--r--tools/doc/node_modules/marked/component.json10
-rw-r--r--tools/doc/node_modules/marked/doc/broken.md426
-rw-r--r--tools/doc/node_modules/marked/doc/todo.md2
-rw-r--r--tools/doc/node_modules/sprintf-js/LICENSE24
-rw-r--r--tools/doc/node_modules/sprintf-js/README.md88
-rw-r--r--tools/doc/node_modules/sprintf-js/dist/angular-sprintf.min.js4
-rw-r--r--tools/doc/node_modules/sprintf-js/dist/angular-sprintf.min.js.map1
-rw-r--r--tools/doc/node_modules/sprintf-js/dist/angular-sprintf.min.map1
-rw-r--r--tools/doc/node_modules/sprintf-js/dist/sprintf.min.js4
-rw-r--r--tools/doc/node_modules/sprintf-js/dist/sprintf.min.js.map1
-rw-r--r--tools/doc/node_modules/sprintf-js/dist/sprintf.min.map1
-rw-r--r--tools/doc/node_modules/sprintf-js/package.json58
-rw-r--r--tools/doc/node_modules/sprintf-js/src/angular-sprintf.js18
-rw-r--r--tools/doc/node_modules/sprintf-js/src/sprintf.js208
-rw-r--r--tools/doc/package-lock.json1314
-rw-r--r--tools/doc/package.json9
-rwxr-xr-xtools/license-builder.sh4
-rw-r--r--vcbuild.bat31
97 files changed, 21501 insertions, 658 deletions
diff --git a/LICENSE b/LICENSE
index d768eb3e2d..c0546eea9d 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1197,6 +1197,57 @@ The externally maintained libraries used by Node.js are:
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
+- unified, located at deps/unified, is licensed as follows:
+ """
+ (The MIT License)
+
+ Copyright (c) 2015 Titus Wormer <tituswormer@gmail.com>
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in
+ all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ THE SOFTWARE.
+ """
+
+- remark-rehype, located at deps/remark-rehype, is licensed as follows:
+ """
+ (The MIT License)
+
+ Copyright (c) 2016 Titus Wormer <tituswormer@gmail.com>
+
+ Permission is hereby granted, free of charge, to any person obtaining
+ a copy of this software and associated documentation files (the
+ 'Software'), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ """
+
- remark-cli, located at tools/remark-cli, is licensed as follows:
"""
(The MIT License)
diff --git a/Makefile b/Makefile
index a8d5af6b30..83f5de697e 100644
--- a/Makefile
+++ b/Makefile
@@ -266,7 +266,6 @@ test: all ## Runs default tests, linters, and builds docs.
# can be displayed together
$(MAKE) -s build-addons
$(MAKE) -s build-addons-napi
- $(MAKE) -s test-doc
$(MAKE) -s cctest
$(MAKE) -s jstest
@@ -611,7 +610,8 @@ apidocs_json = $(addprefix out/,$(apidoc_sources:.md=.json))
apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*)))
.PHONY: doc-only
-doc-only: $(apidoc_dirs) $(apiassets) ## Builds the docs with the local or the global Node.js binary.
+doc-only: tools/doc/node_modules \
+ $(apidoc_dirs) $(apiassets) ## Builds the docs with the local or the global Node.js binary.
# If it's a source tarball, assets are already in doc/api/assets,
# no need to install anything, we have already copied the docs over
if [ ! -d doc/api/assets ]; then \
@@ -1082,8 +1082,13 @@ tools/remark-preset-lint-node/node_modules: \
.PHONY: lint-md-build
lint-md-build: tools/remark-cli/node_modules \
+ tools/doc/node_modules \
tools/remark-preset-lint-node/node_modules
+.PHONY: tools/doc/node_modules
+tools/doc/node_modules:
+ @cd tools/doc && $(call available-node,$(run-npm-install))
+
.PHONY: lint-md
ifneq ("","$(wildcard tools/remark-cli/node_modules/)")
diff --git a/test/doctool/test-doctool-html.js b/test/doctool/test-doctool-html.js
index a6119c1690..c895df087c 100644
--- a/test/doctool/test-doctool-html.js
+++ b/test/doctool/test-doctool-html.js
@@ -21,8 +21,8 @@ const toHTML = require('../../tools/doc/html.js');
const testData = [
{
file: fixtures.path('sample_document.md'),
- html: '<ol><li>fish</li><li><p>fish</p></li><li><p>Redfish</p></li>' +
- '<li>Bluefish</li></ol>'
+ html: '<ol><li>fish</li><li>fish</li></ol>' +
+ '<ul><li>Redfish</li><li>Bluefish</li></ul>'
},
{
file: fixtures.path('order_of_end_tags_5873.md'),
@@ -31,7 +31,7 @@ const testData = [
'id="foo_class_method_buffer_from_array">#</a> </span> </h3>' +
'<ul><li><code>array</code><a ' +
'href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/' +
- 'Reference/Global_Objects/Array" class="type">&lt;Array&gt;</a></li></ul>'
+ 'Reference/Global_Objects/Array" class="type">&#x3C;Array></a></li></ul>'
},
{
file: fixtures.path('doc_with_yaml.md'),
@@ -45,11 +45,11 @@ const testData = [
'<h2>Foobar II<span><a class="mark" href="#foo_foobar_ii" ' +
'id="foo_foobar_ii">#</a></span></h2><div class="api_metadata">' +
'<details class="changelog"><summary>History</summary>' +
- '<table><tr><th>Version</th><th>Changes</th></tr>' +
+ '<table><tbody><tr><th>Version</th><th>Changes</th></tr>' +
'<tr><td>v5.3.0, v4.2.0</td>' +
'<td><p><span>Added in: v5.3.0, v4.2.0</span></p></td></tr>' +
'<tr><td>v4.2.0</td><td><p>The <code>error</code> parameter can now be' +
- 'an arrow function.</p></td></tr></table></details></div> ' +
+ 'an arrow function.</p></td></tr></tbody></table></details></div> ' +
'<p>Describe <code>Foobar II</code> in more detail here.' +
'<a href="http://man7.org/linux/man-pages/man1/fg.1.html"><code>fg(1)' +
'</code></a></p><h2>Deprecated thingy<span><a class="mark" ' +
@@ -65,8 +65,8 @@ const testData = [
},
{
file: fixtures.path('sample_document.md'),
- html: '<ol><li>fish</li><li><p>fish</p></li><li><p>Redfish</p></li>' +
- '<li>Bluefish</li></ol>',
+ html: '<ol><li>fish</li><li>fish</li></ol>' +
+ '<ul><li>Red fish</li><li>Blue fish</li></ul>',
analyticsId: 'UA-67020396-1'
},
];
diff --git a/tools/doc/html.js b/tools/doc/html.js
index 0f3293dadd..8aaced7424 100644
--- a/tools/doc/html.js
+++ b/tools/doc/html.js
@@ -23,26 +23,39 @@
const common = require('./common.js');
const fs = require('fs');
-const marked = require('marked');
+const unified = require('unified');
+const find = require('unist-util-find');
+const visit = require('unist-util-visit');
+const markdown = require('remark-parse');
+const remark2rehype = require('remark-rehype');
+const raw = require('rehype-raw');
+const html = require('rehype-stringify');
const path = require('path');
const typeParser = require('./type-parser.js');
module.exports = toHTML;
-// Make `marked` to not automatically insert id attributes in headings.
-const renderer = new marked.Renderer();
-renderer.heading = (text, level) => `<h${level}>${text}</h${level}>\n`;
-marked.setOptions({ renderer });
-
const docPath = path.resolve(__dirname, '..', '..', 'doc');
+// Add class attributes to index navigation links.
+function navClasses() {
+ return (tree) => {
+ visit(tree, { type: 'element', tagName: 'a' }, (node) => {
+ node.properties.class = 'nav-' +
+ node.properties.href.replace('.html', '').replace(/\W+/g, '-');
+ });
+ };
+}
+
const gtocPath = path.join(docPath, 'api', 'index.md');
const gtocMD = fs.readFileSync(gtocPath, 'utf8').replace(/^<!--.*?-->/gms, '');
-const gtocHTML = marked(gtocMD).replace(
- /<a href="(.*?)"/g,
- (all, href) => `<a class="nav-${href.replace('.html', '')
- .replace(/\W+/g, '-')}" href="${href}"`
-);
+const gtocHTML = unified()
+ .use(markdown)
+ .use(remark2rehype, { allowDangerousHTML: true })
+ .use(raw)
+ .use(navClasses)
+ .use(html)
+ .processSync(gtocMD).toString();
const templatePath = path.join(docPath, 'template.html');
const template = fs.readFileSync(templatePath, 'utf8');
@@ -50,26 +63,28 @@ const template = fs.readFileSync(templatePath, 'utf8');
function toHTML({ input, filename, nodeVersion, analytics }, cb) {
filename = path.basename(filename, '.md');
- const lexed = marked.lexer(input);
-
- const firstHeading = lexed.find(({ type }) => type === 'heading');
- const section = firstHeading ? firstHeading.text : 'Index';
-
- preprocessText(lexed);
- preprocessElements(lexed, filename);
-
- // Generate the table of contents. This mutates the lexed contents in-place.
- const toc = buildToc(lexed, filename);
+ const content = unified()
+ .use(markdown)
+ .use(firstHeader)
+ .use(preprocessText)
+ .use(preprocessElements, { filename })
+ .use(buildToc, { filename })
+ .use(remark2rehype, { allowDangerousHTML: true })
+ .use(raw)
+ .use(html)
+ .processSync(input);
const id = filename.replace(/\W+/g, '-');
let HTML = template.replace('__ID__', id)
.replace(/__FILENAME__/g, filename)
- .replace('__SECTION__', section)
+ .replace('__SECTION__', content.section)
.replace(/__VERSION__/g, nodeVersion)
- .replace('__TOC__', toc)
+ .replace('__TOC__', content.toc)
.replace('__GTOC__', gtocHTML.replace(
- `class="nav-${id}`, `class="nav-${id} active`));
+ `class="nav-${id}`, `class="nav-${id} active`))
+ .replace('__EDIT_ON_GITHUB__', editOnGitHub(filename))
+ .replace('__CONTENT__', content.toString());
if (analytics) {
HTML = HTML.replace('<!-- __TRACKING__ -->', `
@@ -96,39 +111,36 @@ function toHTML({ input, filename, nodeVersion, analytics }, cb) {
HTML = HTML.replace('__ALTDOCS__', '');
}
- HTML = HTML.replace('__EDIT_ON_GITHUB__', editOnGitHub(filename));
-
- // Content insertion has to be the last thing we do with the lexed tokens,
- // because it's destructive.
- HTML = HTML.replace('__CONTENT__', marked.parser(lexed));
-
cb(null, HTML);
}
-// Handle general body-text replacements.
-// For example, link man page references to the actual page.
-function preprocessText(lexed) {
- lexed.forEach((token) => {
- if (token.type === 'table') {
- if (token.header) {
- token.header = token.header.map(replaceInText);
- }
+// Set the section name based on the first header. Default to 'Index'.
+function firstHeader() {
+ return (tree, file) => {
+ file.section = 'Index';
- if (token.cells) {
- token.cells.forEach((row, i) => {
- token.cells[i] = row.map(replaceInText);
- });
- }
- } else if (token.text && token.type !== 'code') {
- token.text = replaceInText(token.text);
+ const heading = find(tree, { type: 'heading' });
+ if (heading) {
+ const text = find(heading, { type: 'text' });
+ if (text) file.section = text.value;
}
- });
+ };
}
-// Replace placeholders in text tokens.
-function replaceInText(text) {
- if (text === '') return text;
- return linkJsTypeDocs(linkManPages(text));
+// Handle general body-text replacements.
+// For example, link man page references to the actual page.
+function preprocessText() {
+ return (tree) => {
+ visit(tree, null, (node) => {
+ if (node.type === 'text' && node.value) {
+ const value = linkJsTypeDocs(linkManPages(node.value));
+ if (value !== node.value) {
+ node.type = 'html';
+ node.value = value;
+ }
+ }
+ });
+ };
}
// Syscalls which appear in the docs, but which only exist in BSD / macOS.
@@ -172,63 +184,73 @@ function linkJsTypeDocs(text) {
return parts.join('`');
}
-// Preprocess stability blockquotes and YAML blocks.
-function preprocessElements(lexed, filename) {
- const STABILITY_RE = /(.*:)\s*(\d)([\s\S]*)/;
- let state = null;
- let headingIndex = -1;
- let heading = null;
-
- lexed.forEach((token, index) => {
- if (token.type === 'heading') {
- headingIndex = index;
- heading = token;
- }
- if (token.type === 'html' && common.isYAMLBlock(token.text)) {
- token.text = parseYAML(token.text);
- }
- if (token.type === 'blockquote_start') {
- state = 'MAYBE_STABILITY_BQ';
- lexed[index] = { type: 'space' };
- }
- if (token.type === 'blockquote_end' && state === 'MAYBE_STABILITY_BQ') {
- state = null;
- lexed[index] = { type: 'space' };
- }
- if (token.type === 'paragraph' && state === 'MAYBE_STABILITY_BQ') {
- if (token.text.includes('Stability:')) {
- const [, prefix, number, explication] = token.text.match(STABILITY_RE);
- const isStabilityIndex =
- index - 2 === headingIndex || // General.
- index - 3 === headingIndex; // With api_metadata block.
-
- if (heading && isStabilityIndex) {
- heading.stability = number;
- headingIndex = -1;
- heading = null;
+// Preprocess stability blockquotes and YAML blocks
+function preprocessElements({ filename }) {
+ return (tree) => {
+ const STABILITY_RE = /(.*:)\s*(\d)([\s\S]*)/;
+ let headingIndex = -1;
+ let heading = null;
+
+ visit(tree, null, (node, index) => {
+ if (node.type === 'heading') {
+ headingIndex = index;
+ heading = node;
+
+ } else if (node.type === 'html' && common.isYAMLBlock(node.value)) {
+ node.value = parseYAML(node.value);
+
+ } else if (node.type === 'blockquote') {
+ const paragraph = node.children[0].type === 'paragraph' &&
+ node.children[0];
+ const text = paragraph && paragraph.children[0].type === 'text' &&
+ paragraph.children[0];
+ if (text && text.value.includes('Stability:')) {
+ const [, prefix, number, explication] =
+ text.value.match(STABILITY_RE);
+
+ const isStabilityIndex =
+ index - 2 === headingIndex || // General.
+ index - 3 === headingIndex; // With api_metadata block.
+
+ if (heading && isStabilityIndex) {
+ heading.stability = number;
+ headingIndex = -1;
+ heading = null;
+ }
+
+ // Do not link to the section we are already in.
+ const noLinking = filename === 'documentation' &&
+ heading !== null && heading.value === 'Stability Index';
+
+ // collapse blockquote and paragraph into a single node
+ node.type = 'paragraph';
+ node.children.shift();
+ node.children.unshift(...paragraph.children);
+
+ // insert div with prefix and number
+ node.children.unshift({
+ type: 'html',
+ value: `<div class="api_stability api_stability_${number}">` +
+ (noLinking ? '' :
+ '<a href="documentation.html#documentation_stability_index">') +
+ `${prefix} ${number}${noLinking ? '' : '</a>'}`
+ .replace(/\n/g, ' ')
+ });
+
+ // remove prefix and number from text
+ text.value = explication;
+
+ // close div
+ node.children.push({ type: 'html', value: '</div>' });
}
-
- // Do not link to the section we are already in.
- const noLinking = filename === 'documentation' &&
- heading !== null && heading.text === 'Stability Index';
- token.text = `<div class="api_stability api_stability_${number}">` +
- (noLinking ? '' :
- '<a href="documentation.html#documentation_stability_index">') +
- `${prefix} ${number}${noLinking ? '' : '</a>'}${explication}</div>`
- .replace(/\n/g, ' ');
-
- lexed[index] = { type: 'html', text: token.text };
- } else if (state === 'MAYBE_STABILITY_BQ') {
- state = null;
- lexed[index - 1] = { type: 'blockquote_start' };
}
- }
- });
+ });
+ };
}
function parseYAML(text) {
const meta = common.extractAndParseYAML(text);
- let html = '<div class="api_metadata">\n';
+ let result = '<div class="api_metadata">\n';
const added = { description: '' };
const deprecated = { description: '' };
@@ -250,25 +272,32 @@ function parseYAML(text) {
meta.changes.sort((a, b) => versionSort(a.version, b.version));
- html += '<details class="changelog"><summary>History</summary>\n' +
+ result += '<details class="changelog"><summary>History</summary>\n' +
'<table>\n<tr><th>Version</th><th>Changes</th></tr>\n';
meta.changes.forEach((change) => {
- html += `<tr><td>${change.version}</td>\n` +
- `<td>${marked(change.description)}</td></tr>\n`;
+ const description = unified()
+ .use(markdown)
+ .use(remark2rehype, { allowDangerousHTML: true })
+ .use(raw)
+ .use(html)
+ .processSync(change.description).toString();
+
+ result += `<tr><td>${change.version}</td>\n` +
+ `<td>${description}</td></tr>\n`;
});
- html += '</table>\n</details>\n';
+ result += '</table>\n</details>\n';
} else {
- html += `${added.description}${deprecated.description}\n`;
+ result += `${added.description}${deprecated.description}\n`;
}
if (meta.napiVersion) {
- html += `<span>N-API version: ${meta.napiVersion.join(', ')}</span>\n`;
+ result += `<span>N-API version: ${meta.napiVersion.join(', ')}</span>\n`;
}
- html += '</div>';
- return html;
+ result += '</div>';
+ return result;
}
const numberRe = /^\d*/;
@@ -282,48 +311,62 @@ function versionSort(a, b) {
return +b.match(numberRe)[0] - +a.match(numberRe)[0];
}
-function buildToc(lexed, filename) {
- const startIncludeRefRE = /^\s*<!-- \[start-include:(.+)\] -->\s*$/;
- const endIncludeRefRE = /^\s*<!-- \[end-include:.+\] -->\s*$/;
- const realFilenames = [filename];
- const idCounters = Object.create(null);
- let toc = '';
- let depth = 0;
-
- lexed.forEach((token) => {
- // Keep track of the current filename along comment wrappers of inclusions.
- if (token.type === 'html') {
- const [, includedFileName] = token.text.match(startIncludeRefRE) || [];
- if (includedFileName !== undefined)
- realFilenames.unshift(includedFileName);
- else if (endIncludeRefRE.test(token.text))
- realFilenames.shift();
- }
+function buildToc({ filename }) {
+ return (tree, file) => {
+ const startIncludeRefRE = /^\s*<!-- \[start-include:(.+)\] -->\s*$/;
+ const endIncludeRefRE = /^\s*<!-- \[end-include:.+\] -->\s*$/;
+ const realFilenames = [filename];
+ const idCounters = Object.create(null);
+ let toc = '';
+ let depth = 0;
+
+ visit(tree, null, (node) => {
+ // Keep track of the current filename for comment wrappers of inclusions.
+ if (node.type === 'html') {
+ const [, includedFileName] = node.value.match(startIncludeRefRE) || [];
+ if (includedFileName !== undefined)
+ realFilenames.unshift(includedFileName);
+ else if (endIncludeRefRE.test(node.value))
+ realFilenames.shift();
+ }
- if (token.type !== 'heading') return;
+ if (node.type !== 'heading') return;
- if (token.depth - depth > 1) {
- throw new Error(`Inappropriate heading level:\n${JSON.stringify(token)}`);
- }
+ if (node.depth - depth > 1) {
+ throw new Error(
+ `Inappropriate heading level:\n${JSON.stringify(node)}`
+ );
+ }
- depth = token.depth;
- const realFilename = path.basename(realFilenames[0], '.md');
- const headingText = token.text.trim();
- const id = getId(`${realFilename}_${headingText}`, idCounters);
+ depth = node.depth;
+ const realFilename = path.basename(realFilenames[0], '.md');
+ const headingText = node.children.map((child) => child.value)
+ .join().trim();
+ const id = getId(`${realFilename}_${headingText}`, idCounters);
- const hasStability = token.stability !== undefined;
- toc += ' '.repeat((depth - 1) * 2) +
- (hasStability ? `* <span class="stability_${token.stability}">` : '* ') +
- `<a href="#${id}">${token.text}</a>${hasStability ? '</span>' : ''}\n`;
+ const hasStability = node.stability !== undefined;
+ toc += ' '.repeat((depth - 1) * 2) +
+ (hasStability ? `* <span class="stability_${node.stability}">` : '* ') +
+ `<a href="#${id}">${headingText}</a>${hasStability ? '</span>' : ''}\n`;
- token.text += `<span><a class="mark" href="#${id}" id="${id}">#</a></span>`;
- if (realFilename === 'errors' && headingText.startsWith('ERR_')) {
- token.text += `<span><a class="mark" href="#${headingText}" ` +
- `id="${headingText}">#</a></span>`;
- }
- });
+ let anchor =
+ `<span><a class="mark" href="#${id}" id="${id}">#</a></span>`;
+
+ if (realFilename === 'errors' && headingText.startsWith('ERR_')) {
+ anchor += `<span><a class="mark" href="#${headingText}" ` +
+ `id="${headingText}">#</a></span>`;
+ }
+
+ node.children.push({ type: 'html', value: anchor });
+ });
- return marked(toc);
+ file.toc = unified()
+ .use(markdown)
+ .use(remark2rehype, { allowDangerousHTML: true })
+ .use(raw)
+ .use(html)
+ .processSync(toc).toString();
+ };
}
const notAlphaNumerics = /[^a-z0-9]+/g;
diff --git a/tools/doc/node_modules/.bin/esparse b/tools/doc/node_modules/.bin/esparse
new file mode 120000
index 0000000000..7423b18b24
--- /dev/null
+++ b/tools/doc/node_modules/.bin/esparse
@@ -0,0 +1 @@
+../esprima/bin/esparse.js \ No newline at end of file
diff --git a/tools/doc/node_modules/.bin/esvalidate b/tools/doc/node_modules/.bin/esvalidate
new file mode 120000
index 0000000000..16069effbc
--- /dev/null
+++ b/tools/doc/node_modules/.bin/esvalidate
@@ -0,0 +1 @@
+../esprima/bin/esvalidate.js \ No newline at end of file
diff --git a/tools/doc/node_modules/.bin/js-yaml b/tools/doc/node_modules/.bin/js-yaml
new file mode 120000
index 0000000000..9dbd010d47
--- /dev/null
+++ b/tools/doc/node_modules/.bin/js-yaml
@@ -0,0 +1 @@
+../js-yaml/bin/js-yaml.js \ No newline at end of file
diff --git a/tools/doc/node_modules/argparse/LICENSE b/tools/doc/node_modules/argparse/LICENSE
new file mode 100644
index 0000000000..1afdae5584
--- /dev/null
+++ b/tools/doc/node_modules/argparse/LICENSE
@@ -0,0 +1,21 @@
+(The MIT License)
+
+Copyright (C) 2012 by Vitaly Puzrin
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/tools/doc/node_modules/argparse/README.md b/tools/doc/node_modules/argparse/README.md
new file mode 100644
index 0000000000..90dfd2c662
--- /dev/null
+++ b/tools/doc/node_modules/argparse/README.md
@@ -0,0 +1,255 @@
+argparse
+========
+
+[![Build Status](https://secure.travis-ci.org/nodeca/argparse.svg?branch=master)](http://travis-ci.org/nodeca/argparse)
+[![NPM version](https://img.shields.io/npm/v/argparse.svg)](https://www.npmjs.org/package/argparse)
+
+CLI arguments parser for node.js. Javascript port of python's
+[argparse](http://docs.python.org/dev/library/argparse.html) module
+(original version 3.2). That's a full port, except some very rare options,
+recorded in issue tracker.
+
+**NB. Difference with original.**
+
+- Method names changed to camelCase. See [generated docs](http://nodeca.github.com/argparse/).
+- Use `defaultValue` instead of `default`.
+- Use `argparse.Const.REMAINDER` instead of `argparse.REMAINDER`, and
+ similarly for constant values `OPTIONAL`, `ZERO_OR_MORE`, and `ONE_OR_MORE`
+ (aliases for `nargs` values `'?'`, `'*'`, `'+'`, respectively), and
+ `SUPPRESS`.
+
+
+Example
+=======
+
+test.js file:
+
+```javascript
+#!/usr/bin/env node
+'use strict';
+
+var ArgumentParser = require('../lib/argparse').ArgumentParser;
+var parser = new ArgumentParser({
+ version: '0.0.1',
+ addHelp:true,
+ description: 'Argparse example'
+});
+parser.addArgument(
+ [ '-f', '--foo' ],
+ {
+ help: 'foo bar'
+ }
+);
+parser.addArgument(
+ [ '-b', '--bar' ],
+ {
+ help: 'bar foo'
+ }
+);
+parser.addArgument(
+ '--baz',
+ {
+ help: 'baz bar'
+ }
+);
+var args = parser.parseArgs();
+console.dir(args);
+```
+
+Display help:
+
+```
+$ ./test.js -h
+usage: example.js [-h] [-v] [-f FOO] [-b BAR] [--baz BAZ]
+
+Argparse example
+
+Optional arguments:
+ -h, --help Show this help message and exit.
+ -v, --version Show program's version number and exit.
+ -f FOO, --foo FOO foo bar
+ -b BAR, --bar BAR bar foo
+ --baz BAZ baz bar
+```
+
+Parse arguments:
+
+```
+$ ./test.js -f=3 --bar=4 --baz 5
+{ foo: '3', bar: '4', baz: '5' }
+```
+
+More [examples](https://github.com/nodeca/argparse/tree/master/examples).
+
+
+ArgumentParser objects
+======================
+
+```
+new ArgumentParser({parameters hash});
+```
+
+Creates a new ArgumentParser object.
+
+**Supported params:**
+
+- ```description``` - Text to display before the argument help.
+- ```epilog``` - Text to display after the argument help.
+- ```addHelp``` - Add a -h/–help option to the parser. (default: true)
+- ```argumentDefault``` - Set the global default value for arguments. (default: null)
+- ```parents``` - A list of ArgumentParser objects whose arguments should also be included.
+- ```prefixChars``` - The set of characters that prefix optional arguments. (default: ‘-‘)
+- ```formatterClass``` - A class for customizing the help output.
+- ```prog``` - The name of the program (default: `path.basename(process.argv[1])`)
+- ```usage``` - The string describing the program usage (default: generated)
+- ```conflictHandler``` - Usually unnecessary, defines strategy for resolving conflicting optionals.
+
+**Not supported yet**
+
+- ```fromfilePrefixChars``` - The set of characters that prefix files from which additional arguments should be read.
+
+
+Details in [original ArgumentParser guide](http://docs.python.org/dev/library/argparse.html#argumentparser-objects)
+
+
+addArgument() method
+====================
+
+```
+ArgumentParser.addArgument(name or flag or [name] or [flags...], {options})
+```
+
+Defines how a single command-line argument should be parsed.
+
+- ```name or flag or [name] or [flags...]``` - Either a positional name
+ (e.g., `'foo'`), a single option (e.g., `'-f'` or `'--foo'`), an array
+ of a single positional name (e.g., `['foo']`), or an array of options
+ (e.g., `['-f', '--foo']`).
+
+Options:
+
+- ```action``` - The basic type of action to be taken when this argument is encountered at the command line.
+- ```nargs```- The number of command-line arguments that should be consumed.
+- ```constant``` - A constant value required by some action and nargs selections.
+- ```defaultValue``` - The value produced if the argument is absent from the command line.
+- ```type``` - The type to which the command-line argument should be converted.
+- ```choices``` - A container of the allowable values for the argument.
+- ```required``` - Whether or not the command-line option may be omitted (optionals only).
+- ```help``` - A brief description of what the argument does.
+- ```metavar``` - A name for the argument in usage messages.
+- ```dest``` - The name of the attribute to be added to the object returned by parseArgs().
+
+Details in [original add_argument guide](http://docs.python.org/dev/library/argparse.html#the-add-argument-method)
+
+
+Action (some details)
+================
+
+ArgumentParser objects associate command-line arguments with actions.
+These actions can do just about anything with the command-line arguments associated
+with them, though most actions simply add an attribute to the object returned by
+parseArgs(). The action keyword argument specifies how the command-line arguments
+should be handled. The supported actions are:
+
+- ```store``` - Just stores the argument’s value. This is the default action.
+- ```storeConst``` - Stores value, specified by the const keyword argument.
+ (Note that the const keyword argument defaults to the rather unhelpful None.)
+ The 'storeConst' action is most commonly used with optional arguments, that
+ specify some sort of flag.
+- ```storeTrue``` and ```storeFalse``` - Stores values True and False
+ respectively. These are special cases of 'storeConst'.
+- ```append``` - Stores a list, and appends each argument value to the list.
+ This is useful to allow an option to be specified multiple times.
+- ```appendConst``` - Stores a list, and appends value, specified by the
+ const keyword argument to the list. (Note, that the const keyword argument defaults
+ is None.) The 'appendConst' action is typically used when multiple arguments need
+ to store constants to the same list.
+- ```count``` - Counts the number of times a keyword argument occurs. For example,
+ used for increasing verbosity levels.
+- ```help``` - Prints a complete help message for all the options in the current
+ parser and then exits. By default a help action is automatically added to the parser.
+ See ArgumentParser for details of how the output is created.
+- ```version``` - Prints version information and exit. Expects a `version=`
+ keyword argument in the addArgument() call.
+
+Details in [original action guide](http://docs.python.org/dev/library/argparse.html#action)
+
+
+Sub-commands
+============
+
+ArgumentParser.addSubparsers()
+
+Many programs split their functionality into a number of sub-commands, for
+example, the svn program can invoke sub-commands like `svn checkout`, `svn update`,
+and `svn commit`. Splitting up functionality this way can be a particularly good
+idea when a program performs several different functions which require different
+kinds of command-line arguments. `ArgumentParser` supports creation of such
+sub-commands with `addSubparsers()` method. The `addSubparsers()` method is
+normally called with no arguments and returns an special action object.
+This object has a single method `addParser()`, which takes a command name and
+any `ArgumentParser` constructor arguments, and returns an `ArgumentParser` object
+that can be modified as usual.
+
+Example:
+
+sub_commands.js
+```javascript
+#!/usr/bin/env node
+'use strict';
+
+var ArgumentParser = require('../lib/argparse').ArgumentParser;
+var parser = new ArgumentParser({
+ version: '0.0.1',
+ addHelp:true,
+ description: 'Argparse examples: sub-commands',
+});
+
+var subparsers = parser.addSubparsers({
+ title:'subcommands',
+ dest:"subcommand_name"
+});
+
+var bar = subparsers.addParser('c1', {addHelp:true});
+bar.addArgument(
+ [ '-f', '--foo' ],
+ {
+ action: 'store',
+ help: 'foo3 bar3'
+ }
+);
+var bar = subparsers.addParser(
+ 'c2',
+ {aliases:['co'], addHelp:true}
+);
+bar.addArgument(
+ [ '-b', '--bar' ],
+ {
+ action: 'store',
+ type: 'int',
+ help: 'foo3 bar3'
+ }
+);
+
+var args = parser.parseArgs();
+console.dir(args);
+
+```
+
+Details in [original sub-commands guide](http://docs.python.org/dev/library/argparse.html#sub-commands)
+
+
+Contributors
+============
+
+- [Eugene Shkuropat](https://github.com/shkuropat)
+- [Paul Jacobson](https://github.com/hpaulj)
+
+[others](https://github.com/nodeca/argparse/graphs/contributors)
+
+License
+=======
+
+Copyright (c) 2012 [Vitaly Puzrin](https://github.com/puzrin).
+Released under the MIT license. See
+[LICENSE](https://github.com/nodeca/argparse/blob/master/LICENSE) for details.
diff --git a/tools/doc/node_modules/argparse/index.js b/tools/doc/node_modules/argparse/index.js
new file mode 100644
index 0000000000..3bbc143200
--- /dev/null
+++ b/tools/doc/node_modules/argparse/index.js
@@ -0,0 +1,3 @@
+'use strict';
+
+module.exports = require('./lib/argparse');
diff --git a/tools/doc/node_modules/argparse/lib/action.js b/tools/doc/node_modules/argparse/lib/action.js
new file mode 100644
index 0000000000..1483c79ffa
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/action.js
@@ -0,0 +1,146 @@
+/**
+ * class Action
+ *
+ * Base class for all actions
+ * Do not call in your code, use this class only for inherits your own action
+ *
+ * Information about how to convert command line strings to Javascript objects.
+ * Action objects are used by an ArgumentParser to represent the information
+ * needed to parse a single argument from one or more strings from the command
+ * line. The keyword arguments to the Action constructor are also all attributes
+ * of Action instances.
+ *
+ * ##### Allowed keywords:
+ *
+ * - `store`
+ * - `storeConstant`
+ * - `storeTrue`
+ * - `storeFalse`
+ * - `append`
+ * - `appendConstant`
+ * - `count`
+ * - `help`
+ * - `version`
+ *
+ * Information about action options see [[Action.new]]
+ *
+ * See also [original guide](http://docs.python.org/dev/library/argparse.html#action)
+ *
+ **/
+
+'use strict';
+
+
+// Constants
+var c = require('./const');
+
+
+/**
+ * new Action(options)
+ *
+ * Base class for all actions. Used only for inherits
+ *
+ *
+ * ##### Options:
+ *
+ * - `optionStrings` A list of command-line option strings for the action.
+ * - `dest` Attribute to hold the created object(s)
+ * - `nargs` The number of command-line arguments that should be consumed.
+ * By default, one argument will be consumed and a single value will be
+ * produced.
+ * - `constant` Default value for an action with no value.
+ * - `defaultValue` The value to be produced if the option is not specified.
+ * - `type` Cast to 'string'|'int'|'float'|'complex'|function (string). If
+ * None, 'string'.
+ * - `choices` The choices available.
+ * - `required` True if the action must always be specified at the command
+ * line.
+ * - `help` The help describing the argument.
+ * - `metavar` The name to be used for the option's argument with the help
+ * string. If None, the 'dest' value will be used as the name.
+ *
+ * ##### nargs supported values:
+ *
+ * - `N` (an integer) consumes N arguments (and produces a list)
+ * - `?` consumes zero or one arguments
+ * - `*` consumes zero or more arguments (and produces a list)
+ * - `+` consumes one or more arguments (and produces a list)
+ *
+ * Note: that the difference between the default and nargs=1 is that with the
+ * default, a single value will be produced, while with nargs=1, a list
+ * containing a single value will be produced.
+ **/
+var Action = module.exports = function Action(options) {
+ options = options || {};
+ this.optionStrings = options.optionStrings || [];
+ this.dest = options.dest;
+ this.nargs = typeof options.nargs !== 'undefined' ? options.nargs : null;
+ this.constant = typeof options.constant !== 'undefined' ? options.constant : null;
+ this.defaultValue = options.defaultValue;
+ this.type = typeof options.type !== 'undefined' ? options.type : null;
+ this.choices = typeof options.choices !== 'undefined' ? options.choices : null;
+ this.required = typeof options.required !== 'undefined' ? options.required : false;
+ this.help = typeof options.help !== 'undefined' ? options.help : null;
+ this.metavar = typeof options.metavar !== 'undefined' ? options.metavar : null;
+
+ if (!(this.optionStrings instanceof Array)) {
+ throw new Error('optionStrings should be an array');
+ }
+ if (typeof this.required !== 'undefined' && typeof this.required !== 'boolean') {
+ throw new Error('required should be a boolean');
+ }
+};
+
+/**
+ * Action#getName -> String
+ *
+ * Tells action name
+ **/
+Action.prototype.getName = function () {
+ if (this.optionStrings.length > 0) {
+ return this.optionStrings.join('/');
+ } else if (this.metavar !== null && this.metavar !== c.SUPPRESS) {
+ return this.metavar;
+ } else if (typeof this.dest !== 'undefined' && this.dest !== c.SUPPRESS) {
+ return this.dest;
+ }
+ return null;
+};
+
+/**
+ * Action#isOptional -> Boolean
+ *
+ * Return true if optional
+ **/
+Action.prototype.isOptional = function () {
+ return !this.isPositional();
+};
+
+/**
+ * Action#isPositional -> Boolean
+ *
+ * Return true if positional
+ **/
+Action.prototype.isPositional = function () {
+ return (this.optionStrings.length === 0);
+};
+
+/**
+ * Action#call(parser, namespace, values, optionString) -> Void
+ * - parser (ArgumentParser): current parser
+ * - namespace (Namespace): namespace for output data
+ * - values (Array): parsed values
+ * - optionString (Array): input option string(not parsed)
+ *
+ * Call the action. Should be implemented in inherited classes
+ *
+ * ##### Example
+ *
+ * ActionCount.prototype.call = function (parser, namespace, values, optionString) {
+ * namespace.set(this.dest, (namespace[this.dest] || 0) + 1);
+ * };
+ *
+ **/
+Action.prototype.call = function () {
+ throw new Error('.call() not defined');// Not Implemented error
+};
diff --git a/tools/doc/node_modules/argparse/lib/action/append.js b/tools/doc/node_modules/argparse/lib/action/append.js
new file mode 100644
index 0000000000..b5da0de232
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/action/append.js
@@ -0,0 +1,53 @@
+/*:nodoc:*
+ * class ActionAppend
+ *
+ * This action stores a list, and appends each argument value to the list.
+ * This is useful to allow an option to be specified multiple times.
+ * This class inherided from [[Action]]
+ *
+ **/
+
+'use strict';
+
+var util = require('util');
+
+var Action = require('../action');
+
+// Constants
+var c = require('../const');
+
+/*:nodoc:*
+ * new ActionAppend(options)
+ * - options (object): options hash see [[Action.new]]
+ *
+ * Note: options.nargs should be optional for constants
+ * and more then zero for other
+ **/
+var ActionAppend = module.exports = function ActionAppend(options) {
+ options = options || {};
+ if (this.nargs <= 0) {
+ throw new Error('nargs for append actions must be > 0; if arg ' +
+ 'strings are not supplying the value to append, ' +
+ 'the append const action may be more appropriate');
+ }
+ if (!!this.constant && this.nargs !== c.OPTIONAL) {
+ throw new Error('nargs must be OPTIONAL to supply const');
+ }
+ Action.call(this, options);
+};
+util.inherits(ActionAppend, Action);
+
+/*:nodoc:*
+ * ActionAppend#call(parser, namespace, values, optionString) -> Void
+ * - parser (ArgumentParser): current parser
+ * - namespace (Namespace): namespace for output data
+ * - values (Array): parsed values
+ * - optionString (Array): input option string(not parsed)
+ *
+ * Call the action. Save result in namespace object
+ **/
+ActionAppend.prototype.call = function (parser, namespace, values) {
+ var items = (namespace[this.dest] || []).slice();
+ items.push(values);
+ namespace.set(this.dest, items);
+};
diff --git a/tools/doc/node_modules/argparse/lib/action/append/constant.js b/tools/doc/node_modules/argparse/lib/action/append/constant.js
new file mode 100644
index 0000000000..313f5d2efc
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/action/append/constant.js
@@ -0,0 +1,47 @@
+/*:nodoc:*
+ * class ActionAppendConstant
+ *
+ * This stores a list, and appends the value specified by
+ * the const keyword argument to the list.
+ * (Note that the const keyword argument defaults to null.)
+ * The 'appendConst' action is typically useful when multiple
+ * arguments need to store constants to the same list.
+ *
+ * This class inherited from [[Action]]
+ **/
+
+'use strict';
+
+var util = require('util');
+
+var Action = require('../../action');
+
+/*:nodoc:*
+ * new ActionAppendConstant(options)
+ * - options (object): options hash see [[Action.new]]
+ *
+ **/
+var ActionAppendConstant = module.exports = function ActionAppendConstant(options) {
+ options = options || {};
+ options.nargs = 0;
+ if (typeof options.constant === 'undefined') {
+ throw new Error('constant option is required for appendAction');
+ }
+ Action.call(this, options);
+};
+util.inherits(ActionAppendConstant, Action);
+
+/*:nodoc:*
+ * ActionAppendConstant#call(parser, namespace, values, optionString) -> Void
+ * - parser (ArgumentParser): current parser
+ * - namespace (Namespace): namespace for output data
+ * - values (Array): parsed values
+ * - optionString (Array): input option string(not parsed)
+ *
+ * Call the action. Save result in namespace object
+ **/
+ActionAppendConstant.prototype.call = function (parser, namespace) {
+ var items = [].concat(namespace[this.dest] || []);
+ items.push(this.constant);
+ namespace.set(this.dest, items);
+};
diff --git a/tools/doc/node_modules/argparse/lib/action/count.js b/tools/doc/node_modules/argparse/lib/action/count.js
new file mode 100644
index 0000000000..d6a5899d07
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/action/count.js
@@ -0,0 +1,40 @@
+/*:nodoc:*
+ * class ActionCount
+ *
+ * This counts the number of times a keyword argument occurs.
+ * For example, this is useful for increasing verbosity levels
+ *
+ * This class inherided from [[Action]]
+ *
+ **/
+'use strict';
+
+var util = require('util');
+
+var Action = require('../action');
+
+/*:nodoc:*
+ * new ActionCount(options)
+ * - options (object): options hash see [[Action.new]]
+ *
+ **/
+var ActionCount = module.exports = function ActionCount(options) {
+ options = options || {};
+ options.nargs = 0;
+
+ Action.call(this, options);
+};
+util.inherits(ActionCount, Action);
+
+/*:nodoc:*
+ * ActionCount#call(parser, namespace, values, optionString) -> Void
+ * - parser (ArgumentParser): current parser
+ * - namespace (Namespace): namespace for output data
+ * - values (Array): parsed values
+ * - optionString (Array): input option string(not parsed)
+ *
+ * Call the action. Save result in namespace object
+ **/
+ActionCount.prototype.call = function (parser, namespace) {
+ namespace.set(this.dest, (namespace[this.dest] || 0) + 1);
+};
diff --git a/tools/doc/node_modules/argparse/lib/action/help.js b/tools/doc/node_modules/argparse/lib/action/help.js
new file mode 100644
index 0000000000..b40e05a6f0
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/action/help.js
@@ -0,0 +1,47 @@
+/*:nodoc:*
+ * class ActionHelp
+ *
+ * Support action for printing help
+ * This class inherided from [[Action]]
+ **/
+'use strict';
+
+var util = require('util');
+
+var Action = require('../action');
+
+// Constants
+var c = require('../const');
+
+/*:nodoc:*
+ * new ActionHelp(options)
+ * - options (object): options hash see [[Action.new]]
+ *
+ **/
+var ActionHelp = module.exports = function ActionHelp(options) {
+ options = options || {};
+ if (options.defaultValue !== null) {
+ options.defaultValue = options.defaultValue;
+ } else {
+ options.defaultValue = c.SUPPRESS;
+ }
+ options.dest = (options.dest !== null ? options.dest : c.SUPPRESS);
+ options.nargs = 0;
+ Action.call(this, options);
+
+};
+util.inherits(ActionHelp, Action);
+
+/*:nodoc:*
+ * ActionHelp#call(parser, namespace, values, optionString)
+ * - parser (ArgumentParser): current parser
+ * - namespace (Namespace): namespace for output data
+ * - values (Array): parsed values
+ * - optionString (Array): input option string(not parsed)
+ *
+ * Print help and exit
+ **/
+ActionHelp.prototype.call = function (parser) {
+ parser.printHelp();
+ parser.exit();
+};
diff --git a/tools/doc/node_modules/argparse/lib/action/store.js b/tools/doc/node_modules/argparse/lib/action/store.js
new file mode 100644
index 0000000000..283b860921
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/action/store.js
@@ -0,0 +1,50 @@
+/*:nodoc:*
+ * class ActionStore
+ *
+ * This action just stores the argument’s value. This is the default action.
+ *
+ * This class inherited from [[Action]]
+ *
+ **/
+'use strict';
+
+var util = require('util');
+
+var Action = require('../action');
+
+// Constants
+var c = require('../const');
+
+
+/*:nodoc:*
+ * new ActionStore(options)
+ * - options (object): options hash see [[Action.new]]
+ *
+ **/
+var ActionStore = module.exports = function ActionStore(options) {
+ options = options || {};
+ if (this.nargs <= 0) {
+ throw new Error('nargs for store actions must be > 0; if you ' +
+ 'have nothing to store, actions such as store ' +
+ 'true or store const may be more appropriate');
+
+ }
+ if (typeof this.constant !== 'undefined' && this.nargs !== c.OPTIONAL) {
+ throw new Error('nargs must be OPTIONAL to supply const');
+ }
+ Action.call(this, options);
+};
+util.inherits(ActionStore, Action);
+
+/*:nodoc:*
+ * ActionStore#call(parser, namespace, values, optionString) -> Void
+ * - parser (ArgumentParser): current parser
+ * - namespace (Namespace): namespace for output data
+ * - values (Array): parsed values
+ * - optionString (Array): input option string(not parsed)
+ *
+ * Call the action. Save result in namespace object
+ **/
+ActionStore.prototype.call = function (parser, namespace, values) {
+ namespace.set(this.dest, values);
+};
diff --git a/tools/doc/node_modules/argparse/lib/action/store/constant.js b/tools/doc/node_modules/argparse/lib/action/store/constant.js
new file mode 100644
index 0000000000..23caa897b3
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/action/store/constant.js
@@ -0,0 +1,43 @@
+/*:nodoc:*
+ * class ActionStoreConstant
+ *
+ * This action stores the value specified by the const keyword argument.
+ * (Note that the const keyword argument defaults to the rather unhelpful null.)
+ * The 'store_const' action is most commonly used with optional
+ * arguments that specify some sort of flag.
+ *
+ * This class inherited from [[Action]]
+ **/
+'use strict';
+
+var util = require('util');
+
+var Action = require('../../action');
+
+/*:nodoc:*
+ * new ActionStoreConstant(options)
+ * - options (object): options hash see [[Action.new]]
+ *
+ **/
+var ActionStoreConstant = module.exports = function ActionStoreConstant(options) {
+ options = options || {};
+ options.nargs = 0;
+ if (typeof options.constant === 'undefined') {
+ throw new Error('constant option is required for storeAction');
+ }
+ Action.call(this, options);
+};
+util.inherits(ActionStoreConstant, Action);
+
+/*:nodoc:*
+ * ActionStoreConstant#call(parser, namespace, values, optionString) -> Void
+ * - parser (ArgumentParser): current parser
+ * - namespace (Namespace): namespace for output data
+ * - values (Array): parsed values
+ * - optionString (Array): input option string(not parsed)
+ *
+ * Call the action. Save result in namespace object
+ **/
+ActionStoreConstant.prototype.call = function (parser, namespace) {
+ namespace.set(this.dest, this.constant);
+};
diff --git a/tools/doc/node_modules/argparse/lib/action/store/false.js b/tools/doc/node_modules/argparse/lib/action/store/false.js
new file mode 100644
index 0000000000..9924f461da
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/action/store/false.js
@@ -0,0 +1,27 @@
+/*:nodoc:*
+ * class ActionStoreFalse
+ *
+ * This action store the values False respectively.
+ * This is special cases of 'storeConst'
+ *
+ * This class inherited from [[Action]]
+ **/
+
+'use strict';
+
+var util = require('util');
+
+var ActionStoreConstant = require('./constant');
+
+/*:nodoc:*
+ * new ActionStoreFalse(options)
+ * - options (object): hash of options see [[Action.new]]
+ *
+ **/
+var ActionStoreFalse = module.exports = function ActionStoreFalse(options) {
+ options = options || {};
+ options.constant = false;
+ options.defaultValue = options.defaultValue !== null ? options.defaultValue : true;
+ ActionStoreConstant.call(this, options);
+};
+util.inherits(ActionStoreFalse, ActionStoreConstant);
diff --git a/tools/doc/node_modules/argparse/lib/action/store/true.js b/tools/doc/node_modules/argparse/lib/action/store/true.js
new file mode 100644
index 0000000000..9e22f7d441
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/action/store/true.js
@@ -0,0 +1,26 @@
+/*:nodoc:*
+ * class ActionStoreTrue
+ *
+ * This action store the values True respectively.
+ * This isspecial cases of 'storeConst'
+ *
+ * This class inherited from [[Action]]
+ **/
+'use strict';
+
+var util = require('util');
+
+var ActionStoreConstant = require('./constant');
+
+/*:nodoc:*
+ * new ActionStoreTrue(options)
+ * - options (object): options hash see [[Action.new]]
+ *
+ **/
+var ActionStoreTrue = module.exports = function ActionStoreTrue(options) {
+ options = options || {};
+ options.constant = true;
+ options.defaultValue = options.defaultValue !== null ? options.defaultValue : false;
+ ActionStoreConstant.call(this, options);
+};
+util.inherits(ActionStoreTrue, ActionStoreConstant);
diff --git a/tools/doc/node_modules/argparse/lib/action/subparsers.js b/tools/doc/node_modules/argparse/lib/action/subparsers.js
new file mode 100644
index 0000000000..99dfedd0f1
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/action/subparsers.js
@@ -0,0 +1,149 @@
+/** internal
+ * class ActionSubparsers
+ *
+ * Support the creation of such sub-commands with the addSubparsers()
+ *
+ * This class inherited from [[Action]]
+ **/
+'use strict';
+
+var util = require('util');
+var format = require('util').format;
+
+
+var Action = require('../action');
+
+// Constants
+var c = require('../const');
+
+// Errors
+var argumentErrorHelper = require('../argument/error');
+
+
+/*:nodoc:*
+ * new ChoicesPseudoAction(name, help)
+ *
+ * Create pseudo action for correct help text
+ *
+ **/
+function ChoicesPseudoAction(name, help) {
+ var options = {
+ optionStrings: [],
+ dest: name,
+ help: help
+ };
+
+ Action.call(this, options);
+}
+
+util.inherits(ChoicesPseudoAction, Action);
+
+/**
+ * new ActionSubparsers(options)
+ * - options (object): options hash see [[Action.new]]
+ *
+ **/
+function ActionSubparsers(options) {
+ options = options || {};
+ options.dest = options.dest || c.SUPPRESS;
+ options.nargs = c.PARSER;
+
+ this.debug = (options.debug === true);
+
+ this._progPrefix = options.prog;
+ this._parserClass = options.parserClass;
+ this._nameParserMap = {};
+ this._choicesActions = [];
+
+ options.choices = this._nameParserMap;
+ Action.call(this, options);
+}
+
+util.inherits(ActionSubparsers, Action);
+
+/*:nodoc:*
+ * ActionSubparsers#addParser(name, options) -> ArgumentParser
+ * - name (string): sub-command name
+ * - options (object): see [[ArgumentParser.new]]
+ *
+ * Note:
+ * addParser supports an additional aliases option,
+ * which allows multiple strings to refer to the same subparser.
+ * This example, like svn, aliases co as a shorthand for checkout
+ *
+ **/
+ActionSubparsers.prototype.addParser = function (name, options) {
+ var parser;
+
+ var self = this;
+
+ options = options || {};
+
+ options.debug = (this.debug === true);
+
+ // set program from the existing prefix
+ if (!options.prog) {
+ options.prog = this._progPrefix + ' ' + name;
+ }
+
+ var aliases = options.aliases || [];
+
+ // create a pseudo-action to hold the choice help
+ if (!!options.help || typeof options.help === 'string') {
+ var help = options.help;
+ delete options.help;
+
+ var choiceAction = new ChoicesPseudoAction(name, help);
+ this._choicesActions.push(choiceAction);
+ }
+
+ // create the parser and add it to the map
+ parser = new this._parserClass(options);
+ this._nameParserMap[name] = parser;
+
+ // make parser available under aliases also
+ aliases.forEach(function (alias) {
+ self._nameParserMap[alias] = parser;
+ });
+
+ return parser;
+};
+
+ActionSubparsers.prototype._getSubactions = function () {
+ return this._choicesActions;
+};
+
+/*:nodoc:*
+ * ActionSubparsers#call(parser, namespace, values, optionString) -> Void
+ * - parser (ArgumentParser): current parser
+ * - namespace (Namespace): namespace for output data
+ * - values (Array): parsed values
+ * - optionString (Array): input option string(not parsed)
+ *
+ * Call the action. Parse input aguments
+ **/
+ActionSubparsers.prototype.call = function (parser, namespace, values) {
+ var parserName = values[0];
+ var argStrings = values.slice(1);
+
+ // set the parser name if requested
+ if (this.dest !== c.SUPPRESS) {
+ namespace[this.dest] = parserName;
+ }
+
+ // select the parser
+ if (this._nameParserMap[parserName]) {
+ parser = this._nameParserMap[parserName];
+ } else {
+ throw argumentErrorHelper(format(
+ 'Unknown parser "%s" (choices: [%s]).',
+ parserName,
+ Object.keys(this._nameParserMap).join(', ')
+ ));
+ }
+
+ // parse all the remaining options into the namespace
+ parser.parseArgs(argStrings, namespace);
+};
+
+module.exports = ActionSubparsers;
diff --git a/tools/doc/node_modules/argparse/lib/action/version.js b/tools/doc/node_modules/argparse/lib/action/version.js
new file mode 100644
index 0000000000..8053328cde
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/action/version.js
@@ -0,0 +1,47 @@
+/*:nodoc:*
+ * class ActionVersion
+ *
+ * Support action for printing program version
+ * This class inherited from [[Action]]
+ **/
+'use strict';
+
+var util = require('util');
+
+var Action = require('../action');
+
+//
+// Constants
+//
+var c = require('../const');
+
+/*:nodoc:*
+ * new ActionVersion(options)
+ * - options (object): options hash see [[Action.new]]
+ *
+ **/
+var ActionVersion = module.exports = function ActionVersion(options) {
+ options = options || {};
+ options.defaultValue = (options.defaultValue ? options.defaultValue : c.SUPPRESS);
+ options.dest = (options.dest || c.SUPPRESS);
+ options.nargs = 0;
+ this.version = options.version;
+ Action.call(this, options);
+};
+util.inherits(ActionVersion, Action);
+
+/*:nodoc:*
+ * ActionVersion#call(parser, namespace, values, optionString) -> Void
+ * - parser (ArgumentParser): current parser
+ * - namespace (Namespace): namespace for output data
+ * - values (Array): parsed values
+ * - optionString (Array): input option string(not parsed)
+ *
+ * Print version and exit
+ **/
+ActionVersion.prototype.call = function (parser) {
+ var version = this.version || parser.version;
+ var formatter = parser._getFormatter();
+ formatter.addText(version);
+ parser.exit(0, formatter.formatHelp());
+};
diff --git a/tools/doc/node_modules/argparse/lib/action_container.js b/tools/doc/node_modules/argparse/lib/action_container.js
new file mode 100644
index 0000000000..6f1237bea2
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/action_container.js
@@ -0,0 +1,482 @@
+/** internal
+ * class ActionContainer
+ *
+ * Action container. Parent for [[ArgumentParser]] and [[ArgumentGroup]]
+ **/
+
+'use strict';
+
+var format = require('util').format;
+
+// Constants
+var c = require('./const');
+
+var $$ = require('./utils');
+
+//Actions
+var ActionHelp = require('./action/help');
+var ActionAppend = require('./action/append');
+var ActionAppendConstant = require('./action/append/constant');
+var ActionCount = require('./action/count');
+var ActionStore = require('./action/store');
+var ActionStoreConstant = require('./action/store/constant');
+var ActionStoreTrue = require('./action/store/true');
+var ActionStoreFalse = require('./action/store/false');
+var ActionVersion = require('./action/version');
+var ActionSubparsers = require('./action/subparsers');
+
+// Errors
+var argumentErrorHelper = require('./argument/error');
+
+/**
+ * new ActionContainer(options)
+ *
+ * Action container. Parent for [[ArgumentParser]] and [[ArgumentGroup]]
+ *
+ * ##### Options:
+ *
+ * - `description` -- A description of what the program does
+ * - `prefixChars` -- Characters that prefix optional arguments
+ * - `argumentDefault` -- The default value for all arguments
+ * - `conflictHandler` -- The conflict handler to use for duplicate arguments
+ **/
+var ActionContainer = module.exports = function ActionContainer(options) {
+ options = options || {};
+
+ this.description = options.description;
+ this.argumentDefault = options.argumentDefault;
+ this.prefixChars = options.prefixChars || '';
+ this.conflictHandler = options.conflictHandler;
+
+ // set up registries
+ this._registries = {};
+
+ // register actions
+ this.register('action', null, ActionStore);
+ this.register('action', 'store', ActionStore);
+ this.register('action', 'storeConst', ActionStoreConstant);
+ this.register('action', 'storeTrue', ActionStoreTrue);
+ this.register('action', 'storeFalse', ActionStoreFalse);
+ this.register('action', 'append', ActionAppend);
+ this.register('action', 'appendConst', ActionAppendConstant);
+ this.register('action', 'count', ActionCount);
+ this.register('action', 'help', ActionHelp);
+ this.register('action', 'version', ActionVersion);
+ this.register('action', 'parsers', ActionSubparsers);
+
+ // raise an exception if the conflict handler is invalid
+ this._getHandler();
+
+ // action storage
+ this._actions = [];
+ this._optionStringActions = {};
+
+ // groups
+ this._actionGroups = [];
+ this._mutuallyExclusiveGroups = [];
+
+ // defaults storage
+ this._defaults = {};
+
+ // determines whether an "option" looks like a negative number
+ // -1, -1.5 -5e+4
+ this._regexpNegativeNumber = new RegExp('^[-]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?$');
+
+ // whether or not there are any optionals that look like negative
+ // numbers -- uses a list so it can be shared and edited
+ this._hasNegativeNumberOptionals = [];
+};
+
+// Groups must be required, then ActionContainer already defined
+var ArgumentGroup = require('./argument/group');
+var MutuallyExclusiveGroup = require('./argument/exclusive');
+
+//
+// Registration methods
+//
+
+/**
+ * ActionContainer#register(registryName, value, object) -> Void
+ * - registryName (String) : object type action|type
+ * - value (string) : keyword
+ * - object (Object|Function) : handler
+ *
+ * Register handlers
+ **/
+ActionContainer.prototype.register = function (registryName, value, object) {
+ this._registries[registryName] = this._registries[registryName] || {};
+ this._registries[registryName][value] = object;
+};
+
+ActionContainer.prototype._registryGet = function (registryName, value, defaultValue) {
+ if (arguments.length < 3) {
+ defaultValue = null;
+ }
+ return this._registries[registryName][value] || defaultValue;
+};
+
+//
+// Namespace default accessor methods
+//
+
+/**
+ * ActionContainer#setDefaults(options) -> Void
+ * - options (object):hash of options see [[Action.new]]
+ *
+ * Set defaults
+ **/
+ActionContainer.prototype.setDefaults = function (options) {
+ options = options || {};
+ for (var property in options) {
+ if ($$.has(options, property)) {
+ this._defaults[property] = options[property];
+ }
+ }
+
+ // if these defaults match any existing arguments, replace the previous
+ // default on the object with the new one
+ this._actions.forEach(function (action) {
+ if ($$.has(options, action.dest)) {
+ action.defaultValue = options[action.dest];
+ }
+ });
+};
+
+/**
+ * ActionContainer#getDefault(dest) -> Mixed
+ * - dest (string): action destination
+ *
+ * Return action default value
+ **/
+ActionContainer.prototype.getDefault = function (dest) {
+ var result = $$.has(this._defaults, dest) ? this._defaults[dest] : null;
+
+ this._actions.forEach(function (action) {
+ if (action.dest === dest && $$.has(action, 'defaultValue')) {
+ result = action.defaultValue;
+ }
+ });
+
+ return result;
+};
+//
+// Adding argument actions
+//
+
+/**
+ * ActionContainer#addArgument(args, options) -> Object
+ * - args (String|Array): argument key, or array of argument keys
+ * - options (Object): action objects see [[Action.new]]
+ *
+ * #### Examples
+ * - addArgument([ '-f', '--foo' ], { action: 'store', defaultValue: 1, ... })
+ * - addArgument([ 'bar' ], { action: 'store', nargs: 1, ... })
+ * - addArgument('--baz', { action: 'store', nargs: 1, ... })
+ **/
+ActionContainer.prototype.addArgument = function (args, options) {
+ args = args;
+ options = options || {};
+
+ if (typeof args === 'string') {
+ args = [ args ];
+ }
+ if (!Array.isArray(args)) {
+ throw new TypeError('addArgument first argument should be a string or an array');
+ }
+ if (typeof options !== 'object' || Array.isArray(options)) {
+ throw new TypeError('addArgument second argument should be a hash');
+ }
+
+ // if no positional args are supplied or only one is supplied and
+ // it doesn't look like an option string, parse a positional argument
+ if (!args || args.length === 1 && this.prefixChars.indexOf(args[0][0]) < 0) {
+ if (args && !!options.dest) {
+ throw new Error('dest supplied twice for positional argument');
+ }
+ options = this._getPositional(args, options);
+
+ // otherwise, we're adding an optional argument
+ } else {
+ options = this._getOptional(args, options);
+ }
+
+ // if no default was supplied, use the parser-level default
+ if (typeof options.defaultValue === 'undefined') {
+ var dest = options.dest;
+ if ($$.has(this._defaults, dest)) {
+ options.defaultValue = this._defaults[dest];
+ } else if (typeof this.argumentDefault !== 'undefined') {
+ options.defaultValue = this.argumentDefault;
+ }
+ }
+
+ // create the action object, and add it to the parser
+ var ActionClass = this._popActionClass(options);
+ if (typeof ActionClass !== 'function') {
+ throw new Error(format('Unknown action "%s".', ActionClass));
+ }
+ var action = new ActionClass(options);
+
+ // throw an error if the action type is not callable
+ var typeFunction = this._registryGet('type', action.type, action.type);
+ if (typeof typeFunction !== 'function') {
+ throw new Error(format('"%s" is not callable', typeFunction));
+ }
+
+ return this._addAction(action);
+};
+
+/**
+ * ActionContainer#addArgumentGroup(options) -> ArgumentGroup
+ * - options (Object): hash of options see [[ArgumentGroup.new]]
+ *
+ * Create new arguments groups
+ **/
+ActionContainer.prototype.addArgumentGroup = function (options) {
+ var group = new ArgumentGroup(this, options);
+ this._actionGroups.push(group);
+ return group;
+};
+
+/**
+ * ActionContainer#addMutuallyExclusiveGroup(options) -> ArgumentGroup
+ * - options (Object): {required: false}
+ *
+ * Create new mutual exclusive groups
+ **/
+ActionContainer.prototype.addMutuallyExclusiveGroup = function (options) {
+ var group = new MutuallyExclusiveGroup(this, options);
+ this._mutuallyExclusiveGroups.push(group);
+ return group;
+};
+
+ActionContainer.prototype._addAction = function (action) {
+ var self = this;
+
+ // resolve any conflicts
+ this._checkConflict(action);
+
+ // add to actions list
+ this._actions.push(action);
+ action.container = this;
+
+ // index the action by any option strings it has
+ action.optionStrings.forEach(function (optionString) {
+ self._optionStringActions[optionString] = action;
+ });
+
+ // set the flag if any option strings look like negative numbers
+ action.optionStrings.forEach(function (optionString) {
+ if (optionString.match(self._regexpNegativeNumber)) {
+ if (!self._hasNegativeNumberOptionals.some(Boolean)) {
+ self._hasNegativeNumberOptionals.push(true);
+ }
+ }
+ });
+
+ // return the created action
+ return action;
+};
+
+ActionContainer.prototype._removeAction = function (action) {
+ var actionIndex = this._actions.indexOf(action);
+ if (actionIndex >= 0) {
+ this._actions.splice(actionIndex, 1);
+ }
+};
+
+ActionContainer.prototype._addContainerActions = function (container) {
+ // collect groups by titles
+ var titleGroupMap = {};
+ this._actionGroups.forEach(function (group) {
+ if (titleGroupMap[group.title]) {
+ throw new Error(format('Cannot merge actions - two groups are named "%s".', group.title));
+ }
+ titleGroupMap[group.title] = group;
+ });
+
+ // map each action to its group
+ var groupMap = {};
+ function actionHash(action) {
+ // unique (hopefully?) string suitable as dictionary key
+ return action.getName();
+ }
+ container._actionGroups.forEach(function (group) {
+ // if a group with the title exists, use that, otherwise
+ // create a new group matching the container's group
+ if (!titleGroupMap[group.title]) {
+ titleGroupMap[group.title] = this.addArgumentGroup({
+ title: group.title,
+ description: group.description
+ });
+ }
+
+ // map the actions to their new group
+ group._groupActions.forEach(function (action) {
+ groupMap[actionHash(action)] = titleGroupMap[group.title];
+ });
+ }, this);
+
+ // add container's mutually exclusive groups
+ // NOTE: if add_mutually_exclusive_group ever gains title= and
+ // description= then this code will need to be expanded as above
+ var mutexGroup;
+ container._mutuallyExclusiveGroups.forEach(function (group) {
+ mutexGroup = this.addMutuallyExclusiveGroup({
+ required: group.required
+ });
+ // map the actions to their new mutex group
+ group._groupActions.forEach(function (action) {
+ groupMap[actionHash(action)] = mutexGroup;
+ });
+ }, this); // forEach takes a 'this' argument
+
+ // add all actions to this container or their group
+ container._actions.forEach(function (action) {
+ var key = actionHash(action);
+ if (groupMap[key]) {
+ groupMap[key]._addAction(action);
+ } else {
+ this._addAction(action);
+ }
+ });
+};
+
+ActionContainer.prototype._getPositional = function (dest, options) {
+ if (Array.isArray(dest)) {
+ dest = dest[0];
+ }
+ // make sure required is not specified
+ if (options.required) {
+ throw new Error('"required" is an invalid argument for positionals.');
+ }
+
+ // mark positional arguments as required if at least one is
+ // always required
+ if (options.nargs !== c.OPTIONAL && options.nargs !== c.ZERO_OR_MORE) {
+ options.required = true;
+ }
+ if (options.nargs === c.ZERO_OR_MORE && typeof options.defaultValue === 'undefined') {
+ options.required = true;
+ }
+
+ // return the keyword arguments with no option strings
+ options.dest = dest;
+ options.optionStrings = [];
+ return options;
+};
+
+ActionContainer.prototype._getOptional = function (args, options) {
+ var prefixChars = this.prefixChars;
+ var optionStrings = [];
+ var optionStringsLong = [];
+
+ // determine short and long option strings
+ args.forEach(function (optionString) {
+ // error on strings that don't start with an appropriate prefix
+ if (prefixChars.indexOf(optionString[0]) < 0) {
+ throw new Error(format('Invalid option string "%s": must start with a "%s".',
+ optionString,
+ prefixChars
+ ));
+ }
+
+ // strings starting with two prefix characters are long options
+ optionStrings.push(optionString);
+ if (optionString.length > 1 && prefixChars.indexOf(optionString[1]) >= 0) {
+ optionStringsLong.push(optionString);
+ }
+ });
+
+ // infer dest, '--foo-bar' -> 'foo_bar' and '-x' -> 'x'
+ var dest = options.dest || null;
+ delete options.dest;
+
+ if (!dest) {
+ var optionStringDest = optionStringsLong.length ? optionStringsLong[0] : optionStrings[0];
+ dest = $$.trimChars(optionStringDest, this.prefixChars);
+
+ if (dest.length === 0) {
+ throw new Error(
+ format('dest= is required for options like "%s"', optionStrings.join(', '))
+ );
+ }
+ dest = dest.replace(/-/g, '_');
+ }
+
+ // return the updated keyword arguments
+ options.dest = dest;
+ options.optionStrings = optionStrings;
+
+ return options;
+};
+
+ActionContainer.prototype._popActionClass = function (options, defaultValue) {
+ defaultValue = defaultValue || null;
+
+ var action = (options.action || defaultValue);
+ delete options.action;
+
+ var actionClass = this._registryGet('action', action, action);
+ return actionClass;
+};
+
+ActionContainer.prototype._getHandler = function () {
+ var handlerString = this.conflictHandler;
+ var handlerFuncName = '_handleConflict' + $$.capitalize(handlerString);
+ var func = this[handlerFuncName];
+ if (typeof func === 'undefined') {
+ var msg = 'invalid conflict resolution value: ' + handlerString;
+ throw new Error(msg);
+ } else {
+ return func;
+ }
+};
+
+ActionContainer.prototype._checkConflict = function (action) {
+ var optionStringActions = this._optionStringActions;
+ var conflictOptionals = [];
+
+ // find all options that conflict with this option
+ // collect pairs, the string, and an existing action that it conflicts with
+ action.optionStrings.forEach(function (optionString) {
+ var conflOptional = optionStringActions[optionString];
+ if (typeof conflOptional !== 'undefined') {
+ conflictOptionals.push([ optionString, conflOptional ]);
+ }
+ });
+
+ if (conflictOptionals.length > 0) {
+ var conflictHandler = this._getHandler();
+ conflictHandler.call(this, action, conflictOptionals);
+ }
+};
+
+ActionContainer.prototype._handleConflictError = function (action, conflOptionals) {
+ var conflicts = conflOptionals.map(function (pair) { return pair[0]; });
+ conflicts = conflicts.join(', ');
+ throw argumentErrorHelper(
+ action,
+ format('Conflicting option string(s): %s', conflicts)
+ );
+};
+
+ActionContainer.prototype._handleConflictResolve = function (action, conflOptionals) {
+ // remove all conflicting options
+ var self = this;
+ conflOptionals.forEach(function (pair) {
+ var optionString = pair[0];
+ var conflictingAction = pair[1];
+ // remove the conflicting option string
+ var i = conflictingAction.optionStrings.indexOf(optionString);
+ if (i >= 0) {
+ conflictingAction.optionStrings.splice(i, 1);
+ }
+ delete self._optionStringActions[optionString];
+ // if the option now has no option string, remove it from the
+ // container holding it
+ if (conflictingAction.optionStrings.length === 0) {
+ conflictingAction.container._removeAction(conflictingAction);
+ }
+ });
+};
diff --git a/tools/doc/node_modules/argparse/lib/argparse.js b/tools/doc/node_modules/argparse/lib/argparse.js
new file mode 100644
index 0000000000..f2a2c51d9a
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/argparse.js
@@ -0,0 +1,14 @@
+'use strict';
+
+module.exports.ArgumentParser = require('./argument_parser.js');
+module.exports.Namespace = require('./namespace');
+module.exports.Action = require('./action');
+module.exports.HelpFormatter = require('./help/formatter.js');
+module.exports.Const = require('./const.js');
+
+module.exports.ArgumentDefaultsHelpFormatter =
+ require('./help/added_formatters.js').ArgumentDefaultsHelpFormatter;
+module.exports.RawDescriptionHelpFormatter =
+ require('./help/added_formatters.js').RawDescriptionHelpFormatter;
+module.exports.RawTextHelpFormatter =
+ require('./help/added_formatters.js').RawTextHelpFormatter;
diff --git a/tools/doc/node_modules/argparse/lib/argument/error.js b/tools/doc/node_modules/argparse/lib/argument/error.js
new file mode 100644
index 0000000000..c8a02a08b8
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/argument/error.js
@@ -0,0 +1,50 @@
+'use strict';
+
+
+var format = require('util').format;
+
+
+var ERR_CODE = 'ARGError';
+
+/*:nodoc:*
+ * argumentError(argument, message) -> TypeError
+ * - argument (Object): action with broken argument
+ * - message (String): error message
+ *
+ * Error format helper. An error from creating or using an argument
+ * (optional or positional). The string value of this exception
+ * is the message, augmented with information
+ * about the argument that caused it.
+ *
+ * #####Example
+ *
+ * var argumentErrorHelper = require('./argument/error');
+ * if (conflictOptionals.length > 0) {
+ * throw argumentErrorHelper(
+ * action,
+ * format('Conflicting option string(s): %s', conflictOptionals.join(', '))
+ * );
+ * }
+ *
+ **/
+module.exports = function (argument, message) {
+ var argumentName = null;
+ var errMessage;
+ var err;
+
+ if (argument.getName) {
+ argumentName = argument.getName();
+ } else {
+ argumentName = '' + argument;
+ }
+
+ if (!argumentName) {
+ errMessage = message;
+ } else {
+ errMessage = format('argument "%s": %s', argumentName, message);
+ }
+
+ err = new TypeError(errMessage);
+ err.code = ERR_CODE;
+ return err;
+};
diff --git a/tools/doc/node_modules/argparse/lib/argument/exclusive.js b/tools/doc/node_modules/argparse/lib/argument/exclusive.js
new file mode 100644
index 0000000000..deaca28b83
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/argument/exclusive.js
@@ -0,0 +1,53 @@
+/** internal
+ * class MutuallyExclusiveGroup
+ *
+ * Group arguments.
+ * By default, ArgumentParser groups command-line arguments
+ * into “positional arguments” and “optional arguments”
+ * when displaying help messages. When there is a better
+ * conceptual grouping of arguments than this default one,
+ * appropriate groups can be created using the addArgumentGroup() method
+ *
+ * This class inherited from [[ArgumentContainer]]
+ **/
+'use strict';
+
+var util = require('util');
+
+var ArgumentGroup = require('./group');
+
+/**
+ * new MutuallyExclusiveGroup(container, options)
+ * - container (object): main container
+ * - options (object): options.required -> true/false
+ *
+ * `required` could be an argument itself, but making it a property of
+ * the options argument is more consistent with the JS adaptation of the Python)
+ **/
+var MutuallyExclusiveGroup = module.exports = function MutuallyExclusiveGroup(container, options) {
+ var required;
+ options = options || {};
+ required = options.required || false;
+ ArgumentGroup.call(this, container);
+ this.required = required;
+
+};
+util.inherits(MutuallyExclusiveGroup, ArgumentGroup);
+
+
+MutuallyExclusiveGroup.prototype._addAction = function (action) {
+ var msg;
+ if (action.required) {
+ msg = 'mutually exclusive arguments must be optional';
+ throw new Error(msg);
+ }
+ action = this._container._addAction(action);
+ this._groupActions.push(action);
+ return action;
+};
+
+
+MutuallyExclusiveGroup.prototype._removeAction = function (action) {
+ this._container._removeAction(action);
+ this._groupActions.remove(action);
+};
diff --git a/tools/doc/node_modules/argparse/lib/argument/group.js b/tools/doc/node_modules/argparse/lib/argument/group.js
new file mode 100644
index 0000000000..ad7693869b
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/argument/group.js
@@ -0,0 +1,74 @@
+/** internal
+ * class ArgumentGroup
+ *
+ * Group arguments.
+ * By default, ArgumentParser groups command-line arguments
+ * into “positional arguments” and “optional arguments”
+ * when displaying help messages. When there is a better
+ * conceptual grouping of arguments than this default one,
+ * appropriate groups can be created using the addArgumentGroup() method
+ *
+ * This class inherited from [[ArgumentContainer]]
+ **/
+'use strict';
+
+var util = require('util');
+
+var ActionContainer = require('../action_container');
+
+
+/**
+ * new ArgumentGroup(container, options)
+ * - container (object): main container
+ * - options (object): hash of group options
+ *
+ * #### options
+ * - **prefixChars** group name prefix
+ * - **argumentDefault** default argument value
+ * - **title** group title
+ * - **description** group description
+ *
+ **/
+var ArgumentGroup = module.exports = function ArgumentGroup(container, options) {
+
+ options = options || {};
+
+ // add any missing keyword arguments by checking the container
+ options.conflictHandler = (options.conflictHandler || container.conflictHandler);
+ options.prefixChars = (options.prefixChars || container.prefixChars);
+ options.argumentDefault = (options.argumentDefault || container.argumentDefault);
+
+ ActionContainer.call(this, options);
+
+ // group attributes
+ this.title = options.title;
+ this._groupActions = [];
+
+ // share most attributes with the container
+ this._container = container;
+ this._registries = container._registries;
+ this._actions = container._actions;
+ this._optionStringActions = container._optionStringActions;
+ this._defaults = container._defaults;
+ this._hasNegativeNumberOptionals = container._hasNegativeNumberOptionals;
+ this._mutuallyExclusiveGroups = container._mutuallyExclusiveGroups;
+};
+util.inherits(ArgumentGroup, ActionContainer);
+
+
+ArgumentGroup.prototype._addAction = function (action) {
+ // Parent add action
+ action = ActionContainer.prototype._addAction.call(this, action);
+ this._groupActions.push(action);
+ return action;
+};
+
+
+ArgumentGroup.prototype._removeAction = function (action) {
+ // Parent remove action
+ ActionContainer.prototype._removeAction.call(this, action);
+ var actionIndex = this._groupActions.indexOf(action);
+ if (actionIndex >= 0) {
+ this._groupActions.splice(actionIndex, 1);
+ }
+};
diff --git a/tools/doc/node_modules/argparse/lib/argument_parser.js b/tools/doc/node_modules/argparse/lib/argument_parser.js
new file mode 100644
index 0000000000..bd9a59a453
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/argument_parser.js
@@ -0,0 +1,1161 @@
+/**
+ * class ArgumentParser
+ *
+ * Object for parsing command line strings into js objects.
+ *
+ * Inherited from [[ActionContainer]]
+ **/
+'use strict';
+
+var util = require('util');
+var format = require('util').format;
+var Path = require('path');
+var sprintf = require('sprintf-js').sprintf;
+
+// Constants
+var c = require('./const');
+
+var $$ = require('./utils');
+
+var ActionContainer = require('./action_container');
+
+// Errors
+var argumentErrorHelper = require('./argument/error');
+
+var HelpFormatter = require('./help/formatter');
+
+var Namespace = require('./namespace');
+
+
+/**
+ * new ArgumentParser(options)
+ *
+ * Create a new ArgumentParser object.
+ *
+ * ##### Options:
+ * - `prog` The name of the program (default: Path.basename(process.argv[1]))
+ * - `usage` A usage message (default: auto-generated from arguments)
+ * - `description` A description of what the program does
+ * - `epilog` Text following the argument descriptions
+ * - `parents` Parsers whose arguments should be copied into this one
+ * - `formatterClass` HelpFormatter class for printing help messages
+ * - `prefixChars` Characters that prefix optional arguments
+ * - `fromfilePrefixChars` Characters that prefix files containing additional arguments
+ * - `argumentDefault` The default value for all arguments
+ * - `addHelp` Add a -h/-help option
+ * - `conflictHandler` Specifies how to handle conflicting argument names
+ * - `debug` Enable debug mode. Argument errors throw exception in
+ * debug mode and process.exit in normal. Used for development and
+ * testing (default: false)
+ *
+ * See also [original guide][1]
+ *
+ * [1]:http://docs.python.org/dev/library/argparse.html#argumentparser-objects
+ **/
+function ArgumentParser(options) {
+ if (!(this instanceof ArgumentParser)) {
+ return new ArgumentParser(options);
+ }
+ var self = this;
+ options = options || {};
+
+ options.description = (options.description || null);
+ options.argumentDefault = (options.argumentDefault || null);
+ options.prefixChars = (options.prefixChars || '-');
+ options.conflictHandler = (options.conflictHandler || 'error');
+ ActionContainer.call(this, options);
+
+ options.addHelp = typeof options.addHelp === 'undefined' || !!options.addHelp;
+ options.parents = options.parents || [];
+ // default program name
+ options.prog = (options.prog || Path.basename(process.argv[1]));
+ this.prog = options.prog;
+ this.usage = options.usage;
+ this.epilog = options.epilog;
+ this.version = options.version;
+
+ this.debug = (options.debug === true);
+
+ this.formatterClass = (options.formatterClass || HelpFormatter);
+ this.fromfilePrefixChars = options.fromfilePrefixChars || null;
+ this._positionals = this.addArgumentGroup({ title: 'Positional arguments' });
+ this._optionals = this.addArgumentGroup({ title: 'Optional arguments' });
+ this._subparsers = null;
+
+ // register types
+ function FUNCTION_IDENTITY(o) {
+ return o;
+ }
+ this.register('type', 'auto', FUNCTION_IDENTITY);
+ this.register('type', null, FUNCTION_IDENTITY);
+ this.register('type', 'int', function (x) {
+ var result = parseInt(x, 10);
+ if (isNaN(result)) {
+ throw new Error(x + ' is not a valid integer.');
+ }
+ return result;
+ });
+ this.register('type', 'float', function (x) {
+ var result = parseFloat(x);
+ if (isNaN(result)) {
+ throw new Error(x + ' is not a valid float.');
+ }
+ return result;
+ });
+ this.register('type', 'string', function (x) {
+ return '' + x;
+ });
+
+ // add help and version arguments if necessary
+ var defaultPrefix = (this.prefixChars.indexOf('-') > -1) ? '-' : this.prefixChars[0];
+ if (options.addHelp) {
+ this.addArgument(
+ [ defaultPrefix + 'h', defaultPrefix + defaultPrefix + 'help' ],
+ {
+ action: 'help',
+ defaultValue: c.SUPPRESS,
+ help: 'Show this help message and exit.'
+ }
+ );
+ }
+ if (typeof this.version !== 'undefined') {
+ this.addArgument(
+ [ defaultPrefix + 'v', defaultPrefix + defaultPrefix + 'version' ],
+ {
+ action: 'version',
+ version: this.version,
+ defaultValue: c.SUPPRESS,
+ help: "Show program's version number and exit."
+ }
+ );
+ }
+
+ // add parent arguments and defaults
+ options.parents.forEach(function (parent) {
+ self._addContainerActions(parent);
+ if (typeof parent._defaults !== 'undefined') {
+ for (var defaultKey in parent._defaults) {
+ if (parent._defaults.hasOwnProperty(defaultKey)) {
+ self._defaults[defaultKey] = parent._defaults[defaultKey];
+ }
+ }
+ }
+ });
+}
+
+util.inherits(ArgumentParser, ActionContainer);
+
+/**
+ * ArgumentParser#addSubparsers(options) -> [[ActionSubparsers]]
+ * - options (object): hash of options see [[ActionSubparsers.new]]
+ *
+ * See also [subcommands][1]
+ *
+ * [1]:http://docs.python.org/dev/library/argparse.html#sub-commands
+ **/
+ArgumentParser.prototype.addSubparsers = function (options) {
+ if (this._subparsers) {
+ this.error('Cannot have multiple subparser arguments.');
+ }
+
+ options = options || {};
+ options.debug = (this.debug === true);
+ options.optionStrings = [];
+ options.parserClass = (options.parserClass || ArgumentParser);
+
+
+ if (!!options.title || !!options.description) {
+
+ this._subparsers = this.addArgumentGroup({
+ title: (options.title || 'subcommands'),
+ description: options.description
+ });
+ delete options.title;
+ delete options.description;
+
+ } else {
+ this._subparsers = this._positionals;
+ }
+
+ // prog defaults to the usage message of this parser, skipping
+ // optional arguments and with no "usage:" prefix
+ if (!options.prog) {
+ var formatter = this._getFormatter();
+ var positionals = this._getPositionalActions();
+ var groups = this._mutuallyExclusiveGroups;
+ formatter.addUsage(this.usage, positionals, groups, '');
+ options.prog = formatter.formatHelp().trim();
+ }
+
+ // create the parsers action and add it to the positionals list
+ var ParsersClass = this._popActionClass(options, 'parsers');
+ var action = new ParsersClass(options);
+ this._subparsers._addAction(action);
+
+ // return the created parsers action
+ return action;
+};
+
+ArgumentParser.prototype._addAction = function (action) {
+ if (action.isOptional()) {
+ this._optionals._addAction(action);
+ } else {
+ this._positionals._addAction(action);
+ }
+ return action;
+};
+
+ArgumentParser.prototype._getOptionalActions = function () {
+ return this._actions.filter(function (action) {
+ return action.isOptional();
+ });
+};
+
+ArgumentParser.prototype._getPositionalActions = function () {
+ return this._actions.filter(function (action) {
+ return action.isPositional();
+ });
+};
+
+
+/**
+ * ArgumentParser#parseArgs(args, namespace) -> Namespace|Object
+ * - args (array): input elements
+ * - namespace (Namespace|Object): result object
+ *
+ * Parsed args and throws error if some arguments are not recognized
+ *
+ * See also [original guide][1]
+ *
+ * [1]:http://docs.python.org/dev/library/argparse.html#the-parse-args-method
+ **/
+ArgumentParser.prototype.parseArgs = function (args, namespace) {
+ var argv;
+ var result = this.parseKnownArgs(args, namespace);
+
+ args = result[0];
+ argv = result[1];
+ if (argv && argv.length > 0) {
+ this.error(
+ format('Unrecognized arguments: %s.', argv.join(' '))
+ );
+ }
+ return args;
+};
+
+/**
+ * ArgumentParser#parseKnownArgs(args, namespace) -> array
+ * - args (array): input options
+ * - namespace (Namespace|Object): result object
+ *
+ * Parse known arguments and return tuple of result object
+ * and unknown args
+ *
+ * See also [original guide][1]
+ *
+ * [1]:http://docs.python.org/dev/library/argparse.html#partial-parsing
+ **/
+ArgumentParser.prototype.parseKnownArgs = function (args, namespace) {
+ var self = this;
+
+ // args default to the system args
+ args = args || process.argv.slice(2);
+
+ // default Namespace built from parser defaults
+ namespace = namespace || new Namespace();
+
+ self._actions.forEach(function (action) {
+ if (action.dest !== c.SUPPRESS) {
+ if (!$$.has(namespace, action.dest)) {
+ if (action.defaultValue !== c.SUPPRESS) {
+ var defaultValue = action.defaultValue;
+ if (typeof action.defaultValue === 'string') {
+ defaultValue = self._getValue(action, defaultValue);
+ }
+ namespace[action.dest] = defaultValue;
+ }
+ }
+ }
+ });
+
+ Object.keys(self._defaults).forEach(function (dest) {
+ namespace[dest] = self._defaults[dest];
+ });
+
+ // parse the arguments and exit if there are any errors
+ try {
+ var res = this._parseKnownArgs(args, namespace);
+
+ namespace = res[0];
+ args = res[1];
+ if ($$.has(namespace, c._UNRECOGNIZED_ARGS_ATTR)) {
+ args = $$.arrayUnion(args, namespace[c._UNRECOGNIZED_ARGS_ATTR]);
+ delete namespace[c._UNRECOGNIZED_ARGS_ATTR];
+ }
+ return [ namespace, args ];
+ } catch (e) {
+ this.error(e);
+ }
+};
+
+ArgumentParser.prototype._parseKnownArgs = function (argStrings, namespace) {
+ var self = this;
+
+ var extras = [];
+
+ // replace arg strings that are file references
+ if (this.fromfilePrefixChars !== null) {
+ argStrings = this._readArgsFromFiles(argStrings);
+ }
+ // map all mutually exclusive arguments to the other arguments
+ // they can't occur with
+ // Python has 'conflicts = action_conflicts.setdefault(mutex_action, [])'
+ // though I can't conceive of a way in which an action could be a member
+ // of two different mutually exclusive groups.
+
+ function actionHash(action) {
+ // some sort of hashable key for this action
+ // action itself cannot be a key in actionConflicts
+ // I think getName() (join of optionStrings) is unique enough
+ return action.getName();
+ }
+
+ var conflicts, key;
+ var actionConflicts = {};
+
+ this._mutuallyExclusiveGroups.forEach(function (mutexGroup) {
+ mutexGroup._groupActions.forEach(function (mutexAction, i, groupActions) {
+ key = actionHash(mutexAction);
+ if (!$$.has(actionConflicts, key)) {
+ actionConflicts[key] = [];
+ }
+ conflicts = actionConflicts[key];
+ conflicts.push.apply(conflicts, groupActions.slice(0, i));
+ conflicts.push.apply(conflicts, groupActions.slice(i + 1));
+ });
+ });
+
+ // find all option indices, and determine the arg_string_pattern
+ // which has an 'O' if there is an option at an index,
+ // an 'A' if there is an argument, or a '-' if there is a '--'
+ var optionStringIndices = {};
+
+ var argStringPatternParts = [];
+
+ argStrings.forEach(function (argString, argStringIndex) {
+ if (argString === '--') {
+ argStringPatternParts.push('-');
+ while (argStringIndex < argStrings.length) {
+ argStringPatternParts.push('A');
+ argStringIndex++;
+ }
+ } else {
+ // otherwise, add the arg to the arg strings
+ // and note the index if it was an option
+ var pattern;
+ var optionTuple = self._parseOptional(argString);
+ if (!optionTuple) {
+ pattern = 'A';
+ } else {
+ optionStringIndices[argStringIndex] = optionTuple;
+ pattern = 'O';
+ }
+ argStringPatternParts.push(pattern);
+ }
+ });
+ var argStringsPattern = argStringPatternParts.join('');
+
+ var seenActions = [];
+ var seenNonDefaultActions = [];
+
+
+ function takeAction(action, argumentStrings, optionString) {
+ seenActions.push(action);
+ var argumentValues = self._getValues(action, argumentStrings);
+
+ // error if this argument is not allowed with other previously
+ // seen arguments, assuming that actions that use the default
+ // value don't really count as "present"
+ if (argumentValues !== action.defaultValue) {
+ seenNonDefaultActions.push(action);
+ if (actionConflicts[actionHash(action)]) {
+ actionConflicts[actionHash(action)].forEach(function (actionConflict) {
+ if (seenNonDefaultActions.indexOf(actionConflict) >= 0) {
+ throw argumentErrorHelper(
+ action,
+ format('Not allowed with argument "%s".', actionConflict.getName())
+ );
+ }
+ });
+ }
+ }
+
+ if (argumentValues !== c.SUPPRESS) {
+ action.call(self, namespace, argumentValues, optionString);
+ }
+ }
+
+ function consumeOptional(startIndex) {
+ // get the optional identified at this index
+ var optionTuple = optionStringIndices[startIndex];
+ var action = optionTuple[0];
+ var optionString = optionTuple[1];
+ var explicitArg = optionTuple[2];
+
+ // identify additional optionals in the same arg string
+ // (e.g. -xyz is the same as -x -y -z if no args are required)
+ var actionTuples = [];
+
+ var args, argCount, start, stop;
+
+ for (;;) {
+ if (!action) {
+ extras.push(argStrings[startIndex]);
+ return startIndex + 1;
+ }
+ if (explicitArg) {
+ argCount = self._matchArgument(action, 'A');
+
+ // if the action is a single-dash option and takes no
+ // arguments, try to parse more single-dash options out
+ // of the tail of the option string
+ var chars = self.prefixChars;
+ if (argCount === 0 && chars.indexOf(optionString[1]) < 0) {
+ actionTuples.push([ action, [], optionString ]);
+ optionString = optionString[0] + explicitArg[0];
+ var newExplicitArg = explicitArg.slice(1) || null;
+ var optionalsMap = self._optionStringActions;
+
+ if (Object.keys(optionalsMap).indexOf(optionString) >= 0) {
+ action = optionalsMap[optionString];
+ explicitArg = newExplicitArg;
+ } else {
+ throw argumentErrorHelper(action, sprintf('ignored explicit argument %r', explicitArg));
+ }
+ } else if (argCount === 1) {
+ // if the action expect exactly one argument, we've
+ // successfully matched the option; exit the loop
+ stop = startIndex + 1;
+ args = [ explicitArg ];
+ actionTuples.push([ action, args, optionString ]);
+ break;
+ } else {
+ // error if a double-dash option did not use the
+ // explicit argument
+ throw argumentErrorHelper(action, sprintf('ignored explicit argument %r', explicitArg));
+ }
+ } else {
+ // if there is no explicit argument, try to match the
+ // optional's string arguments with the following strings
+ // if successful, exit the loop
+
+ start = startIndex + 1;
+ var selectedPatterns = argStringsPattern.substr(start);
+
+ argCount = self._matchArgument(action, selectedPatterns);
+ stop = start + argCount;
+
+
+ args = argStrings.slice(start, stop);
+
+ actionTuples.push([ action, args, optionString ]);
+ break;
+ }
+
+ }
+
+ // add the Optional to the list and return the index at which
+ // the Optional's string args stopped
+ if (actionTuples.length < 1) {
+ throw new Error('length should be > 0');
+ }
+ for (var i = 0; i < actionTuples.length; i++) {
+ takeAction.apply(self, actionTuples[i]);
+ }
+ return stop;
+ }
+
+ // the list of Positionals left to be parsed; this is modified
+ // by consume_positionals()
+ var positionals = self._getPositionalActions();
+
+ function consumePositionals(startIndex) {
+ // match as many Positionals as possible
+ var selectedPattern = argStringsPattern.substr(startIndex);
+ var argCounts = self._matchArgumentsPartial(positionals, selectedPattern);
+
+ // slice off the appropriate arg strings for each Positional
+ // and add the Positional and its args to the list
+ for (var i = 0; i < positionals.length; i++) {
+ var action = positionals[i];
+ var argCount = argCounts[i];
+ if (typeof argCount === 'undefined') {
+ continue;
+ }
+ var args = argStrings.slice(startIndex, startIndex + argCount);
+
+ startIndex += argCount;
+ takeAction(action, args);
+ }
+
+ // slice off the Positionals that we just parsed and return the
+ // index at which the Positionals' string args stopped
+ positionals = positionals.slice(argCounts.length);
+ return startIndex;
+ }
+
+ // consume Positionals and Optionals alternately, until we have
+ // passed the last option string
+ var startIndex = 0;
+ var position;
+
+ var maxOptionStringIndex = -1;
+
+ Object.keys(optionStringIndices).forEach(function (position) {
+ maxOptionStringIndex = Math.max(maxOptionStringIndex, parseInt(position, 10));
+ });
+
+ var positionalsEndIndex, nextOptionStringIndex;
+
+ while (startIndex <= maxOptionStringIndex) {
+ // consume any Positionals preceding the next option
+ nextOptionStringIndex = null;
+ for (position in optionStringIndices) {
+ if (!optionStringIndices.hasOwnProperty(position)) { continue; }
+
+ position = parseInt(position, 10);
+ if (position >= startIndex) {
+ if (nextOptionStringIndex !== null) {
+ nextOptionStringIndex = Math.min(nextOptionStringIndex, position);
+ } else {
+ nextOptionStringIndex = position;
+ }
+ }
+ }
+
+ if (startIndex !== nextOptionStringIndex) {
+ positionalsEndIndex = consumePositionals(startIndex);
+ // only try to parse the next optional if we didn't consume
+ // the option string during the positionals parsing
+ if (positionalsEndIndex > startIndex) {
+ startIndex = positionalsEndIndex;
+ continue;
+ } else {
+ startIndex = positionalsEndIndex;
+ }
+ }
+
+ // if we consumed all the positionals we could and we're not
+ // at the index of an option string, there were extra arguments
+ if (!optionStringIndices[startIndex]) {
+ var strings = argStrings.slice(startIndex, nextOptionStringIndex);
+ extras = extras.concat(strings);
+ startIndex = nextOptionStringIndex;
+ }
+ // consume the next optional and any arguments for it
+ startIndex = consumeOptional(startIndex);
+ }
+
+ // consume any positionals following the last Optional
+ var stopIndex = consumePositionals(startIndex);
+
+ // if we didn't consume all the argument strings, there were extras
+ extras = extras.concat(argStrings.slice(stopIndex));
+
+ // if we didn't use all the Positional objects, there were too few
+ // arg strings supplied.
+ if (positionals.length > 0) {
+ self.error('too few arguments');
+ }
+
+ // make sure all required actions were present
+ self._actions.forEach(function (action) {
+ if (action.required) {
+ if (seenActions.indexOf(action) < 0) {
+ self.error(format('Argument "%s" is required', action.getName()));
+ }
+ }
+ });
+
+ // make sure all required groups have one option present
+ var actionUsed = false;
+ self._mutuallyExclusiveGroups.forEach(function (group) {
+ if (group.required) {
+ actionUsed = group._groupActions.some(function (action) {
+ return seenNonDefaultActions.indexOf(action) !== -1;
+ });
+
+ // if no actions were used, report the error
+ if (!actionUsed) {
+ var names = [];
+ group._groupActions.forEach(function (action) {
+ if (action.help !== c.SUPPRESS) {
+ names.push(action.getName());
+ }
+ });
+ names = names.join(' ');
+ var msg = 'one of the arguments ' + names + ' is required';
+ self.error(msg);
+ }
+ }
+ });
+
+ // return the updated namespace and the extra arguments
+ return [ namespace, extras ];
+};
+
+ArgumentParser.prototype._readArgsFromFiles = function (argStrings) {
+ // expand arguments referencing files
+ var self = this;
+ var fs = require('fs');
+ var newArgStrings = [];
+ argStrings.forEach(function (argString) {
+ if (self.fromfilePrefixChars.indexOf(argString[0]) < 0) {
+ // for regular arguments, just add them back into the list
+ newArgStrings.push(argString);
+ } else {
+ // replace arguments referencing files with the file content
+ try {
+ var argstrs = [];
+ var filename = argString.slice(1);
+ var content = fs.readFileSync(filename, 'utf8');
+ content = content.trim().split('\n');
+ content.forEach(function (argLine) {
+ self.convertArgLineToArgs(argLine).forEach(function (arg) {
+ argstrs.push(arg);
+ });
+ argstrs = self._readArgsFromFiles(argstrs);
+ });
+ newArgStrings.push.apply(newArgStrings, argstrs);
+ } catch (error) {
+ return self.error(error.message);
+ }
+ }
+ });
+ return newArgStrings;
+};
+
+ArgumentParser.prototype.convertArgLineToArgs = function (argLine) {
+ return [ argLine ];
+};
+
+ArgumentParser.prototype._matchArgument = function (action, regexpArgStrings) {
+
+ // match the pattern for this action to the arg strings
+ var regexpNargs = new RegExp('^' + this._getNargsPattern(action));
+ var matches = regexpArgStrings.match(regexpNargs);
+ var message;
+
+ // throw an exception if we weren't able to find a match
+ if (!matches) {
+ switch (action.nargs) {
+ /*eslint-disable no-undefined*/
+ case undefined:
+ case null:
+ message = 'Expected one argument.';
+ break;
+ case c.OPTIONAL:
+ message = 'Expected at most one argument.';
+ break;
+ case c.ONE_OR_MORE:
+ message = 'Expected at least one argument.';
+ break;
+ default:
+ message = 'Expected %s argument(s)';
+ }
+
+ throw argumentErrorHelper(
+ action,
+ format(message, action.nargs)
+ );
+ }
+ // return the number of arguments matched
+ return matches[1].length;
+};
+
+ArgumentParser.prototype._matchArgumentsPartial = function (actions, regexpArgStrings) {
+ // progressively shorten the actions list by slicing off the
+ // final actions until we find a match
+ var self = this;
+ var result = [];
+ var actionSlice, pattern, matches;
+ var i, j;
+
+ function getLength(string) {
+ return string.length;
+ }
+
+ for (i = actions.length; i > 0; i--) {
+ pattern = '';
+ actionSlice = actions.slice(0, i);
+ for (j = 0; j < actionSlice.length; j++) {
+ pattern += self._getNargsPattern(actionSlice[j]);
+ }
+
+ pattern = new RegExp('^' + pattern);
+ matches = regexpArgStrings.match(pattern);
+
+ if (matches && matches.length > 0) {
+ // need only groups
+ matches = matches.splice(1);
+ result = result.concat(matches.map(getLength));
+ break;
+ }
+ }
+
+ // return the list of arg string counts
+ return result;
+};
+
+ArgumentParser.prototype._parseOptional = function (argString) {
+ var action, optionString, argExplicit, optionTuples;
+
+ // if it's an empty string, it was meant to be a positional
+ if (!argString) {
+ return null;
+ }
+
+ // if it doesn't start with a prefix, it was meant to be positional
+ if (this.prefixChars.indexOf(argString[0]) < 0) {
+ return null;
+ }
+
+ // if the option string is present in the parser, return the action
+ if (this._optionStringActions[argString]) {
+ return [ this._optionStringActions[argString], argString, null ];
+ }
+
+ // if it's just a single character, it was meant to be positional
+ if (argString.length === 1) {
+ return null;
+ }
+
+ // if the option string before the "=" is present, return the action
+ if (argString.indexOf('=') >= 0) {
+ optionString = argString.split('=', 1)[0];
+ argExplicit = argString.slice(optionString.length + 1);
+
+ if (this._optionStringActions[optionString]) {
+ action = this._optionStringActions[optionString];
+ return [ action, optionString, argExplicit ];
+ }
+ }
+
+ // search through all possible prefixes of the option string
+ // and all actions in the parser for possible interpretations
+ optionTuples = this._getOptionTuples(argString);
+
+ // if multiple actions match, the option string was ambiguous
+ if (optionTuples.length > 1) {
+ var optionStrings = optionTuples.map(function (optionTuple) {
+ return optionTuple[1];
+ });
+ this.error(format(
+ 'Ambiguous option: "%s" could match %s.',
+ argString, optionStrings.join(', ')
+ ));
+ // if exactly one action matched, this segmentation is good,
+ // so return the parsed action
+ } else if (optionTuples.length === 1) {
+ return optionTuples[0];
+ }
+
+ // if it was not found as an option, but it looks like a negative
+ // number, it was meant to be positional
+ // unless there are negative-number-like options
+ if (argString.match(this._regexpNegativeNumber)) {
+ if (!this._hasNegativeNumberOptionals.some(Boolean)) {
+ return null;
+ }
+ }
+ // if it contains a space, it was meant to be a positional
+ if (argString.search(' ') >= 0) {
+ return null;
+ }
+
+ // it was meant to be an optional but there is no such option
+ // in this parser (though it might be a valid option in a subparser)
+ return [ null, argString, null ];
+};
+
+ArgumentParser.prototype._getOptionTuples = function (optionString) {
+ var result = [];
+ var chars = this.prefixChars;
+ var optionPrefix;
+ var argExplicit;
+ var action;
+ var actionOptionString;
+
+ // option strings starting with two prefix characters are only split at
+ // the '='
+ if (chars.indexOf(optionString[0]) >= 0 && chars.indexOf(optionString[1]) >= 0) {
+ if (optionString.indexOf('=') >= 0) {
+ var optionStringSplit = optionString.split('=', 1);
+
+ optionPrefix = optionStringSplit[0];
+ argExplicit = optionStringSplit[1];
+ } else {
+ optionPrefix = optionString;
+ argExplicit = null;
+ }
+
+ for (actionOptionString in this._optionStringActions) {
+ if (actionOptionString.substr(0, optionPrefix.length) === optionPrefix) {
+ action = this._optionStringActions[actionOptionString];
+ result.push([ action, actionOptionString, argExplicit ]);
+ }
+ }
+
+ // single character options can be concatenated with their arguments
+ // but multiple character options always have to have their argument
+ // separate
+ } else if (chars.indexOf(optionString[0]) >= 0 && chars.indexOf(optionString[1]) < 0) {
+ optionPrefix = optionString;
+ argExplicit = null;
+ var optionPrefixShort = optionString.substr(0, 2);
+ var argExplicitShort = optionString.substr(2);
+
+ for (actionOptionString in this._optionStringActions) {
+ if (!$$.has(this._optionStringActions, actionOptionString)) continue;
+
+ action = this._optionStringActions[actionOptionString];
+ if (actionOptionString === optionPrefixShort) {
+ result.push([ action, actionOptionString, argExplicitShort ]);
+ } else if (actionOptionString.substr(0, optionPrefix.length) === optionPrefix) {
+ result.push([ action, actionOptionString, argExplicit ]);
+ }
+ }
+
+ // shouldn't ever get here
+ } else {
+ throw new Error(format('Unexpected option string: %s.', optionString));
+ }
+ // return the collected option tuples
+ return result;
+};
+
+ArgumentParser.prototype._getNargsPattern = function (action) {
+ // in all examples below, we have to allow for '--' args
+ // which are represented as '-' in the pattern
+ var regexpNargs;
+
+ switch (action.nargs) {
+ // the default (null) is assumed to be a single argument
+ case undefined:
+ case null:
+ regexpNargs = '(-*A-*)';
+ break;
+ // allow zero or more arguments
+ case c.OPTIONAL:
+ regexpNargs = '(-*A?-*)';
+ break;
+ // allow zero or more arguments
+ case c.ZERO_OR_MORE:
+ regexpNargs = '(-*[A-]*)';
+ break;
+ // allow one or more arguments
+ case c.ONE_OR_MORE:
+ regexpNargs = '(-*A[A-]*)';
+ break;
+ // allow any number of options or arguments
+ case c.REMAINDER:
+ regexpNargs = '([-AO]*)';
+ break;
+ // allow one argument followed by any number of options or arguments
+ case c.PARSER:
+ regexpNargs = '(-*A[-AO]*)';
+ break;
+ // all others should be integers
+ default:
+ regexpNargs = '(-*' + $$.repeat('-*A', action.nargs) + '-*)';
+ }
+
+ // if this is an optional action, -- is not allowed
+ if (action.isOptional()) {
+ regexpNargs = regexpNargs.replace(/-\*/g, '');
+ regexpNargs = regexpNargs.replace(/-/g, '');
+ }
+
+ // return the pattern
+ return regexpNargs;
+};
+
+//
+// Value conversion methods
+//
+
+ArgumentParser.prototype._getValues = function (action, argStrings) {
+ var self = this;
+
+ // for everything but PARSER args, strip out '--'
+ if (action.nargs !== c.PARSER && action.nargs !== c.REMAINDER) {
+ argStrings = argStrings.filter(function (arrayElement) {
+ return arrayElement !== '--';
+ });
+ }
+
+ var value, argString;
+
+ // optional argument produces a default when not present
+ if (argStrings.length === 0 && action.nargs === c.OPTIONAL) {
+
+ value = (action.isOptional()) ? action.constant : action.defaultValue;
+
+ if (typeof (value) === 'string') {
+ value = this._getValue(action, value);
+ this._checkValue(action, value);
+ }
+
+ // when nargs='*' on a positional, if there were no command-line
+ // args, use the default if it is anything other than None
+ } else if (argStrings.length === 0 && action.nargs === c.ZERO_OR_MORE &&
+ action.optionStrings.length === 0) {
+
+ value = (action.defaultValue || argStrings);
+ this._checkValue(action, value);
+
+ // single argument or optional argument produces a single value
+ } else if (argStrings.length === 1 &&
+ (!action.nargs || action.nargs === c.OPTIONAL)) {
+
+ argString = argStrings[0];
+ value = this._getValue(action, argString);
+ this._checkValue(action, value);
+
+ // REMAINDER arguments convert all values, checking none
+ } else if (action.nargs === c.REMAINDER) {
+ value = argStrings.map(function (v) {
+ return self._getValue(action, v);
+ });
+
+ // PARSER arguments convert all values, but check only the first
+ } else if (action.nargs === c.PARSER) {
+ value = argStrings.map(function (v) {
+ return self._getValue(action, v);
+ });
+ this._checkValue(action, value[0]);
+
+ // all other types of nargs produce a list
+ } else {
+ value = argStrings.map(function (v) {
+ return self._getValue(action, v);
+ });
+ value.forEach(function (v) {
+ self._checkValue(action, v);
+ });
+ }
+
+ // return the converted value
+ return value;
+};
+
+ArgumentParser.prototype._getValue = function (action, argString) {
+ var result;
+
+ var typeFunction = this._registryGet('type', action.type, action.type);
+ if (typeof typeFunction !== 'function') {
+ var message = format('%s is not callable', typeFunction);
+ throw argumentErrorHelper(action, message);
+ }
+
+ // convert the value to the appropriate type
+ try {
+ result = typeFunction(argString);
+
+ // ArgumentTypeErrors indicate errors
+ // If action.type is not a registered string, it is a function
+ // Try to deduce its name for inclusion in the error message
+ // Failing that, include the error message it raised.
+ } catch (e) {
+ var name = null;
+ if (typeof action.type === 'string') {
+ name = action.type;
+ } else {
+ name = action.type.name || action.type.displayName || '<function>';
+ }
+ var msg = format('Invalid %s value: %s', name, argString);
+ if (name === '<function>') { msg += '\n' + e.message; }
+ throw argumentErrorHelper(action, msg);
+ }
+ // return the converted value
+ return result;
+};
+
+ArgumentParser.prototype._checkValue = function (action, value) {
+ // converted value must be one of the choices (if specified)
+ var choices = action.choices;
+ if (choices) {
+ // choise for argument can by array or string
+ if ((typeof choices === 'string' || Array.isArray(choices)) &&
+ choices.indexOf(value) !== -1) {
+ return;
+ }
+ // choise for subparsers can by only hash
+ if (typeof choices === 'object' && !Array.isArray(choices) && choices[value]) {
+ return;
+ }
+
+ if (typeof choices === 'string') {
+ choices = choices.split('').join(', ');
+ } else if (Array.isArray(choices)) {
+ choices = choices.join(', ');
+ } else {
+ choices = Object.keys(choices).join(', ');
+ }
+ var message = format('Invalid choice: %s (choose from [%s])', value, choices);
+ throw argumentErrorHelper(action, message);
+ }
+};
+
+//
+// Help formatting methods
+//
+
+/**
+ * ArgumentParser#formatUsage -> string
+ *
+ * Return usage string
+ *
+ * See also [original guide][1]
+ *
+ * [1]:http://docs.python.org/dev/library/argparse.html#printing-help
+ **/
+ArgumentParser.prototype.formatUsage = function () {
+ var formatter = this._getFormatter();
+ formatter.addUsage(this.usage, this._actions, this._mutuallyExclusiveGroups);
+ return formatter.formatHelp();
+};
+
+/**
+ * ArgumentParser#formatHelp -> string
+ *
+ * Return help
+ *
+ * See also [original guide][1]
+ *
+ * [1]:http://docs.python.org/dev/library/argparse.html#printing-help
+ **/
+ArgumentParser.prototype.formatHelp = function () {
+ var formatter = this._getFormatter();
+
+ // usage
+ formatter.addUsage(this.usage, this._actions, this._mutuallyExclusiveGroups);
+
+ // description
+ formatter.addText(this.description);
+
+ // positionals, optionals and user-defined groups
+ this._actionGroups.forEach(function (actionGroup) {
+ formatter.startSection(actionGroup.title);
+ formatter.addText(actionGroup.description);
+ formatter.addArguments(actionGroup._groupActions);
+ formatter.endSection();
+ });
+
+ // epilog
+ formatter.addText(this.epilog);
+
+ // determine help from format above
+ return formatter.formatHelp();
+};
+
+ArgumentParser.prototype._getFormatter = function () {
+ var FormatterClass = this.formatterClass;
+ var formatter = new FormatterClass({ prog: this.prog });
+ return formatter;
+};
+
+//
+// Print functions
+//
+
+/**
+ * ArgumentParser#printUsage() -> Void
+ *
+ * Print usage
+ *
+ * See also [original guide][1]
+ *
+ * [1]:http://docs.python.org/dev/library/argparse.html#printing-help
+ **/
+ArgumentParser.prototype.printUsage = function () {
+ this._printMessage(this.formatUsage());
+};
+
+/**
+ * ArgumentParser#printHelp() -> Void
+ *
+ * Print help
+ *
+ * See also [original guide][1]
+ *
+ * [1]:http://docs.python.org/dev/library/argparse.html#printing-help
+ **/
+ArgumentParser.prototype.printHelp = function () {
+ this._printMessage(this.formatHelp());
+};
+
+ArgumentParser.prototype._printMessage = function (message, stream) {
+ if (!stream) {
+ stream = process.stdout;
+ }
+ if (message) {
+ stream.write('' + message);
+ }
+};
+
+//
+// Exit functions
+//
+
+/**
+ * ArgumentParser#exit(status=0, message) -> Void
+ * - status (int): exit status
+ * - message (string): message
+ *
+ * Print message in stderr/stdout and exit program
+ **/
+ArgumentParser.prototype.exit = function (status, message) {
+ if (message) {
+ if (status === 0) {
+ this._printMessage(message);
+ } else {
+ this._printMessage(message, process.stderr);
+ }
+ }
+
+ process.exit(status);
+};
+
+/**
+ * ArgumentParser#error(message) -> Void
+ * - err (Error|string): message
+ *
+ * Error method Prints a usage message incorporating the message to stderr and
+ * exits. If you override this in a subclass,
+ * it should not return -- it should
+ * either exit or throw an exception.
+ *
+ **/
+ArgumentParser.prototype.error = function (err) {
+ var message;
+ if (err instanceof Error) {
+ if (this.debug === true) {
+ throw err;
+ }
+ message = err.message;
+ } else {
+ message = err;
+ }
+ var msg = format('%s: error: %s', this.prog, message) + c.EOL;
+
+ if (this.debug === true) {
+ throw new Error(msg);
+ }
+
+ this.printUsage(process.stderr);
+
+ return this.exit(2, msg);
+};
+
+module.exports = ArgumentParser;
diff --git a/tools/doc/node_modules/argparse/lib/const.js b/tools/doc/node_modules/argparse/lib/const.js
new file mode 100644
index 0000000000..b1fd4ced4e
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/const.js
@@ -0,0 +1,21 @@
+//
+// Constants
+//
+
+'use strict';
+
+module.exports.EOL = '\n';
+
+module.exports.SUPPRESS = '==SUPPRESS==';
+
+module.exports.OPTIONAL = '?';
+
+module.exports.ZERO_OR_MORE = '*';
+
+module.exports.ONE_OR_MORE = '+';
+
+module.exports.PARSER = 'A...';
+
+module.exports.REMAINDER = '...';
+
+module.exports._UNRECOGNIZED_ARGS_ATTR = '_unrecognized_args';
diff --git a/tools/doc/node_modules/argparse/lib/help/added_formatters.js b/tools/doc/node_modules/argparse/lib/help/added_formatters.js
new file mode 100644
index 0000000000..f8e42998e9
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/help/added_formatters.js
@@ -0,0 +1,87 @@
+'use strict';
+
+var util = require('util');
+
+// Constants
+var c = require('../const');
+
+var $$ = require('../utils');
+var HelpFormatter = require('./formatter.js');
+
+/**
+ * new RawDescriptionHelpFormatter(options)
+ * new ArgumentParser({formatterClass: argparse.RawDescriptionHelpFormatter, ...})
+ *
+ * Help message formatter which adds default values to argument help.
+ *
+ * Only the name of this class is considered a public API. All the methods
+ * provided by the class are considered an implementation detail.
+ **/
+
+function ArgumentDefaultsHelpFormatter(options) {
+ HelpFormatter.call(this, options);
+}
+
+util.inherits(ArgumentDefaultsHelpFormatter, HelpFormatter);
+
+ArgumentDefaultsHelpFormatter.prototype._getHelpString = function (action) {
+ var help = action.help;
+ if (action.help.indexOf('%(defaultValue)s') === -1) {
+ if (action.defaultValue !== c.SUPPRESS) {
+ var defaulting_nargs = [ c.OPTIONAL, c.ZERO_OR_MORE ];
+ if (action.isOptional() || (defaulting_nargs.indexOf(action.nargs) >= 0)) {
+ help += ' (default: %(defaultValue)s)';
+ }
+ }
+ }
+ return help;
+};
+
+module.exports.ArgumentDefaultsHelpFormatter = ArgumentDefaultsHelpFormatter;
+
+/**
+ * new RawDescriptionHelpFormatter(options)
+ * new ArgumentParser({formatterClass: argparse.RawDescriptionHelpFormatter, ...})
+ *
+ * Help message formatter which retains any formatting in descriptions.
+ *
+ * Only the name of this class is considered a public API. All the methods
+ * provided by the class are considered an implementation detail.
+ **/
+
+function RawDescriptionHelpFormatter(options) {
+ HelpFormatter.call(this, options);
+}
+
+util.inherits(RawDescriptionHelpFormatter, HelpFormatter);
+
+RawDescriptionHelpFormatter.prototype._fillText = function (text, width, indent) {
+ var lines = text.split('\n');
+ lines = lines.map(function (line) {
+ return $$.trimEnd(indent + line);
+ });
+ return lines.join('\n');
+};
+module.exports.RawDescriptionHelpFormatter = RawDescriptionHelpFormatter;
+
+/**
+ * new RawTextHelpFormatter(options)
+ * new ArgumentParser({formatterClass: argparse.RawTextHelpFormatter, ...})
+ *
+ * Help message formatter which retains formatting of all help text.
+ *
+ * Only the name of this class is considered a public API. All the methods
+ * provided by the class are considered an implementation detail.
+ **/
+
+function RawTextHelpFormatter(options) {
+ RawDescriptionHelpFormatter.call(this, options);
+}
+
+util.inherits(RawTextHelpFormatter, RawDescriptionHelpFormatter);
+
+RawTextHelpFormatter.prototype._splitLines = function (text) {
+ return text.split('\n');
+};
+
+module.exports.RawTextHelpFormatter = RawTextHelpFormatter;
diff --git a/tools/doc/node_modules/argparse/lib/help/formatter.js b/tools/doc/node_modules/argparse/lib/help/formatter.js
new file mode 100644
index 0000000000..29036c14b2
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/help/formatter.js
@@ -0,0 +1,795 @@
+/**
+ * class HelpFormatter
+ *
+ * Formatter for generating usage messages and argument help strings. Only the
+ * name of this class is considered a public API. All the methods provided by
+ * the class are considered an implementation detail.
+ *
+ * Do not call in your code, use this class only for inherits your own forvatter
+ *
+ * ToDo add [additonal formatters][1]
+ *
+ * [1]:http://docs.python.org/dev/library/argparse.html#formatter-class
+ **/
+'use strict';
+
+var sprintf = require('sprintf-js').sprintf;
+
+// Constants
+var c = require('../const');
+
+var $$ = require('../utils');
+
+
+/*:nodoc:* internal
+ * new Support(parent, heding)
+ * - parent (object): parent section
+ * - heading (string): header string
+ *
+ **/
+function Section(parent, heading) {
+ this._parent = parent;
+ this._heading = heading;
+ this._items = [];
+}
+
+/*:nodoc:* internal
+ * Section#addItem(callback) -> Void
+ * - callback (array): tuple with function and args
+ *
+ * Add function for single element
+ **/
+Section.prototype.addItem = function (callback) {
+ this._items.push(callback);
+};
+
+/*:nodoc:* internal
+ * Section#formatHelp(formatter) -> string
+ * - formatter (HelpFormatter): current formatter
+ *
+ * Form help section string
+ *
+ **/
+Section.prototype.formatHelp = function (formatter) {
+ var itemHelp, heading;
+
+ // format the indented section
+ if (this._parent) {
+ formatter._indent();
+ }
+
+ itemHelp = this._items.map(function (item) {
+ var obj, func, args;
+
+ obj = formatter;
+ func = item[0];
+ args = item[1];
+ return func.apply(obj, args);
+ });
+ itemHelp = formatter._joinParts(itemHelp);
+
+ if (this._parent) {
+ formatter._dedent();
+ }
+
+ // return nothing if the section was empty
+ if (!itemHelp) {
+ return '';
+ }
+
+ // add the heading if the section was non-empty
+ heading = '';
+ if (this._heading && this._heading !== c.SUPPRESS) {
+ var currentIndent = formatter.currentIndent;
+ heading = $$.repeat(' ', currentIndent) + this._heading + ':' + c.EOL;
+ }
+
+ // join the section-initialize newline, the heading and the help
+ return formatter._joinParts([ c.EOL, heading, itemHelp, c.EOL ]);
+};
+
+/**
+ * new HelpFormatter(options)
+ *
+ * #### Options:
+ * - `prog`: program name
+ * - `indentIncriment`: indent step, default value 2
+ * - `maxHelpPosition`: max help position, default value = 24
+ * - `width`: line width
+ *
+ **/
+var HelpFormatter = module.exports = function HelpFormatter(options) {
+ options = options || {};
+
+ this._prog = options.prog;
+
+ this._maxHelpPosition = options.maxHelpPosition || 24;
+ this._width = (options.width || ((process.env.COLUMNS || 80) - 2));
+
+ this._currentIndent = 0;
+ this._indentIncriment = options.indentIncriment || 2;
+ this._level = 0;
+ this._actionMaxLength = 0;
+
+ this._rootSection = new Section(null);
+ this._currentSection = this._rootSection;
+
+ this._whitespaceMatcher = new RegExp('\\s+', 'g');
+ this._longBreakMatcher = new RegExp(c.EOL + c.EOL + c.EOL + '+', 'g');
+};
+
+HelpFormatter.prototype._indent = function () {
+ this._currentIndent += this._indentIncriment;
+ this._level += 1;
+};
+
+HelpFormatter.prototype._dedent = function () {
+ this._currentIndent -= this._indentIncriment;
+ this._level -= 1;
+ if (this._currentIndent < 0) {
+ throw new Error('Indent decreased below 0.');
+ }
+};
+
+HelpFormatter.prototype._addItem = function (func, args) {
+ this._currentSection.addItem([ func, args ]);
+};
+
+//
+// Message building methods
+//
+
+/**
+ * HelpFormatter#startSection(heading) -> Void
+ * - heading (string): header string
+ *
+ * Start new help section
+ *
+ * See alse [code example][1]
+ *
+ * ##### Example
+ *
+ * formatter.startSection(actionGroup.title);
+ * formatter.addText(actionGroup.description);
+ * formatter.addArguments(actionGroup._groupActions);
+ * formatter.endSection();
+ *
+ **/
+HelpFormatter.prototype.startSection = function (heading) {
+ this._indent();
+ var section = new Section(this._currentSection, heading);
+ var func = section.formatHelp.bind(section);
+ this._addItem(func, [ this ]);
+ this._currentSection = section;
+};
+
+/**
+ * HelpFormatter#endSection -> Void
+ *
+ * End help section
+ *
+ * ##### Example
+ *
+ * formatter.startSection(actionGroup.title);
+ * formatter.addText(actionGroup.description);
+ * formatter.addArguments(actionGroup._groupActions);
+ * formatter.endSection();
+ **/
+HelpFormatter.prototype.endSection = function () {
+ this._currentSection = this._currentSection._parent;
+ this._dedent();
+};
+
+/**
+ * HelpFormatter#addText(text) -> Void
+ * - text (string): plain text
+ *
+ * Add plain text into current section
+ *
+ * ##### Example
+ *
+ * formatter.startSection(actionGroup.title);
+ * formatter.addText(actionGroup.description);
+ * formatter.addArguments(actionGroup._groupActions);
+ * formatter.endSection();
+ *
+ **/
+HelpFormatter.prototype.addText = function (text) {
+ if (text && text !== c.SUPPRESS) {
+ this._addItem(this._formatText, [ text ]);
+ }
+};
+
+/**
+ * HelpFormatter#addUsage(usage, actions, groups, prefix) -> Void
+ * - usage (string): usage text
+ * - actions (array): actions list
+ * - groups (array): groups list
+ * - prefix (string): usage prefix
+ *
+ * Add usage data into current section
+ *
+ * ##### Example
+ *
+ * formatter.addUsage(this.usage, this._actions, []);
+ * return formatter.formatHelp();
+ *
+ **/
+HelpFormatter.prototype.addUsage = function (usage, actions, groups, prefix) {
+ if (usage !== c.SUPPRESS) {
+ this._addItem(this._formatUsage, [ usage, actions, groups, prefix ]);
+ }
+};
+
+/**
+ * HelpFormatter#addArgument(action) -> Void
+ * - action (object): action
+ *
+ * Add argument into current section
+ *
+ * Single variant of [[HelpFormatter#addArguments]]
+ **/
+HelpFormatter.prototype.addArgument = function (action) {
+ if (action.help !== c.SUPPRESS) {
+ var self = this;
+
+ // find all invocations
+ var invocations = [ this._formatActionInvocation(action) ];
+ var invocationLength = invocations[0].length;
+
+ var actionLength;
+
+ if (action._getSubactions) {
+ this._indent();
+ action._getSubactions().forEach(function (subaction) {
+
+ var invocationNew = self._formatActionInvocation(subaction);
+ invocations.push(invocationNew);
+ invocationLength = Math.max(invocationLength, invocationNew.length);
+
+ });
+ this._dedent();
+ }
+
+ // update the maximum item length
+ actionLength = invocationLength + this._currentIndent;
+ this._actionMaxLength = Math.max(this._actionMaxLength, actionLength);
+
+ // add the item to the list
+ this._addItem(this._formatAction, [ action ]);
+ }
+};
+
+/**
+ * HelpFormatter#addArguments(actions) -> Void
+ * - actions (array): actions list
+ *
+ * Mass add arguments into current section
+ *
+ * ##### Example
+ *
+ * formatter.startSection(actionGroup.title);
+ * formatter.addText(actionGroup.description);
+ * formatter.addArguments(actionGroup._groupActions);
+ * formatter.endSection();
+ *
+ **/
+HelpFormatter.prototype.addArguments = function (actions) {
+ var self = this;
+ actions.forEach(function (action) {
+ self.addArgument(action);
+ });
+};
+
+//
+// Help-formatting methods
+//
+
+/**
+ * HelpFormatter#formatHelp -> string
+ *
+ * Format help
+ *
+ * ##### Example
+ *
+ * formatter.addText(this.epilog);
+ * return formatter.formatHelp();
+ *
+ **/
+HelpFormatter.prototype.formatHelp = function () {
+ var help = this._rootSection.formatHelp(this);
+ if (help) {
+ help = help.replace(this._longBreakMatcher, c.EOL + c.EOL);
+ help = $$.trimChars(help, c.EOL) + c.EOL;
+ }
+ return help;
+};
+
+HelpFormatter.prototype._joinParts = function (partStrings) {
+ return partStrings.filter(function (part) {
+ return (part && part !== c.SUPPRESS);
+ }).join('');
+};
+
+HelpFormatter.prototype._formatUsage = function (usage, actions, groups, prefix) {
+ if (!prefix && typeof prefix !== 'string') {
+ prefix = 'usage: ';
+ }
+
+ actions = actions || [];
+ groups = groups || [];
+
+
+ // if usage is specified, use that
+ if (usage) {
+ usage = sprintf(usage, { prog: this._prog });
+
+ // if no optionals or positionals are available, usage is just prog
+ } else if (!usage && actions.length === 0) {
+ usage = this._prog;
+
+ // if optionals and positionals are available, calculate usage
+ } else if (!usage) {
+ var prog = this._prog;
+ var optionals = [];
+ var positionals = [];
+ var actionUsage;
+ var textWidth;
+
+ // split optionals from positionals
+ actions.forEach(function (action) {
+ if (action.isOptional()) {
+ optionals.push(action);
+ } else {
+ positionals.push(action);
+ }
+ });
+
+ // build full usage string
+ actionUsage = this._formatActionsUsage([].concat(optionals, positionals), groups);
+ usage = [ prog, actionUsage ].join(' ');
+
+ // wrap the usage parts if it's too long
+ textWidth = this._width - this._currentIndent;
+ if ((prefix.length + usage.length) > textWidth) {
+
+ // break usage into wrappable parts
+ var regexpPart = new RegExp('\\(.*?\\)+|\\[.*?\\]+|\\S+', 'g');
+ var optionalUsage = this._formatActionsUsage(optionals, groups);
+ var positionalUsage = this._formatActionsUsage(positionals, groups);
+
+
+ var optionalParts = optionalUsage.match(regexpPart);
+ var positionalParts = positionalUsage.match(regexpPart) || [];
+
+ if (optionalParts.join(' ') !== optionalUsage) {
+ throw new Error('assert "optionalParts.join(\' \') === optionalUsage"');
+ }
+ if (positionalParts.join(' ') !== positionalUsage) {
+ throw new Error('assert "positionalParts.join(\' \') === positionalUsage"');
+ }
+
+ // helper for wrapping lines
+ /*eslint-disable func-style*/ // node 0.10 compat
+ var _getLines = function (parts, indent, prefix) {
+ var lines = [];
+ var line = [];
+
+ var lineLength = prefix ? prefix.length - 1 : indent.length - 1;
+
+ parts.forEach(function (part) {
+ if (lineLength + 1 + part.length > textWidth) {
+ lines.push(indent + line.join(' '));
+ line = [];
+ lineLength = indent.length - 1;
+ }
+ line.push(part);
+ lineLength += part.length + 1;
+ });
+
+ if (line) {
+ lines.push(indent + line.join(' '));
+ }
+ if (prefix) {
+ lines[0] = lines[0].substr(indent.length);
+ }
+ return lines;
+ };
+
+ var lines, indent, parts;
+ // if prog is short, follow it with optionals or positionals
+ if (prefix.length + prog.length <= 0.75 * textWidth) {
+ indent = $$.repeat(' ', (prefix.length + prog.length + 1));
+ if (optionalParts) {
+ lines = [].concat(
+ _getLines([ prog ].concat(optionalParts), indent, prefix),
+ _getLines(positionalParts, indent)
+ );
+ } else if (positionalParts) {
+ lines = _getLines([ prog ].concat(positionalParts), indent, prefix);
+ } else {
+ lines = [ prog ];
+ }
+
+ // if prog is long, put it on its own line
+ } else {
+ indent = $$.repeat(' ', prefix.length);
+ parts = optionalParts.concat(positionalParts);
+ lines = _getLines(parts, indent);
+ if (lines.length > 1) {
+ lines = [].concat(
+ _getLines(optionalParts, indent),
+ _getLines(positionalParts, indent)
+ );
+ }
+ lines = [ prog ].concat(lines);
+ }
+ // join lines into usage
+ usage = lines.join(c.EOL);
+ }
+ }
+
+ // prefix with 'usage:'
+ return prefix + usage + c.EOL + c.EOL;
+};
+
+HelpFormatter.prototype._formatActionsUsage = function (actions, groups) {
+ // find group indices and identify actions in groups
+ var groupActions = [];
+ var inserts = [];
+ var self = this;
+
+ groups.forEach(function (group) {
+ var end;
+ var i;
+
+ var start = actions.indexOf(group._groupActions[0]);
+ if (start >= 0) {
+ end = start + group._groupActions.length;
+
+ //if (actions.slice(start, end) === group._groupActions) {
+ if ($$.arrayEqual(actions.slice(start, end), group._groupActions)) {
+ group._groupActions.forEach(function (action) {
+ groupActions.push(action);
+ });
+
+ if (!group.required) {
+ if (inserts[start]) {
+ inserts[start] += ' [';
+ } else {
+ inserts[start] = '[';
+ }
+ inserts[end] = ']';
+ } else {
+ if (inserts[start]) {
+ inserts[start] += ' (';
+ } else {
+ inserts[start] = '(';
+ }
+ inserts[end] = ')';
+ }
+ for (i = start + 1; i < end; i += 1) {
+ inserts[i] = '|';
+ }
+ }
+ }
+ });
+
+ // collect all actions format strings
+ var parts = [];
+
+ actions.forEach(function (action, actionIndex) {
+ var part;
+ var optionString;
+ var argsDefault;
+ var argsString;
+
+ // suppressed arguments are marked with None
+ // remove | separators for suppressed arguments
+ if (action.help === c.SUPPRESS) {
+ parts.push(null);
+ if (inserts[actionIndex] === '|') {
+ inserts.splice(actionIndex, actionIndex);
+ } else if (inserts[actionIndex + 1] === '|') {
+ inserts.splice(actionIndex + 1, actionIndex + 1);
+ }
+
+ // produce all arg strings
+ } else if (!action.isOptional()) {
+ part = self._formatArgs(action, action.dest);
+
+ // if it's in a group, strip the outer []
+ if (groupActions.indexOf(action) >= 0) {
+ if (part[0] === '[' && part[part.length - 1] === ']') {
+ part = part.slice(1, -1);
+ }
+ }
+ // add the action string to the list
+ parts.push(part);
+
+ // produce the first way to invoke the option in brackets
+ } else {
+ optionString = action.optionStrings[0];
+
+ // if the Optional doesn't take a value, format is: -s or --long
+ if (action.nargs === 0) {
+ part = '' + optionString;
+
+ // if the Optional takes a value, format is: -s ARGS or --long ARGS
+ } else {
+ argsDefault = action.dest.toUpperCase();
+ argsString = self._formatArgs(action, argsDefault);
+ part = optionString + ' ' + argsString;
+ }
+ // make it look optional if it's not required or in a group
+ if (!action.required && groupActions.indexOf(action) < 0) {
+ part = '[' + part + ']';
+ }
+ // add the action string to the list
+ parts.push(part);
+ }
+ });
+
+ // insert things at the necessary indices
+ for (var i = inserts.length - 1; i >= 0; --i) {
+ if (inserts[i] !== null) {
+ parts.splice(i, 0, inserts[i]);
+ }
+ }
+
+ // join all the action items with spaces
+ var text = parts.filter(function (part) {
+ return !!part;
+ }).join(' ');
+
+ // clean up separators for mutually exclusive groups
+ text = text.replace(/([\[(]) /g, '$1'); // remove spaces
+ text = text.replace(/ ([\])])/g, '$1');
+ text = text.replace(/\[ *\]/g, ''); // remove empty groups
+ text = text.replace(/\( *\)/g, '');
+ text = text.replace(/\(([^|]*)\)/g, '$1'); // remove () from single action groups
+
+ text = text.trim();
+
+ // return the text
+ return text;
+};
+
+HelpFormatter.prototype._formatText = function (text) {
+ text = sprintf(text, { prog: this._prog });
+ var textWidth = this._width - this._currentIndent;
+ var indentIncriment = $$.repeat(' ', this._currentIndent);
+ return this._fillText(text, textWidth, indentIncriment) + c.EOL + c.EOL;
+};
+
+HelpFormatter.prototype._formatAction = function (action) {
+ var self = this;
+
+ var helpText;
+ var helpLines;
+ var parts;
+ var indentFirst;
+
+ // determine the required width and the entry label
+ var helpPosition = Math.min(this._actionMaxLength + 2, this._maxHelpPosition);
+ var helpWidth = this._width - helpPosition;
+ var actionWidth = helpPosition - this._currentIndent - 2;
+ var actionHeader = this._formatActionInvocation(action);
+
+ // no help; start on same line and add a final newline
+ if (!action.help) {
+ actionHeader = $$.repeat(' ', this._currentIndent) + actionHeader + c.EOL;
+
+ // short action name; start on the same line and pad two spaces
+ } else if (actionHeader.length <= actionWidth) {
+ actionHeader = $$.repeat(' ', this._currentIndent) +
+ actionHeader +
+ ' ' +
+ $$.repeat(' ', actionWidth - actionHeader.length);
+ indentFirst = 0;
+
+ // long action name; start on the next line
+ } else {
+ actionHeader = $$.repeat(' ', this._currentIndent) + actionHeader + c.EOL;
+ indentFirst = helpPosition;
+ }
+
+ // collect the pieces of the action help
+ parts = [ actionHeader ];
+
+ // if there was help for the action, add lines of help text
+ if (action.help) {
+ helpText = this._expandHelp(action);
+ helpLines = this._splitLines(helpText, helpWidth);
+ parts.push($$.repeat(' ', indentFirst) + helpLines[0] + c.EOL);
+ helpLines.slice(1).forEach(function (line) {
+ parts.push($$.repeat(' ', helpPosition) + line + c.EOL);
+ });
+
+ // or add a newline if the description doesn't end with one
+ } else if (actionHeader.charAt(actionHeader.length - 1) !== c.EOL) {
+ parts.push(c.EOL);
+ }
+ // if there are any sub-actions, add their help as well
+ if (action._getSubactions) {
+ this._indent();
+ action._getSubactions().forEach(function (subaction) {
+ parts.push(self._formatAction(subaction));
+ });
+ this._dedent();
+ }
+ // return a single string
+ return this._joinParts(parts);
+};
+
+HelpFormatter.prototype._formatActionInvocation = function (action) {
+ if (!action.isOptional()) {
+ var format_func = this._metavarFormatter(action, action.dest);
+ var metavars = format_func(1);
+ return metavars[0];
+ }
+
+ var parts = [];
+ var argsDefault;
+ var argsString;
+
+ // if the Optional doesn't take a value, format is: -s, --long
+ if (action.nargs === 0) {
+ parts = parts.concat(action.optionStrings);
+
+ // if the Optional takes a value, format is: -s ARGS, --long ARGS
+ } else {
+ argsDefault = action.dest.toUpperCase();
+ argsString = this._formatArgs(action, argsDefault);
+ action.optionStrings.forEach(function (optionString) {
+ parts.push(optionString + ' ' + argsString);
+ });
+ }
+ return parts.join(', ');
+};
+
+HelpFormatter.prototype._metavarFormatter = function (action, metavarDefault) {
+ var result;
+
+ if (action.metavar || action.metavar === '') {
+ result = action.metavar;
+ } else if (action.choices) {
+ var choices = action.choices;
+
+ if (typeof choices === 'string') {
+ choices = choices.split('').join(', ');
+ } else if (Array.isArray(choices)) {
+ choices = choices.join(',');
+ } else {
+ choices = Object.keys(choices).join(',');
+ }
+ result = '{' + choices + '}';
+ } else {
+ result = metavarDefault;
+ }
+
+ return function (size) {
+ if (Array.isArray(result)) {
+ return result;
+ }
+
+ var metavars = [];
+ for (var i = 0; i < size; i += 1) {
+ metavars.push(result);
+ }
+ return metavars;
+ };
+};
+
+HelpFormatter.prototype._formatArgs = function (action, metavarDefault) {
+ var result;
+ var metavars;
+
+ var buildMetavar = this._metavarFormatter(action, metavarDefault);
+
+ switch (action.nargs) {
+ /*eslint-disable no-undefined*/
+ case undefined:
+ case null:
+ metavars = buildMetavar(1);
+ result = '' + metavars[0];
+ break;
+ case c.OPTIONAL:
+ metavars = buildMetavar(1);
+ result = '[' + metavars[0] + ']';
+ break;
+ case c.ZERO_OR_MORE:
+ metavars = buildMetavar(2);
+ result = '[' + metavars[0] + ' [' + metavars[1] + ' ...]]';
+ break;
+ case c.ONE_OR_MORE:
+ metavars = buildMetavar(2);
+ result = '' + metavars[0] + ' [' + metavars[1] + ' ...]';
+ break;
+ case c.REMAINDER:
+ result = '...';
+ break;
+ case c.PARSER:
+ metavars = buildMetavar(1);
+ result = metavars[0] + ' ...';
+ break;
+ default:
+ metavars = buildMetavar(action.nargs);
+ result = metavars.join(' ');
+ }
+ return result;
+};
+
+HelpFormatter.prototype._expandHelp = function (action) {
+ var params = { prog: this._prog };
+
+ Object.keys(action).forEach(function (actionProperty) {
+ var actionValue = action[actionProperty];
+
+ if (actionValue !== c.SUPPRESS) {
+ params[actionProperty] = actionValue;
+ }
+ });
+
+ if (params.choices) {
+ if (typeof params.choices === 'string') {
+ params.choices = params.choices.split('').join(', ');
+ } else if (Array.isArray(params.choices)) {
+ params.choices = params.choices.join(', ');
+ } else {
+ params.choices = Object.keys(params.choices).join(', ');
+ }
+ }
+
+ return sprintf(this._getHelpString(action), params);
+};
+
+HelpFormatter.prototype._splitLines = function (text, width) {
+ var lines = [];
+ var delimiters = [ ' ', '.', ',', '!', '?' ];
+ var re = new RegExp('[' + delimiters.join('') + '][^' + delimiters.join('') + ']*$');
+
+ text = text.replace(/[\n\|\t]/g, ' ');
+
+ text = text.trim();
+ text = text.replace(this._whitespaceMatcher, ' ');
+
+ // Wraps the single paragraph in text (a string) so every line
+ // is at most width characters long.
+ text.split(c.EOL).forEach(function (line) {
+ if (width >= line.length) {
+ lines.push(line);
+ return;
+ }
+
+ var wrapStart = 0;
+ var wrapEnd = width;
+ var delimiterIndex = 0;
+ while (wrapEnd <= line.length) {
+ if (wrapEnd !== line.length && delimiters.indexOf(line[wrapEnd] < -1)) {
+ delimiterIndex = (re.exec(line.substring(wrapStart, wrapEnd)) || {}).index;
+ wrapEnd = wrapStart + delimiterIndex + 1;
+ }
+ lines.push(line.substring(wrapStart, wrapEnd));
+ wrapStart = wrapEnd;
+ wrapEnd += width;
+ }
+ if (wrapStart < line.length) {
+ lines.push(line.substring(wrapStart, wrapEnd));
+ }
+ });
+
+ return lines;
+};
+
+HelpFormatter.prototype._fillText = function (text, width, indent) {
+ var lines = this._splitLines(text, width);
+ lines = lines.map(function (line) {
+ return indent + line;
+ });
+ return lines.join(c.EOL);
+};
+
+HelpFormatter.prototype._getHelpString = function (action) {
+ return action.help;
+};
diff --git a/tools/doc/node_modules/argparse/lib/namespace.js b/tools/doc/node_modules/argparse/lib/namespace.js
new file mode 100644
index 0000000000..a860de9ecc
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/namespace.js
@@ -0,0 +1,76 @@
+/**
+ * class Namespace
+ *
+ * Simple object for storing attributes. Implements equality by attribute names
+ * and values, and provides a simple string representation.
+ *
+ * See also [original guide][1]
+ *
+ * [1]:http://docs.python.org/dev/library/argparse.html#the-namespace-object
+ **/
+'use strict';
+
+var $$ = require('./utils');
+
+/**
+ * new Namespace(options)
+ * - options(object): predefined propertis for result object
+ *
+ **/
+var Namespace = module.exports = function Namespace(options) {
+ $$.extend(this, options);
+};
+
+/**
+ * Namespace#isset(key) -> Boolean
+ * - key (string|number): property name
+ *
+ * Tells whenever `namespace` contains given `key` or not.
+ **/
+Namespace.prototype.isset = function (key) {
+ return $$.has(this, key);
+};
+
+/**
+ * Namespace#set(key, value) -> self
+ * -key (string|number|object): propery name
+ * -value (mixed): new property value
+ *
+ * Set the property named key with value.
+ * If key object then set all key properties to namespace object
+ **/
+Namespace.prototype.set = function (key, value) {
+ if (typeof (key) === 'object') {
+ $$.extend(this, key);
+ } else {
+ this[key] = value;
+ }
+ return this;
+};
+
+/**
+ * Namespace#get(key, defaultValue) -> mixed
+ * - key (string|number): property name
+ * - defaultValue (mixed): default value
+ *
+ * Return the property key or defaulValue if not set
+ **/
+Namespace.prototype.get = function (key, defaultValue) {
+ return !this[key] ? defaultValue : this[key];
+};
+
+/**
+ * Namespace#unset(key, defaultValue) -> mixed
+ * - key (string|number): property name
+ * - defaultValue (mixed): default value
+ *
+ * Return data[key](and delete it) or defaultValue
+ **/
+Namespace.prototype.unset = function (key, defaultValue) {
+ var value = this[key];
+ if (value !== null) {
+ delete this[key];
+ return value;
+ }
+ return defaultValue;
+};
diff --git a/tools/doc/node_modules/argparse/lib/utils.js b/tools/doc/node_modules/argparse/lib/utils.js
new file mode 100644
index 0000000000..4a9cf3edb6
--- /dev/null
+++ b/tools/doc/node_modules/argparse/lib/utils.js
@@ -0,0 +1,57 @@
+'use strict';
+
+exports.repeat = function (str, num) {
+ var result = '';
+ for (var i = 0; i < num; i++) { result += str; }
+ return result;
+};
+
+exports.arrayEqual = function (a, b) {
+ if (a.length !== b.length) { return false; }
+ for (var i = 0; i < a.length; i++) {
+ if (a[i] !== b[i]) { return false; }
+ }
+ return true;
+};
+
+exports.trimChars = function (str, chars) {
+ var start = 0;
+ var end = str.length - 1;
+ while (chars.indexOf(str.charAt(start)) >= 0) { start++; }
+ while (chars.indexOf(str.charAt(end)) >= 0) { end--; }
+ return str.slice(start, end + 1);
+};
+
+exports.capitalize = function (str) {
+ return str.charAt(0).toUpperCase() + str.slice(1);
+};
+
+exports.arrayUnion = function () {
+ var result = [];
+ for (var i = 0, values = {}; i < arguments.length; i++) {
+ var arr = arguments[i];
+ for (var j = 0; j < arr.length; j++) {
+ if (!values[arr[j]]) {
+ values[arr[j]] = true;
+ result.push(arr[j]);
+ }
+ }
+ }
+ return result;
+};
+
+function has(obj, key) {
+ return Object.prototype.hasOwnProperty.call(obj, key);
+}
+
+exports.has = has;
+
+exports.extend = function (dest, src) {
+ for (var i in src) {
+ if (has(src, i)) { dest[i] = src[i]; }
+ }
+};
+
+exports.trimEnd = function (str) {
+ return str.replace(/\s+$/g, '');
+};
diff --git a/tools/doc/node_modules/argparse/package.json b/tools/doc/node_modules/argparse/package.json
new file mode 100644
index 0000000000..24313f5e3c
--- /dev/null
+++ b/tools/doc/node_modules/argparse/package.json
@@ -0,0 +1,74 @@
+{
+ "_args": [
+ [
+ "argparse@1.0.10",
+ "/Users/rubys/git/node/tools/doc"
+ ]
+ ],
+ "_development": true,
+ "_from": "argparse@1.0.10",
+ "_id": "argparse@1.0.10",
+ "_inBundle": false,
+ "_integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==",
+ "_location": "/argparse",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "version",
+ "registry": true,
+ "raw": "argparse@1.0.10",
+ "name": "argparse",
+ "escapedName": "argparse",
+ "rawSpec": "1.0.10",
+ "saveSpec": null,
+ "fetchSpec": "1.0.10"
+ },
+ "_requiredBy": [
+ "/js-yaml"
+ ],
+ "_resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
+ "_spec": "1.0.10",
+ "_where": "/Users/rubys/git/node/tools/doc",
+ "bugs": {
+ "url": "https://github.com/nodeca/argparse/issues"
+ },
+ "contributors": [
+ {
+ "name": "Eugene Shkuropat"
+ },
+ {
+ "name": "Paul Jacobson"
+ }
+ ],
+ "dependencies": {
+ "sprintf-js": "~1.0.2"
+ },
+ "description": "Very powerful CLI arguments parser. Native port of argparse - python's options parsing library",
+ "devDependencies": {
+ "eslint": "^2.13.1",
+ "istanbul": "^0.4.5",
+ "mocha": "^3.1.0",
+ "ndoc": "^5.0.1"
+ },
+ "files": [
+ "index.js",
+ "lib/"
+ ],
+ "homepage": "https://github.com/nodeca/argparse#readme",
+ "keywords": [
+ "cli",
+ "parser",
+ "argparse",
+ "option",
+ "args"
+ ],
+ "license": "MIT",
+ "name": "argparse",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/nodeca/argparse.git"
+ },
+ "scripts": {
+ "test": "make test"
+ },
+ "version": "1.0.10"
+}
diff --git a/tools/doc/node_modules/esprima/LICENSE.BSD b/tools/doc/node_modules/esprima/LICENSE.BSD
new file mode 100644
index 0000000000..7a55160f56
--- /dev/null
+++ b/tools/doc/node_modules/esprima/LICENSE.BSD
@@ -0,0 +1,21 @@
+Copyright JS Foundation and other contributors, https://js.foundation/
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/tools/doc/node_modules/esprima/README.md b/tools/doc/node_modules/esprima/README.md
new file mode 100644
index 0000000000..1ee10bfa0d
--- /dev/null
+++ b/tools/doc/node_modules/esprima/README.md
@@ -0,0 +1,46 @@
+[![NPM version](https://img.shields.io/npm/v/esprima.svg)](https://www.npmjs.com/package/esprima)
+[![npm download](https://img.shields.io/npm/dm/esprima.svg)](https://www.npmjs.com/package/esprima)
+[![Build Status](https://img.shields.io/travis/jquery/esprima/master.svg)](https://travis-ci.org/jquery/esprima)
+[![Coverage Status](https://img.shields.io/codecov/c/github/jquery/esprima/master.svg)](https://codecov.io/github/jquery/esprima)
+
+**Esprima** ([esprima.org](http://esprima.org), BSD license) is a high performance,
+standard-compliant [ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm)
+parser written in ECMAScript (also popularly known as
+[JavaScript](https://en.wikipedia.org/wiki/JavaScript)).
+Esprima is created and maintained by [Ariya Hidayat](https://twitter.com/ariyahidayat),
+with the help of [many contributors](https://github.com/jquery/esprima/contributors).
+
+### Features
+
+- Full support for ECMAScript 2017 ([ECMA-262 8th Edition](http://www.ecma-international.org/publications/standards/Ecma-262.htm))
+- Sensible [syntax tree format](https://github.com/estree/estree/blob/master/es5.md) as standardized by [ESTree project](https://github.com/estree/estree)
+- Experimental support for [JSX](https://facebook.github.io/jsx/), a syntax extension for [React](https://facebook.github.io/react/)
+- Optional tracking of syntax node location (index-based and line-column)
+- [Heavily tested](http://esprima.org/test/ci.html) (~1500 [unit tests](https://github.com/jquery/esprima/tree/master/test/fixtures) with [full code coverage](https://codecov.io/github/jquery/esprima))
+
+### API
+
+Esprima can be used to perform [lexical analysis](https://en.wikipedia.org/wiki/Lexical_analysis) (tokenization) or [syntactic analysis](https://en.wikipedia.org/wiki/Parsing) (parsing) of a JavaScript program.
+
+A simple example on Node.js REPL:
+
+```javascript
+> var esprima = require('esprima');
+> var program = 'const answer = 42';
+
+> esprima.tokenize(program);
+[ { type: 'Keyword', value: 'const' },
+ { type: 'Identifier', value: 'answer' },
+ { type: 'Punctuator', value: '=' },
+ { type: 'Numeric', value: '42' } ]
+
+> esprima.parseScript(program);
+{ type: 'Program',
+ body:
+ [ { type: 'VariableDeclaration',
+ declarations: [Object],
+ kind: 'const' } ],
+ sourceType: 'script' }
+```
+
+For more information, please read the [complete documentation](http://esprima.org/doc). \ No newline at end of file
diff --git a/tools/doc/node_modules/esprima/bin/esparse.js b/tools/doc/node_modules/esprima/bin/esparse.js
new file mode 100755
index 0000000000..45d05fbb73
--- /dev/null
+++ b/tools/doc/node_modules/esprima/bin/esparse.js
@@ -0,0 +1,139 @@
+#!/usr/bin/env node
+/*
+ Copyright JS Foundation and other contributors, https://js.foundation/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/*jslint sloppy:true node:true rhino:true */
+
+var fs, esprima, fname, forceFile, content, options, syntax;
+
+if (typeof require === 'function') {
+ fs = require('fs');
+ try {
+ esprima = require('esprima');
+ } catch (e) {
+ esprima = require('../');
+ }
+} else if (typeof load === 'function') {
+ try {
+ load('esprima.js');
+ } catch (e) {
+ load('../esprima.js');
+ }
+}
+
+// Shims to Node.js objects when running under Rhino.
+if (typeof console === 'undefined' && typeof process === 'undefined') {
+ console = { log: print };
+ fs = { readFileSync: readFile };
+ process = { argv: arguments, exit: quit };
+ process.argv.unshift('esparse.js');
+ process.argv.unshift('rhino');
+}
+
+function showUsage() {
+ console.log('Usage:');
+ console.log(' esparse [options] [file.js]');
+ console.log();
+ console.log('Available options:');
+ console.log();
+ console.log(' --comment Gather all line and block comments in an array');
+ console.log(' --loc Include line-column location info for each syntax node');
+ console.log(' --range Include index-based range for each syntax node');
+ console.log(' --raw Display the raw value of literals');
+ console.log(' --tokens List all tokens in an array');
+ console.log(' --tolerant Tolerate errors on a best-effort basis (experimental)');
+ console.log(' -v, --version Shows program version');
+ console.log();
+ process.exit(1);
+}
+
+options = {};
+
+process.argv.splice(2).forEach(function (entry) {
+
+ if (forceFile || entry === '-' || entry.slice(0, 1) !== '-') {
+ if (typeof fname === 'string') {
+ console.log('Error: more than one input file.');
+ process.exit(1);
+ } else {
+ fname = entry;
+ }
+ } else if (entry === '-h' || entry === '--help') {
+ showUsage();
+ } else if (entry === '-v' || entry === '--version') {
+ console.log('ECMAScript Parser (using Esprima version', esprima.version, ')');
+ console.log();
+ process.exit(0);
+ } else if (entry === '--comment') {
+ options.comment = true;
+ } else if (entry === '--loc') {
+ options.loc = true;
+ } else if (entry === '--range') {
+ options.range = true;
+ } else if (entry === '--raw') {
+ options.raw = true;
+ } else if (entry === '--tokens') {
+ options.tokens = true;
+ } else if (entry === '--tolerant') {
+ options.tolerant = true;
+ } else if (entry === '--') {
+ forceFile = true;
+ } else {
+ console.log('Error: unknown option ' + entry + '.');
+ process.exit(1);
+ }
+});
+
+// Special handling for regular expression literal since we need to
+// convert it to a string literal, otherwise it will be decoded
+// as object "{}" and the regular expression would be lost.
+function adjustRegexLiteral(key, value) {
+ if (key === 'value' && value instanceof RegExp) {
+ value = value.toString();
+ }
+ return value;
+}
+
+function run(content) {
+ syntax = esprima.parse(content, options);
+ console.log(JSON.stringify(syntax, adjustRegexLiteral, 4));
+}
+
+try {
+ if (fname && (fname !== '-' || forceFile)) {
+ run(fs.readFileSync(fname, 'utf-8'));
+ } else {
+ var content = '';
+ process.stdin.resume();
+ process.stdin.on('data', function(chunk) {
+ content += chunk;
+ });
+ process.stdin.on('end', function() {
+ run(content);
+ });
+ }
+} catch (e) {
+ console.log('Error: ' + e.message);
+ process.exit(1);
+}
diff --git a/tools/doc/node_modules/esprima/bin/esvalidate.js b/tools/doc/node_modules/esprima/bin/esvalidate.js
new file mode 100755
index 0000000000..d49a7e40a8
--- /dev/null
+++ b/tools/doc/node_modules/esprima/bin/esvalidate.js
@@ -0,0 +1,236 @@
+#!/usr/bin/env node
+/*
+ Copyright JS Foundation and other contributors, https://js.foundation/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+/*jslint sloppy:true plusplus:true node:true rhino:true */
+/*global phantom:true */
+
+var fs, system, esprima, options, fnames, forceFile, count;
+
+if (typeof esprima === 'undefined') {
+ // PhantomJS can only require() relative files
+ if (typeof phantom === 'object') {
+ fs = require('fs');
+ system = require('system');
+ esprima = require('./esprima');
+ } else if (typeof require === 'function') {
+ fs = require('fs');
+ try {
+ esprima = require('esprima');
+ } catch (e) {
+ esprima = require('../');
+ }
+ } else if (typeof load === 'function') {
+ try {
+ load('esprima.js');
+ } catch (e) {
+ load('../esprima.js');
+ }
+ }
+}
+
+// Shims to Node.js objects when running under PhantomJS 1.7+.
+if (typeof phantom === 'object') {
+ fs.readFileSync = fs.read;
+ process = {
+ argv: [].slice.call(system.args),
+ exit: phantom.exit,
+ on: function (evt, callback) {
+ callback();
+ }
+ };
+ process.argv.unshift('phantomjs');
+}
+
+// Shims to Node.js objects when running under Rhino.
+if (typeof console === 'undefined' && typeof process === 'undefined') {
+ console = { log: print };
+ fs = { readFileSync: readFile };
+ process = {
+ argv: arguments,
+ exit: quit,
+ on: function (evt, callback) {
+ callback();
+ }
+ };
+ process.argv.unshift('esvalidate.js');
+ process.argv.unshift('rhino');
+}
+
+function showUsage() {
+ console.log('Usage:');
+ console.log(' esvalidate [options] [file.js...]');
+ console.log();
+ console.log('Available options:');
+ console.log();
+ console.log(' --format=type Set the report format, plain (default) or junit');
+ console.log(' -v, --version Print program version');
+ console.log();
+ process.exit(1);
+}
+
+options = {
+ format: 'plain'
+};
+
+fnames = [];
+
+process.argv.splice(2).forEach(function (entry) {
+
+ if (forceFile || entry === '-' || entry.slice(0, 1) !== '-') {
+ fnames.push(entry);
+ } else if (entry === '-h' || entry === '--help') {
+ showUsage();
+ } else if (entry === '-v' || entry === '--version') {
+ console.log('ECMAScript Validator (using Esprima version', esprima.version, ')');
+ console.log();
+ process.exit(0);
+ } else if (entry.slice(0, 9) === '--format=') {
+ options.format = entry.slice(9);
+ if (options.format !== 'plain' && options.format !== 'junit') {
+ console.log('Error: unknown report format ' + options.format + '.');
+ process.exit(1);
+ }
+ } else if (entry === '--') {
+ forceFile = true;
+ } else {
+ console.log('Error: unknown option ' + entry + '.');
+ process.exit(1);
+ }
+});
+
+if (fnames.length === 0) {
+ fnames.push('');
+}
+
+if (options.format === 'junit') {
+ console.log('<?xml version="1.0" encoding="UTF-8"?>');
+ console.log('<testsuites>');
+}
+
+count = 0;
+
+function run(fname, content) {
+ var timestamp, syntax, name;
+ try {
+ if (typeof content !== 'string') {
+ throw content;
+ }
+
+ if (content[0] === '#' && content[1] === '!') {
+ content = '//' + content.substr(2, content.length);
+ }
+
+ timestamp = Date.now();
+ syntax = esprima.parse(content, { tolerant: true });
+
+ if (options.format === 'junit') {
+
+ name = fname;
+ if (name.lastIndexOf('/') >= 0) {
+ name = name.slice(name.lastIndexOf('/') + 1);
+ }
+
+ console.log('<testsuite name="' + fname + '" errors="0" ' +
+ ' failures="' + syntax.errors.length + '" ' +
+ ' tests="' + syntax.errors.length + '" ' +
+ ' time="' + Math.round((Date.now() - timestamp) / 1000) +
+ '">');
+
+ syntax.errors.forEach(function (error) {
+ var msg = error.message;
+ msg = msg.replace(/^Line\ [0-9]*\:\ /, '');
+ console.log(' <testcase name="Line ' + error.lineNumber + ': ' + msg + '" ' +
+ ' time="0">');
+ console.log(' <error type="SyntaxError" message="' + error.message + '">' +
+ error.message + '(' + name + ':' + error.lineNumber + ')' +
+ '</error>');
+ console.log(' </testcase>');
+ });
+
+ console.log('</testsuite>');
+
+ } else if (options.format === 'plain') {
+
+ syntax.errors.forEach(function (error) {
+ var msg = error.message;
+ msg = msg.replace(/^Line\ [0-9]*\:\ /, '');
+ msg = fname + ':' + error.lineNumber + ': ' + msg;
+ console.log(msg);
+ ++count;
+ });
+
+ }
+ } catch (e) {
+ ++count;
+ if (options.format === 'junit') {
+ console.log('<testsuite name="' + fname + '" errors="1" failures="0" tests="1" ' +
+ ' time="' + Math.round((Date.now() - timestamp) / 1000) + '">');
+ console.log(' <testcase name="' + e.message + '" ' + ' time="0">');
+ console.log(' <error type="ParseError" message="' + e.message + '">' +
+ e.message + '(' + fname + ((e.lineNumber) ? ':' + e.lineNumber : '') +
+ ')</error>');
+ console.log(' </testcase>');
+ console.log('</testsuite>');
+ } else {
+ console.log(fname + ':' + e.lineNumber + ': ' + e.message.replace(/^Line\ [0-9]*\:\ /, ''));
+ }
+ }
+}
+
+fnames.forEach(function (fname) {
+ var content = '';
+ try {
+ if (fname && (fname !== '-' || forceFile)) {
+ content = fs.readFileSync(fname, 'utf-8');
+ } else {
+ fname = '';
+ process.stdin.resume();
+ process.stdin.on('data', function(chunk) {
+ content += chunk;
+ });
+ process.stdin.on('end', function() {
+ run(fname, content);
+ });
+ return;
+ }
+ } catch (e) {
+ content = e;
+ }
+ run(fname, content);
+});
+
+process.on('exit', function () {
+ if (options.format === 'junit') {
+ console.log('</testsuites>');
+ }
+
+ if (count > 0) {
+ process.exit(1);
+ }
+
+ if (count === 0 && typeof phantom === 'object') {
+ process.exit(0);
+ }
+});
diff --git a/tools/doc/node_modules/esprima/dist/esprima.js b/tools/doc/node_modules/esprima/dist/esprima.js
new file mode 100644
index 0000000000..2c2f93cbd3
--- /dev/null
+++ b/tools/doc/node_modules/esprima/dist/esprima.js
@@ -0,0 +1,6700 @@
+(function webpackUniversalModuleDefinition(root, factory) {
+/* istanbul ignore next */
+ if(typeof exports === 'object' && typeof module === 'object')
+ module.exports = factory();
+ else if(typeof define === 'function' && define.amd)
+ define([], factory);
+/* istanbul ignore next */
+ else if(typeof exports === 'object')
+ exports["esprima"] = factory();
+ else
+ root["esprima"] = factory();
+})(this, function() {
+return /******/ (function(modules) { // webpackBootstrap
+/******/ // The module cache
+/******/ var installedModules = {};
+
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+
+/******/ // Check if module is in cache
+/* istanbul ignore if */
+/******/ if(installedModules[moduleId])
+/******/ return installedModules[moduleId].exports;
+
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = installedModules[moduleId] = {
+/******/ exports: {},
+/******/ id: moduleId,
+/******/ loaded: false
+/******/ };
+
+/******/ // Execute the module function
+/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
+
+/******/ // Flag the module as loaded
+/******/ module.loaded = true;
+
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+
+
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = modules;
+
+/******/ // expose the module cache
+/******/ __webpack_require__.c = installedModules;
+
+/******/ // __webpack_public_path__
+/******/ __webpack_require__.p = "";
+
+/******/ // Load entry module and return exports
+/******/ return __webpack_require__(0);
+/******/ })
+/************************************************************************/
+/******/ ([
+/* 0 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+ /*
+ Copyright JS Foundation and other contributors, https://js.foundation/
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var comment_handler_1 = __webpack_require__(1);
+ var jsx_parser_1 = __webpack_require__(3);
+ var parser_1 = __webpack_require__(8);
+ var tokenizer_1 = __webpack_require__(15);
+ function parse(code, options, delegate) {
+ var commentHandler = null;
+ var proxyDelegate = function (node, metadata) {
+ if (delegate) {
+ delegate(node, metadata);
+ }
+ if (commentHandler) {
+ commentHandler.visit(node, metadata);
+ }
+ };
+ var parserDelegate = (typeof delegate === 'function') ? proxyDelegate : null;
+ var collectComment = false;
+ if (options) {
+ collectComment = (typeof options.comment === 'boolean' && options.comment);
+ var attachComment = (typeof options.attachComment === 'boolean' && options.attachComment);
+ if (collectComment || attachComment) {
+ commentHandler = new comment_handler_1.CommentHandler();
+ commentHandler.attach = attachComment;
+ options.comment = true;
+ parserDelegate = proxyDelegate;
+ }
+ }
+ var isModule = false;
+ if (options && typeof options.sourceType === 'string') {
+ isModule = (options.sourceType === 'module');
+ }
+ var parser;
+ if (options && typeof options.jsx === 'boolean' && options.jsx) {
+ parser = new jsx_parser_1.JSXParser(code, options, parserDelegate);
+ }
+ else {
+ parser = new parser_1.Parser(code, options, parserDelegate);
+ }
+ var program = isModule ? parser.parseModule() : parser.parseScript();
+ var ast = program;
+ if (collectComment && commentHandler) {
+ ast.comments = commentHandler.comments;
+ }
+ if (parser.config.tokens) {
+ ast.tokens = parser.tokens;
+ }
+ if (parser.config.tolerant) {
+ ast.errors = parser.errorHandler.errors;
+ }
+ return ast;
+ }
+ exports.parse = parse;
+ function parseModule(code, options, delegate) {
+ var parsingOptions = options || {};
+ parsingOptions.sourceType = 'module';
+ return parse(code, parsingOptions, delegate);
+ }
+ exports.parseModule = parseModule;
+ function parseScript(code, options, delegate) {
+ var parsingOptions = options || {};
+ parsingOptions.sourceType = 'script';
+ return parse(code, parsingOptions, delegate);
+ }
+ exports.parseScript = parseScript;
+ function tokenize(code, options, delegate) {
+ var tokenizer = new tokenizer_1.Tokenizer(code, options);
+ var tokens;
+ tokens = [];
+ try {
+ while (true) {
+ var token = tokenizer.getNextToken();
+ if (!token) {
+ break;
+ }
+ if (delegate) {
+ token = delegate(token);
+ }
+ tokens.push(token);
+ }
+ }
+ catch (e) {
+ tokenizer.errorHandler.tolerate(e);
+ }
+ if (tokenizer.errorHandler.tolerant) {
+ tokens.errors = tokenizer.errors();
+ }
+ return tokens;
+ }
+ exports.tokenize = tokenize;
+ var syntax_1 = __webpack_require__(2);
+ exports.Syntax = syntax_1.Syntax;
+ // Sync with *.json manifests.
+ exports.version = '4.0.0';
+
+
+/***/ },
+/* 1 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var syntax_1 = __webpack_require__(2);
+ var CommentHandler = (function () {
+ function CommentHandler() {
+ this.attach = false;
+ this.comments = [];
+ this.stack = [];
+ this.leading = [];
+ this.trailing = [];
+ }
+ CommentHandler.prototype.insertInnerComments = function (node, metadata) {
+ // innnerComments for properties empty block
+ // `function a() {/** comments **\/}`
+ if (node.type === syntax_1.Syntax.BlockStatement && node.body.length === 0) {
+ var innerComments = [];
+ for (var i = this.leading.length - 1; i >= 0; --i) {
+ var entry = this.leading[i];
+ if (metadata.end.offset >= entry.start) {
+ innerComments.unshift(entry.comment);
+ this.leading.splice(i, 1);
+ this.trailing.splice(i, 1);
+ }
+ }
+ if (innerComments.length) {
+ node.innerComments = innerComments;
+ }
+ }
+ };
+ CommentHandler.prototype.findTrailingComments = function (metadata) {
+ var trailingComments = [];
+ if (this.trailing.length > 0) {
+ for (var i = this.trailing.length - 1; i >= 0; --i) {
+ var entry_1 = this.trailing[i];
+ if (entry_1.start >= metadata.end.offset) {
+ trailingComments.unshift(entry_1.comment);
+ }
+ }
+ this.trailing.length = 0;
+ return trailingComments;
+ }
+ var entry = this.stack[this.stack.length - 1];
+ if (entry && entry.node.trailingComments) {
+ var firstComment = entry.node.trailingComments[0];
+ if (firstComment && firstComment.range[0] >= metadata.end.offset) {
+ trailingComments = entry.node.trailingComments;
+ delete entry.node.trailingComments;
+ }
+ }
+ return trailingComments;
+ };
+ CommentHandler.prototype.findLeadingComments = function (metadata) {
+ var leadingComments = [];
+ var target;
+ while (this.stack.length > 0) {
+ var entry = this.stack[this.stack.length - 1];
+ if (entry && entry.start >= metadata.start.offset) {
+ target = entry.node;
+ this.stack.pop();
+ }
+ else {
+ break;
+ }
+ }
+ if (target) {
+ var count = target.leadingComments ? target.leadingComments.length : 0;
+ for (var i = count - 1; i >= 0; --i) {
+ var comment = target.leadingComments[i];
+ if (comment.range[1] <= metadata.start.offset) {
+ leadingComments.unshift(comment);
+ target.leadingComments.splice(i, 1);
+ }
+ }
+ if (target.leadingComments && target.leadingComments.length === 0) {
+ delete target.leadingComments;
+ }
+ return leadingComments;
+ }
+ for (var i = this.leading.length - 1; i >= 0; --i) {
+ var entry = this.leading[i];
+ if (entry.start <= metadata.start.offset) {
+ leadingComments.unshift(entry.comment);
+ this.leading.splice(i, 1);
+ }
+ }
+ return leadingComments;
+ };
+ CommentHandler.prototype.visitNode = function (node, metadata) {
+ if (node.type === syntax_1.Syntax.Program && node.body.length > 0) {
+ return;
+ }
+ this.insertInnerComments(node, metadata);
+ var trailingComments = this.findTrailingComments(metadata);
+ var leadingComments = this.findLeadingComments(metadata);
+ if (leadingComments.length > 0) {
+ node.leadingComments = leadingComments;
+ }
+ if (trailingComments.length > 0) {
+ node.trailingComments = trailingComments;
+ }
+ this.stack.push({
+ node: node,
+ start: metadata.start.offset
+ });
+ };
+ CommentHandler.prototype.visitComment = function (node, metadata) {
+ var type = (node.type[0] === 'L') ? 'Line' : 'Block';
+ var comment = {
+ type: type,
+ value: node.value
+ };
+ if (node.range) {
+ comment.range = node.range;
+ }
+ if (node.loc) {
+ comment.loc = node.loc;
+ }
+ this.comments.push(comment);
+ if (this.attach) {
+ var entry = {
+ comment: {
+ type: type,
+ value: node.value,
+ range: [metadata.start.offset, metadata.end.offset]
+ },
+ start: metadata.start.offset
+ };
+ if (node.loc) {
+ entry.comment.loc = node.loc;
+ }
+ node.type = type;
+ this.leading.push(entry);
+ this.trailing.push(entry);
+ }
+ };
+ CommentHandler.prototype.visit = function (node, metadata) {
+ if (node.type === 'LineComment') {
+ this.visitComment(node, metadata);
+ }
+ else if (node.type === 'BlockComment') {
+ this.visitComment(node, metadata);
+ }
+ else if (this.attach) {
+ this.visitNode(node, metadata);
+ }
+ };
+ return CommentHandler;
+ }());
+ exports.CommentHandler = CommentHandler;
+
+
+/***/ },
+/* 2 */
+/***/ function(module, exports) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.Syntax = {
+ AssignmentExpression: 'AssignmentExpression',
+ AssignmentPattern: 'AssignmentPattern',
+ ArrayExpression: 'ArrayExpression',
+ ArrayPattern: 'ArrayPattern',
+ ArrowFunctionExpression: 'ArrowFunctionExpression',
+ AwaitExpression: 'AwaitExpression',
+ BlockStatement: 'BlockStatement',
+ BinaryExpression: 'BinaryExpression',
+ BreakStatement: 'BreakStatement',
+ CallExpression: 'CallExpression',
+ CatchClause: 'CatchClause',
+ ClassBody: 'ClassBody',
+ ClassDeclaration: 'ClassDeclaration',
+ ClassExpression: 'ClassExpression',
+ ConditionalExpression: 'ConditionalExpression',
+ ContinueStatement: 'ContinueStatement',
+ DoWhileStatement: 'DoWhileStatement',
+ DebuggerStatement: 'DebuggerStatement',
+ EmptyStatement: 'EmptyStatement',
+ ExportAllDeclaration: 'ExportAllDeclaration',
+ ExportDefaultDeclaration: 'ExportDefaultDeclaration',
+ ExportNamedDeclaration: 'ExportNamedDeclaration',
+ ExportSpecifier: 'ExportSpecifier',
+ ExpressionStatement: 'ExpressionStatement',
+ ForStatement: 'ForStatement',
+ ForOfStatement: 'ForOfStatement',
+ ForInStatement: 'ForInStatement',
+ FunctionDeclaration: 'FunctionDeclaration',
+ FunctionExpression: 'FunctionExpression',
+ Identifier: 'Identifier',
+ IfStatement: 'IfStatement',
+ ImportDeclaration: 'ImportDeclaration',
+ ImportDefaultSpecifier: 'ImportDefaultSpecifier',
+ ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
+ ImportSpecifier: 'ImportSpecifier',
+ Literal: 'Literal',
+ LabeledStatement: 'LabeledStatement',
+ LogicalExpression: 'LogicalExpression',
+ MemberExpression: 'MemberExpression',
+ MetaProperty: 'MetaProperty',
+ MethodDefinition: 'MethodDefinition',
+ NewExpression: 'NewExpression',
+ ObjectExpression: 'ObjectExpression',
+ ObjectPattern: 'ObjectPattern',
+ Program: 'Program',
+ Property: 'Property',
+ RestElement: 'RestElement',
+ ReturnStatement: 'ReturnStatement',
+ SequenceExpression: 'SequenceExpression',
+ SpreadElement: 'SpreadElement',
+ Super: 'Super',
+ SwitchCase: 'SwitchCase',
+ SwitchStatement: 'SwitchStatement',
+ TaggedTemplateExpression: 'TaggedTemplateExpression',
+ TemplateElement: 'TemplateElement',
+ TemplateLiteral: 'TemplateLiteral',
+ ThisExpression: 'ThisExpression',
+ ThrowStatement: 'ThrowStatement',
+ TryStatement: 'TryStatement',
+ UnaryExpression: 'UnaryExpression',
+ UpdateExpression: 'UpdateExpression',
+ VariableDeclaration: 'VariableDeclaration',
+ VariableDeclarator: 'VariableDeclarator',
+ WhileStatement: 'WhileStatement',
+ WithStatement: 'WithStatement',
+ YieldExpression: 'YieldExpression'
+ };
+
+
+/***/ },
+/* 3 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+/* istanbul ignore next */
+ var __extends = (this && this.__extends) || (function () {
+ var extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+ return function (d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+ };
+ })();
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var character_1 = __webpack_require__(4);
+ var JSXNode = __webpack_require__(5);
+ var jsx_syntax_1 = __webpack_require__(6);
+ var Node = __webpack_require__(7);
+ var parser_1 = __webpack_require__(8);
+ var token_1 = __webpack_require__(13);
+ var xhtml_entities_1 = __webpack_require__(14);
+ token_1.TokenName[100 /* Identifier */] = 'JSXIdentifier';
+ token_1.TokenName[101 /* Text */] = 'JSXText';
+ // Fully qualified element name, e.g. <svg:path> returns "svg:path"
+ function getQualifiedElementName(elementName) {
+ var qualifiedName;
+ switch (elementName.type) {
+ case jsx_syntax_1.JSXSyntax.JSXIdentifier:
+ var id = elementName;
+ qualifiedName = id.name;
+ break;
+ case jsx_syntax_1.JSXSyntax.JSXNamespacedName:
+ var ns = elementName;
+ qualifiedName = getQualifiedElementName(ns.namespace) + ':' +
+ getQualifiedElementName(ns.name);
+ break;
+ case jsx_syntax_1.JSXSyntax.JSXMemberExpression:
+ var expr = elementName;
+ qualifiedName = getQualifiedElementName(expr.object) + '.' +
+ getQualifiedElementName(expr.property);
+ break;
+ /* istanbul ignore next */
+ default:
+ break;
+ }
+ return qualifiedName;
+ }
+ var JSXParser = (function (_super) {
+ __extends(JSXParser, _super);
+ function JSXParser(code, options, delegate) {
+ return _super.call(this, code, options, delegate) || this;
+ }
+ JSXParser.prototype.parsePrimaryExpression = function () {
+ return this.match('<') ? this.parseJSXRoot() : _super.prototype.parsePrimaryExpression.call(this);
+ };
+ JSXParser.prototype.startJSX = function () {
+ // Unwind the scanner before the lookahead token.
+ this.scanner.index = this.startMarker.index;
+ this.scanner.lineNumber = this.startMarker.line;
+ this.scanner.lineStart = this.startMarker.index - this.startMarker.column;
+ };
+ JSXParser.prototype.finishJSX = function () {
+ // Prime the next lookahead.
+ this.nextToken();
+ };
+ JSXParser.prototype.reenterJSX = function () {
+ this.startJSX();
+ this.expectJSX('}');
+ // Pop the closing '}' added from the lookahead.
+ if (this.config.tokens) {
+ this.tokens.pop();
+ }
+ };
+ JSXParser.prototype.createJSXNode = function () {
+ this.collectComments();
+ return {
+ index: this.scanner.index,
+ line: this.scanner.lineNumber,
+ column: this.scanner.index - this.scanner.lineStart
+ };
+ };
+ JSXParser.prototype.createJSXChildNode = function () {
+ return {
+ index: this.scanner.index,
+ line: this.scanner.lineNumber,
+ column: this.scanner.index - this.scanner.lineStart
+ };
+ };
+ JSXParser.prototype.scanXHTMLEntity = function (quote) {
+ var result = '&';
+ var valid = true;
+ var terminated = false;
+ var numeric = false;
+ var hex = false;
+ while (!this.scanner.eof() && valid && !terminated) {
+ var ch = this.scanner.source[this.scanner.index];
+ if (ch === quote) {
+ break;
+ }
+ terminated = (ch === ';');
+ result += ch;
+ ++this.scanner.index;
+ if (!terminated) {
+ switch (result.length) {
+ case 2:
+ // e.g. '&#123;'
+ numeric = (ch === '#');
+ break;
+ case 3:
+ if (numeric) {
+ // e.g. '&#x41;'
+ hex = (ch === 'x');
+ valid = hex || character_1.Character.isDecimalDigit(ch.charCodeAt(0));
+ numeric = numeric && !hex;
+ }
+ break;
+ default:
+ valid = valid && !(numeric && !character_1.Character.isDecimalDigit(ch.charCodeAt(0)));
+ valid = valid && !(hex && !character_1.Character.isHexDigit(ch.charCodeAt(0)));
+ break;
+ }
+ }
+ }
+ if (valid && terminated && result.length > 2) {
+ // e.g. '&#x41;' becomes just '#x41'
+ var str = result.substr(1, result.length - 2);
+ if (numeric && str.length > 1) {
+ result = String.fromCharCode(parseInt(str.substr(1), 10));
+ }
+ else if (hex && str.length > 2) {
+ result = String.fromCharCode(parseInt('0' + str.substr(1), 16));
+ }
+ else if (!numeric && !hex && xhtml_entities_1.XHTMLEntities[str]) {
+ result = xhtml_entities_1.XHTMLEntities[str];
+ }
+ }
+ return result;
+ };
+ // Scan the next JSX token. This replaces Scanner#lex when in JSX mode.
+ JSXParser.prototype.lexJSX = function () {
+ var cp = this.scanner.source.charCodeAt(this.scanner.index);
+ // < > / : = { }
+ if (cp === 60 || cp === 62 || cp === 47 || cp === 58 || cp === 61 || cp === 123 || cp === 125) {
+ var value = this.scanner.source[this.scanner.index++];
+ return {
+ type: 7 /* Punctuator */,
+ value: value,
+ lineNumber: this.scanner.lineNumber,
+ lineStart: this.scanner.lineStart,
+ start: this.scanner.index - 1,
+ end: this.scanner.index
+ };
+ }
+ // " '
+ if (cp === 34 || cp === 39) {
+ var start = this.scanner.index;
+ var quote = this.scanner.source[this.scanner.index++];
+ var str = '';
+ while (!this.scanner.eof()) {
+ var ch = this.scanner.source[this.scanner.index++];
+ if (ch === quote) {
+ break;
+ }
+ else if (ch === '&') {
+ str += this.scanXHTMLEntity(quote);
+ }
+ else {
+ str += ch;
+ }
+ }
+ return {
+ type: 8 /* StringLiteral */,
+ value: str,
+ lineNumber: this.scanner.lineNumber,
+ lineStart: this.scanner.lineStart,
+ start: start,
+ end: this.scanner.index
+ };
+ }
+ // ... or .
+ if (cp === 46) {
+ var n1 = this.scanner.source.charCodeAt(this.scanner.index + 1);
+ var n2 = this.scanner.source.charCodeAt(this.scanner.index + 2);
+ var value = (n1 === 46 && n2 === 46) ? '...' : '.';
+ var start = this.scanner.index;
+ this.scanner.index += value.length;
+ return {
+ type: 7 /* Punctuator */,
+ value: value,
+ lineNumber: this.scanner.lineNumber,
+ lineStart: this.scanner.lineStart,
+ start: start,
+ end: this.scanner.index
+ };
+ }
+ // `
+ if (cp === 96) {
+ // Only placeholder, since it will be rescanned as a real assignment expression.
+ return {
+ type: 10 /* Template */,
+ value: '',
+ lineNumber: this.scanner.lineNumber,
+ lineStart: this.scanner.lineStart,
+ start: this.scanner.index,
+ end: this.scanner.index
+ };
+ }
+ // Identifer can not contain backslash (char code 92).
+ if (character_1.Character.isIdentifierStart(cp) && (cp !== 92)) {
+ var start = this.scanner.index;
+ ++this.scanner.index;
+ while (!this.scanner.eof()) {
+ var ch = this.scanner.source.charCodeAt(this.scanner.index);
+ if (character_1.Character.isIdentifierPart(ch) && (ch !== 92)) {
+ ++this.scanner.index;
+ }
+ else if (ch === 45) {
+ // Hyphen (char code 45) can be part of an identifier.
+ ++this.scanner.index;
+ }
+ else {
+ break;
+ }
+ }
+ var id = this.scanner.source.slice(start, this.scanner.index);
+ return {
+ type: 100 /* Identifier */,
+ value: id,
+ lineNumber: this.scanner.lineNumber,
+ lineStart: this.scanner.lineStart,
+ start: start,
+ end: this.scanner.index
+ };
+ }
+ return this.scanner.lex();
+ };
+ JSXParser.prototype.nextJSXToken = function () {
+ this.collectComments();
+ this.startMarker.index = this.scanner.index;
+ this.startMarker.line = this.scanner.lineNumber;
+ this.startMarker.column = this.scanner.index - this.scanner.lineStart;
+ var token = this.lexJSX();
+ this.lastMarker.index = this.scanner.index;
+ this.lastMarker.line = this.scanner.lineNumber;
+ this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
+ if (this.config.tokens) {
+ this.tokens.push(this.convertToken(token));
+ }
+ return token;
+ };
+ JSXParser.prototype.nextJSXText = function () {
+ this.startMarker.index = this.scanner.index;
+ this.startMarker.line = this.scanner.lineNumber;
+ this.startMarker.column = this.scanner.index - this.scanner.lineStart;
+ var start = this.scanner.index;
+ var text = '';
+ while (!this.scanner.eof()) {
+ var ch = this.scanner.source[this.scanner.index];
+ if (ch === '{' || ch === '<') {
+ break;
+ }
+ ++this.scanner.index;
+ text += ch;
+ if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
+ ++this.scanner.lineNumber;
+ if (ch === '\r' && this.scanner.source[this.scanner.index] === '\n') {
+ ++this.scanner.index;
+ }
+ this.scanner.lineStart = this.scanner.index;
+ }
+ }
+ this.lastMarker.index = this.scanner.index;
+ this.lastMarker.line = this.scanner.lineNumber;
+ this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
+ var token = {
+ type: 101 /* Text */,
+ value: text,
+ lineNumber: this.scanner.lineNumber,
+ lineStart: this.scanner.lineStart,
+ start: start,
+ end: this.scanner.index
+ };
+ if ((text.length > 0) && this.config.tokens) {
+ this.tokens.push(this.convertToken(token));
+ }
+ return token;
+ };
+ JSXParser.prototype.peekJSXToken = function () {
+ var state = this.scanner.saveState();
+ this.scanner.scanComments();
+ var next = this.lexJSX();
+ this.scanner.restoreState(state);
+ return next;
+ };
+ // Expect the next JSX token to match the specified punctuator.
+ // If not, an exception will be thrown.
+ JSXParser.prototype.expectJSX = function (value) {
+ var token = this.nextJSXToken();
+ if (token.type !== 7 /* Punctuator */ || token.value !== value) {
+ this.throwUnexpectedToken(token);
+ }
+ };
+ // Return true if the next JSX token matches the specified punctuator.
+ JSXParser.prototype.matchJSX = function (value) {
+ var next = this.peekJSXToken();
+ return next.type === 7 /* Punctuator */ && next.value === value;
+ };
+ JSXParser.prototype.parseJSXIdentifier = function () {
+ var node = this.createJSXNode();
+ var token = this.nextJSXToken();
+ if (token.type !== 100 /* Identifier */) {
+ this.throwUnexpectedToken(token);
+ }
+ return this.finalize(node, new JSXNode.JSXIdentifier(token.value));
+ };
+ JSXParser.prototype.parseJSXElementName = function () {
+ var node = this.createJSXNode();
+ var elementName = this.parseJSXIdentifier();
+ if (this.matchJSX(':')) {
+ var namespace = elementName;
+ this.expectJSX(':');
+ var name_1 = this.parseJSXIdentifier();
+ elementName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_1));
+ }
+ else if (this.matchJSX('.')) {
+ while (this.matchJSX('.')) {
+ var object = elementName;
+ this.expectJSX('.');
+ var property = this.parseJSXIdentifier();
+ elementName = this.finalize(node, new JSXNode.JSXMemberExpression(object, property));
+ }
+ }
+ return elementName;
+ };
+ JSXParser.prototype.parseJSXAttributeName = function () {
+ var node = this.createJSXNode();
+ var attributeName;
+ var identifier = this.parseJSXIdentifier();
+ if (this.matchJSX(':')) {
+ var namespace = identifier;
+ this.expectJSX(':');
+ var name_2 = this.parseJSXIdentifier();
+ attributeName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_2));
+ }
+ else {
+ attributeName = identifier;
+ }
+ return attributeName;
+ };
+ JSXParser.prototype.parseJSXStringLiteralAttribute = function () {
+ var node = this.createJSXNode();
+ var token = this.nextJSXToken();
+ if (token.type !== 8 /* StringLiteral */) {
+ this.throwUnexpectedToken(token);
+ }
+ var raw = this.getTokenRaw(token);
+ return this.finalize(node, new Node.Literal(token.value, raw));
+ };
+ JSXParser.prototype.parseJSXExpressionAttribute = function () {
+ var node = this.createJSXNode();
+ this.expectJSX('{');
+ this.finishJSX();
+ if (this.match('}')) {
+ this.tolerateError('JSX attributes must only be assigned a non-empty expression');
+ }
+ var expression = this.parseAssignmentExpression();
+ this.reenterJSX();
+ return this.finalize(node, new JSXNode.JSXExpressionContainer(expression));
+ };
+ JSXParser.prototype.parseJSXAttributeValue = function () {
+ return this.matchJSX('{') ? this.parseJSXExpressionAttribute() :
+ this.matchJSX('<') ? this.parseJSXElement() : this.parseJSXStringLiteralAttribute();
+ };
+ JSXParser.prototype.parseJSXNameValueAttribute = function () {
+ var node = this.createJSXNode();
+ var name = this.parseJSXAttributeName();
+ var value = null;
+ if (this.matchJSX('=')) {
+ this.expectJSX('=');
+ value = this.parseJSXAttributeValue();
+ }
+ return this.finalize(node, new JSXNode.JSXAttribute(name, value));
+ };
+ JSXParser.prototype.parseJSXSpreadAttribute = function () {
+ var node = this.createJSXNode();
+ this.expectJSX('{');
+ this.expectJSX('...');
+ this.finishJSX();
+ var argument = this.parseAssignmentExpression();
+ this.reenterJSX();
+ return this.finalize(node, new JSXNode.JSXSpreadAttribute(argument));
+ };
+ JSXParser.prototype.parseJSXAttributes = function () {
+ var attributes = [];
+ while (!this.matchJSX('/') && !this.matchJSX('>')) {
+ var attribute = this.matchJSX('{') ? this.parseJSXSpreadAttribute() :
+ this.parseJSXNameValueAttribute();
+ attributes.push(attribute);
+ }
+ return attributes;
+ };
+ JSXParser.prototype.parseJSXOpeningElement = function () {
+ var node = this.createJSXNode();
+ this.expectJSX('<');
+ var name = this.parseJSXElementName();
+ var attributes = this.parseJSXAttributes();
+ var selfClosing = this.matchJSX('/');
+ if (selfClosing) {
+ this.expectJSX('/');
+ }
+ this.expectJSX('>');
+ return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes));
+ };
+ JSXParser.prototype.parseJSXBoundaryElement = function () {
+ var node = this.createJSXNode();
+ this.expectJSX('<');
+ if (this.matchJSX('/')) {
+ this.expectJSX('/');
+ var name_3 = this.parseJSXElementName();
+ this.expectJSX('>');
+ return this.finalize(node, new JSXNode.JSXClosingElement(name_3));
+ }
+ var name = this.parseJSXElementName();
+ var attributes = this.parseJSXAttributes();
+ var selfClosing = this.matchJSX('/');
+ if (selfClosing) {
+ this.expectJSX('/');
+ }
+ this.expectJSX('>');
+ return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes));
+ };
+ JSXParser.prototype.parseJSXEmptyExpression = function () {
+ var node = this.createJSXChildNode();
+ this.collectComments();
+ this.lastMarker.index = this.scanner.index;
+ this.lastMarker.line = this.scanner.lineNumber;
+ this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
+ return this.finalize(node, new JSXNode.JSXEmptyExpression());
+ };
+ JSXParser.prototype.parseJSXExpressionContainer = function () {
+ var node = this.createJSXNode();
+ this.expectJSX('{');
+ var expression;
+ if (this.matchJSX('}')) {
+ expression = this.parseJSXEmptyExpression();
+ this.expectJSX('}');
+ }
+ else {
+ this.finishJSX();
+ expression = this.parseAssignmentExpression();
+ this.reenterJSX();
+ }
+ return this.finalize(node, new JSXNode.JSXExpressionContainer(expression));
+ };
+ JSXParser.prototype.parseJSXChildren = function () {
+ var children = [];
+ while (!this.scanner.eof()) {
+ var node = this.createJSXChildNode();
+ var token = this.nextJSXText();
+ if (token.start < token.end) {
+ var raw = this.getTokenRaw(token);
+ var child = this.finalize(node, new JSXNode.JSXText(token.value, raw));
+ children.push(child);
+ }
+ if (this.scanner.source[this.scanner.index] === '{') {
+ var container = this.parseJSXExpressionContainer();
+ children.push(container);
+ }
+ else {
+ break;
+ }
+ }
+ return children;
+ };
+ JSXParser.prototype.parseComplexJSXElement = function (el) {
+ var stack = [];
+ while (!this.scanner.eof()) {
+ el.children = el.children.concat(this.parseJSXChildren());
+ var node = this.createJSXChildNode();
+ var element = this.parseJSXBoundaryElement();
+ if (element.type === jsx_syntax_1.JSXSyntax.JSXOpeningElement) {
+ var opening = element;
+ if (opening.selfClosing) {
+ var child = this.finalize(node, new JSXNode.JSXElement(opening, [], null));
+ el.children.push(child);
+ }
+ else {
+ stack.push(el);
+ el = { node: node, opening: opening, closing: null, children: [] };
+ }
+ }
+ if (element.type === jsx_syntax_1.JSXSyntax.JSXClosingElement) {
+ el.closing = element;
+ var open_1 = getQualifiedElementName(el.opening.name);
+ var close_1 = getQualifiedElementName(el.closing.name);
+ if (open_1 !== close_1) {
+ this.tolerateError('Expected corresponding JSX closing tag for %0', open_1);
+ }
+ if (stack.length > 0) {
+ var child = this.finalize(el.node, new JSXNode.JSXElement(el.opening, el.children, el.closing));
+ el = stack[stack.length - 1];
+ el.children.push(child);
+ stack.pop();
+ }
+ else {
+ break;
+ }
+ }
+ }
+ return el;
+ };
+ JSXParser.prototype.parseJSXElement = function () {
+ var node = this.createJSXNode();
+ var opening = this.parseJSXOpeningElement();
+ var children = [];
+ var closing = null;
+ if (!opening.selfClosing) {
+ var el = this.parseComplexJSXElement({ node: node, opening: opening, closing: closing, children: children });
+ children = el.children;
+ closing = el.closing;
+ }
+ return this.finalize(node, new JSXNode.JSXElement(opening, children, closing));
+ };
+ JSXParser.prototype.parseJSXRoot = function () {
+ // Pop the opening '<' added from the lookahead.
+ if (this.config.tokens) {
+ this.tokens.pop();
+ }
+ this.startJSX();
+ var element = this.parseJSXElement();
+ this.finishJSX();
+ return element;
+ };
+ JSXParser.prototype.isStartOfExpression = function () {
+ return _super.prototype.isStartOfExpression.call(this) || this.match('<');
+ };
+ return JSXParser;
+ }(parser_1.Parser));
+ exports.JSXParser = JSXParser;
+
+
+/***/ },
+/* 4 */
+/***/ function(module, exports) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ // See also tools/generate-unicode-regex.js.
+ var Regex = {
+ // Unicode v8.0.0 NonAsciiIdentifierStart:
+ NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,
+ // Unicode v8.0.0 NonAsciiIdentifierPart:
+ NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/
+ };
+ exports.Character = {
+ /* tslint:disable:no-bitwise */
+ fromCodePoint: function (cp) {
+ return (cp < 0x10000) ? String.fromCharCode(cp) :
+ String.fromCharCode(0xD800 + ((cp - 0x10000) >> 10)) +
+ String.fromCharCode(0xDC00 + ((cp - 0x10000) & 1023));
+ },
+ // https://tc39.github.io/ecma262/#sec-white-space
+ isWhiteSpace: function (cp) {
+ return (cp === 0x20) || (cp === 0x09) || (cp === 0x0B) || (cp === 0x0C) || (cp === 0xA0) ||
+ (cp >= 0x1680 && [0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(cp) >= 0);
+ },
+ // https://tc39.github.io/ecma262/#sec-line-terminators
+ isLineTerminator: function (cp) {
+ return (cp === 0x0A) || (cp === 0x0D) || (cp === 0x2028) || (cp === 0x2029);
+ },
+ // https://tc39.github.io/ecma262/#sec-names-and-keywords
+ isIdentifierStart: function (cp) {
+ return (cp === 0x24) || (cp === 0x5F) ||
+ (cp >= 0x41 && cp <= 0x5A) ||
+ (cp >= 0x61 && cp <= 0x7A) ||
+ (cp === 0x5C) ||
+ ((cp >= 0x80) && Regex.NonAsciiIdentifierStart.test(exports.Character.fromCodePoint(cp)));
+ },
+ isIdentifierPart: function (cp) {
+ return (cp === 0x24) || (cp === 0x5F) ||
+ (cp >= 0x41 && cp <= 0x5A) ||
+ (cp >= 0x61 && cp <= 0x7A) ||
+ (cp >= 0x30 && cp <= 0x39) ||
+ (cp === 0x5C) ||
+ ((cp >= 0x80) && Regex.NonAsciiIdentifierPart.test(exports.Character.fromCodePoint(cp)));
+ },
+ // https://tc39.github.io/ecma262/#sec-literals-numeric-literals
+ isDecimalDigit: function (cp) {
+ return (cp >= 0x30 && cp <= 0x39); // 0..9
+ },
+ isHexDigit: function (cp) {
+ return (cp >= 0x30 && cp <= 0x39) ||
+ (cp >= 0x41 && cp <= 0x46) ||
+ (cp >= 0x61 && cp <= 0x66); // a..f
+ },
+ isOctalDigit: function (cp) {
+ return (cp >= 0x30 && cp <= 0x37); // 0..7
+ }
+ };
+
+
+/***/ },
+/* 5 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var jsx_syntax_1 = __webpack_require__(6);
+ /* tslint:disable:max-classes-per-file */
+ var JSXClosingElement = (function () {
+ function JSXClosingElement(name) {
+ this.type = jsx_syntax_1.JSXSyntax.JSXClosingElement;
+ this.name = name;
+ }
+ return JSXClosingElement;
+ }());
+ exports.JSXClosingElement = JSXClosingElement;
+ var JSXElement = (function () {
+ function JSXElement(openingElement, children, closingElement) {
+ this.type = jsx_syntax_1.JSXSyntax.JSXElement;
+ this.openingElement = openingElement;
+ this.children = children;
+ this.closingElement = closingElement;
+ }
+ return JSXElement;
+ }());
+ exports.JSXElement = JSXElement;
+ var JSXEmptyExpression = (function () {
+ function JSXEmptyExpression() {
+ this.type = jsx_syntax_1.JSXSyntax.JSXEmptyExpression;
+ }
+ return JSXEmptyExpression;
+ }());
+ exports.JSXEmptyExpression = JSXEmptyExpression;
+ var JSXExpressionContainer = (function () {
+ function JSXExpressionContainer(expression) {
+ this.type = jsx_syntax_1.JSXSyntax.JSXExpressionContainer;
+ this.expression = expression;
+ }
+ return JSXExpressionContainer;
+ }());
+ exports.JSXExpressionContainer = JSXExpressionContainer;
+ var JSXIdentifier = (function () {
+ function JSXIdentifier(name) {
+ this.type = jsx_syntax_1.JSXSyntax.JSXIdentifier;
+ this.name = name;
+ }
+ return JSXIdentifier;
+ }());
+ exports.JSXIdentifier = JSXIdentifier;
+ var JSXMemberExpression = (function () {
+ function JSXMemberExpression(object, property) {
+ this.type = jsx_syntax_1.JSXSyntax.JSXMemberExpression;
+ this.object = object;
+ this.property = property;
+ }
+ return JSXMemberExpression;
+ }());
+ exports.JSXMemberExpression = JSXMemberExpression;
+ var JSXAttribute = (function () {
+ function JSXAttribute(name, value) {
+ this.type = jsx_syntax_1.JSXSyntax.JSXAttribute;
+ this.name = name;
+ this.value = value;
+ }
+ return JSXAttribute;
+ }());
+ exports.JSXAttribute = JSXAttribute;
+ var JSXNamespacedName = (function () {
+ function JSXNamespacedName(namespace, name) {
+ this.type = jsx_syntax_1.JSXSyntax.JSXNamespacedName;
+ this.namespace = namespace;
+ this.name = name;
+ }
+ return JSXNamespacedName;
+ }());
+ exports.JSXNamespacedName = JSXNamespacedName;
+ var JSXOpeningElement = (function () {
+ function JSXOpeningElement(name, selfClosing, attributes) {
+ this.type = jsx_syntax_1.JSXSyntax.JSXOpeningElement;
+ this.name = name;
+ this.selfClosing = selfClosing;
+ this.attributes = attributes;
+ }
+ return JSXOpeningElement;
+ }());
+ exports.JSXOpeningElement = JSXOpeningElement;
+ var JSXSpreadAttribute = (function () {
+ function JSXSpreadAttribute(argument) {
+ this.type = jsx_syntax_1.JSXSyntax.JSXSpreadAttribute;
+ this.argument = argument;
+ }
+ return JSXSpreadAttribute;
+ }());
+ exports.JSXSpreadAttribute = JSXSpreadAttribute;
+ var JSXText = (function () {
+ function JSXText(value, raw) {
+ this.type = jsx_syntax_1.JSXSyntax.JSXText;
+ this.value = value;
+ this.raw = raw;
+ }
+ return JSXText;
+ }());
+ exports.JSXText = JSXText;
+
+
+/***/ },
+/* 6 */
+/***/ function(module, exports) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.JSXSyntax = {
+ JSXAttribute: 'JSXAttribute',
+ JSXClosingElement: 'JSXClosingElement',
+ JSXElement: 'JSXElement',
+ JSXEmptyExpression: 'JSXEmptyExpression',
+ JSXExpressionContainer: 'JSXExpressionContainer',
+ JSXIdentifier: 'JSXIdentifier',
+ JSXMemberExpression: 'JSXMemberExpression',
+ JSXNamespacedName: 'JSXNamespacedName',
+ JSXOpeningElement: 'JSXOpeningElement',
+ JSXSpreadAttribute: 'JSXSpreadAttribute',
+ JSXText: 'JSXText'
+ };
+
+
+/***/ },
+/* 7 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var syntax_1 = __webpack_require__(2);
+ /* tslint:disable:max-classes-per-file */
+ var ArrayExpression = (function () {
+ function ArrayExpression(elements) {
+ this.type = syntax_1.Syntax.ArrayExpression;
+ this.elements = elements;
+ }
+ return ArrayExpression;
+ }());
+ exports.ArrayExpression = ArrayExpression;
+ var ArrayPattern = (function () {
+ function ArrayPattern(elements) {
+ this.type = syntax_1.Syntax.ArrayPattern;
+ this.elements = elements;
+ }
+ return ArrayPattern;
+ }());
+ exports.ArrayPattern = ArrayPattern;
+ var ArrowFunctionExpression = (function () {
+ function ArrowFunctionExpression(params, body, expression) {
+ this.type = syntax_1.Syntax.ArrowFunctionExpression;
+ this.id = null;
+ this.params = params;
+ this.body = body;
+ this.generator = false;
+ this.expression = expression;
+ this.async = false;
+ }
+ return ArrowFunctionExpression;
+ }());
+ exports.ArrowFunctionExpression = ArrowFunctionExpression;
+ var AssignmentExpression = (function () {
+ function AssignmentExpression(operator, left, right) {
+ this.type = syntax_1.Syntax.AssignmentExpression;
+ this.operator = operator;
+ this.left = left;
+ this.right = right;
+ }
+ return AssignmentExpression;
+ }());
+ exports.AssignmentExpression = AssignmentExpression;
+ var AssignmentPattern = (function () {
+ function AssignmentPattern(left, right) {
+ this.type = syntax_1.Syntax.AssignmentPattern;
+ this.left = left;
+ this.right = right;
+ }
+ return AssignmentPattern;
+ }());
+ exports.AssignmentPattern = AssignmentPattern;
+ var AsyncArrowFunctionExpression = (function () {
+ function AsyncArrowFunctionExpression(params, body, expression) {
+ this.type = syntax_1.Syntax.ArrowFunctionExpression;
+ this.id = null;
+ this.params = params;
+ this.body = body;
+ this.generator = false;
+ this.expression = expression;
+ this.async = true;
+ }
+ return AsyncArrowFunctionExpression;
+ }());
+ exports.AsyncArrowFunctionExpression = AsyncArrowFunctionExpression;
+ var AsyncFunctionDeclaration = (function () {
+ function AsyncFunctionDeclaration(id, params, body) {
+ this.type = syntax_1.Syntax.FunctionDeclaration;
+ this.id = id;
+ this.params = params;
+ this.body = body;
+ this.generator = false;
+ this.expression = false;
+ this.async = true;
+ }
+ return AsyncFunctionDeclaration;
+ }());
+ exports.AsyncFunctionDeclaration = AsyncFunctionDeclaration;
+ var AsyncFunctionExpression = (function () {
+ function AsyncFunctionExpression(id, params, body) {
+ this.type = syntax_1.Syntax.FunctionExpression;
+ this.id = id;
+ this.params = params;
+ this.body = body;
+ this.generator = false;
+ this.expression = false;
+ this.async = true;
+ }
+ return AsyncFunctionExpression;
+ }());
+ exports.AsyncFunctionExpression = AsyncFunctionExpression;
+ var AwaitExpression = (function () {
+ function AwaitExpression(argument) {
+ this.type = syntax_1.Syntax.AwaitExpression;
+ this.argument = argument;
+ }
+ return AwaitExpression;
+ }());
+ exports.AwaitExpression = AwaitExpression;
+ var BinaryExpression = (function () {
+ function BinaryExpression(operator, left, right) {
+ var logical = (operator === '||' || operator === '&&');
+ this.type = logical ? syntax_1.Syntax.LogicalExpression : syntax_1.Syntax.BinaryExpression;
+ this.operator = operator;
+ this.left = left;
+ this.right = right;
+ }
+ return BinaryExpression;
+ }());
+ exports.BinaryExpression = BinaryExpression;
+ var BlockStatement = (function () {
+ function BlockStatement(body) {
+ this.type = syntax_1.Syntax.BlockStatement;
+ this.body = body;
+ }
+ return BlockStatement;
+ }());
+ exports.BlockStatement = BlockStatement;
+ var BreakStatement = (function () {
+ function BreakStatement(label) {
+ this.type = syntax_1.Syntax.BreakStatement;
+ this.label = label;
+ }
+ return BreakStatement;
+ }());
+ exports.BreakStatement = BreakStatement;
+ var CallExpression = (function () {
+ function CallExpression(callee, args) {
+ this.type = syntax_1.Syntax.CallExpression;
+ this.callee = callee;
+ this.arguments = args;
+ }
+ return CallExpression;
+ }());
+ exports.CallExpression = CallExpression;
+ var CatchClause = (function () {
+ function CatchClause(param, body) {
+ this.type = syntax_1.Syntax.CatchClause;
+ this.param = param;
+ this.body = body;
+ }
+ return CatchClause;
+ }());
+ exports.CatchClause = CatchClause;
+ var ClassBody = (function () {
+ function ClassBody(body) {
+ this.type = syntax_1.Syntax.ClassBody;
+ this.body = body;
+ }
+ return ClassBody;
+ }());
+ exports.ClassBody = ClassBody;
+ var ClassDeclaration = (function () {
+ function ClassDeclaration(id, superClass, body) {
+ this.type = syntax_1.Syntax.ClassDeclaration;
+ this.id = id;
+ this.superClass = superClass;
+ this.body = body;
+ }
+ return ClassDeclaration;
+ }());
+ exports.ClassDeclaration = ClassDeclaration;
+ var ClassExpression = (function () {
+ function ClassExpression(id, superClass, body) {
+ this.type = syntax_1.Syntax.ClassExpression;
+ this.id = id;
+ this.superClass = superClass;
+ this.body = body;
+ }
+ return ClassExpression;
+ }());
+ exports.ClassExpression = ClassExpression;
+ var ComputedMemberExpression = (function () {
+ function ComputedMemberExpression(object, property) {
+ this.type = syntax_1.Syntax.MemberExpression;
+ this.computed = true;
+ this.object = object;
+ this.property = property;
+ }
+ return ComputedMemberExpression;
+ }());
+ exports.ComputedMemberExpression = ComputedMemberExpression;
+ var ConditionalExpression = (function () {
+ function ConditionalExpression(test, consequent, alternate) {
+ this.type = syntax_1.Syntax.ConditionalExpression;
+ this.test = test;
+ this.consequent = consequent;
+ this.alternate = alternate;
+ }
+ return ConditionalExpression;
+ }());
+ exports.ConditionalExpression = ConditionalExpression;
+ var ContinueStatement = (function () {
+ function ContinueStatement(label) {
+ this.type = syntax_1.Syntax.ContinueStatement;
+ this.label = label;
+ }
+ return ContinueStatement;
+ }());
+ exports.ContinueStatement = ContinueStatement;
+ var DebuggerStatement = (function () {
+ function DebuggerStatement() {
+ this.type = syntax_1.Syntax.DebuggerStatement;
+ }
+ return DebuggerStatement;
+ }());
+ exports.DebuggerStatement = DebuggerStatement;
+ var Directive = (function () {
+ function Directive(expression, directive) {
+ this.type = syntax_1.Syntax.ExpressionStatement;
+ this.expression = expression;
+ this.directive = directive;
+ }
+ return Directive;
+ }());
+ exports.Directive = Directive;
+ var DoWhileStatement = (function () {
+ function DoWhileStatement(body, test) {
+ this.type = syntax_1.Syntax.DoWhileStatement;
+ this.body = body;
+ this.test = test;
+ }
+ return DoWhileStatement;
+ }());
+ exports.DoWhileStatement = DoWhileStatement;
+ var EmptyStatement = (function () {
+ function EmptyStatement() {
+ this.type = syntax_1.Syntax.EmptyStatement;
+ }
+ return EmptyStatement;
+ }());
+ exports.EmptyStatement = EmptyStatement;
+ var ExportAllDeclaration = (function () {
+ function ExportAllDeclaration(source) {
+ this.type = syntax_1.Syntax.ExportAllDeclaration;
+ this.source = source;
+ }
+ return ExportAllDeclaration;
+ }());
+ exports.ExportAllDeclaration = ExportAllDeclaration;
+ var ExportDefaultDeclaration = (function () {
+ function ExportDefaultDeclaration(declaration) {
+ this.type = syntax_1.Syntax.ExportDefaultDeclaration;
+ this.declaration = declaration;
+ }
+ return ExportDefaultDeclaration;
+ }());
+ exports.ExportDefaultDeclaration = ExportDefaultDeclaration;
+ var ExportNamedDeclaration = (function () {
+ function ExportNamedDeclaration(declaration, specifiers, source) {
+ this.type = syntax_1.Syntax.ExportNamedDeclaration;
+ this.declaration = declaration;
+ this.specifiers = specifiers;
+ this.source = source;
+ }
+ return ExportNamedDeclaration;
+ }());
+ exports.ExportNamedDeclaration = ExportNamedDeclaration;
+ var ExportSpecifier = (function () {
+ function ExportSpecifier(local, exported) {
+ this.type = syntax_1.Syntax.ExportSpecifier;
+ this.exported = exported;
+ this.local = local;
+ }
+ return ExportSpecifier;
+ }());
+ exports.ExportSpecifier = ExportSpecifier;
+ var ExpressionStatement = (function () {
+ function ExpressionStatement(expression) {
+ this.type = syntax_1.Syntax.ExpressionStatement;
+ this.expression = expression;
+ }
+ return ExpressionStatement;
+ }());
+ exports.ExpressionStatement = ExpressionStatement;
+ var ForInStatement = (function () {
+ function ForInStatement(left, right, body) {
+ this.type = syntax_1.Syntax.ForInStatement;
+ this.left = left;
+ this.right = right;
+ this.body = body;
+ this.each = false;
+ }
+ return ForInStatement;
+ }());
+ exports.ForInStatement = ForInStatement;
+ var ForOfStatement = (function () {
+ function ForOfStatement(left, right, body) {
+ this.type = syntax_1.Syntax.ForOfStatement;
+ this.left = left;
+ this.right = right;
+ this.body = body;
+ }
+ return ForOfStatement;
+ }());
+ exports.ForOfStatement = ForOfStatement;
+ var ForStatement = (function () {
+ function ForStatement(init, test, update, body) {
+ this.type = syntax_1.Syntax.ForStatement;
+ this.init = init;
+ this.test = test;
+ this.update = update;
+ this.body = body;
+ }
+ return ForStatement;
+ }());
+ exports.ForStatement = ForStatement;
+ var FunctionDeclaration = (function () {
+ function FunctionDeclaration(id, params, body, generator) {
+ this.type = syntax_1.Syntax.FunctionDeclaration;
+ this.id = id;
+ this.params = params;
+ this.body = body;
+ this.generator = generator;
+ this.expression = false;
+ this.async = false;
+ }
+ return FunctionDeclaration;
+ }());
+ exports.FunctionDeclaration = FunctionDeclaration;
+ var FunctionExpression = (function () {
+ function FunctionExpression(id, params, body, generator) {
+ this.type = syntax_1.Syntax.FunctionExpression;
+ this.id = id;
+ this.params = params;
+ this.body = body;
+ this.generator = generator;
+ this.expression = false;
+ this.async = false;
+ }
+ return FunctionExpression;
+ }());
+ exports.FunctionExpression = FunctionExpression;
+ var Identifier = (function () {
+ function Identifier(name) {
+ this.type = syntax_1.Syntax.Identifier;
+ this.name = name;
+ }
+ return Identifier;
+ }());
+ exports.Identifier = Identifier;
+ var IfStatement = (function () {
+ function IfStatement(test, consequent, alternate) {
+ this.type = syntax_1.Syntax.IfStatement;
+ this.test = test;
+ this.consequent = consequent;
+ this.alternate = alternate;
+ }
+ return IfStatement;
+ }());
+ exports.IfStatement = IfStatement;
+ var ImportDeclaration = (function () {
+ function ImportDeclaration(specifiers, source) {
+ this.type = syntax_1.Syntax.ImportDeclaration;
+ this.specifiers = specifiers;
+ this.source = source;
+ }
+ return ImportDeclaration;
+ }());
+ exports.ImportDeclaration = ImportDeclaration;
+ var ImportDefaultSpecifier = (function () {
+ function ImportDefaultSpecifier(local) {
+ this.type = syntax_1.Syntax.ImportDefaultSpecifier;
+ this.local = local;
+ }
+ return ImportDefaultSpecifier;
+ }());
+ exports.ImportDefaultSpecifier = ImportDefaultSpecifier;
+ var ImportNamespaceSpecifier = (function () {
+ function ImportNamespaceSpecifier(local) {
+ this.type = syntax_1.Syntax.ImportNamespaceSpecifier;
+ this.local = local;
+ }
+ return ImportNamespaceSpecifier;
+ }());
+ exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier;
+ var ImportSpecifier = (function () {
+ function ImportSpecifier(local, imported) {
+ this.type = syntax_1.Syntax.ImportSpecifier;
+ this.local = local;
+ this.imported = imported;
+ }
+ return ImportSpecifier;
+ }());
+ exports.ImportSpecifier = ImportSpecifier;
+ var LabeledStatement = (function () {
+ function LabeledStatement(label, body) {
+ this.type = syntax_1.Syntax.LabeledStatement;
+ this.label = label;
+ this.body = body;
+ }
+ return LabeledStatement;
+ }());
+ exports.LabeledStatement = LabeledStatement;
+ var Literal = (function () {
+ function Literal(value, raw) {
+ this.type = syntax_1.Syntax.Literal;
+ this.value = value;
+ this.raw = raw;
+ }
+ return Literal;
+ }());
+ exports.Literal = Literal;
+ var MetaProperty = (function () {
+ function MetaProperty(meta, property) {
+ this.type = syntax_1.Syntax.MetaProperty;
+ this.meta = meta;
+ this.property = property;
+ }
+ return MetaProperty;
+ }());
+ exports.MetaProperty = MetaProperty;
+ var MethodDefinition = (function () {
+ function MethodDefinition(key, computed, value, kind, isStatic) {
+ this.type = syntax_1.Syntax.MethodDefinition;
+ this.key = key;
+ this.computed = computed;
+ this.value = value;
+ this.kind = kind;
+ this.static = isStatic;
+ }
+ return MethodDefinition;
+ }());
+ exports.MethodDefinition = MethodDefinition;
+ var Module = (function () {
+ function Module(body) {
+ this.type = syntax_1.Syntax.Program;
+ this.body = body;
+ this.sourceType = 'module';
+ }
+ return Module;
+ }());
+ exports.Module = Module;
+ var NewExpression = (function () {
+ function NewExpression(callee, args) {
+ this.type = syntax_1.Syntax.NewExpression;
+ this.callee = callee;
+ this.arguments = args;
+ }
+ return NewExpression;
+ }());
+ exports.NewExpression = NewExpression;
+ var ObjectExpression = (function () {
+ function ObjectExpression(properties) {
+ this.type = syntax_1.Syntax.ObjectExpression;
+ this.properties = properties;
+ }
+ return ObjectExpression;
+ }());
+ exports.ObjectExpression = ObjectExpression;
+ var ObjectPattern = (function () {
+ function ObjectPattern(properties) {
+ this.type = syntax_1.Syntax.ObjectPattern;
+ this.properties = properties;
+ }
+ return ObjectPattern;
+ }());
+ exports.ObjectPattern = ObjectPattern;
+ var Property = (function () {
+ function Property(kind, key, computed, value, method, shorthand) {
+ this.type = syntax_1.Syntax.Property;
+ this.key = key;
+ this.computed = computed;
+ this.value = value;
+ this.kind = kind;
+ this.method = method;
+ this.shorthand = shorthand;
+ }
+ return Property;
+ }());
+ exports.Property = Property;
+ var RegexLiteral = (function () {
+ function RegexLiteral(value, raw, pattern, flags) {
+ this.type = syntax_1.Syntax.Literal;
+ this.value = value;
+ this.raw = raw;
+ this.regex = { pattern: pattern, flags: flags };
+ }
+ return RegexLiteral;
+ }());
+ exports.RegexLiteral = RegexLiteral;
+ var RestElement = (function () {
+ function RestElement(argument) {
+ this.type = syntax_1.Syntax.RestElement;
+ this.argument = argument;
+ }
+ return RestElement;
+ }());
+ exports.RestElement = RestElement;
+ var ReturnStatement = (function () {
+ function ReturnStatement(argument) {
+ this.type = syntax_1.Syntax.ReturnStatement;
+ this.argument = argument;
+ }
+ return ReturnStatement;
+ }());
+ exports.ReturnStatement = ReturnStatement;
+ var Script = (function () {
+ function Script(body) {
+ this.type = syntax_1.Syntax.Program;
+ this.body = body;
+ this.sourceType = 'script';
+ }
+ return Script;
+ }());
+ exports.Script = Script;
+ var SequenceExpression = (function () {
+ function SequenceExpression(expressions) {
+ this.type = syntax_1.Syntax.SequenceExpression;
+ this.expressions = expressions;
+ }
+ return SequenceExpression;
+ }());
+ exports.SequenceExpression = SequenceExpression;
+ var SpreadElement = (function () {
+ function SpreadElement(argument) {
+ this.type = syntax_1.Syntax.SpreadElement;
+ this.argument = argument;
+ }
+ return SpreadElement;
+ }());
+ exports.SpreadElement = SpreadElement;
+ var StaticMemberExpression = (function () {
+ function StaticMemberExpression(object, property) {
+ this.type = syntax_1.Syntax.MemberExpression;
+ this.computed = false;
+ this.object = object;
+ this.property = property;
+ }
+ return StaticMemberExpression;
+ }());
+ exports.StaticMemberExpression = StaticMemberExpression;
+ var Super = (function () {
+ function Super() {
+ this.type = syntax_1.Syntax.Super;
+ }
+ return Super;
+ }());
+ exports.Super = Super;
+ var SwitchCase = (function () {
+ function SwitchCase(test, consequent) {
+ this.type = syntax_1.Syntax.SwitchCase;
+ this.test = test;
+ this.consequent = consequent;
+ }
+ return SwitchCase;
+ }());
+ exports.SwitchCase = SwitchCase;
+ var SwitchStatement = (function () {
+ function SwitchStatement(discriminant, cases) {
+ this.type = syntax_1.Syntax.SwitchStatement;
+ this.discriminant = discriminant;
+ this.cases = cases;
+ }
+ return SwitchStatement;
+ }());
+ exports.SwitchStatement = SwitchStatement;
+ var TaggedTemplateExpression = (function () {
+ function TaggedTemplateExpression(tag, quasi) {
+ this.type = syntax_1.Syntax.TaggedTemplateExpression;
+ this.tag = tag;
+ this.quasi = quasi;
+ }
+ return TaggedTemplateExpression;
+ }());
+ exports.TaggedTemplateExpression = TaggedTemplateExpression;
+ var TemplateElement = (function () {
+ function TemplateElement(value, tail) {
+ this.type = syntax_1.Syntax.TemplateElement;
+ this.value = value;
+ this.tail = tail;
+ }
+ return TemplateElement;
+ }());
+ exports.TemplateElement = TemplateElement;
+ var TemplateLiteral = (function () {
+ function TemplateLiteral(quasis, expressions) {
+ this.type = syntax_1.Syntax.TemplateLiteral;
+ this.quasis = quasis;
+ this.expressions = expressions;
+ }
+ return TemplateLiteral;
+ }());
+ exports.TemplateLiteral = TemplateLiteral;
+ var ThisExpression = (function () {
+ function ThisExpression() {
+ this.type = syntax_1.Syntax.ThisExpression;
+ }
+ return ThisExpression;
+ }());
+ exports.ThisExpression = ThisExpression;
+ var ThrowStatement = (function () {
+ function ThrowStatement(argument) {
+ this.type = syntax_1.Syntax.ThrowStatement;
+ this.argument = argument;
+ }
+ return ThrowStatement;
+ }());
+ exports.ThrowStatement = ThrowStatement;
+ var TryStatement = (function () {
+ function TryStatement(block, handler, finalizer) {
+ this.type = syntax_1.Syntax.TryStatement;
+ this.block = block;
+ this.handler = handler;
+ this.finalizer = finalizer;
+ }
+ return TryStatement;
+ }());
+ exports.TryStatement = TryStatement;
+ var UnaryExpression = (function () {
+ function UnaryExpression(operator, argument) {
+ this.type = syntax_1.Syntax.UnaryExpression;
+ this.operator = operator;
+ this.argument = argument;
+ this.prefix = true;
+ }
+ return UnaryExpression;
+ }());
+ exports.UnaryExpression = UnaryExpression;
+ var UpdateExpression = (function () {
+ function UpdateExpression(operator, argument, prefix) {
+ this.type = syntax_1.Syntax.UpdateExpression;
+ this.operator = operator;
+ this.argument = argument;
+ this.prefix = prefix;
+ }
+ return UpdateExpression;
+ }());
+ exports.UpdateExpression = UpdateExpression;
+ var VariableDeclaration = (function () {
+ function VariableDeclaration(declarations, kind) {
+ this.type = syntax_1.Syntax.VariableDeclaration;
+ this.declarations = declarations;
+ this.kind = kind;
+ }
+ return VariableDeclaration;
+ }());
+ exports.VariableDeclaration = VariableDeclaration;
+ var VariableDeclarator = (function () {
+ function VariableDeclarator(id, init) {
+ this.type = syntax_1.Syntax.VariableDeclarator;
+ this.id = id;
+ this.init = init;
+ }
+ return VariableDeclarator;
+ }());
+ exports.VariableDeclarator = VariableDeclarator;
+ var WhileStatement = (function () {
+ function WhileStatement(test, body) {
+ this.type = syntax_1.Syntax.WhileStatement;
+ this.test = test;
+ this.body = body;
+ }
+ return WhileStatement;
+ }());
+ exports.WhileStatement = WhileStatement;
+ var WithStatement = (function () {
+ function WithStatement(object, body) {
+ this.type = syntax_1.Syntax.WithStatement;
+ this.object = object;
+ this.body = body;
+ }
+ return WithStatement;
+ }());
+ exports.WithStatement = WithStatement;
+ var YieldExpression = (function () {
+ function YieldExpression(argument, delegate) {
+ this.type = syntax_1.Syntax.YieldExpression;
+ this.argument = argument;
+ this.delegate = delegate;
+ }
+ return YieldExpression;
+ }());
+ exports.YieldExpression = YieldExpression;
+
+
+/***/ },
+/* 8 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var assert_1 = __webpack_require__(9);
+ var error_handler_1 = __webpack_require__(10);
+ var messages_1 = __webpack_require__(11);
+ var Node = __webpack_require__(7);
+ var scanner_1 = __webpack_require__(12);
+ var syntax_1 = __webpack_require__(2);
+ var token_1 = __webpack_require__(13);
+ var ArrowParameterPlaceHolder = 'ArrowParameterPlaceHolder';
+ var Parser = (function () {
+ function Parser(code, options, delegate) {
+ if (options === void 0) { options = {}; }
+ this.config = {
+ range: (typeof options.range === 'boolean') && options.range,
+ loc: (typeof options.loc === 'boolean') && options.loc,
+ source: null,
+ tokens: (typeof options.tokens === 'boolean') && options.tokens,
+ comment: (typeof options.comment === 'boolean') && options.comment,
+ tolerant: (typeof options.tolerant === 'boolean') && options.tolerant
+ };
+ if (this.config.loc && options.source && options.source !== null) {
+ this.config.source = String(options.source);
+ }
+ this.delegate = delegate;
+ this.errorHandler = new error_handler_1.ErrorHandler();
+ this.errorHandler.tolerant = this.config.tolerant;
+ this.scanner = new scanner_1.Scanner(code, this.errorHandler);
+ this.scanner.trackComment = this.config.comment;
+ this.operatorPrecedence = {
+ ')': 0,
+ ';': 0,
+ ',': 0,
+ '=': 0,
+ ']': 0,
+ '||': 1,
+ '&&': 2,
+ '|': 3,
+ '^': 4,
+ '&': 5,
+ '==': 6,
+ '!=': 6,
+ '===': 6,
+ '!==': 6,
+ '<': 7,
+ '>': 7,
+ '<=': 7,
+ '>=': 7,
+ '<<': 8,
+ '>>': 8,
+ '>>>': 8,
+ '+': 9,
+ '-': 9,
+ '*': 11,
+ '/': 11,
+ '%': 11
+ };
+ this.lookahead = {
+ type: 2 /* EOF */,
+ value: '',
+ lineNumber: this.scanner.lineNumber,
+ lineStart: 0,
+ start: 0,
+ end: 0
+ };
+ this.hasLineTerminator = false;
+ this.context = {
+ isModule: false,
+ await: false,
+ allowIn: true,
+ allowStrictDirective: true,
+ allowYield: true,
+ firstCoverInitializedNameError: null,
+ isAssignmentTarget: false,
+ isBindingElement: false,
+ inFunctionBody: false,
+ inIteration: false,
+ inSwitch: false,
+ labelSet: {},
+ strict: false
+ };
+ this.tokens = [];
+ this.startMarker = {
+ index: 0,
+ line: this.scanner.lineNumber,
+ column: 0
+ };
+ this.lastMarker = {
+ index: 0,
+ line: this.scanner.lineNumber,
+ column: 0
+ };
+ this.nextToken();
+ this.lastMarker = {
+ index: this.scanner.index,
+ line: this.scanner.lineNumber,
+ column: this.scanner.index - this.scanner.lineStart
+ };
+ }
+ Parser.prototype.throwError = function (messageFormat) {
+ var values = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ values[_i - 1] = arguments[_i];
+ }
+ var args = Array.prototype.slice.call(arguments, 1);
+ var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) {
+ assert_1.assert(idx < args.length, 'Message reference must be in range');
+ return args[idx];
+ });
+ var index = this.lastMarker.index;
+ var line = this.lastMarker.line;
+ var column = this.lastMarker.column + 1;
+ throw this.errorHandler.createError(index, line, column, msg);
+ };
+ Parser.prototype.tolerateError = function (messageFormat) {
+ var values = [];
+ for (var _i = 1; _i < arguments.length; _i++) {
+ values[_i - 1] = arguments[_i];
+ }
+ var args = Array.prototype.slice.call(arguments, 1);
+ var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) {
+ assert_1.assert(idx < args.length, 'Message reference must be in range');
+ return args[idx];
+ });
+ var index = this.lastMarker.index;
+ var line = this.scanner.lineNumber;
+ var column = this.lastMarker.column + 1;
+ this.errorHandler.tolerateError(index, line, column, msg);
+ };
+ // Throw an exception because of the token.
+ Parser.prototype.unexpectedTokenError = function (token, message) {
+ var msg = message || messages_1.Messages.UnexpectedToken;
+ var value;
+ if (token) {
+ if (!message) {
+ msg = (token.type === 2 /* EOF */) ? messages_1.Messages.UnexpectedEOS :
+ (token.type === 3 /* Identifier */) ? messages_1.Messages.UnexpectedIdentifier :
+ (token.type === 6 /* NumericLiteral */) ? messages_1.Messages.UnexpectedNumber :
+ (token.type === 8 /* StringLiteral */) ? messages_1.Messages.UnexpectedString :
+ (token.type === 10 /* Template */) ? messages_1.Messages.UnexpectedTemplate :
+ messages_1.Messages.UnexpectedToken;
+ if (token.type === 4 /* Keyword */) {
+ if (this.scanner.isFutureReservedWord(token.value)) {
+ msg = messages_1.Messages.UnexpectedReserved;
+ }
+ else if (this.context.strict && this.scanner.isStrictModeReservedWord(token.value)) {
+ msg = messages_1.Messages.StrictReservedWord;
+ }
+ }
+ }
+ value = token.value;
+ }
+ else {
+ value = 'ILLEGAL';
+ }
+ msg = msg.replace('%0', value);
+ if (token && typeof token.lineNumber === 'number') {
+ var index = token.start;
+ var line = token.lineNumber;
+ var lastMarkerLineStart = this.lastMarker.index - this.lastMarker.column;
+ var column = token.start - lastMarkerLineStart + 1;
+ return this.errorHandler.createError(index, line, column, msg);
+ }
+ else {
+ var index = this.lastMarker.index;
+ var line = this.lastMarker.line;
+ var column = this.lastMarker.column + 1;
+ return this.errorHandler.createError(index, line, column, msg);
+ }
+ };
+ Parser.prototype.throwUnexpectedToken = function (token, message) {
+ throw this.unexpectedTokenError(token, message);
+ };
+ Parser.prototype.tolerateUnexpectedToken = function (token, message) {
+ this.errorHandler.tolerate(this.unexpectedTokenError(token, message));
+ };
+ Parser.prototype.collectComments = function () {
+ if (!this.config.comment) {
+ this.scanner.scanComments();
+ }
+ else {
+ var comments = this.scanner.scanComments();
+ if (comments.length > 0 && this.delegate) {
+ for (var i = 0; i < comments.length; ++i) {
+ var e = comments[i];
+ var node = void 0;
+ node = {
+ type: e.multiLine ? 'BlockComment' : 'LineComment',
+ value: this.scanner.source.slice(e.slice[0], e.slice[1])
+ };
+ if (this.config.range) {
+ node.range = e.range;
+ }
+ if (this.config.loc) {
+ node.loc = e.loc;
+ }
+ var metadata = {
+ start: {
+ line: e.loc.start.line,
+ column: e.loc.start.column,
+ offset: e.range[0]
+ },
+ end: {
+ line: e.loc.end.line,
+ column: e.loc.end.column,
+ offset: e.range[1]
+ }
+ };
+ this.delegate(node, metadata);
+ }
+ }
+ }
+ };
+ // From internal representation to an external structure
+ Parser.prototype.getTokenRaw = function (token) {
+ return this.scanner.source.slice(token.start, token.end);
+ };
+ Parser.prototype.convertToken = function (token) {
+ var t = {
+ type: token_1.TokenName[token.type],
+ value: this.getTokenRaw(token)
+ };
+ if (this.config.range) {
+ t.range = [token.start, token.end];
+ }
+ if (this.config.loc) {
+ t.loc = {
+ start: {
+ line: this.startMarker.line,
+ column: this.startMarker.column
+ },
+ end: {
+ line: this.scanner.lineNumber,
+ column: this.scanner.index - this.scanner.lineStart
+ }
+ };
+ }
+ if (token.type === 9 /* RegularExpression */) {
+ var pattern = token.pattern;
+ var flags = token.flags;
+ t.regex = { pattern: pattern, flags: flags };
+ }
+ return t;
+ };
+ Parser.prototype.nextToken = function () {
+ var token = this.lookahead;
+ this.lastMarker.index = this.scanner.index;
+ this.lastMarker.line = this.scanner.lineNumber;
+ this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
+ this.collectComments();
+ if (this.scanner.index !== this.startMarker.index) {
+ this.startMarker.index = this.scanner.index;
+ this.startMarker.line = this.scanner.lineNumber;
+ this.startMarker.column = this.scanner.index - this.scanner.lineStart;
+ }
+ var next = this.scanner.lex();
+ this.hasLineTerminator = (token.lineNumber !== next.lineNumber);
+ if (next && this.context.strict && next.type === 3 /* Identifier */) {
+ if (this.scanner.isStrictModeReservedWord(next.value)) {
+ next.type = 4 /* Keyword */;
+ }
+ }
+ this.lookahead = next;
+ if (this.config.tokens && next.type !== 2 /* EOF */) {
+ this.tokens.push(this.convertToken(next));
+ }
+ return token;
+ };
+ Parser.prototype.nextRegexToken = function () {
+ this.collectComments();
+ var token = this.scanner.scanRegExp();
+ if (this.config.tokens) {
+ // Pop the previous token, '/' or '/='
+ // This is added from the lookahead token.
+ this.tokens.pop();
+ this.tokens.push(this.convertToken(token));
+ }
+ // Prime the next lookahead.
+ this.lookahead = token;
+ this.nextToken();
+ return token;
+ };
+ Parser.prototype.createNode = function () {
+ return {
+ index: this.startMarker.index,
+ line: this.startMarker.line,
+ column: this.startMarker.column
+ };
+ };
+ Parser.prototype.startNode = function (token) {
+ return {
+ index: token.start,
+ line: token.lineNumber,
+ column: token.start - token.lineStart
+ };
+ };
+ Parser.prototype.finalize = function (marker, node) {
+ if (this.config.range) {
+ node.range = [marker.index, this.lastMarker.index];
+ }
+ if (this.config.loc) {
+ node.loc = {
+ start: {
+ line: marker.line,
+ column: marker.column,
+ },
+ end: {
+ line: this.lastMarker.line,
+ column: this.lastMarker.column
+ }
+ };
+ if (this.config.source) {
+ node.loc.source = this.config.source;
+ }
+ }
+ if (this.delegate) {
+ var metadata = {
+ start: {
+ line: marker.line,
+ column: marker.column,
+ offset: marker.index
+ },
+ end: {
+ line: this.lastMarker.line,
+ column: this.lastMarker.column,
+ offset: this.lastMarker.index
+ }
+ };
+ this.delegate(node, metadata);
+ }
+ return node;
+ };
+ // Expect the next token to match the specified punctuator.
+ // If not, an exception will be thrown.
+ Parser.prototype.expect = function (value) {
+ var token = this.nextToken();
+ if (token.type !== 7 /* Punctuator */ || token.value !== value) {
+ this.throwUnexpectedToken(token);
+ }
+ };
+ // Quietly expect a comma when in tolerant mode, otherwise delegates to expect().
+ Parser.prototype.expectCommaSeparator = function () {
+ if (this.config.tolerant) {
+ var token = this.lookahead;
+ if (token.type === 7 /* Punctuator */ && token.value === ',') {
+ this.nextToken();
+ }
+ else if (token.type === 7 /* Punctuator */ && token.value === ';') {
+ this.nextToken();
+ this.tolerateUnexpectedToken(token);
+ }
+ else {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.UnexpectedToken);
+ }
+ }
+ else {
+ this.expect(',');
+ }
+ };
+ // Expect the next token to match the specified keyword.
+ // If not, an exception will be thrown.
+ Parser.prototype.expectKeyword = function (keyword) {
+ var token = this.nextToken();
+ if (token.type !== 4 /* Keyword */ || token.value !== keyword) {
+ this.throwUnexpectedToken(token);
+ }
+ };
+ // Return true if the next token matches the specified punctuator.
+ Parser.prototype.match = function (value) {
+ return this.lookahead.type === 7 /* Punctuator */ && this.lookahead.value === value;
+ };
+ // Return true if the next token matches the specified keyword
+ Parser.prototype.matchKeyword = function (keyword) {
+ return this.lookahead.type === 4 /* Keyword */ && this.lookahead.value === keyword;
+ };
+ // Return true if the next token matches the specified contextual keyword
+ // (where an identifier is sometimes a keyword depending on the context)
+ Parser.prototype.matchContextualKeyword = function (keyword) {
+ return this.lookahead.type === 3 /* Identifier */ && this.lookahead.value === keyword;
+ };
+ // Return true if the next token is an assignment operator
+ Parser.prototype.matchAssign = function () {
+ if (this.lookahead.type !== 7 /* Punctuator */) {
+ return false;
+ }
+ var op = this.lookahead.value;
+ return op === '=' ||
+ op === '*=' ||
+ op === '**=' ||
+ op === '/=' ||
+ op === '%=' ||
+ op === '+=' ||
+ op === '-=' ||
+ op === '<<=' ||
+ op === '>>=' ||
+ op === '>>>=' ||
+ op === '&=' ||
+ op === '^=' ||
+ op === '|=';
+ };
+ // Cover grammar support.
+ //
+ // When an assignment expression position starts with an left parenthesis, the determination of the type
+ // of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead)
+ // or the first comma. This situation also defers the determination of all the expressions nested in the pair.
+ //
+ // There are three productions that can be parsed in a parentheses pair that needs to be determined
+ // after the outermost pair is closed. They are:
+ //
+ // 1. AssignmentExpression
+ // 2. BindingElements
+ // 3. AssignmentTargets
+ //
+ // In order to avoid exponential backtracking, we use two flags to denote if the production can be
+ // binding element or assignment target.
+ //
+ // The three productions have the relationship:
+ //
+ // BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression
+ //
+ // with a single exception that CoverInitializedName when used directly in an Expression, generates
+ // an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the
+ // first usage of CoverInitializedName and report it when we reached the end of the parentheses pair.
+ //
+ // isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not
+ // effect the current flags. This means the production the parser parses is only used as an expression. Therefore
+ // the CoverInitializedName check is conducted.
+ //
+ // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates
+ // the flags outside of the parser. This means the production the parser parses is used as a part of a potential
+ // pattern. The CoverInitializedName check is deferred.
+ Parser.prototype.isolateCoverGrammar = function (parseFunction) {
+ var previousIsBindingElement = this.context.isBindingElement;
+ var previousIsAssignmentTarget = this.context.isAssignmentTarget;
+ var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError;
+ this.context.isBindingElement = true;
+ this.context.isAssignmentTarget = true;
+ this.context.firstCoverInitializedNameError = null;
+ var result = parseFunction.call(this);
+ if (this.context.firstCoverInitializedNameError !== null) {
+ this.throwUnexpectedToken(this.context.firstCoverInitializedNameError);
+ }
+ this.context.isBindingElement = previousIsBindingElement;
+ this.context.isAssignmentTarget = previousIsAssignmentTarget;
+ this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError;
+ return result;
+ };
+ Parser.prototype.inheritCoverGrammar = function (parseFunction) {
+ var previousIsBindingElement = this.context.isBindingElement;
+ var previousIsAssignmentTarget = this.context.isAssignmentTarget;
+ var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError;
+ this.context.isBindingElement = true;
+ this.context.isAssignmentTarget = true;
+ this.context.firstCoverInitializedNameError = null;
+ var result = parseFunction.call(this);
+ this.context.isBindingElement = this.context.isBindingElement && previousIsBindingElement;
+ this.context.isAssignmentTarget = this.context.isAssignmentTarget && previousIsAssignmentTarget;
+ this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError || this.context.firstCoverInitializedNameError;
+ return result;
+ };
+ Parser.prototype.consumeSemicolon = function () {
+ if (this.match(';')) {
+ this.nextToken();
+ }
+ else if (!this.hasLineTerminator) {
+ if (this.lookahead.type !== 2 /* EOF */ && !this.match('}')) {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ this.lastMarker.index = this.startMarker.index;
+ this.lastMarker.line = this.startMarker.line;
+ this.lastMarker.column = this.startMarker.column;
+ }
+ };
+ // https://tc39.github.io/ecma262/#sec-primary-expression
+ Parser.prototype.parsePrimaryExpression = function () {
+ var node = this.createNode();
+ var expr;
+ var token, raw;
+ switch (this.lookahead.type) {
+ case 3 /* Identifier */:
+ if ((this.context.isModule || this.context.await) && this.lookahead.value === 'await') {
+ this.tolerateUnexpectedToken(this.lookahead);
+ }
+ expr = this.matchAsyncFunction() ? this.parseFunctionExpression() : this.finalize(node, new Node.Identifier(this.nextToken().value));
+ break;
+ case 6 /* NumericLiteral */:
+ case 8 /* StringLiteral */:
+ if (this.context.strict && this.lookahead.octal) {
+ this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.StrictOctalLiteral);
+ }
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ token = this.nextToken();
+ raw = this.getTokenRaw(token);
+ expr = this.finalize(node, new Node.Literal(token.value, raw));
+ break;
+ case 1 /* BooleanLiteral */:
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ token = this.nextToken();
+ raw = this.getTokenRaw(token);
+ expr = this.finalize(node, new Node.Literal(token.value === 'true', raw));
+ break;
+ case 5 /* NullLiteral */:
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ token = this.nextToken();
+ raw = this.getTokenRaw(token);
+ expr = this.finalize(node, new Node.Literal(null, raw));
+ break;
+ case 10 /* Template */:
+ expr = this.parseTemplateLiteral();
+ break;
+ case 7 /* Punctuator */:
+ switch (this.lookahead.value) {
+ case '(':
+ this.context.isBindingElement = false;
+ expr = this.inheritCoverGrammar(this.parseGroupExpression);
+ break;
+ case '[':
+ expr = this.inheritCoverGrammar(this.parseArrayInitializer);
+ break;
+ case '{':
+ expr = this.inheritCoverGrammar(this.parseObjectInitializer);
+ break;
+ case '/':
+ case '/=':
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ this.scanner.index = this.startMarker.index;
+ token = this.nextRegexToken();
+ raw = this.getTokenRaw(token);
+ expr = this.finalize(node, new Node.RegexLiteral(token.regex, raw, token.pattern, token.flags));
+ break;
+ default:
+ expr = this.throwUnexpectedToken(this.nextToken());
+ }
+ break;
+ case 4 /* Keyword */:
+ if (!this.context.strict && this.context.allowYield && this.matchKeyword('yield')) {
+ expr = this.parseIdentifierName();
+ }
+ else if (!this.context.strict && this.matchKeyword('let')) {
+ expr = this.finalize(node, new Node.Identifier(this.nextToken().value));
+ }
+ else {
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ if (this.matchKeyword('function')) {
+ expr = this.parseFunctionExpression();
+ }
+ else if (this.matchKeyword('this')) {
+ this.nextToken();
+ expr = this.finalize(node, new Node.ThisExpression());
+ }
+ else if (this.matchKeyword('class')) {
+ expr = this.parseClassExpression();
+ }
+ else {
+ expr = this.throwUnexpectedToken(this.nextToken());
+ }
+ }
+ break;
+ default:
+ expr = this.throwUnexpectedToken(this.nextToken());
+ }
+ return expr;
+ };
+ // https://tc39.github.io/ecma262/#sec-array-initializer
+ Parser.prototype.parseSpreadElement = function () {
+ var node = this.createNode();
+ this.expect('...');
+ var arg = this.inheritCoverGrammar(this.parseAssignmentExpression);
+ return this.finalize(node, new Node.SpreadElement(arg));
+ };
+ Parser.prototype.parseArrayInitializer = function () {
+ var node = this.createNode();
+ var elements = [];
+ this.expect('[');
+ while (!this.match(']')) {
+ if (this.match(',')) {
+ this.nextToken();
+ elements.push(null);
+ }
+ else if (this.match('...')) {
+ var element = this.parseSpreadElement();
+ if (!this.match(']')) {
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ this.expect(',');
+ }
+ elements.push(element);
+ }
+ else {
+ elements.push(this.inheritCoverGrammar(this.parseAssignmentExpression));
+ if (!this.match(']')) {
+ this.expect(',');
+ }
+ }
+ }
+ this.expect(']');
+ return this.finalize(node, new Node.ArrayExpression(elements));
+ };
+ // https://tc39.github.io/ecma262/#sec-object-initializer
+ Parser.prototype.parsePropertyMethod = function (params) {
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ var previousStrict = this.context.strict;
+ var previousAllowStrictDirective = this.context.allowStrictDirective;
+ this.context.allowStrictDirective = params.simple;
+ var body = this.isolateCoverGrammar(this.parseFunctionSourceElements);
+ if (this.context.strict && params.firstRestricted) {
+ this.tolerateUnexpectedToken(params.firstRestricted, params.message);
+ }
+ if (this.context.strict && params.stricted) {
+ this.tolerateUnexpectedToken(params.stricted, params.message);
+ }
+ this.context.strict = previousStrict;
+ this.context.allowStrictDirective = previousAllowStrictDirective;
+ return body;
+ };
+ Parser.prototype.parsePropertyMethodFunction = function () {
+ var isGenerator = false;
+ var node = this.createNode();
+ var previousAllowYield = this.context.allowYield;
+ this.context.allowYield = false;
+ var params = this.parseFormalParameters();
+ var method = this.parsePropertyMethod(params);
+ this.context.allowYield = previousAllowYield;
+ return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator));
+ };
+ Parser.prototype.parsePropertyMethodAsyncFunction = function () {
+ var node = this.createNode();
+ var previousAllowYield = this.context.allowYield;
+ var previousAwait = this.context.await;
+ this.context.allowYield = false;
+ this.context.await = true;
+ var params = this.parseFormalParameters();
+ var method = this.parsePropertyMethod(params);
+ this.context.allowYield = previousAllowYield;
+ this.context.await = previousAwait;
+ return this.finalize(node, new Node.AsyncFunctionExpression(null, params.params, method));
+ };
+ Parser.prototype.parseObjectPropertyKey = function () {
+ var node = this.createNode();
+ var token = this.nextToken();
+ var key;
+ switch (token.type) {
+ case 8 /* StringLiteral */:
+ case 6 /* NumericLiteral */:
+ if (this.context.strict && token.octal) {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.StrictOctalLiteral);
+ }
+ var raw = this.getTokenRaw(token);
+ key = this.finalize(node, new Node.Literal(token.value, raw));
+ break;
+ case 3 /* Identifier */:
+ case 1 /* BooleanLiteral */:
+ case 5 /* NullLiteral */:
+ case 4 /* Keyword */:
+ key = this.finalize(node, new Node.Identifier(token.value));
+ break;
+ case 7 /* Punctuator */:
+ if (token.value === '[') {
+ key = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ this.expect(']');
+ }
+ else {
+ key = this.throwUnexpectedToken(token);
+ }
+ break;
+ default:
+ key = this.throwUnexpectedToken(token);
+ }
+ return key;
+ };
+ Parser.prototype.isPropertyKey = function (key, value) {
+ return (key.type === syntax_1.Syntax.Identifier && key.name === value) ||
+ (key.type === syntax_1.Syntax.Literal && key.value === value);
+ };
+ Parser.prototype.parseObjectProperty = function (hasProto) {
+ var node = this.createNode();
+ var token = this.lookahead;
+ var kind;
+ var key = null;
+ var value = null;
+ var computed = false;
+ var method = false;
+ var shorthand = false;
+ var isAsync = false;
+ if (token.type === 3 /* Identifier */) {
+ var id = token.value;
+ this.nextToken();
+ computed = this.match('[');
+ isAsync = !this.hasLineTerminator && (id === 'async') &&
+ !this.match(':') && !this.match('(') && !this.match('*');
+ key = isAsync ? this.parseObjectPropertyKey() : this.finalize(node, new Node.Identifier(id));
+ }
+ else if (this.match('*')) {
+ this.nextToken();
+ }
+ else {
+ computed = this.match('[');
+ key = this.parseObjectPropertyKey();
+ }
+ var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead);
+ if (token.type === 3 /* Identifier */ && !isAsync && token.value === 'get' && lookaheadPropertyKey) {
+ kind = 'get';
+ computed = this.match('[');
+ key = this.parseObjectPropertyKey();
+ this.context.allowYield = false;
+ value = this.parseGetterMethod();
+ }
+ else if (token.type === 3 /* Identifier */ && !isAsync && token.value === 'set' && lookaheadPropertyKey) {
+ kind = 'set';
+ computed = this.match('[');
+ key = this.parseObjectPropertyKey();
+ value = this.parseSetterMethod();
+ }
+ else if (token.type === 7 /* Punctuator */ && token.value === '*' && lookaheadPropertyKey) {
+ kind = 'init';
+ computed = this.match('[');
+ key = this.parseObjectPropertyKey();
+ value = this.parseGeneratorMethod();
+ method = true;
+ }
+ else {
+ if (!key) {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ kind = 'init';
+ if (this.match(':') && !isAsync) {
+ if (!computed && this.isPropertyKey(key, '__proto__')) {
+ if (hasProto.value) {
+ this.tolerateError(messages_1.Messages.DuplicateProtoProperty);
+ }
+ hasProto.value = true;
+ }
+ this.nextToken();
+ value = this.inheritCoverGrammar(this.parseAssignmentExpression);
+ }
+ else if (this.match('(')) {
+ value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction();
+ method = true;
+ }
+ else if (token.type === 3 /* Identifier */) {
+ var id = this.finalize(node, new Node.Identifier(token.value));
+ if (this.match('=')) {
+ this.context.firstCoverInitializedNameError = this.lookahead;
+ this.nextToken();
+ shorthand = true;
+ var init = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ value = this.finalize(node, new Node.AssignmentPattern(id, init));
+ }
+ else {
+ shorthand = true;
+ value = id;
+ }
+ }
+ else {
+ this.throwUnexpectedToken(this.nextToken());
+ }
+ }
+ return this.finalize(node, new Node.Property(kind, key, computed, value, method, shorthand));
+ };
+ Parser.prototype.parseObjectInitializer = function () {
+ var node = this.createNode();
+ this.expect('{');
+ var properties = [];
+ var hasProto = { value: false };
+ while (!this.match('}')) {
+ properties.push(this.parseObjectProperty(hasProto));
+ if (!this.match('}')) {
+ this.expectCommaSeparator();
+ }
+ }
+ this.expect('}');
+ return this.finalize(node, new Node.ObjectExpression(properties));
+ };
+ // https://tc39.github.io/ecma262/#sec-template-literals
+ Parser.prototype.parseTemplateHead = function () {
+ assert_1.assert(this.lookahead.head, 'Template literal must start with a template head');
+ var node = this.createNode();
+ var token = this.nextToken();
+ var raw = token.value;
+ var cooked = token.cooked;
+ return this.finalize(node, new Node.TemplateElement({ raw: raw, cooked: cooked }, token.tail));
+ };
+ Parser.prototype.parseTemplateElement = function () {
+ if (this.lookahead.type !== 10 /* Template */) {
+ this.throwUnexpectedToken();
+ }
+ var node = this.createNode();
+ var token = this.nextToken();
+ var raw = token.value;
+ var cooked = token.cooked;
+ return this.finalize(node, new Node.TemplateElement({ raw: raw, cooked: cooked }, token.tail));
+ };
+ Parser.prototype.parseTemplateLiteral = function () {
+ var node = this.createNode();
+ var expressions = [];
+ var quasis = [];
+ var quasi = this.parseTemplateHead();
+ quasis.push(quasi);
+ while (!quasi.tail) {
+ expressions.push(this.parseExpression());
+ quasi = this.parseTemplateElement();
+ quasis.push(quasi);
+ }
+ return this.finalize(node, new Node.TemplateLiteral(quasis, expressions));
+ };
+ // https://tc39.github.io/ecma262/#sec-grouping-operator
+ Parser.prototype.reinterpretExpressionAsPattern = function (expr) {
+ switch (expr.type) {
+ case syntax_1.Syntax.Identifier:
+ case syntax_1.Syntax.MemberExpression:
+ case syntax_1.Syntax.RestElement:
+ case syntax_1.Syntax.AssignmentPattern:
+ break;
+ case syntax_1.Syntax.SpreadElement:
+ expr.type = syntax_1.Syntax.RestElement;
+ this.reinterpretExpressionAsPattern(expr.argument);
+ break;
+ case syntax_1.Syntax.ArrayExpression:
+ expr.type = syntax_1.Syntax.ArrayPattern;
+ for (var i = 0; i < expr.elements.length; i++) {
+ if (expr.elements[i] !== null) {
+ this.reinterpretExpressionAsPattern(expr.elements[i]);
+ }
+ }
+ break;
+ case syntax_1.Syntax.ObjectExpression:
+ expr.type = syntax_1.Syntax.ObjectPattern;
+ for (var i = 0; i < expr.properties.length; i++) {
+ this.reinterpretExpressionAsPattern(expr.properties[i].value);
+ }
+ break;
+ case syntax_1.Syntax.AssignmentExpression:
+ expr.type = syntax_1.Syntax.AssignmentPattern;
+ delete expr.operator;
+ this.reinterpretExpressionAsPattern(expr.left);
+ break;
+ default:
+ // Allow other node type for tolerant parsing.
+ break;
+ }
+ };
+ Parser.prototype.parseGroupExpression = function () {
+ var expr;
+ this.expect('(');
+ if (this.match(')')) {
+ this.nextToken();
+ if (!this.match('=>')) {
+ this.expect('=>');
+ }
+ expr = {
+ type: ArrowParameterPlaceHolder,
+ params: [],
+ async: false
+ };
+ }
+ else {
+ var startToken = this.lookahead;
+ var params = [];
+ if (this.match('...')) {
+ expr = this.parseRestElement(params);
+ this.expect(')');
+ if (!this.match('=>')) {
+ this.expect('=>');
+ }
+ expr = {
+ type: ArrowParameterPlaceHolder,
+ params: [expr],
+ async: false
+ };
+ }
+ else {
+ var arrow = false;
+ this.context.isBindingElement = true;
+ expr = this.inheritCoverGrammar(this.parseAssignmentExpression);
+ if (this.match(',')) {
+ var expressions = [];
+ this.context.isAssignmentTarget = false;
+ expressions.push(expr);
+ while (this.lookahead.type !== 2 /* EOF */) {
+ if (!this.match(',')) {
+ break;
+ }
+ this.nextToken();
+ if (this.match(')')) {
+ this.nextToken();
+ for (var i = 0; i < expressions.length; i++) {
+ this.reinterpretExpressionAsPattern(expressions[i]);
+ }
+ arrow = true;
+ expr = {
+ type: ArrowParameterPlaceHolder,
+ params: expressions,
+ async: false
+ };
+ }
+ else if (this.match('...')) {
+ if (!this.context.isBindingElement) {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ expressions.push(this.parseRestElement(params));
+ this.expect(')');
+ if (!this.match('=>')) {
+ this.expect('=>');
+ }
+ this.context.isBindingElement = false;
+ for (var i = 0; i < expressions.length; i++) {
+ this.reinterpretExpressionAsPattern(expressions[i]);
+ }
+ arrow = true;
+ expr = {
+ type: ArrowParameterPlaceHolder,
+ params: expressions,
+ async: false
+ };
+ }
+ else {
+ expressions.push(this.inheritCoverGrammar(this.parseAssignmentExpression));
+ }
+ if (arrow) {
+ break;
+ }
+ }
+ if (!arrow) {
+ expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions));
+ }
+ }
+ if (!arrow) {
+ this.expect(')');
+ if (this.match('=>')) {
+ if (expr.type === syntax_1.Syntax.Identifier && expr.name === 'yield') {
+ arrow = true;
+ expr = {
+ type: ArrowParameterPlaceHolder,
+ params: [expr],
+ async: false
+ };
+ }
+ if (!arrow) {
+ if (!this.context.isBindingElement) {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ if (expr.type === syntax_1.Syntax.SequenceExpression) {
+ for (var i = 0; i < expr.expressions.length; i++) {
+ this.reinterpretExpressionAsPattern(expr.expressions[i]);
+ }
+ }
+ else {
+ this.reinterpretExpressionAsPattern(expr);
+ }
+ var parameters = (expr.type === syntax_1.Syntax.SequenceExpression ? expr.expressions : [expr]);
+ expr = {
+ type: ArrowParameterPlaceHolder,
+ params: parameters,
+ async: false
+ };
+ }
+ }
+ this.context.isBindingElement = false;
+ }
+ }
+ }
+ return expr;
+ };
+ // https://tc39.github.io/ecma262/#sec-left-hand-side-expressions
+ Parser.prototype.parseArguments = function () {
+ this.expect('(');
+ var args = [];
+ if (!this.match(')')) {
+ while (true) {
+ var expr = this.match('...') ? this.parseSpreadElement() :
+ this.isolateCoverGrammar(this.parseAssignmentExpression);
+ args.push(expr);
+ if (this.match(')')) {
+ break;
+ }
+ this.expectCommaSeparator();
+ if (this.match(')')) {
+ break;
+ }
+ }
+ }
+ this.expect(')');
+ return args;
+ };
+ Parser.prototype.isIdentifierName = function (token) {
+ return token.type === 3 /* Identifier */ ||
+ token.type === 4 /* Keyword */ ||
+ token.type === 1 /* BooleanLiteral */ ||
+ token.type === 5 /* NullLiteral */;
+ };
+ Parser.prototype.parseIdentifierName = function () {
+ var node = this.createNode();
+ var token = this.nextToken();
+ if (!this.isIdentifierName(token)) {
+ this.throwUnexpectedToken(token);
+ }
+ return this.finalize(node, new Node.Identifier(token.value));
+ };
+ Parser.prototype.parseNewExpression = function () {
+ var node = this.createNode();
+ var id = this.parseIdentifierName();
+ assert_1.assert(id.name === 'new', 'New expression must start with `new`');
+ var expr;
+ if (this.match('.')) {
+ this.nextToken();
+ if (this.lookahead.type === 3 /* Identifier */ && this.context.inFunctionBody && this.lookahead.value === 'target') {
+ var property = this.parseIdentifierName();
+ expr = new Node.MetaProperty(id, property);
+ }
+ else {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ }
+ else {
+ var callee = this.isolateCoverGrammar(this.parseLeftHandSideExpression);
+ var args = this.match('(') ? this.parseArguments() : [];
+ expr = new Node.NewExpression(callee, args);
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ }
+ return this.finalize(node, expr);
+ };
+ Parser.prototype.parseAsyncArgument = function () {
+ var arg = this.parseAssignmentExpression();
+ this.context.firstCoverInitializedNameError = null;
+ return arg;
+ };
+ Parser.prototype.parseAsyncArguments = function () {
+ this.expect('(');
+ var args = [];
+ if (!this.match(')')) {
+ while (true) {
+ var expr = this.match('...') ? this.parseSpreadElement() :
+ this.isolateCoverGrammar(this.parseAsyncArgument);
+ args.push(expr);
+ if (this.match(')')) {
+ break;
+ }
+ this.expectCommaSeparator();
+ if (this.match(')')) {
+ break;
+ }
+ }
+ }
+ this.expect(')');
+ return args;
+ };
+ Parser.prototype.parseLeftHandSideExpressionAllowCall = function () {
+ var startToken = this.lookahead;
+ var maybeAsync = this.matchContextualKeyword('async');
+ var previousAllowIn = this.context.allowIn;
+ this.context.allowIn = true;
+ var expr;
+ if (this.matchKeyword('super') && this.context.inFunctionBody) {
+ expr = this.createNode();
+ this.nextToken();
+ expr = this.finalize(expr, new Node.Super());
+ if (!this.match('(') && !this.match('.') && !this.match('[')) {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ }
+ else {
+ expr = this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression);
+ }
+ while (true) {
+ if (this.match('.')) {
+ this.context.isBindingElement = false;
+ this.context.isAssignmentTarget = true;
+ this.expect('.');
+ var property = this.parseIdentifierName();
+ expr = this.finalize(this.startNode(startToken), new Node.StaticMemberExpression(expr, property));
+ }
+ else if (this.match('(')) {
+ var asyncArrow = maybeAsync && (startToken.lineNumber === this.lookahead.lineNumber);
+ this.context.isBindingElement = false;
+ this.context.isAssignmentTarget = false;
+ var args = asyncArrow ? this.parseAsyncArguments() : this.parseArguments();
+ expr = this.finalize(this.startNode(startToken), new Node.CallExpression(expr, args));
+ if (asyncArrow && this.match('=>')) {
+ for (var i = 0; i < args.length; ++i) {
+ this.reinterpretExpressionAsPattern(args[i]);
+ }
+ expr = {
+ type: ArrowParameterPlaceHolder,
+ params: args,
+ async: true
+ };
+ }
+ }
+ else if (this.match('[')) {
+ this.context.isBindingElement = false;
+ this.context.isAssignmentTarget = true;
+ this.expect('[');
+ var property = this.isolateCoverGrammar(this.parseExpression);
+ this.expect(']');
+ expr = this.finalize(this.startNode(startToken), new Node.ComputedMemberExpression(expr, property));
+ }
+ else if (this.lookahead.type === 10 /* Template */ && this.lookahead.head) {
+ var quasi = this.parseTemplateLiteral();
+ expr = this.finalize(this.startNode(startToken), new Node.TaggedTemplateExpression(expr, quasi));
+ }
+ else {
+ break;
+ }
+ }
+ this.context.allowIn = previousAllowIn;
+ return expr;
+ };
+ Parser.prototype.parseSuper = function () {
+ var node = this.createNode();
+ this.expectKeyword('super');
+ if (!this.match('[') && !this.match('.')) {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ return this.finalize(node, new Node.Super());
+ };
+ Parser.prototype.parseLeftHandSideExpression = function () {
+ assert_1.assert(this.context.allowIn, 'callee of new expression always allow in keyword.');
+ var node = this.startNode(this.lookahead);
+ var expr = (this.matchKeyword('super') && this.context.inFunctionBody) ? this.parseSuper() :
+ this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression);
+ while (true) {
+ if (this.match('[')) {
+ this.context.isBindingElement = false;
+ this.context.isAssignmentTarget = true;
+ this.expect('[');
+ var property = this.isolateCoverGrammar(this.parseExpression);
+ this.expect(']');
+ expr = this.finalize(node, new Node.ComputedMemberExpression(expr, property));
+ }
+ else if (this.match('.')) {
+ this.context.isBindingElement = false;
+ this.context.isAssignmentTarget = true;
+ this.expect('.');
+ var property = this.parseIdentifierName();
+ expr = this.finalize(node, new Node.StaticMemberExpression(expr, property));
+ }
+ else if (this.lookahead.type === 10 /* Template */ && this.lookahead.head) {
+ var quasi = this.parseTemplateLiteral();
+ expr = this.finalize(node, new Node.TaggedTemplateExpression(expr, quasi));
+ }
+ else {
+ break;
+ }
+ }
+ return expr;
+ };
+ // https://tc39.github.io/ecma262/#sec-update-expressions
+ Parser.prototype.parseUpdateExpression = function () {
+ var expr;
+ var startToken = this.lookahead;
+ if (this.match('++') || this.match('--')) {
+ var node = this.startNode(startToken);
+ var token = this.nextToken();
+ expr = this.inheritCoverGrammar(this.parseUnaryExpression);
+ if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) {
+ this.tolerateError(messages_1.Messages.StrictLHSPrefix);
+ }
+ if (!this.context.isAssignmentTarget) {
+ this.tolerateError(messages_1.Messages.InvalidLHSInAssignment);
+ }
+ var prefix = true;
+ expr = this.finalize(node, new Node.UpdateExpression(token.value, expr, prefix));
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ }
+ else {
+ expr = this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall);
+ if (!this.hasLineTerminator && this.lookahead.type === 7 /* Punctuator */) {
+ if (this.match('++') || this.match('--')) {
+ if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) {
+ this.tolerateError(messages_1.Messages.StrictLHSPostfix);
+ }
+ if (!this.context.isAssignmentTarget) {
+ this.tolerateError(messages_1.Messages.InvalidLHSInAssignment);
+ }
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ var operator = this.nextToken().value;
+ var prefix = false;
+ expr = this.finalize(this.startNode(startToken), new Node.UpdateExpression(operator, expr, prefix));
+ }
+ }
+ }
+ return expr;
+ };
+ // https://tc39.github.io/ecma262/#sec-unary-operators
+ Parser.prototype.parseAwaitExpression = function () {
+ var node = this.createNode();
+ this.nextToken();
+ var argument = this.parseUnaryExpression();
+ return this.finalize(node, new Node.AwaitExpression(argument));
+ };
+ Parser.prototype.parseUnaryExpression = function () {
+ var expr;
+ if (this.match('+') || this.match('-') || this.match('~') || this.match('!') ||
+ this.matchKeyword('delete') || this.matchKeyword('void') || this.matchKeyword('typeof')) {
+ var node = this.startNode(this.lookahead);
+ var token = this.nextToken();
+ expr = this.inheritCoverGrammar(this.parseUnaryExpression);
+ expr = this.finalize(node, new Node.UnaryExpression(token.value, expr));
+ if (this.context.strict && expr.operator === 'delete' && expr.argument.type === syntax_1.Syntax.Identifier) {
+ this.tolerateError(messages_1.Messages.StrictDelete);
+ }
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ }
+ else if (this.context.await && this.matchContextualKeyword('await')) {
+ expr = this.parseAwaitExpression();
+ }
+ else {
+ expr = this.parseUpdateExpression();
+ }
+ return expr;
+ };
+ Parser.prototype.parseExponentiationExpression = function () {
+ var startToken = this.lookahead;
+ var expr = this.inheritCoverGrammar(this.parseUnaryExpression);
+ if (expr.type !== syntax_1.Syntax.UnaryExpression && this.match('**')) {
+ this.nextToken();
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ var left = expr;
+ var right = this.isolateCoverGrammar(this.parseExponentiationExpression);
+ expr = this.finalize(this.startNode(startToken), new Node.BinaryExpression('**', left, right));
+ }
+ return expr;
+ };
+ // https://tc39.github.io/ecma262/#sec-exp-operator
+ // https://tc39.github.io/ecma262/#sec-multiplicative-operators
+ // https://tc39.github.io/ecma262/#sec-additive-operators
+ // https://tc39.github.io/ecma262/#sec-bitwise-shift-operators
+ // https://tc39.github.io/ecma262/#sec-relational-operators
+ // https://tc39.github.io/ecma262/#sec-equality-operators
+ // https://tc39.github.io/ecma262/#sec-binary-bitwise-operators
+ // https://tc39.github.io/ecma262/#sec-binary-logical-operators
+ Parser.prototype.binaryPrecedence = function (token) {
+ var op = token.value;
+ var precedence;
+ if (token.type === 7 /* Punctuator */) {
+ precedence = this.operatorPrecedence[op] || 0;
+ }
+ else if (token.type === 4 /* Keyword */) {
+ precedence = (op === 'instanceof' || (this.context.allowIn && op === 'in')) ? 7 : 0;
+ }
+ else {
+ precedence = 0;
+ }
+ return precedence;
+ };
+ Parser.prototype.parseBinaryExpression = function () {
+ var startToken = this.lookahead;
+ var expr = this.inheritCoverGrammar(this.parseExponentiationExpression);
+ var token = this.lookahead;
+ var prec = this.binaryPrecedence(token);
+ if (prec > 0) {
+ this.nextToken();
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ var markers = [startToken, this.lookahead];
+ var left = expr;
+ var right = this.isolateCoverGrammar(this.parseExponentiationExpression);
+ var stack = [left, token.value, right];
+ var precedences = [prec];
+ while (true) {
+ prec = this.binaryPrecedence(this.lookahead);
+ if (prec <= 0) {
+ break;
+ }
+ // Reduce: make a binary expression from the three topmost entries.
+ while ((stack.length > 2) && (prec <= precedences[precedences.length - 1])) {
+ right = stack.pop();
+ var operator = stack.pop();
+ precedences.pop();
+ left = stack.pop();
+ markers.pop();
+ var node = this.startNode(markers[markers.length - 1]);
+ stack.push(this.finalize(node, new Node.BinaryExpression(operator, left, right)));
+ }
+ // Shift.
+ stack.push(this.nextToken().value);
+ precedences.push(prec);
+ markers.push(this.lookahead);
+ stack.push(this.isolateCoverGrammar(this.parseExponentiationExpression));
+ }
+ // Final reduce to clean-up the stack.
+ var i = stack.length - 1;
+ expr = stack[i];
+ markers.pop();
+ while (i > 1) {
+ var node = this.startNode(markers.pop());
+ var operator = stack[i - 1];
+ expr = this.finalize(node, new Node.BinaryExpression(operator, stack[i - 2], expr));
+ i -= 2;
+ }
+ }
+ return expr;
+ };
+ // https://tc39.github.io/ecma262/#sec-conditional-operator
+ Parser.prototype.parseConditionalExpression = function () {
+ var startToken = this.lookahead;
+ var expr = this.inheritCoverGrammar(this.parseBinaryExpression);
+ if (this.match('?')) {
+ this.nextToken();
+ var previousAllowIn = this.context.allowIn;
+ this.context.allowIn = true;
+ var consequent = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ this.context.allowIn = previousAllowIn;
+ this.expect(':');
+ var alternate = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ expr = this.finalize(this.startNode(startToken), new Node.ConditionalExpression(expr, consequent, alternate));
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ }
+ return expr;
+ };
+ // https://tc39.github.io/ecma262/#sec-assignment-operators
+ Parser.prototype.checkPatternParam = function (options, param) {
+ switch (param.type) {
+ case syntax_1.Syntax.Identifier:
+ this.validateParam(options, param, param.name);
+ break;
+ case syntax_1.Syntax.RestElement:
+ this.checkPatternParam(options, param.argument);
+ break;
+ case syntax_1.Syntax.AssignmentPattern:
+ this.checkPatternParam(options, param.left);
+ break;
+ case syntax_1.Syntax.ArrayPattern:
+ for (var i = 0; i < param.elements.length; i++) {
+ if (param.elements[i] !== null) {
+ this.checkPatternParam(options, param.elements[i]);
+ }
+ }
+ break;
+ case syntax_1.Syntax.ObjectPattern:
+ for (var i = 0; i < param.properties.length; i++) {
+ this.checkPatternParam(options, param.properties[i].value);
+ }
+ break;
+ default:
+ break;
+ }
+ options.simple = options.simple && (param instanceof Node.Identifier);
+ };
+ Parser.prototype.reinterpretAsCoverFormalsList = function (expr) {
+ var params = [expr];
+ var options;
+ var asyncArrow = false;
+ switch (expr.type) {
+ case syntax_1.Syntax.Identifier:
+ break;
+ case ArrowParameterPlaceHolder:
+ params = expr.params;
+ asyncArrow = expr.async;
+ break;
+ default:
+ return null;
+ }
+ options = {
+ simple: true,
+ paramSet: {}
+ };
+ for (var i = 0; i < params.length; ++i) {
+ var param = params[i];
+ if (param.type === syntax_1.Syntax.AssignmentPattern) {
+ if (param.right.type === syntax_1.Syntax.YieldExpression) {
+ if (param.right.argument) {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ param.right.type = syntax_1.Syntax.Identifier;
+ param.right.name = 'yield';
+ delete param.right.argument;
+ delete param.right.delegate;
+ }
+ }
+ else if (asyncArrow && param.type === syntax_1.Syntax.Identifier && param.name === 'await') {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ this.checkPatternParam(options, param);
+ params[i] = param;
+ }
+ if (this.context.strict || !this.context.allowYield) {
+ for (var i = 0; i < params.length; ++i) {
+ var param = params[i];
+ if (param.type === syntax_1.Syntax.YieldExpression) {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ }
+ }
+ if (options.message === messages_1.Messages.StrictParamDupe) {
+ var token = this.context.strict ? options.stricted : options.firstRestricted;
+ this.throwUnexpectedToken(token, options.message);
+ }
+ return {
+ simple: options.simple,
+ params: params,
+ stricted: options.stricted,
+ firstRestricted: options.firstRestricted,
+ message: options.message
+ };
+ };
+ Parser.prototype.parseAssignmentExpression = function () {
+ var expr;
+ if (!this.context.allowYield && this.matchKeyword('yield')) {
+ expr = this.parseYieldExpression();
+ }
+ else {
+ var startToken = this.lookahead;
+ var token = startToken;
+ expr = this.parseConditionalExpression();
+ if (token.type === 3 /* Identifier */ && (token.lineNumber === this.lookahead.lineNumber) && token.value === 'async') {
+ if (this.lookahead.type === 3 /* Identifier */ || this.matchKeyword('yield')) {
+ var arg = this.parsePrimaryExpression();
+ this.reinterpretExpressionAsPattern(arg);
+ expr = {
+ type: ArrowParameterPlaceHolder,
+ params: [arg],
+ async: true
+ };
+ }
+ }
+ if (expr.type === ArrowParameterPlaceHolder || this.match('=>')) {
+ // https://tc39.github.io/ecma262/#sec-arrow-function-definitions
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ var isAsync = expr.async;
+ var list = this.reinterpretAsCoverFormalsList(expr);
+ if (list) {
+ if (this.hasLineTerminator) {
+ this.tolerateUnexpectedToken(this.lookahead);
+ }
+ this.context.firstCoverInitializedNameError = null;
+ var previousStrict = this.context.strict;
+ var previousAllowStrictDirective = this.context.allowStrictDirective;
+ this.context.allowStrictDirective = list.simple;
+ var previousAllowYield = this.context.allowYield;
+ var previousAwait = this.context.await;
+ this.context.allowYield = true;
+ this.context.await = isAsync;
+ var node = this.startNode(startToken);
+ this.expect('=>');
+ var body = void 0;
+ if (this.match('{')) {
+ var previousAllowIn = this.context.allowIn;
+ this.context.allowIn = true;
+ body = this.parseFunctionSourceElements();
+ this.context.allowIn = previousAllowIn;
+ }
+ else {
+ body = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ }
+ var expression = body.type !== syntax_1.Syntax.BlockStatement;
+ if (this.context.strict && list.firstRestricted) {
+ this.throwUnexpectedToken(list.firstRestricted, list.message);
+ }
+ if (this.context.strict && list.stricted) {
+ this.tolerateUnexpectedToken(list.stricted, list.message);
+ }
+ expr = isAsync ? this.finalize(node, new Node.AsyncArrowFunctionExpression(list.params, body, expression)) :
+ this.finalize(node, new Node.ArrowFunctionExpression(list.params, body, expression));
+ this.context.strict = previousStrict;
+ this.context.allowStrictDirective = previousAllowStrictDirective;
+ this.context.allowYield = previousAllowYield;
+ this.context.await = previousAwait;
+ }
+ }
+ else {
+ if (this.matchAssign()) {
+ if (!this.context.isAssignmentTarget) {
+ this.tolerateError(messages_1.Messages.InvalidLHSInAssignment);
+ }
+ if (this.context.strict && expr.type === syntax_1.Syntax.Identifier) {
+ var id = expr;
+ if (this.scanner.isRestrictedWord(id.name)) {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.StrictLHSAssignment);
+ }
+ if (this.scanner.isStrictModeReservedWord(id.name)) {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord);
+ }
+ }
+ if (!this.match('=')) {
+ this.context.isAssignmentTarget = false;
+ this.context.isBindingElement = false;
+ }
+ else {
+ this.reinterpretExpressionAsPattern(expr);
+ }
+ token = this.nextToken();
+ var operator = token.value;
+ var right = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ expr = this.finalize(this.startNode(startToken), new Node.AssignmentExpression(operator, expr, right));
+ this.context.firstCoverInitializedNameError = null;
+ }
+ }
+ }
+ return expr;
+ };
+ // https://tc39.github.io/ecma262/#sec-comma-operator
+ Parser.prototype.parseExpression = function () {
+ var startToken = this.lookahead;
+ var expr = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ if (this.match(',')) {
+ var expressions = [];
+ expressions.push(expr);
+ while (this.lookahead.type !== 2 /* EOF */) {
+ if (!this.match(',')) {
+ break;
+ }
+ this.nextToken();
+ expressions.push(this.isolateCoverGrammar(this.parseAssignmentExpression));
+ }
+ expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions));
+ }
+ return expr;
+ };
+ // https://tc39.github.io/ecma262/#sec-block
+ Parser.prototype.parseStatementListItem = function () {
+ var statement;
+ this.context.isAssignmentTarget = true;
+ this.context.isBindingElement = true;
+ if (this.lookahead.type === 4 /* Keyword */) {
+ switch (this.lookahead.value) {
+ case 'export':
+ if (!this.context.isModule) {
+ this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalExportDeclaration);
+ }
+ statement = this.parseExportDeclaration();
+ break;
+ case 'import':
+ if (!this.context.isModule) {
+ this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalImportDeclaration);
+ }
+ statement = this.parseImportDeclaration();
+ break;
+ case 'const':
+ statement = this.parseLexicalDeclaration({ inFor: false });
+ break;
+ case 'function':
+ statement = this.parseFunctionDeclaration();
+ break;
+ case 'class':
+ statement = this.parseClassDeclaration();
+ break;
+ case 'let':
+ statement = this.isLexicalDeclaration() ? this.parseLexicalDeclaration({ inFor: false }) : this.parseStatement();
+ break;
+ default:
+ statement = this.parseStatement();
+ break;
+ }
+ }
+ else {
+ statement = this.parseStatement();
+ }
+ return statement;
+ };
+ Parser.prototype.parseBlock = function () {
+ var node = this.createNode();
+ this.expect('{');
+ var block = [];
+ while (true) {
+ if (this.match('}')) {
+ break;
+ }
+ block.push(this.parseStatementListItem());
+ }
+ this.expect('}');
+ return this.finalize(node, new Node.BlockStatement(block));
+ };
+ // https://tc39.github.io/ecma262/#sec-let-and-const-declarations
+ Parser.prototype.parseLexicalBinding = function (kind, options) {
+ var node = this.createNode();
+ var params = [];
+ var id = this.parsePattern(params, kind);
+ if (this.context.strict && id.type === syntax_1.Syntax.Identifier) {
+ if (this.scanner.isRestrictedWord(id.name)) {
+ this.tolerateError(messages_1.Messages.StrictVarName);
+ }
+ }
+ var init = null;
+ if (kind === 'const') {
+ if (!this.matchKeyword('in') && !this.matchContextualKeyword('of')) {
+ if (this.match('=')) {
+ this.nextToken();
+ init = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ }
+ else {
+ this.throwError(messages_1.Messages.DeclarationMissingInitializer, 'const');
+ }
+ }
+ }
+ else if ((!options.inFor && id.type !== syntax_1.Syntax.Identifier) || this.match('=')) {
+ this.expect('=');
+ init = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ }
+ return this.finalize(node, new Node.VariableDeclarator(id, init));
+ };
+ Parser.prototype.parseBindingList = function (kind, options) {
+ var list = [this.parseLexicalBinding(kind, options)];
+ while (this.match(',')) {
+ this.nextToken();
+ list.push(this.parseLexicalBinding(kind, options));
+ }
+ return list;
+ };
+ Parser.prototype.isLexicalDeclaration = function () {
+ var state = this.scanner.saveState();
+ this.scanner.scanComments();
+ var next = this.scanner.lex();
+ this.scanner.restoreState(state);
+ return (next.type === 3 /* Identifier */) ||
+ (next.type === 7 /* Punctuator */ && next.value === '[') ||
+ (next.type === 7 /* Punctuator */ && next.value === '{') ||
+ (next.type === 4 /* Keyword */ && next.value === 'let') ||
+ (next.type === 4 /* Keyword */ && next.value === 'yield');
+ };
+ Parser.prototype.parseLexicalDeclaration = function (options) {
+ var node = this.createNode();
+ var kind = this.nextToken().value;
+ assert_1.assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const');
+ var declarations = this.parseBindingList(kind, options);
+ this.consumeSemicolon();
+ return this.finalize(node, new Node.VariableDeclaration(declarations, kind));
+ };
+ // https://tc39.github.io/ecma262/#sec-destructuring-binding-patterns
+ Parser.prototype.parseBindingRestElement = function (params, kind) {
+ var node = this.createNode();
+ this.expect('...');
+ var arg = this.parsePattern(params, kind);
+ return this.finalize(node, new Node.RestElement(arg));
+ };
+ Parser.prototype.parseArrayPattern = function (params, kind) {
+ var node = this.createNode();
+ this.expect('[');
+ var elements = [];
+ while (!this.match(']')) {
+ if (this.match(',')) {
+ this.nextToken();
+ elements.push(null);
+ }
+ else {
+ if (this.match('...')) {
+ elements.push(this.parseBindingRestElement(params, kind));
+ break;
+ }
+ else {
+ elements.push(this.parsePatternWithDefault(params, kind));
+ }
+ if (!this.match(']')) {
+ this.expect(',');
+ }
+ }
+ }
+ this.expect(']');
+ return this.finalize(node, new Node.ArrayPattern(elements));
+ };
+ Parser.prototype.parsePropertyPattern = function (params, kind) {
+ var node = this.createNode();
+ var computed = false;
+ var shorthand = false;
+ var method = false;
+ var key;
+ var value;
+ if (this.lookahead.type === 3 /* Identifier */) {
+ var keyToken = this.lookahead;
+ key = this.parseVariableIdentifier();
+ var init = this.finalize(node, new Node.Identifier(keyToken.value));
+ if (this.match('=')) {
+ params.push(keyToken);
+ shorthand = true;
+ this.nextToken();
+ var expr = this.parseAssignmentExpression();
+ value = this.finalize(this.startNode(keyToken), new Node.AssignmentPattern(init, expr));
+ }
+ else if (!this.match(':')) {
+ params.push(keyToken);
+ shorthand = true;
+ value = init;
+ }
+ else {
+ this.expect(':');
+ value = this.parsePatternWithDefault(params, kind);
+ }
+ }
+ else {
+ computed = this.match('[');
+ key = this.parseObjectPropertyKey();
+ this.expect(':');
+ value = this.parsePatternWithDefault(params, kind);
+ }
+ return this.finalize(node, new Node.Property('init', key, computed, value, method, shorthand));
+ };
+ Parser.prototype.parseObjectPattern = function (params, kind) {
+ var node = this.createNode();
+ var properties = [];
+ this.expect('{');
+ while (!this.match('}')) {
+ properties.push(this.parsePropertyPattern(params, kind));
+ if (!this.match('}')) {
+ this.expect(',');
+ }
+ }
+ this.expect('}');
+ return this.finalize(node, new Node.ObjectPattern(properties));
+ };
+ Parser.prototype.parsePattern = function (params, kind) {
+ var pattern;
+ if (this.match('[')) {
+ pattern = this.parseArrayPattern(params, kind);
+ }
+ else if (this.match('{')) {
+ pattern = this.parseObjectPattern(params, kind);
+ }
+ else {
+ if (this.matchKeyword('let') && (kind === 'const' || kind === 'let')) {
+ this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.LetInLexicalBinding);
+ }
+ params.push(this.lookahead);
+ pattern = this.parseVariableIdentifier(kind);
+ }
+ return pattern;
+ };
+ Parser.prototype.parsePatternWithDefault = function (params, kind) {
+ var startToken = this.lookahead;
+ var pattern = this.parsePattern(params, kind);
+ if (this.match('=')) {
+ this.nextToken();
+ var previousAllowYield = this.context.allowYield;
+ this.context.allowYield = true;
+ var right = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ this.context.allowYield = previousAllowYield;
+ pattern = this.finalize(this.startNode(startToken), new Node.AssignmentPattern(pattern, right));
+ }
+ return pattern;
+ };
+ // https://tc39.github.io/ecma262/#sec-variable-statement
+ Parser.prototype.parseVariableIdentifier = function (kind) {
+ var node = this.createNode();
+ var token = this.nextToken();
+ if (token.type === 4 /* Keyword */ && token.value === 'yield') {
+ if (this.context.strict) {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord);
+ }
+ else if (!this.context.allowYield) {
+ this.throwUnexpectedToken(token);
+ }
+ }
+ else if (token.type !== 3 /* Identifier */) {
+ if (this.context.strict && token.type === 4 /* Keyword */ && this.scanner.isStrictModeReservedWord(token.value)) {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord);
+ }
+ else {
+ if (this.context.strict || token.value !== 'let' || kind !== 'var') {
+ this.throwUnexpectedToken(token);
+ }
+ }
+ }
+ else if ((this.context.isModule || this.context.await) && token.type === 3 /* Identifier */ && token.value === 'await') {
+ this.tolerateUnexpectedToken(token);
+ }
+ return this.finalize(node, new Node.Identifier(token.value));
+ };
+ Parser.prototype.parseVariableDeclaration = function (options) {
+ var node = this.createNode();
+ var params = [];
+ var id = this.parsePattern(params, 'var');
+ if (this.context.strict && id.type === syntax_1.Syntax.Identifier) {
+ if (this.scanner.isRestrictedWord(id.name)) {
+ this.tolerateError(messages_1.Messages.StrictVarName);
+ }
+ }
+ var init = null;
+ if (this.match('=')) {
+ this.nextToken();
+ init = this.isolateCoverGrammar(this.parseAssignmentExpression);
+ }
+ else if (id.type !== syntax_1.Syntax.Identifier && !options.inFor) {
+ this.expect('=');
+ }
+ return this.finalize(node, new Node.VariableDeclarator(id, init));
+ };
+ Parser.prototype.parseVariableDeclarationList = function (options) {
+ var opt = { inFor: options.inFor };
+ var list = [];
+ list.push(this.parseVariableDeclaration(opt));
+ while (this.match(',')) {
+ this.nextToken();
+ list.push(this.parseVariableDeclaration(opt));
+ }
+ return list;
+ };
+ Parser.prototype.parseVariableStatement = function () {
+ var node = this.createNode();
+ this.expectKeyword('var');
+ var declarations = this.parseVariableDeclarationList({ inFor: false });
+ this.consumeSemicolon();
+ return this.finalize(node, new Node.VariableDeclaration(declarations, 'var'));
+ };
+ // https://tc39.github.io/ecma262/#sec-empty-statement
+ Parser.prototype.parseEmptyStatement = function () {
+ var node = this.createNode();
+ this.expect(';');
+ return this.finalize(node, new Node.EmptyStatement());
+ };
+ // https://tc39.github.io/ecma262/#sec-expression-statement
+ Parser.prototype.parseExpressionStatement = function () {
+ var node = this.createNode();
+ var expr = this.parseExpression();
+ this.consumeSemicolon();
+ return this.finalize(node, new Node.ExpressionStatement(expr));
+ };
+ // https://tc39.github.io/ecma262/#sec-if-statement
+ Parser.prototype.parseIfClause = function () {
+ if (this.context.strict && this.matchKeyword('function')) {
+ this.tolerateError(messages_1.Messages.StrictFunction);
+ }
+ return this.parseStatement();
+ };
+ Parser.prototype.parseIfStatement = function () {
+ var node = this.createNode();
+ var consequent;
+ var alternate = null;
+ this.expectKeyword('if');
+ this.expect('(');
+ var test = this.parseExpression();
+ if (!this.match(')') && this.config.tolerant) {
+ this.tolerateUnexpectedToken(this.nextToken());
+ consequent = this.finalize(this.createNode(), new Node.EmptyStatement());
+ }
+ else {
+ this.expect(')');
+ consequent = this.parseIfClause();
+ if (this.matchKeyword('else')) {
+ this.nextToken();
+ alternate = this.parseIfClause();
+ }
+ }
+ return this.finalize(node, new Node.IfStatement(test, consequent, alternate));
+ };
+ // https://tc39.github.io/ecma262/#sec-do-while-statement
+ Parser.prototype.parseDoWhileStatement = function () {
+ var node = this.createNode();
+ this.expectKeyword('do');
+ var previousInIteration = this.context.inIteration;
+ this.context.inIteration = true;
+ var body = this.parseStatement();
+ this.context.inIteration = previousInIteration;
+ this.expectKeyword('while');
+ this.expect('(');
+ var test = this.parseExpression();
+ if (!this.match(')') && this.config.tolerant) {
+ this.tolerateUnexpectedToken(this.nextToken());
+ }
+ else {
+ this.expect(')');
+ if (this.match(';')) {
+ this.nextToken();
+ }
+ }
+ return this.finalize(node, new Node.DoWhileStatement(body, test));
+ };
+ // https://tc39.github.io/ecma262/#sec-while-statement
+ Parser.prototype.parseWhileStatement = function () {
+ var node = this.createNode();
+ var body;
+ this.expectKeyword('while');
+ this.expect('(');
+ var test = this.parseExpression();
+ if (!this.match(')') && this.config.tolerant) {
+ this.tolerateUnexpectedToken(this.nextToken());
+ body = this.finalize(this.createNode(), new Node.EmptyStatement());
+ }
+ else {
+ this.expect(')');
+ var previousInIteration = this.context.inIteration;
+ this.context.inIteration = true;
+ body = this.parseStatement();
+ this.context.inIteration = previousInIteration;
+ }
+ return this.finalize(node, new Node.WhileStatement(test, body));
+ };
+ // https://tc39.github.io/ecma262/#sec-for-statement
+ // https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements
+ Parser.prototype.parseForStatement = function () {
+ var init = null;
+ var test = null;
+ var update = null;
+ var forIn = true;
+ var left, right;
+ var node = this.createNode();
+ this.expectKeyword('for');
+ this.expect('(');
+ if (this.match(';')) {
+ this.nextToken();
+ }
+ else {
+ if (this.matchKeyword('var')) {
+ init = this.createNode();
+ this.nextToken();
+ var previousAllowIn = this.context.allowIn;
+ this.context.allowIn = false;
+ var declarations = this.parseVariableDeclarationList({ inFor: true });
+ this.context.allowIn = previousAllowIn;
+ if (declarations.length === 1 && this.matchKeyword('in')) {
+ var decl = declarations[0];
+ if (decl.init && (decl.id.type === syntax_1.Syntax.ArrayPattern || decl.id.type === syntax_1.Syntax.ObjectPattern || this.context.strict)) {
+ this.tolerateError(messages_1.Messages.ForInOfLoopInitializer, 'for-in');
+ }
+ init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var'));
+ this.nextToken();
+ left = init;
+ right = this.parseExpression();
+ init = null;
+ }
+ else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) {
+ init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var'));
+ this.nextToken();
+ left = init;
+ right = this.parseAssignmentExpression();
+ init = null;
+ forIn = false;
+ }
+ else {
+ init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var'));
+ this.expect(';');
+ }
+ }
+ else if (this.matchKeyword('const') || this.matchKeyword('let')) {
+ init = this.createNode();
+ var kind = this.nextToken().value;
+ if (!this.context.strict && this.lookahead.value === 'in') {
+ init = this.finalize(init, new Node.Identifier(kind));
+ this.nextToken();
+ left = init;
+ right = this.parseExpression();
+ init = null;
+ }
+ else {
+ var previousAllowIn = this.context.allowIn;
+ this.context.allowIn = false;
+ var declarations = this.parseBindingList(kind, { inFor: true });
+ this.context.allowIn = previousAllowIn;
+ if (declarations.length === 1 && declarations[0].init === null && this.matchKeyword('in')) {
+ init = this.finalize(init, new Node.VariableDeclaration(declarations, kind));
+ this.nextToken();
+ left = init;
+ right = this.parseExpression();
+ init = null;
+ }
+ else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) {
+ init = this.finalize(init, new Node.VariableDeclaration(declarations, kind));
+ this.nextToken();
+ left = init;
+ right = this.parseAssignmentExpression();
+ init = null;
+ forIn = false;
+ }
+ else {
+ this.consumeSemicolon();
+ init = this.finalize(init, new Node.VariableDeclaration(declarations, kind));
+ }
+ }
+ }
+ else {
+ var initStartToken = this.lookahead;
+ var previousAllowIn = this.context.allowIn;
+ this.context.allowIn = false;
+ init = this.inheritCoverGrammar(this.parseAssignmentExpression);
+ this.context.allowIn = previousAllowIn;
+ if (this.matchKeyword('in')) {
+ if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) {
+ this.tolerateError(messages_1.Messages.InvalidLHSInForIn);
+ }
+ this.nextToken();
+ this.reinterpretExpressionAsPattern(init);
+ left = init;
+ right = this.parseExpression();
+ init = null;
+ }
+ else if (this.matchContextualKeyword('of')) {
+ if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) {
+ this.tolerateError(messages_1.Messages.InvalidLHSInForLoop);
+ }
+ this.nextToken();
+ this.reinterpretExpressionAsPattern(init);
+ left = init;
+ right = this.parseAssignmentExpression();
+ init = null;
+ forIn = false;
+ }
+ else {
+ if (this.match(',')) {
+ var initSeq = [init];
+ while (this.match(',')) {
+ this.nextToken();
+ initSeq.push(this.isolateCoverGrammar(this.parseAssignmentExpression));
+ }
+ init = this.finalize(this.startNode(initStartToken), new Node.SequenceExpression(initSeq));
+ }
+ this.expect(';');
+ }
+ }
+ }
+ if (typeof left === 'undefined') {
+ if (!this.match(';')) {
+ test = this.parseExpression();
+ }
+ this.expect(';');
+ if (!this.match(')')) {
+ update = this.parseExpression();
+ }
+ }
+ var body;
+ if (!this.match(')') && this.config.tolerant) {
+ this.tolerateUnexpectedToken(this.nextToken());
+ body = this.finalize(this.createNode(), new Node.EmptyStatement());
+ }
+ else {
+ this.expect(')');
+ var previousInIteration = this.context.inIteration;
+ this.context.inIteration = true;
+ body = this.isolateCoverGrammar(this.parseStatement);
+ this.context.inIteration = previousInIteration;
+ }
+ return (typeof left === 'undefined') ?
+ this.finalize(node, new Node.ForStatement(init, test, update, body)) :
+ forIn ? this.finalize(node, new Node.ForInStatement(left, right, body)) :
+ this.finalize(node, new Node.ForOfStatement(left, right, body));
+ };
+ // https://tc39.github.io/ecma262/#sec-continue-statement
+ Parser.prototype.parseContinueStatement = function () {
+ var node = this.createNode();
+ this.expectKeyword('continue');
+ var label = null;
+ if (this.lookahead.type === 3 /* Identifier */ && !this.hasLineTerminator) {
+ var id = this.parseVariableIdentifier();
+ label = id;
+ var key = '$' + id.name;
+ if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) {
+ this.throwError(messages_1.Messages.UnknownLabel, id.name);
+ }
+ }
+ this.consumeSemicolon();
+ if (label === null && !this.context.inIteration) {
+ this.throwError(messages_1.Messages.IllegalContinue);
+ }
+ return this.finalize(node, new Node.ContinueStatement(label));
+ };
+ // https://tc39.github.io/ecma262/#sec-break-statement
+ Parser.prototype.parseBreakStatement = function () {
+ var node = this.createNode();
+ this.expectKeyword('break');
+ var label = null;
+ if (this.lookahead.type === 3 /* Identifier */ && !this.hasLineTerminator) {
+ var id = this.parseVariableIdentifier();
+ var key = '$' + id.name;
+ if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) {
+ this.throwError(messages_1.Messages.UnknownLabel, id.name);
+ }
+ label = id;
+ }
+ this.consumeSemicolon();
+ if (label === null && !this.context.inIteration && !this.context.inSwitch) {
+ this.throwError(messages_1.Messages.IllegalBreak);
+ }
+ return this.finalize(node, new Node.BreakStatement(label));
+ };
+ // https://tc39.github.io/ecma262/#sec-return-statement
+ Parser.prototype.parseReturnStatement = function () {
+ if (!this.context.inFunctionBody) {
+ this.tolerateError(messages_1.Messages.IllegalReturn);
+ }
+ var node = this.createNode();
+ this.expectKeyword('return');
+ var hasArgument = !this.match(';') && !this.match('}') &&
+ !this.hasLineTerminator && this.lookahead.type !== 2 /* EOF */;
+ var argument = hasArgument ? this.parseExpression() : null;
+ this.consumeSemicolon();
+ return this.finalize(node, new Node.ReturnStatement(argument));
+ };
+ // https://tc39.github.io/ecma262/#sec-with-statement
+ Parser.prototype.parseWithStatement = function () {
+ if (this.context.strict) {
+ this.tolerateError(messages_1.Messages.StrictModeWith);
+ }
+ var node = this.createNode();
+ var body;
+ this.expectKeyword('with');
+ this.expect('(');
+ var object = this.parseExpression();
+ if (!this.match(')') && this.config.tolerant) {
+ this.tolerateUnexpectedToken(this.nextToken());
+ body = this.finalize(this.createNode(), new Node.EmptyStatement());
+ }
+ else {
+ this.expect(')');
+ body = this.parseStatement();
+ }
+ return this.finalize(node, new Node.WithStatement(object, body));
+ };
+ // https://tc39.github.io/ecma262/#sec-switch-statement
+ Parser.prototype.parseSwitchCase = function () {
+ var node = this.createNode();
+ var test;
+ if (this.matchKeyword('default')) {
+ this.nextToken();
+ test = null;
+ }
+ else {
+ this.expectKeyword('case');
+ test = this.parseExpression();
+ }
+ this.expect(':');
+ var consequent = [];
+ while (true) {
+ if (this.match('}') || this.matchKeyword('default') || this.matchKeyword('case')) {
+ break;
+ }
+ consequent.push(this.parseStatementListItem());
+ }
+ return this.finalize(node, new Node.SwitchCase(test, consequent));
+ };
+ Parser.prototype.parseSwitchStatement = function () {
+ var node = this.createNode();
+ this.expectKeyword('switch');
+ this.expect('(');
+ var discriminant = this.parseExpression();
+ this.expect(')');
+ var previousInSwitch = this.context.inSwitch;
+ this.context.inSwitch = true;
+ var cases = [];
+ var defaultFound = false;
+ this.expect('{');
+ while (true) {
+ if (this.match('}')) {
+ break;
+ }
+ var clause = this.parseSwitchCase();
+ if (clause.test === null) {
+ if (defaultFound) {
+ this.throwError(messages_1.Messages.MultipleDefaultsInSwitch);
+ }
+ defaultFound = true;
+ }
+ cases.push(clause);
+ }
+ this.expect('}');
+ this.context.inSwitch = previousInSwitch;
+ return this.finalize(node, new Node.SwitchStatement(discriminant, cases));
+ };
+ // https://tc39.github.io/ecma262/#sec-labelled-statements
+ Parser.prototype.parseLabelledStatement = function () {
+ var node = this.createNode();
+ var expr = this.parseExpression();
+ var statement;
+ if ((expr.type === syntax_1.Syntax.Identifier) && this.match(':')) {
+ this.nextToken();
+ var id = expr;
+ var key = '$' + id.name;
+ if (Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) {
+ this.throwError(messages_1.Messages.Redeclaration, 'Label', id.name);
+ }
+ this.context.labelSet[key] = true;
+ var body = void 0;
+ if (this.matchKeyword('class')) {
+ this.tolerateUnexpectedToken(this.lookahead);
+ body = this.parseClassDeclaration();
+ }
+ else if (this.matchKeyword('function')) {
+ var token = this.lookahead;
+ var declaration = this.parseFunctionDeclaration();
+ if (this.context.strict) {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunction);
+ }
+ else if (declaration.generator) {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.GeneratorInLegacyContext);
+ }
+ body = declaration;
+ }
+ else {
+ body = this.parseStatement();
+ }
+ delete this.context.labelSet[key];
+ statement = new Node.LabeledStatement(id, body);
+ }
+ else {
+ this.consumeSemicolon();
+ statement = new Node.ExpressionStatement(expr);
+ }
+ return this.finalize(node, statement);
+ };
+ // https://tc39.github.io/ecma262/#sec-throw-statement
+ Parser.prototype.parseThrowStatement = function () {
+ var node = this.createNode();
+ this.expectKeyword('throw');
+ if (this.hasLineTerminator) {
+ this.throwError(messages_1.Messages.NewlineAfterThrow);
+ }
+ var argument = this.parseExpression();
+ this.consumeSemicolon();
+ return this.finalize(node, new Node.ThrowStatement(argument));
+ };
+ // https://tc39.github.io/ecma262/#sec-try-statement
+ Parser.prototype.parseCatchClause = function () {
+ var node = this.createNode();
+ this.expectKeyword('catch');
+ this.expect('(');
+ if (this.match(')')) {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ var params = [];
+ var param = this.parsePattern(params);
+ var paramMap = {};
+ for (var i = 0; i < params.length; i++) {
+ var key = '$' + params[i].value;
+ if (Object.prototype.hasOwnProperty.call(paramMap, key)) {
+ this.tolerateError(messages_1.Messages.DuplicateBinding, params[i].value);
+ }
+ paramMap[key] = true;
+ }
+ if (this.context.strict && param.type === syntax_1.Syntax.Identifier) {
+ if (this.scanner.isRestrictedWord(param.name)) {
+ this.tolerateError(messages_1.Messages.StrictCatchVariable);
+ }
+ }
+ this.expect(')');
+ var body = this.parseBlock();
+ return this.finalize(node, new Node.CatchClause(param, body));
+ };
+ Parser.prototype.parseFinallyClause = function () {
+ this.expectKeyword('finally');
+ return this.parseBlock();
+ };
+ Parser.prototype.parseTryStatement = function () {
+ var node = this.createNode();
+ this.expectKeyword('try');
+ var block = this.parseBlock();
+ var handler = this.matchKeyword('catch') ? this.parseCatchClause() : null;
+ var finalizer = this.matchKeyword('finally') ? this.parseFinallyClause() : null;
+ if (!handler && !finalizer) {
+ this.throwError(messages_1.Messages.NoCatchOrFinally);
+ }
+ return this.finalize(node, new Node.TryStatement(block, handler, finalizer));
+ };
+ // https://tc39.github.io/ecma262/#sec-debugger-statement
+ Parser.prototype.parseDebuggerStatement = function () {
+ var node = this.createNode();
+ this.expectKeyword('debugger');
+ this.consumeSemicolon();
+ return this.finalize(node, new Node.DebuggerStatement());
+ };
+ // https://tc39.github.io/ecma262/#sec-ecmascript-language-statements-and-declarations
+ Parser.prototype.parseStatement = function () {
+ var statement;
+ switch (this.lookahead.type) {
+ case 1 /* BooleanLiteral */:
+ case 5 /* NullLiteral */:
+ case 6 /* NumericLiteral */:
+ case 8 /* StringLiteral */:
+ case 10 /* Template */:
+ case 9 /* RegularExpression */:
+ statement = this.parseExpressionStatement();
+ break;
+ case 7 /* Punctuator */:
+ var value = this.lookahead.value;
+ if (value === '{') {
+ statement = this.parseBlock();
+ }
+ else if (value === '(') {
+ statement = this.parseExpressionStatement();
+ }
+ else if (value === ';') {
+ statement = this.parseEmptyStatement();
+ }
+ else {
+ statement = this.parseExpressionStatement();
+ }
+ break;
+ case 3 /* Identifier */:
+ statement = this.matchAsyncFunction() ? this.parseFunctionDeclaration() : this.parseLabelledStatement();
+ break;
+ case 4 /* Keyword */:
+ switch (this.lookahead.value) {
+ case 'break':
+ statement = this.parseBreakStatement();
+ break;
+ case 'continue':
+ statement = this.parseContinueStatement();
+ break;
+ case 'debugger':
+ statement = this.parseDebuggerStatement();
+ break;
+ case 'do':
+ statement = this.parseDoWhileStatement();
+ break;
+ case 'for':
+ statement = this.parseForStatement();
+ break;
+ case 'function':
+ statement = this.parseFunctionDeclaration();
+ break;
+ case 'if':
+ statement = this.parseIfStatement();
+ break;
+ case 'return':
+ statement = this.parseReturnStatement();
+ break;
+ case 'switch':
+ statement = this.parseSwitchStatement();
+ break;
+ case 'throw':
+ statement = this.parseThrowStatement();
+ break;
+ case 'try':
+ statement = this.parseTryStatement();
+ break;
+ case 'var':
+ statement = this.parseVariableStatement();
+ break;
+ case 'while':
+ statement = this.parseWhileStatement();
+ break;
+ case 'with':
+ statement = this.parseWithStatement();
+ break;
+ default:
+ statement = this.parseExpressionStatement();
+ break;
+ }
+ break;
+ default:
+ statement = this.throwUnexpectedToken(this.lookahead);
+ }
+ return statement;
+ };
+ // https://tc39.github.io/ecma262/#sec-function-definitions
+ Parser.prototype.parseFunctionSourceElements = function () {
+ var node = this.createNode();
+ this.expect('{');
+ var body = this.parseDirectivePrologues();
+ var previousLabelSet = this.context.labelSet;
+ var previousInIteration = this.context.inIteration;
+ var previousInSwitch = this.context.inSwitch;
+ var previousInFunctionBody = this.context.inFunctionBody;
+ this.context.labelSet = {};
+ this.context.inIteration = false;
+ this.context.inSwitch = false;
+ this.context.inFunctionBody = true;
+ while (this.lookahead.type !== 2 /* EOF */) {
+ if (this.match('}')) {
+ break;
+ }
+ body.push(this.parseStatementListItem());
+ }
+ this.expect('}');
+ this.context.labelSet = previousLabelSet;
+ this.context.inIteration = previousInIteration;
+ this.context.inSwitch = previousInSwitch;
+ this.context.inFunctionBody = previousInFunctionBody;
+ return this.finalize(node, new Node.BlockStatement(body));
+ };
+ Parser.prototype.validateParam = function (options, param, name) {
+ var key = '$' + name;
+ if (this.context.strict) {
+ if (this.scanner.isRestrictedWord(name)) {
+ options.stricted = param;
+ options.message = messages_1.Messages.StrictParamName;
+ }
+ if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
+ options.stricted = param;
+ options.message = messages_1.Messages.StrictParamDupe;
+ }
+ }
+ else if (!options.firstRestricted) {
+ if (this.scanner.isRestrictedWord(name)) {
+ options.firstRestricted = param;
+ options.message = messages_1.Messages.StrictParamName;
+ }
+ else if (this.scanner.isStrictModeReservedWord(name)) {
+ options.firstRestricted = param;
+ options.message = messages_1.Messages.StrictReservedWord;
+ }
+ else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
+ options.stricted = param;
+ options.message = messages_1.Messages.StrictParamDupe;
+ }
+ }
+ /* istanbul ignore next */
+ if (typeof Object.defineProperty === 'function') {
+ Object.defineProperty(options.paramSet, key, { value: true, enumerable: true, writable: true, configurable: true });
+ }
+ else {
+ options.paramSet[key] = true;
+ }
+ };
+ Parser.prototype.parseRestElement = function (params) {
+ var node = this.createNode();
+ this.expect('...');
+ var arg = this.parsePattern(params);
+ if (this.match('=')) {
+ this.throwError(messages_1.Messages.DefaultRestParameter);
+ }
+ if (!this.match(')')) {
+ this.throwError(messages_1.Messages.ParameterAfterRestParameter);
+ }
+ return this.finalize(node, new Node.RestElement(arg));
+ };
+ Parser.prototype.parseFormalParameter = function (options) {
+ var params = [];
+ var param = this.match('...') ? this.parseRestElement(params) : this.parsePatternWithDefault(params);
+ for (var i = 0; i < params.length; i++) {
+ this.validateParam(options, params[i], params[i].value);
+ }
+ options.simple = options.simple && (param instanceof Node.Identifier);
+ options.params.push(param);
+ };
+ Parser.prototype.parseFormalParameters = function (firstRestricted) {
+ var options;
+ options = {
+ simple: true,
+ params: [],
+ firstRestricted: firstRestricted
+ };
+ this.expect('(');
+ if (!this.match(')')) {
+ options.paramSet = {};
+ while (this.lookahead.type !== 2 /* EOF */) {
+ this.parseFormalParameter(options);
+ if (this.match(')')) {
+ break;
+ }
+ this.expect(',');
+ if (this.match(')')) {
+ break;
+ }
+ }
+ }
+ this.expect(')');
+ return {
+ simple: options.simple,
+ params: options.params,
+ stricted: options.stricted,
+ firstRestricted: options.firstRestricted,
+ message: options.message
+ };
+ };
+ Parser.prototype.matchAsyncFunction = function () {
+ var match = this.matchContextualKeyword('async');
+ if (match) {
+ var state = this.scanner.saveState();
+ this.scanner.scanComments();
+ var next = this.scanner.lex();
+ this.scanner.restoreState(state);
+ match = (state.lineNumber === next.lineNumber) && (next.type === 4 /* Keyword */) && (next.value === 'function');
+ }
+ return match;
+ };
+ Parser.prototype.parseFunctionDeclaration = function (identifierIsOptional) {
+ var node = this.createNode();
+ var isAsync = this.matchContextualKeyword('async');
+ if (isAsync) {
+ this.nextToken();
+ }
+ this.expectKeyword('function');
+ var isGenerator = isAsync ? false : this.match('*');
+ if (isGenerator) {
+ this.nextToken();
+ }
+ var message;
+ var id = null;
+ var firstRestricted = null;
+ if (!identifierIsOptional || !this.match('(')) {
+ var token = this.lookahead;
+ id = this.parseVariableIdentifier();
+ if (this.context.strict) {
+ if (this.scanner.isRestrictedWord(token.value)) {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName);
+ }
+ }
+ else {
+ if (this.scanner.isRestrictedWord(token.value)) {
+ firstRestricted = token;
+ message = messages_1.Messages.StrictFunctionName;
+ }
+ else if (this.scanner.isStrictModeReservedWord(token.value)) {
+ firstRestricted = token;
+ message = messages_1.Messages.StrictReservedWord;
+ }
+ }
+ }
+ var previousAllowAwait = this.context.await;
+ var previousAllowYield = this.context.allowYield;
+ this.context.await = isAsync;
+ this.context.allowYield = !isGenerator;
+ var formalParameters = this.parseFormalParameters(firstRestricted);
+ var params = formalParameters.params;
+ var stricted = formalParameters.stricted;
+ firstRestricted = formalParameters.firstRestricted;
+ if (formalParameters.message) {
+ message = formalParameters.message;
+ }
+ var previousStrict = this.context.strict;
+ var previousAllowStrictDirective = this.context.allowStrictDirective;
+ this.context.allowStrictDirective = formalParameters.simple;
+ var body = this.parseFunctionSourceElements();
+ if (this.context.strict && firstRestricted) {
+ this.throwUnexpectedToken(firstRestricted, message);
+ }
+ if (this.context.strict && stricted) {
+ this.tolerateUnexpectedToken(stricted, message);
+ }
+ this.context.strict = previousStrict;
+ this.context.allowStrictDirective = previousAllowStrictDirective;
+ this.context.await = previousAllowAwait;
+ this.context.allowYield = previousAllowYield;
+ return isAsync ? this.finalize(node, new Node.AsyncFunctionDeclaration(id, params, body)) :
+ this.finalize(node, new Node.FunctionDeclaration(id, params, body, isGenerator));
+ };
+ Parser.prototype.parseFunctionExpression = function () {
+ var node = this.createNode();
+ var isAsync = this.matchContextualKeyword('async');
+ if (isAsync) {
+ this.nextToken();
+ }
+ this.expectKeyword('function');
+ var isGenerator = isAsync ? false : this.match('*');
+ if (isGenerator) {
+ this.nextToken();
+ }
+ var message;
+ var id = null;
+ var firstRestricted;
+ var previousAllowAwait = this.context.await;
+ var previousAllowYield = this.context.allowYield;
+ this.context.await = isAsync;
+ this.context.allowYield = !isGenerator;
+ if (!this.match('(')) {
+ var token = this.lookahead;
+ id = (!this.context.strict && !isGenerator && this.matchKeyword('yield')) ? this.parseIdentifierName() : this.parseVariableIdentifier();
+ if (this.context.strict) {
+ if (this.scanner.isRestrictedWord(token.value)) {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName);
+ }
+ }
+ else {
+ if (this.scanner.isRestrictedWord(token.value)) {
+ firstRestricted = token;
+ message = messages_1.Messages.StrictFunctionName;
+ }
+ else if (this.scanner.isStrictModeReservedWord(token.value)) {
+ firstRestricted = token;
+ message = messages_1.Messages.StrictReservedWord;
+ }
+ }
+ }
+ var formalParameters = this.parseFormalParameters(firstRestricted);
+ var params = formalParameters.params;
+ var stricted = formalParameters.stricted;
+ firstRestricted = formalParameters.firstRestricted;
+ if (formalParameters.message) {
+ message = formalParameters.message;
+ }
+ var previousStrict = this.context.strict;
+ var previousAllowStrictDirective = this.context.allowStrictDirective;
+ this.context.allowStrictDirective = formalParameters.simple;
+ var body = this.parseFunctionSourceElements();
+ if (this.context.strict && firstRestricted) {
+ this.throwUnexpectedToken(firstRestricted, message);
+ }
+ if (this.context.strict && stricted) {
+ this.tolerateUnexpectedToken(stricted, message);
+ }
+ this.context.strict = previousStrict;
+ this.context.allowStrictDirective = previousAllowStrictDirective;
+ this.context.await = previousAllowAwait;
+ this.context.allowYield = previousAllowYield;
+ return isAsync ? this.finalize(node, new Node.AsyncFunctionExpression(id, params, body)) :
+ this.finalize(node, new Node.FunctionExpression(id, params, body, isGenerator));
+ };
+ // https://tc39.github.io/ecma262/#sec-directive-prologues-and-the-use-strict-directive
+ Parser.prototype.parseDirective = function () {
+ var token = this.lookahead;
+ var node = this.createNode();
+ var expr = this.parseExpression();
+ var directive = (expr.type === syntax_1.Syntax.Literal) ? this.getTokenRaw(token).slice(1, -1) : null;
+ this.consumeSemicolon();
+ return this.finalize(node, directive ? new Node.Directive(expr, directive) : new Node.ExpressionStatement(expr));
+ };
+ Parser.prototype.parseDirectivePrologues = function () {
+ var firstRestricted = null;
+ var body = [];
+ while (true) {
+ var token = this.lookahead;
+ if (token.type !== 8 /* StringLiteral */) {
+ break;
+ }
+ var statement = this.parseDirective();
+ body.push(statement);
+ var directive = statement.directive;
+ if (typeof directive !== 'string') {
+ break;
+ }
+ if (directive === 'use strict') {
+ this.context.strict = true;
+ if (firstRestricted) {
+ this.tolerateUnexpectedToken(firstRestricted, messages_1.Messages.StrictOctalLiteral);
+ }
+ if (!this.context.allowStrictDirective) {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.IllegalLanguageModeDirective);
+ }
+ }
+ else {
+ if (!firstRestricted && token.octal) {
+ firstRestricted = token;
+ }
+ }
+ }
+ return body;
+ };
+ // https://tc39.github.io/ecma262/#sec-method-definitions
+ Parser.prototype.qualifiedPropertyName = function (token) {
+ switch (token.type) {
+ case 3 /* Identifier */:
+ case 8 /* StringLiteral */:
+ case 1 /* BooleanLiteral */:
+ case 5 /* NullLiteral */:
+ case 6 /* NumericLiteral */:
+ case 4 /* Keyword */:
+ return true;
+ case 7 /* Punctuator */:
+ return token.value === '[';
+ default:
+ break;
+ }
+ return false;
+ };
+ Parser.prototype.parseGetterMethod = function () {
+ var node = this.createNode();
+ var isGenerator = false;
+ var previousAllowYield = this.context.allowYield;
+ this.context.allowYield = false;
+ var formalParameters = this.parseFormalParameters();
+ if (formalParameters.params.length > 0) {
+ this.tolerateError(messages_1.Messages.BadGetterArity);
+ }
+ var method = this.parsePropertyMethod(formalParameters);
+ this.context.allowYield = previousAllowYield;
+ return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator));
+ };
+ Parser.prototype.parseSetterMethod = function () {
+ var node = this.createNode();
+ var isGenerator = false;
+ var previousAllowYield = this.context.allowYield;
+ this.context.allowYield = false;
+ var formalParameters = this.parseFormalParameters();
+ if (formalParameters.params.length !== 1) {
+ this.tolerateError(messages_1.Messages.BadSetterArity);
+ }
+ else if (formalParameters.params[0] instanceof Node.RestElement) {
+ this.tolerateError(messages_1.Messages.BadSetterRestParameter);
+ }
+ var method = this.parsePropertyMethod(formalParameters);
+ this.context.allowYield = previousAllowYield;
+ return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator));
+ };
+ Parser.prototype.parseGeneratorMethod = function () {
+ var node = this.createNode();
+ var isGenerator = true;
+ var previousAllowYield = this.context.allowYield;
+ this.context.allowYield = true;
+ var params = this.parseFormalParameters();
+ this.context.allowYield = false;
+ var method = this.parsePropertyMethod(params);
+ this.context.allowYield = previousAllowYield;
+ return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator));
+ };
+ // https://tc39.github.io/ecma262/#sec-generator-function-definitions
+ Parser.prototype.isStartOfExpression = function () {
+ var start = true;
+ var value = this.lookahead.value;
+ switch (this.lookahead.type) {
+ case 7 /* Punctuator */:
+ start = (value === '[') || (value === '(') || (value === '{') ||
+ (value === '+') || (value === '-') ||
+ (value === '!') || (value === '~') ||
+ (value === '++') || (value === '--') ||
+ (value === '/') || (value === '/='); // regular expression literal
+ break;
+ case 4 /* Keyword */:
+ start = (value === 'class') || (value === 'delete') ||
+ (value === 'function') || (value === 'let') || (value === 'new') ||
+ (value === 'super') || (value === 'this') || (value === 'typeof') ||
+ (value === 'void') || (value === 'yield');
+ break;
+ default:
+ break;
+ }
+ return start;
+ };
+ Parser.prototype.parseYieldExpression = function () {
+ var node = this.createNode();
+ this.expectKeyword('yield');
+ var argument = null;
+ var delegate = false;
+ if (!this.hasLineTerminator) {
+ var previousAllowYield = this.context.allowYield;
+ this.context.allowYield = false;
+ delegate = this.match('*');
+ if (delegate) {
+ this.nextToken();
+ argument = this.parseAssignmentExpression();
+ }
+ else if (this.isStartOfExpression()) {
+ argument = this.parseAssignmentExpression();
+ }
+ this.context.allowYield = previousAllowYield;
+ }
+ return this.finalize(node, new Node.YieldExpression(argument, delegate));
+ };
+ // https://tc39.github.io/ecma262/#sec-class-definitions
+ Parser.prototype.parseClassElement = function (hasConstructor) {
+ var token = this.lookahead;
+ var node = this.createNode();
+ var kind = '';
+ var key = null;
+ var value = null;
+ var computed = false;
+ var method = false;
+ var isStatic = false;
+ var isAsync = false;
+ if (this.match('*')) {
+ this.nextToken();
+ }
+ else {
+ computed = this.match('[');
+ key = this.parseObjectPropertyKey();
+ var id = key;
+ if (id.name === 'static' && (this.qualifiedPropertyName(this.lookahead) || this.match('*'))) {
+ token = this.lookahead;
+ isStatic = true;
+ computed = this.match('[');
+ if (this.match('*')) {
+ this.nextToken();
+ }
+ else {
+ key = this.parseObjectPropertyKey();
+ }
+ }
+ if ((token.type === 3 /* Identifier */) && !this.hasLineTerminator && (token.value === 'async')) {
+ var punctuator = this.lookahead.value;
+ if (punctuator !== ':' && punctuator !== '(' && punctuator !== '*') {
+ isAsync = true;
+ token = this.lookahead;
+ key = this.parseObjectPropertyKey();
+ if (token.type === 3 /* Identifier */) {
+ if (token.value === 'get' || token.value === 'set') {
+ this.tolerateUnexpectedToken(token);
+ }
+ else if (token.value === 'constructor') {
+ this.tolerateUnexpectedToken(token, messages_1.Messages.ConstructorIsAsync);
+ }
+ }
+ }
+ }
+ }
+ var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead);
+ if (token.type === 3 /* Identifier */) {
+ if (token.value === 'get' && lookaheadPropertyKey) {
+ kind = 'get';
+ computed = this.match('[');
+ key = this.parseObjectPropertyKey();
+ this.context.allowYield = false;
+ value = this.parseGetterMethod();
+ }
+ else if (token.value === 'set' && lookaheadPropertyKey) {
+ kind = 'set';
+ computed = this.match('[');
+ key = this.parseObjectPropertyKey();
+ value = this.parseSetterMethod();
+ }
+ }
+ else if (token.type === 7 /* Punctuator */ && token.value === '*' && lookaheadPropertyKey) {
+ kind = 'init';
+ computed = this.match('[');
+ key = this.parseObjectPropertyKey();
+ value = this.parseGeneratorMethod();
+ method = true;
+ }
+ if (!kind && key && this.match('(')) {
+ kind = 'init';
+ value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction();
+ method = true;
+ }
+ if (!kind) {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ if (kind === 'init') {
+ kind = 'method';
+ }
+ if (!computed) {
+ if (isStatic && this.isPropertyKey(key, 'prototype')) {
+ this.throwUnexpectedToken(token, messages_1.Messages.StaticPrototype);
+ }
+ if (!isStatic && this.isPropertyKey(key, 'constructor')) {
+ if (kind !== 'method' || !method || (value && value.generator)) {
+ this.throwUnexpectedToken(token, messages_1.Messages.ConstructorSpecialMethod);
+ }
+ if (hasConstructor.value) {
+ this.throwUnexpectedToken(token, messages_1.Messages.DuplicateConstructor);
+ }
+ else {
+ hasConstructor.value = true;
+ }
+ kind = 'constructor';
+ }
+ }
+ return this.finalize(node, new Node.MethodDefinition(key, computed, value, kind, isStatic));
+ };
+ Parser.prototype.parseClassElementList = function () {
+ var body = [];
+ var hasConstructor = { value: false };
+ this.expect('{');
+ while (!this.match('}')) {
+ if (this.match(';')) {
+ this.nextToken();
+ }
+ else {
+ body.push(this.parseClassElement(hasConstructor));
+ }
+ }
+ this.expect('}');
+ return body;
+ };
+ Parser.prototype.parseClassBody = function () {
+ var node = this.createNode();
+ var elementList = this.parseClassElementList();
+ return this.finalize(node, new Node.ClassBody(elementList));
+ };
+ Parser.prototype.parseClassDeclaration = function (identifierIsOptional) {
+ var node = this.createNode();
+ var previousStrict = this.context.strict;
+ this.context.strict = true;
+ this.expectKeyword('class');
+ var id = (identifierIsOptional && (this.lookahead.type !== 3 /* Identifier */)) ? null : this.parseVariableIdentifier();
+ var superClass = null;
+ if (this.matchKeyword('extends')) {
+ this.nextToken();
+ superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall);
+ }
+ var classBody = this.parseClassBody();
+ this.context.strict = previousStrict;
+ return this.finalize(node, new Node.ClassDeclaration(id, superClass, classBody));
+ };
+ Parser.prototype.parseClassExpression = function () {
+ var node = this.createNode();
+ var previousStrict = this.context.strict;
+ this.context.strict = true;
+ this.expectKeyword('class');
+ var id = (this.lookahead.type === 3 /* Identifier */) ? this.parseVariableIdentifier() : null;
+ var superClass = null;
+ if (this.matchKeyword('extends')) {
+ this.nextToken();
+ superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall);
+ }
+ var classBody = this.parseClassBody();
+ this.context.strict = previousStrict;
+ return this.finalize(node, new Node.ClassExpression(id, superClass, classBody));
+ };
+ // https://tc39.github.io/ecma262/#sec-scripts
+ // https://tc39.github.io/ecma262/#sec-modules
+ Parser.prototype.parseModule = function () {
+ this.context.strict = true;
+ this.context.isModule = true;
+ var node = this.createNode();
+ var body = this.parseDirectivePrologues();
+ while (this.lookahead.type !== 2 /* EOF */) {
+ body.push(this.parseStatementListItem());
+ }
+ return this.finalize(node, new Node.Module(body));
+ };
+ Parser.prototype.parseScript = function () {
+ var node = this.createNode();
+ var body = this.parseDirectivePrologues();
+ while (this.lookahead.type !== 2 /* EOF */) {
+ body.push(this.parseStatementListItem());
+ }
+ return this.finalize(node, new Node.Script(body));
+ };
+ // https://tc39.github.io/ecma262/#sec-imports
+ Parser.prototype.parseModuleSpecifier = function () {
+ var node = this.createNode();
+ if (this.lookahead.type !== 8 /* StringLiteral */) {
+ this.throwError(messages_1.Messages.InvalidModuleSpecifier);
+ }
+ var token = this.nextToken();
+ var raw = this.getTokenRaw(token);
+ return this.finalize(node, new Node.Literal(token.value, raw));
+ };
+ // import {<foo as bar>} ...;
+ Parser.prototype.parseImportSpecifier = function () {
+ var node = this.createNode();
+ var imported;
+ var local;
+ if (this.lookahead.type === 3 /* Identifier */) {
+ imported = this.parseVariableIdentifier();
+ local = imported;
+ if (this.matchContextualKeyword('as')) {
+ this.nextToken();
+ local = this.parseVariableIdentifier();
+ }
+ }
+ else {
+ imported = this.parseIdentifierName();
+ local = imported;
+ if (this.matchContextualKeyword('as')) {
+ this.nextToken();
+ local = this.parseVariableIdentifier();
+ }
+ else {
+ this.throwUnexpectedToken(this.nextToken());
+ }
+ }
+ return this.finalize(node, new Node.ImportSpecifier(local, imported));
+ };
+ // {foo, bar as bas}
+ Parser.prototype.parseNamedImports = function () {
+ this.expect('{');
+ var specifiers = [];
+ while (!this.match('}')) {
+ specifiers.push(this.parseImportSpecifier());
+ if (!this.match('}')) {
+ this.expect(',');
+ }
+ }
+ this.expect('}');
+ return specifiers;
+ };
+ // import <foo> ...;
+ Parser.prototype.parseImportDefaultSpecifier = function () {
+ var node = this.createNode();
+ var local = this.parseIdentifierName();
+ return this.finalize(node, new Node.ImportDefaultSpecifier(local));
+ };
+ // import <* as foo> ...;
+ Parser.prototype.parseImportNamespaceSpecifier = function () {
+ var node = this.createNode();
+ this.expect('*');
+ if (!this.matchContextualKeyword('as')) {
+ this.throwError(messages_1.Messages.NoAsAfterImportNamespace);
+ }
+ this.nextToken();
+ var local = this.parseIdentifierName();
+ return this.finalize(node, new Node.ImportNamespaceSpecifier(local));
+ };
+ Parser.prototype.parseImportDeclaration = function () {
+ if (this.context.inFunctionBody) {
+ this.throwError(messages_1.Messages.IllegalImportDeclaration);
+ }
+ var node = this.createNode();
+ this.expectKeyword('import');
+ var src;
+ var specifiers = [];
+ if (this.lookahead.type === 8 /* StringLiteral */) {
+ // import 'foo';
+ src = this.parseModuleSpecifier();
+ }
+ else {
+ if (this.match('{')) {
+ // import {bar}
+ specifiers = specifiers.concat(this.parseNamedImports());
+ }
+ else if (this.match('*')) {
+ // import * as foo
+ specifiers.push(this.parseImportNamespaceSpecifier());
+ }
+ else if (this.isIdentifierName(this.lookahead) && !this.matchKeyword('default')) {
+ // import foo
+ specifiers.push(this.parseImportDefaultSpecifier());
+ if (this.match(',')) {
+ this.nextToken();
+ if (this.match('*')) {
+ // import foo, * as foo
+ specifiers.push(this.parseImportNamespaceSpecifier());
+ }
+ else if (this.match('{')) {
+ // import foo, {bar}
+ specifiers = specifiers.concat(this.parseNamedImports());
+ }
+ else {
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ }
+ }
+ else {
+ this.throwUnexpectedToken(this.nextToken());
+ }
+ if (!this.matchContextualKeyword('from')) {
+ var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause;
+ this.throwError(message, this.lookahead.value);
+ }
+ this.nextToken();
+ src = this.parseModuleSpecifier();
+ }
+ this.consumeSemicolon();
+ return this.finalize(node, new Node.ImportDeclaration(specifiers, src));
+ };
+ // https://tc39.github.io/ecma262/#sec-exports
+ Parser.prototype.parseExportSpecifier = function () {
+ var node = this.createNode();
+ var local = this.parseIdentifierName();
+ var exported = local;
+ if (this.matchContextualKeyword('as')) {
+ this.nextToken();
+ exported = this.parseIdentifierName();
+ }
+ return this.finalize(node, new Node.ExportSpecifier(local, exported));
+ };
+ Parser.prototype.parseExportDeclaration = function () {
+ if (this.context.inFunctionBody) {
+ this.throwError(messages_1.Messages.IllegalExportDeclaration);
+ }
+ var node = this.createNode();
+ this.expectKeyword('export');
+ var exportDeclaration;
+ if (this.matchKeyword('default')) {
+ // export default ...
+ this.nextToken();
+ if (this.matchKeyword('function')) {
+ // export default function foo () {}
+ // export default function () {}
+ var declaration = this.parseFunctionDeclaration(true);
+ exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
+ }
+ else if (this.matchKeyword('class')) {
+ // export default class foo {}
+ var declaration = this.parseClassDeclaration(true);
+ exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
+ }
+ else if (this.matchContextualKeyword('async')) {
+ // export default async function f () {}
+ // export default async function () {}
+ // export default async x => x
+ var declaration = this.matchAsyncFunction() ? this.parseFunctionDeclaration(true) : this.parseAssignmentExpression();
+ exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
+ }
+ else {
+ if (this.matchContextualKeyword('from')) {
+ this.throwError(messages_1.Messages.UnexpectedToken, this.lookahead.value);
+ }
+ // export default {};
+ // export default [];
+ // export default (1 + 2);
+ var declaration = this.match('{') ? this.parseObjectInitializer() :
+ this.match('[') ? this.parseArrayInitializer() : this.parseAssignmentExpression();
+ this.consumeSemicolon();
+ exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
+ }
+ }
+ else if (this.match('*')) {
+ // export * from 'foo';
+ this.nextToken();
+ if (!this.matchContextualKeyword('from')) {
+ var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause;
+ this.throwError(message, this.lookahead.value);
+ }
+ this.nextToken();
+ var src = this.parseModuleSpecifier();
+ this.consumeSemicolon();
+ exportDeclaration = this.finalize(node, new Node.ExportAllDeclaration(src));
+ }
+ else if (this.lookahead.type === 4 /* Keyword */) {
+ // export var f = 1;
+ var declaration = void 0;
+ switch (this.lookahead.value) {
+ case 'let':
+ case 'const':
+ declaration = this.parseLexicalDeclaration({ inFor: false });
+ break;
+ case 'var':
+ case 'class':
+ case 'function':
+ declaration = this.parseStatementListItem();
+ break;
+ default:
+ this.throwUnexpectedToken(this.lookahead);
+ }
+ exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null));
+ }
+ else if (this.matchAsyncFunction()) {
+ var declaration = this.parseFunctionDeclaration();
+ exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null));
+ }
+ else {
+ var specifiers = [];
+ var source = null;
+ var isExportFromIdentifier = false;
+ this.expect('{');
+ while (!this.match('}')) {
+ isExportFromIdentifier = isExportFromIdentifier || this.matchKeyword('default');
+ specifiers.push(this.parseExportSpecifier());
+ if (!this.match('}')) {
+ this.expect(',');
+ }
+ }
+ this.expect('}');
+ if (this.matchContextualKeyword('from')) {
+ // export {default} from 'foo';
+ // export {foo} from 'foo';
+ this.nextToken();
+ source = this.parseModuleSpecifier();
+ this.consumeSemicolon();
+ }
+ else if (isExportFromIdentifier) {
+ // export {default}; // missing fromClause
+ var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause;
+ this.throwError(message, this.lookahead.value);
+ }
+ else {
+ // export {foo};
+ this.consumeSemicolon();
+ }
+ exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(null, specifiers, source));
+ }
+ return exportDeclaration;
+ };
+ return Parser;
+ }());
+ exports.Parser = Parser;
+
+
+/***/ },
+/* 9 */
+/***/ function(module, exports) {
+
+ "use strict";
+ // Ensure the condition is true, otherwise throw an error.
+ // This is only to have a better contract semantic, i.e. another safety net
+ // to catch a logic error. The condition shall be fulfilled in normal case.
+ // Do NOT use this to enforce a certain condition on any user input.
+ Object.defineProperty(exports, "__esModule", { value: true });
+ function assert(condition, message) {
+ /* istanbul ignore if */
+ if (!condition) {
+ throw new Error('ASSERT: ' + message);
+ }
+ }
+ exports.assert = assert;
+
+
+/***/ },
+/* 10 */
+/***/ function(module, exports) {
+
+ "use strict";
+ /* tslint:disable:max-classes-per-file */
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var ErrorHandler = (function () {
+ function ErrorHandler() {
+ this.errors = [];
+ this.tolerant = false;
+ }
+ ErrorHandler.prototype.recordError = function (error) {
+ this.errors.push(error);
+ };
+ ErrorHandler.prototype.tolerate = function (error) {
+ if (this.tolerant) {
+ this.recordError(error);
+ }
+ else {
+ throw error;
+ }
+ };
+ ErrorHandler.prototype.constructError = function (msg, column) {
+ var error = new Error(msg);
+ try {
+ throw error;
+ }
+ catch (base) {
+ /* istanbul ignore else */
+ if (Object.create && Object.defineProperty) {
+ error = Object.create(base);
+ Object.defineProperty(error, 'column', { value: column });
+ }
+ }
+ /* istanbul ignore next */
+ return error;
+ };
+ ErrorHandler.prototype.createError = function (index, line, col, description) {
+ var msg = 'Line ' + line + ': ' + description;
+ var error = this.constructError(msg, col);
+ error.index = index;
+ error.lineNumber = line;
+ error.description = description;
+ return error;
+ };
+ ErrorHandler.prototype.throwError = function (index, line, col, description) {
+ throw this.createError(index, line, col, description);
+ };
+ ErrorHandler.prototype.tolerateError = function (index, line, col, description) {
+ var error = this.createError(index, line, col, description);
+ if (this.tolerant) {
+ this.recordError(error);
+ }
+ else {
+ throw error;
+ }
+ };
+ return ErrorHandler;
+ }());
+ exports.ErrorHandler = ErrorHandler;
+
+
+/***/ },
+/* 11 */
+/***/ function(module, exports) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ // Error messages should be identical to V8.
+ exports.Messages = {
+ BadGetterArity: 'Getter must not have any formal parameters',
+ BadSetterArity: 'Setter must have exactly one formal parameter',
+ BadSetterRestParameter: 'Setter function argument must not be a rest parameter',
+ ConstructorIsAsync: 'Class constructor may not be an async method',
+ ConstructorSpecialMethod: 'Class constructor may not be an accessor',
+ DeclarationMissingInitializer: 'Missing initializer in %0 declaration',
+ DefaultRestParameter: 'Unexpected token =',
+ DuplicateBinding: 'Duplicate binding %0',
+ DuplicateConstructor: 'A class may only have one constructor',
+ DuplicateProtoProperty: 'Duplicate __proto__ fields are not allowed in object literals',
+ ForInOfLoopInitializer: '%0 loop variable declaration may not have an initializer',
+ GeneratorInLegacyContext: 'Generator declarations are not allowed in legacy contexts',
+ IllegalBreak: 'Illegal break statement',
+ IllegalContinue: 'Illegal continue statement',
+ IllegalExportDeclaration: 'Unexpected token',
+ IllegalImportDeclaration: 'Unexpected token',
+ IllegalLanguageModeDirective: 'Illegal \'use strict\' directive in function with non-simple parameter list',
+ IllegalReturn: 'Illegal return statement',
+ InvalidEscapedReservedWord: 'Keyword must not contain escaped characters',
+ InvalidHexEscapeSequence: 'Invalid hexadecimal escape sequence',
+ InvalidLHSInAssignment: 'Invalid left-hand side in assignment',
+ InvalidLHSInForIn: 'Invalid left-hand side in for-in',
+ InvalidLHSInForLoop: 'Invalid left-hand side in for-loop',
+ InvalidModuleSpecifier: 'Unexpected token',
+ InvalidRegExp: 'Invalid regular expression',
+ LetInLexicalBinding: 'let is disallowed as a lexically bound name',
+ MissingFromClause: 'Unexpected token',
+ MultipleDefaultsInSwitch: 'More than one default clause in switch statement',
+ NewlineAfterThrow: 'Illegal newline after throw',
+ NoAsAfterImportNamespace: 'Unexpected token',
+ NoCatchOrFinally: 'Missing catch or finally after try',
+ ParameterAfterRestParameter: 'Rest parameter must be last formal parameter',
+ Redeclaration: '%0 \'%1\' has already been declared',
+ StaticPrototype: 'Classes may not have static property named prototype',
+ StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',
+ StrictDelete: 'Delete of an unqualified identifier in strict mode.',
+ StrictFunction: 'In strict mode code, functions can only be declared at top level or inside a block',
+ StrictFunctionName: 'Function name may not be eval or arguments in strict mode',
+ StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',
+ StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',
+ StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',
+ StrictModeWith: 'Strict mode code may not include a with statement',
+ StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',
+ StrictParamDupe: 'Strict mode function may not have duplicate parameter names',
+ StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',
+ StrictReservedWord: 'Use of future reserved word in strict mode',
+ StrictVarName: 'Variable name may not be eval or arguments in strict mode',
+ TemplateOctalLiteral: 'Octal literals are not allowed in template strings.',
+ UnexpectedEOS: 'Unexpected end of input',
+ UnexpectedIdentifier: 'Unexpected identifier',
+ UnexpectedNumber: 'Unexpected number',
+ UnexpectedReserved: 'Unexpected reserved word',
+ UnexpectedString: 'Unexpected string',
+ UnexpectedTemplate: 'Unexpected quasi %0',
+ UnexpectedToken: 'Unexpected token %0',
+ UnexpectedTokenIllegal: 'Unexpected token ILLEGAL',
+ UnknownLabel: 'Undefined label \'%0\'',
+ UnterminatedRegExp: 'Invalid regular expression: missing /'
+ };
+
+
+/***/ },
+/* 12 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var assert_1 = __webpack_require__(9);
+ var character_1 = __webpack_require__(4);
+ var messages_1 = __webpack_require__(11);
+ function hexValue(ch) {
+ return '0123456789abcdef'.indexOf(ch.toLowerCase());
+ }
+ function octalValue(ch) {
+ return '01234567'.indexOf(ch);
+ }
+ var Scanner = (function () {
+ function Scanner(code, handler) {
+ this.source = code;
+ this.errorHandler = handler;
+ this.trackComment = false;
+ this.length = code.length;
+ this.index = 0;
+ this.lineNumber = (code.length > 0) ? 1 : 0;
+ this.lineStart = 0;
+ this.curlyStack = [];
+ }
+ Scanner.prototype.saveState = function () {
+ return {
+ index: this.index,
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart
+ };
+ };
+ Scanner.prototype.restoreState = function (state) {
+ this.index = state.index;
+ this.lineNumber = state.lineNumber;
+ this.lineStart = state.lineStart;
+ };
+ Scanner.prototype.eof = function () {
+ return this.index >= this.length;
+ };
+ Scanner.prototype.throwUnexpectedToken = function (message) {
+ if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; }
+ return this.errorHandler.throwError(this.index, this.lineNumber, this.index - this.lineStart + 1, message);
+ };
+ Scanner.prototype.tolerateUnexpectedToken = function (message) {
+ if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; }
+ this.errorHandler.tolerateError(this.index, this.lineNumber, this.index - this.lineStart + 1, message);
+ };
+ // https://tc39.github.io/ecma262/#sec-comments
+ Scanner.prototype.skipSingleLineComment = function (offset) {
+ var comments = [];
+ var start, loc;
+ if (this.trackComment) {
+ comments = [];
+ start = this.index - offset;
+ loc = {
+ start: {
+ line: this.lineNumber,
+ column: this.index - this.lineStart - offset
+ },
+ end: {}
+ };
+ }
+ while (!this.eof()) {
+ var ch = this.source.charCodeAt(this.index);
+ ++this.index;
+ if (character_1.Character.isLineTerminator(ch)) {
+ if (this.trackComment) {
+ loc.end = {
+ line: this.lineNumber,
+ column: this.index - this.lineStart - 1
+ };
+ var entry = {
+ multiLine: false,
+ slice: [start + offset, this.index - 1],
+ range: [start, this.index - 1],
+ loc: loc
+ };
+ comments.push(entry);
+ }
+ if (ch === 13 && this.source.charCodeAt(this.index) === 10) {
+ ++this.index;
+ }
+ ++this.lineNumber;
+ this.lineStart = this.index;
+ return comments;
+ }
+ }
+ if (this.trackComment) {
+ loc.end = {
+ line: this.lineNumber,
+ column: this.index - this.lineStart
+ };
+ var entry = {
+ multiLine: false,
+ slice: [start + offset, this.index],
+ range: [start, this.index],
+ loc: loc
+ };
+ comments.push(entry);
+ }
+ return comments;
+ };
+ Scanner.prototype.skipMultiLineComment = function () {
+ var comments = [];
+ var start, loc;
+ if (this.trackComment) {
+ comments = [];
+ start = this.index - 2;
+ loc = {
+ start: {
+ line: this.lineNumber,
+ column: this.index - this.lineStart - 2
+ },
+ end: {}
+ };
+ }
+ while (!this.eof()) {
+ var ch = this.source.charCodeAt(this.index);
+ if (character_1.Character.isLineTerminator(ch)) {
+ if (ch === 0x0D && this.source.charCodeAt(this.index + 1) === 0x0A) {
+ ++this.index;
+ }
+ ++this.lineNumber;
+ ++this.index;
+ this.lineStart = this.index;
+ }
+ else if (ch === 0x2A) {
+ // Block comment ends with '*/'.
+ if (this.source.charCodeAt(this.index + 1) === 0x2F) {
+ this.index += 2;
+ if (this.trackComment) {
+ loc.end = {
+ line: this.lineNumber,
+ column: this.index - this.lineStart
+ };
+ var entry = {
+ multiLine: true,
+ slice: [start + 2, this.index - 2],
+ range: [start, this.index],
+ loc: loc
+ };
+ comments.push(entry);
+ }
+ return comments;
+ }
+ ++this.index;
+ }
+ else {
+ ++this.index;
+ }
+ }
+ // Ran off the end of the file - the whole thing is a comment
+ if (this.trackComment) {
+ loc.end = {
+ line: this.lineNumber,
+ column: this.index - this.lineStart
+ };
+ var entry = {
+ multiLine: true,
+ slice: [start + 2, this.index],
+ range: [start, this.index],
+ loc: loc
+ };
+ comments.push(entry);
+ }
+ this.tolerateUnexpectedToken();
+ return comments;
+ };
+ Scanner.prototype.scanComments = function () {
+ var comments;
+ if (this.trackComment) {
+ comments = [];
+ }
+ var start = (this.index === 0);
+ while (!this.eof()) {
+ var ch = this.source.charCodeAt(this.index);
+ if (character_1.Character.isWhiteSpace(ch)) {
+ ++this.index;
+ }
+ else if (character_1.Character.isLineTerminator(ch)) {
+ ++this.index;
+ if (ch === 0x0D && this.source.charCodeAt(this.index) === 0x0A) {
+ ++this.index;
+ }
+ ++this.lineNumber;
+ this.lineStart = this.index;
+ start = true;
+ }
+ else if (ch === 0x2F) {
+ ch = this.source.charCodeAt(this.index + 1);
+ if (ch === 0x2F) {
+ this.index += 2;
+ var comment = this.skipSingleLineComment(2);
+ if (this.trackComment) {
+ comments = comments.concat(comment);
+ }
+ start = true;
+ }
+ else if (ch === 0x2A) {
+ this.index += 2;
+ var comment = this.skipMultiLineComment();
+ if (this.trackComment) {
+ comments = comments.concat(comment);
+ }
+ }
+ else {
+ break;
+ }
+ }
+ else if (start && ch === 0x2D) {
+ // U+003E is '>'
+ if ((this.source.charCodeAt(this.index + 1) === 0x2D) && (this.source.charCodeAt(this.index + 2) === 0x3E)) {
+ // '-->' is a single-line comment
+ this.index += 3;
+ var comment = this.skipSingleLineComment(3);
+ if (this.trackComment) {
+ comments = comments.concat(comment);
+ }
+ }
+ else {
+ break;
+ }
+ }
+ else if (ch === 0x3C) {
+ if (this.source.slice(this.index + 1, this.index + 4) === '!--') {
+ this.index += 4; // `<!--`
+ var comment = this.skipSingleLineComment(4);
+ if (this.trackComment) {
+ comments = comments.concat(comment);
+ }
+ }
+ else {
+ break;
+ }
+ }
+ else {
+ break;
+ }
+ }
+ return comments;
+ };
+ // https://tc39.github.io/ecma262/#sec-future-reserved-words
+ Scanner.prototype.isFutureReservedWord = function (id) {
+ switch (id) {
+ case 'enum':
+ case 'export':
+ case 'import':
+ case 'super':
+ return true;
+ default:
+ return false;
+ }
+ };
+ Scanner.prototype.isStrictModeReservedWord = function (id) {
+ switch (id) {
+ case 'implements':
+ case 'interface':
+ case 'package':
+ case 'private':
+ case 'protected':
+ case 'public':
+ case 'static':
+ case 'yield':
+ case 'let':
+ return true;
+ default:
+ return false;
+ }
+ };
+ Scanner.prototype.isRestrictedWord = function (id) {
+ return id === 'eval' || id === 'arguments';
+ };
+ // https://tc39.github.io/ecma262/#sec-keywords
+ Scanner.prototype.isKeyword = function (id) {
+ switch (id.length) {
+ case 2:
+ return (id === 'if') || (id === 'in') || (id === 'do');
+ case 3:
+ return (id === 'var') || (id === 'for') || (id === 'new') ||
+ (id === 'try') || (id === 'let');
+ case 4:
+ return (id === 'this') || (id === 'else') || (id === 'case') ||
+ (id === 'void') || (id === 'with') || (id === 'enum');
+ case 5:
+ return (id === 'while') || (id === 'break') || (id === 'catch') ||
+ (id === 'throw') || (id === 'const') || (id === 'yield') ||
+ (id === 'class') || (id === 'super');
+ case 6:
+ return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
+ (id === 'switch') || (id === 'export') || (id === 'import');
+ case 7:
+ return (id === 'default') || (id === 'finally') || (id === 'extends');
+ case 8:
+ return (id === 'function') || (id === 'continue') || (id === 'debugger');
+ case 10:
+ return (id === 'instanceof');
+ default:
+ return false;
+ }
+ };
+ Scanner.prototype.codePointAt = function (i) {
+ var cp = this.source.charCodeAt(i);
+ if (cp >= 0xD800 && cp <= 0xDBFF) {
+ var second = this.source.charCodeAt(i + 1);
+ if (second >= 0xDC00 && second <= 0xDFFF) {
+ var first = cp;
+ cp = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
+ }
+ }
+ return cp;
+ };
+ Scanner.prototype.scanHexEscape = function (prefix) {
+ var len = (prefix === 'u') ? 4 : 2;
+ var code = 0;
+ for (var i = 0; i < len; ++i) {
+ if (!this.eof() && character_1.Character.isHexDigit(this.source.charCodeAt(this.index))) {
+ code = code * 16 + hexValue(this.source[this.index++]);
+ }
+ else {
+ return null;
+ }
+ }
+ return String.fromCharCode(code);
+ };
+ Scanner.prototype.scanUnicodeCodePointEscape = function () {
+ var ch = this.source[this.index];
+ var code = 0;
+ // At least, one hex digit is required.
+ if (ch === '}') {
+ this.throwUnexpectedToken();
+ }
+ while (!this.eof()) {
+ ch = this.source[this.index++];
+ if (!character_1.Character.isHexDigit(ch.charCodeAt(0))) {
+ break;
+ }
+ code = code * 16 + hexValue(ch);
+ }
+ if (code > 0x10FFFF || ch !== '}') {
+ this.throwUnexpectedToken();
+ }
+ return character_1.Character.fromCodePoint(code);
+ };
+ Scanner.prototype.getIdentifier = function () {
+ var start = this.index++;
+ while (!this.eof()) {
+ var ch = this.source.charCodeAt(this.index);
+ if (ch === 0x5C) {
+ // Blackslash (U+005C) marks Unicode escape sequence.
+ this.index = start;
+ return this.getComplexIdentifier();
+ }
+ else if (ch >= 0xD800 && ch < 0xDFFF) {
+ // Need to handle surrogate pairs.
+ this.index = start;
+ return this.getComplexIdentifier();
+ }
+ if (character_1.Character.isIdentifierPart(ch)) {
+ ++this.index;
+ }
+ else {
+ break;
+ }
+ }
+ return this.source.slice(start, this.index);
+ };
+ Scanner.prototype.getComplexIdentifier = function () {
+ var cp = this.codePointAt(this.index);
+ var id = character_1.Character.fromCodePoint(cp);
+ this.index += id.length;
+ // '\u' (U+005C, U+0075) denotes an escaped character.
+ var ch;
+ if (cp === 0x5C) {
+ if (this.source.charCodeAt(this.index) !== 0x75) {
+ this.throwUnexpectedToken();
+ }
+ ++this.index;
+ if (this.source[this.index] === '{') {
+ ++this.index;
+ ch = this.scanUnicodeCodePointEscape();
+ }
+ else {
+ ch = this.scanHexEscape('u');
+ if (ch === null || ch === '\\' || !character_1.Character.isIdentifierStart(ch.charCodeAt(0))) {
+ this.throwUnexpectedToken();
+ }
+ }
+ id = ch;
+ }
+ while (!this.eof()) {
+ cp = this.codePointAt(this.index);
+ if (!character_1.Character.isIdentifierPart(cp)) {
+ break;
+ }
+ ch = character_1.Character.fromCodePoint(cp);
+ id += ch;
+ this.index += ch.length;
+ // '\u' (U+005C, U+0075) denotes an escaped character.
+ if (cp === 0x5C) {
+ id = id.substr(0, id.length - 1);
+ if (this.source.charCodeAt(this.index) !== 0x75) {
+ this.throwUnexpectedToken();
+ }
+ ++this.index;
+ if (this.source[this.index] === '{') {
+ ++this.index;
+ ch = this.scanUnicodeCodePointEscape();
+ }
+ else {
+ ch = this.scanHexEscape('u');
+ if (ch === null || ch === '\\' || !character_1.Character.isIdentifierPart(ch.charCodeAt(0))) {
+ this.throwUnexpectedToken();
+ }
+ }
+ id += ch;
+ }
+ }
+ return id;
+ };
+ Scanner.prototype.octalToDecimal = function (ch) {
+ // \0 is not octal escape sequence
+ var octal = (ch !== '0');
+ var code = octalValue(ch);
+ if (!this.eof() && character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) {
+ octal = true;
+ code = code * 8 + octalValue(this.source[this.index++]);
+ // 3 digits are only allowed when string starts
+ // with 0, 1, 2, 3
+ if ('0123'.indexOf(ch) >= 0 && !this.eof() && character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) {
+ code = code * 8 + octalValue(this.source[this.index++]);
+ }
+ }
+ return {
+ code: code,
+ octal: octal
+ };
+ };
+ // https://tc39.github.io/ecma262/#sec-names-and-keywords
+ Scanner.prototype.scanIdentifier = function () {
+ var type;
+ var start = this.index;
+ // Backslash (U+005C) starts an escaped character.
+ var id = (this.source.charCodeAt(start) === 0x5C) ? this.getComplexIdentifier() : this.getIdentifier();
+ // There is no keyword or literal with only one character.
+ // Thus, it must be an identifier.
+ if (id.length === 1) {
+ type = 3 /* Identifier */;
+ }
+ else if (this.isKeyword(id)) {
+ type = 4 /* Keyword */;
+ }
+ else if (id === 'null') {
+ type = 5 /* NullLiteral */;
+ }
+ else if (id === 'true' || id === 'false') {
+ type = 1 /* BooleanLiteral */;
+ }
+ else {
+ type = 3 /* Identifier */;
+ }
+ if (type !== 3 /* Identifier */ && (start + id.length !== this.index)) {
+ var restore = this.index;
+ this.index = start;
+ this.tolerateUnexpectedToken(messages_1.Messages.InvalidEscapedReservedWord);
+ this.index = restore;
+ }
+ return {
+ type: type,
+ value: id,
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart,
+ start: start,
+ end: this.index
+ };
+ };
+ // https://tc39.github.io/ecma262/#sec-punctuators
+ Scanner.prototype.scanPunctuator = function () {
+ var start = this.index;
+ // Check for most common single-character punctuators.
+ var str = this.source[this.index];
+ switch (str) {
+ case '(':
+ case '{':
+ if (str === '{') {
+ this.curlyStack.push('{');
+ }
+ ++this.index;
+ break;
+ case '.':
+ ++this.index;
+ if (this.source[this.index] === '.' && this.source[this.index + 1] === '.') {
+ // Spread operator: ...
+ this.index += 2;
+ str = '...';
+ }
+ break;
+ case '}':
+ ++this.index;
+ this.curlyStack.pop();
+ break;
+ case ')':
+ case ';':
+ case ',':
+ case '[':
+ case ']':
+ case ':':
+ case '?':
+ case '~':
+ ++this.index;
+ break;
+ default:
+ // 4-character punctuator.
+ str = this.source.substr(this.index, 4);
+ if (str === '>>>=') {
+ this.index += 4;
+ }
+ else {
+ // 3-character punctuators.
+ str = str.substr(0, 3);
+ if (str === '===' || str === '!==' || str === '>>>' ||
+ str === '<<=' || str === '>>=' || str === '**=') {
+ this.index += 3;
+ }
+ else {
+ // 2-character punctuators.
+ str = str.substr(0, 2);
+ if (str === '&&' || str === '||' || str === '==' || str === '!=' ||
+ str === '+=' || str === '-=' || str === '*=' || str === '/=' ||
+ str === '++' || str === '--' || str === '<<' || str === '>>' ||
+ str === '&=' || str === '|=' || str === '^=' || str === '%=' ||
+ str === '<=' || str === '>=' || str === '=>' || str === '**') {
+ this.index += 2;
+ }
+ else {
+ // 1-character punctuators.
+ str = this.source[this.index];
+ if ('<>=!+-*%&|^/'.indexOf(str) >= 0) {
+ ++this.index;
+ }
+ }
+ }
+ }
+ }
+ if (this.index === start) {
+ this.throwUnexpectedToken();
+ }
+ return {
+ type: 7 /* Punctuator */,
+ value: str,
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart,
+ start: start,
+ end: this.index
+ };
+ };
+ // https://tc39.github.io/ecma262/#sec-literals-numeric-literals
+ Scanner.prototype.scanHexLiteral = function (start) {
+ var num = '';
+ while (!this.eof()) {
+ if (!character_1.Character.isHexDigit(this.source.charCodeAt(this.index))) {
+ break;
+ }
+ num += this.source[this.index++];
+ }
+ if (num.length === 0) {
+ this.throwUnexpectedToken();
+ }
+ if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index))) {
+ this.throwUnexpectedToken();
+ }
+ return {
+ type: 6 /* NumericLiteral */,
+ value: parseInt('0x' + num, 16),
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart,
+ start: start,
+ end: this.index
+ };
+ };
+ Scanner.prototype.scanBinaryLiteral = function (start) {
+ var num = '';
+ var ch;
+ while (!this.eof()) {
+ ch = this.source[this.index];
+ if (ch !== '0' && ch !== '1') {
+ break;
+ }
+ num += this.source[this.index++];
+ }
+ if (num.length === 0) {
+ // only 0b or 0B
+ this.throwUnexpectedToken();
+ }
+ if (!this.eof()) {
+ ch = this.source.charCodeAt(this.index);
+ /* istanbul ignore else */
+ if (character_1.Character.isIdentifierStart(ch) || character_1.Character.isDecimalDigit(ch)) {
+ this.throwUnexpectedToken();
+ }
+ }
+ return {
+ type: 6 /* NumericLiteral */,
+ value: parseInt(num, 2),
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart,
+ start: start,
+ end: this.index
+ };
+ };
+ Scanner.prototype.scanOctalLiteral = function (prefix, start) {
+ var num = '';
+ var octal = false;
+ if (character_1.Character.isOctalDigit(prefix.charCodeAt(0))) {
+ octal = true;
+ num = '0' + this.source[this.index++];
+ }
+ else {
+ ++this.index;
+ }
+ while (!this.eof()) {
+ if (!character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) {
+ break;
+ }
+ num += this.source[this.index++];
+ }
+ if (!octal && num.length === 0) {
+ // only 0o or 0O
+ this.throwUnexpectedToken();
+ }
+ if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index)) || character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
+ this.throwUnexpectedToken();
+ }
+ return {
+ type: 6 /* NumericLiteral */,
+ value: parseInt(num, 8),
+ octal: octal,
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart,
+ start: start,
+ end: this.index
+ };
+ };
+ Scanner.prototype.isImplicitOctalLiteral = function () {
+ // Implicit octal, unless there is a non-octal digit.
+ // (Annex B.1.1 on Numeric Literals)
+ for (var i = this.index + 1; i < this.length; ++i) {
+ var ch = this.source[i];
+ if (ch === '8' || ch === '9') {
+ return false;
+ }
+ if (!character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
+ return true;
+ }
+ }
+ return true;
+ };
+ Scanner.prototype.scanNumericLiteral = function () {
+ var start = this.index;
+ var ch = this.source[start];
+ assert_1.assert(character_1.Character.isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'), 'Numeric literal must start with a decimal digit or a decimal point');
+ var num = '';
+ if (ch !== '.') {
+ num = this.source[this.index++];
+ ch = this.source[this.index];
+ // Hex number starts with '0x'.
+ // Octal number starts with '0'.
+ // Octal number in ES6 starts with '0o'.
+ // Binary number in ES6 starts with '0b'.
+ if (num === '0') {
+ if (ch === 'x' || ch === 'X') {
+ ++this.index;
+ return this.scanHexLiteral(start);
+ }
+ if (ch === 'b' || ch === 'B') {
+ ++this.index;
+ return this.scanBinaryLiteral(start);
+ }
+ if (ch === 'o' || ch === 'O') {
+ return this.scanOctalLiteral(ch, start);
+ }
+ if (ch && character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
+ if (this.isImplicitOctalLiteral()) {
+ return this.scanOctalLiteral(ch, start);
+ }
+ }
+ }
+ while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
+ num += this.source[this.index++];
+ }
+ ch = this.source[this.index];
+ }
+ if (ch === '.') {
+ num += this.source[this.index++];
+ while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
+ num += this.source[this.index++];
+ }
+ ch = this.source[this.index];
+ }
+ if (ch === 'e' || ch === 'E') {
+ num += this.source[this.index++];
+ ch = this.source[this.index];
+ if (ch === '+' || ch === '-') {
+ num += this.source[this.index++];
+ }
+ if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
+ while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
+ num += this.source[this.index++];
+ }
+ }
+ else {
+ this.throwUnexpectedToken();
+ }
+ }
+ if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index))) {
+ this.throwUnexpectedToken();
+ }
+ return {
+ type: 6 /* NumericLiteral */,
+ value: parseFloat(num),
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart,
+ start: start,
+ end: this.index
+ };
+ };
+ // https://tc39.github.io/ecma262/#sec-literals-string-literals
+ Scanner.prototype.scanStringLiteral = function () {
+ var start = this.index;
+ var quote = this.source[start];
+ assert_1.assert((quote === '\'' || quote === '"'), 'String literal must starts with a quote');
+ ++this.index;
+ var octal = false;
+ var str = '';
+ while (!this.eof()) {
+ var ch = this.source[this.index++];
+ if (ch === quote) {
+ quote = '';
+ break;
+ }
+ else if (ch === '\\') {
+ ch = this.source[this.index++];
+ if (!ch || !character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
+ switch (ch) {
+ case 'u':
+ if (this.source[this.index] === '{') {
+ ++this.index;
+ str += this.scanUnicodeCodePointEscape();
+ }
+ else {
+ var unescaped_1 = this.scanHexEscape(ch);
+ if (unescaped_1 === null) {
+ this.throwUnexpectedToken();
+ }
+ str += unescaped_1;
+ }
+ break;
+ case 'x':
+ var unescaped = this.scanHexEscape(ch);
+ if (unescaped === null) {
+ this.throwUnexpectedToken(messages_1.Messages.InvalidHexEscapeSequence);
+ }
+ str += unescaped;
+ break;
+ case 'n':
+ str += '\n';
+ break;
+ case 'r':
+ str += '\r';
+ break;
+ case 't':
+ str += '\t';
+ break;
+ case 'b':
+ str += '\b';
+ break;
+ case 'f':
+ str += '\f';
+ break;
+ case 'v':
+ str += '\x0B';
+ break;
+ case '8':
+ case '9':
+ str += ch;
+ this.tolerateUnexpectedToken();
+ break;
+ default:
+ if (ch && character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
+ var octToDec = this.octalToDecimal(ch);
+ octal = octToDec.octal || octal;
+ str += String.fromCharCode(octToDec.code);
+ }
+ else {
+ str += ch;
+ }
+ break;
+ }
+ }
+ else {
+ ++this.lineNumber;
+ if (ch === '\r' && this.source[this.index] === '\n') {
+ ++this.index;
+ }
+ this.lineStart = this.index;
+ }
+ }
+ else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
+ break;
+ }
+ else {
+ str += ch;
+ }
+ }
+ if (quote !== '') {
+ this.index = start;
+ this.throwUnexpectedToken();
+ }
+ return {
+ type: 8 /* StringLiteral */,
+ value: str,
+ octal: octal,
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart,
+ start: start,
+ end: this.index
+ };
+ };
+ // https://tc39.github.io/ecma262/#sec-template-literal-lexical-components
+ Scanner.prototype.scanTemplate = function () {
+ var cooked = '';
+ var terminated = false;
+ var start = this.index;
+ var head = (this.source[start] === '`');
+ var tail = false;
+ var rawOffset = 2;
+ ++this.index;
+ while (!this.eof()) {
+ var ch = this.source[this.index++];
+ if (ch === '`') {
+ rawOffset = 1;
+ tail = true;
+ terminated = true;
+ break;
+ }
+ else if (ch === '$') {
+ if (this.source[this.index] === '{') {
+ this.curlyStack.push('${');
+ ++this.index;
+ terminated = true;
+ break;
+ }
+ cooked += ch;
+ }
+ else if (ch === '\\') {
+ ch = this.source[this.index++];
+ if (!character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
+ switch (ch) {
+ case 'n':
+ cooked += '\n';
+ break;
+ case 'r':
+ cooked += '\r';
+ break;
+ case 't':
+ cooked += '\t';
+ break;
+ case 'u':
+ if (this.source[this.index] === '{') {
+ ++this.index;
+ cooked += this.scanUnicodeCodePointEscape();
+ }
+ else {
+ var restore = this.index;
+ var unescaped_2 = this.scanHexEscape(ch);
+ if (unescaped_2 !== null) {
+ cooked += unescaped_2;
+ }
+ else {
+ this.index = restore;
+ cooked += ch;
+ }
+ }
+ break;
+ case 'x':
+ var unescaped = this.scanHexEscape(ch);
+ if (unescaped === null) {
+ this.throwUnexpectedToken(messages_1.Messages.InvalidHexEscapeSequence);
+ }
+ cooked += unescaped;
+ break;
+ case 'b':
+ cooked += '\b';
+ break;
+ case 'f':
+ cooked += '\f';
+ break;
+ case 'v':
+ cooked += '\v';
+ break;
+ default:
+ if (ch === '0') {
+ if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
+ // Illegal: \01 \02 and so on
+ this.throwUnexpectedToken(messages_1.Messages.TemplateOctalLiteral);
+ }
+ cooked += '\0';
+ }
+ else if (character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
+ // Illegal: \1 \2
+ this.throwUnexpectedToken(messages_1.Messages.TemplateOctalLiteral);
+ }
+ else {
+ cooked += ch;
+ }
+ break;
+ }
+ }
+ else {
+ ++this.lineNumber;
+ if (ch === '\r' && this.source[this.index] === '\n') {
+ ++this.index;
+ }
+ this.lineStart = this.index;
+ }
+ }
+ else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
+ ++this.lineNumber;
+ if (ch === '\r' && this.source[this.index] === '\n') {
+ ++this.index;
+ }
+ this.lineStart = this.index;
+ cooked += '\n';
+ }
+ else {
+ cooked += ch;
+ }
+ }
+ if (!terminated) {
+ this.throwUnexpectedToken();
+ }
+ if (!head) {
+ this.curlyStack.pop();
+ }
+ return {
+ type: 10 /* Template */,
+ value: this.source.slice(start + 1, this.index - rawOffset),
+ cooked: cooked,
+ head: head,
+ tail: tail,
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart,
+ start: start,
+ end: this.index
+ };
+ };
+ // https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals
+ Scanner.prototype.testRegExp = function (pattern, flags) {
+ // The BMP character to use as a replacement for astral symbols when
+ // translating an ES6 "u"-flagged pattern to an ES5-compatible
+ // approximation.
+ // Note: replacing with '\uFFFF' enables false positives in unlikely
+ // scenarios. For example, `[\u{1044f}-\u{10440}]` is an invalid
+ // pattern that would not be detected by this substitution.
+ var astralSubstitute = '\uFFFF';
+ var tmp = pattern;
+ var self = this;
+ if (flags.indexOf('u') >= 0) {
+ tmp = tmp
+ .replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g, function ($0, $1, $2) {
+ var codePoint = parseInt($1 || $2, 16);
+ if (codePoint > 0x10FFFF) {
+ self.throwUnexpectedToken(messages_1.Messages.InvalidRegExp);
+ }
+ if (codePoint <= 0xFFFF) {
+ return String.fromCharCode(codePoint);
+ }
+ return astralSubstitute;
+ })
+ .replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, astralSubstitute);
+ }
+ // First, detect invalid regular expressions.
+ try {
+ RegExp(tmp);
+ }
+ catch (e) {
+ this.throwUnexpectedToken(messages_1.Messages.InvalidRegExp);
+ }
+ // Return a regular expression object for this pattern-flag pair, or
+ // `null` in case the current environment doesn't support the flags it
+ // uses.
+ try {
+ return new RegExp(pattern, flags);
+ }
+ catch (exception) {
+ /* istanbul ignore next */
+ return null;
+ }
+ };
+ Scanner.prototype.scanRegExpBody = function () {
+ var ch = this.source[this.index];
+ assert_1.assert(ch === '/', 'Regular expression literal must start with a slash');
+ var str = this.source[this.index++];
+ var classMarker = false;
+ var terminated = false;
+ while (!this.eof()) {
+ ch = this.source[this.index++];
+ str += ch;
+ if (ch === '\\') {
+ ch = this.source[this.index++];
+ // https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals
+ if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
+ this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
+ }
+ str += ch;
+ }
+ else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
+ this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
+ }
+ else if (classMarker) {
+ if (ch === ']') {
+ classMarker = false;
+ }
+ }
+ else {
+ if (ch === '/') {
+ terminated = true;
+ break;
+ }
+ else if (ch === '[') {
+ classMarker = true;
+ }
+ }
+ }
+ if (!terminated) {
+ this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
+ }
+ // Exclude leading and trailing slash.
+ return str.substr(1, str.length - 2);
+ };
+ Scanner.prototype.scanRegExpFlags = function () {
+ var str = '';
+ var flags = '';
+ while (!this.eof()) {
+ var ch = this.source[this.index];
+ if (!character_1.Character.isIdentifierPart(ch.charCodeAt(0))) {
+ break;
+ }
+ ++this.index;
+ if (ch === '\\' && !this.eof()) {
+ ch = this.source[this.index];
+ if (ch === 'u') {
+ ++this.index;
+ var restore = this.index;
+ var char = this.scanHexEscape('u');
+ if (char !== null) {
+ flags += char;
+ for (str += '\\u'; restore < this.index; ++restore) {
+ str += this.source[restore];
+ }
+ }
+ else {
+ this.index = restore;
+ flags += 'u';
+ str += '\\u';
+ }
+ this.tolerateUnexpectedToken();
+ }
+ else {
+ str += '\\';
+ this.tolerateUnexpectedToken();
+ }
+ }
+ else {
+ flags += ch;
+ str += ch;
+ }
+ }
+ return flags;
+ };
+ Scanner.prototype.scanRegExp = function () {
+ var start = this.index;
+ var pattern = this.scanRegExpBody();
+ var flags = this.scanRegExpFlags();
+ var value = this.testRegExp(pattern, flags);
+ return {
+ type: 9 /* RegularExpression */,
+ value: '',
+ pattern: pattern,
+ flags: flags,
+ regex: value,
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart,
+ start: start,
+ end: this.index
+ };
+ };
+ Scanner.prototype.lex = function () {
+ if (this.eof()) {
+ return {
+ type: 2 /* EOF */,
+ value: '',
+ lineNumber: this.lineNumber,
+ lineStart: this.lineStart,
+ start: this.index,
+ end: this.index
+ };
+ }
+ var cp = this.source.charCodeAt(this.index);
+ if (character_1.Character.isIdentifierStart(cp)) {
+ return this.scanIdentifier();
+ }
+ // Very common: ( and ) and ;
+ if (cp === 0x28 || cp === 0x29 || cp === 0x3B) {
+ return this.scanPunctuator();
+ }
+ // String literal starts with single quote (U+0027) or double quote (U+0022).
+ if (cp === 0x27 || cp === 0x22) {
+ return this.scanStringLiteral();
+ }
+ // Dot (.) U+002E can also start a floating-point number, hence the need
+ // to check the next character.
+ if (cp === 0x2E) {
+ if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index + 1))) {
+ return this.scanNumericLiteral();
+ }
+ return this.scanPunctuator();
+ }
+ if (character_1.Character.isDecimalDigit(cp)) {
+ return this.scanNumericLiteral();
+ }
+ // Template literals start with ` (U+0060) for template head
+ // or } (U+007D) for template middle or template tail.
+ if (cp === 0x60 || (cp === 0x7D && this.curlyStack[this.curlyStack.length - 1] === '${')) {
+ return this.scanTemplate();
+ }
+ // Possible identifier start in a surrogate pair.
+ if (cp >= 0xD800 && cp < 0xDFFF) {
+ if (character_1.Character.isIdentifierStart(this.codePointAt(this.index))) {
+ return this.scanIdentifier();
+ }
+ }
+ return this.scanPunctuator();
+ };
+ return Scanner;
+ }());
+ exports.Scanner = Scanner;
+
+
+/***/ },
+/* 13 */
+/***/ function(module, exports) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.TokenName = {};
+ exports.TokenName[1 /* BooleanLiteral */] = 'Boolean';
+ exports.TokenName[2 /* EOF */] = '<end>';
+ exports.TokenName[3 /* Identifier */] = 'Identifier';
+ exports.TokenName[4 /* Keyword */] = 'Keyword';
+ exports.TokenName[5 /* NullLiteral */] = 'Null';
+ exports.TokenName[6 /* NumericLiteral */] = 'Numeric';
+ exports.TokenName[7 /* Punctuator */] = 'Punctuator';
+ exports.TokenName[8 /* StringLiteral */] = 'String';
+ exports.TokenName[9 /* RegularExpression */] = 'RegularExpression';
+ exports.TokenName[10 /* Template */] = 'Template';
+
+
+/***/ },
+/* 14 */
+/***/ function(module, exports) {
+
+ "use strict";
+ // Generated by generate-xhtml-entities.js. DO NOT MODIFY!
+ Object.defineProperty(exports, "__esModule", { value: true });
+ exports.XHTMLEntities = {
+ quot: '\u0022',
+ amp: '\u0026',
+ apos: '\u0027',
+ gt: '\u003E',
+ nbsp: '\u00A0',
+ iexcl: '\u00A1',
+ cent: '\u00A2',
+ pound: '\u00A3',
+ curren: '\u00A4',
+ yen: '\u00A5',
+ brvbar: '\u00A6',
+ sect: '\u00A7',
+ uml: '\u00A8',
+ copy: '\u00A9',
+ ordf: '\u00AA',
+ laquo: '\u00AB',
+ not: '\u00AC',
+ shy: '\u00AD',
+ reg: '\u00AE',
+ macr: '\u00AF',
+ deg: '\u00B0',
+ plusmn: '\u00B1',
+ sup2: '\u00B2',
+ sup3: '\u00B3',
+ acute: '\u00B4',
+ micro: '\u00B5',
+ para: '\u00B6',
+ middot: '\u00B7',
+ cedil: '\u00B8',
+ sup1: '\u00B9',
+ ordm: '\u00BA',
+ raquo: '\u00BB',
+ frac14: '\u00BC',
+ frac12: '\u00BD',
+ frac34: '\u00BE',
+ iquest: '\u00BF',
+ Agrave: '\u00C0',
+ Aacute: '\u00C1',
+ Acirc: '\u00C2',
+ Atilde: '\u00C3',
+ Auml: '\u00C4',
+ Aring: '\u00C5',
+ AElig: '\u00C6',
+ Ccedil: '\u00C7',
+ Egrave: '\u00C8',
+ Eacute: '\u00C9',
+ Ecirc: '\u00CA',
+ Euml: '\u00CB',
+ Igrave: '\u00CC',
+ Iacute: '\u00CD',
+ Icirc: '\u00CE',
+ Iuml: '\u00CF',
+ ETH: '\u00D0',
+ Ntilde: '\u00D1',
+ Ograve: '\u00D2',
+ Oacute: '\u00D3',
+ Ocirc: '\u00D4',
+ Otilde: '\u00D5',
+ Ouml: '\u00D6',
+ times: '\u00D7',
+ Oslash: '\u00D8',
+ Ugrave: '\u00D9',
+ Uacute: '\u00DA',
+ Ucirc: '\u00DB',
+ Uuml: '\u00DC',
+ Yacute: '\u00DD',
+ THORN: '\u00DE',
+ szlig: '\u00DF',
+ agrave: '\u00E0',
+ aacute: '\u00E1',
+ acirc: '\u00E2',
+ atilde: '\u00E3',
+ auml: '\u00E4',
+ aring: '\u00E5',
+ aelig: '\u00E6',
+ ccedil: '\u00E7',
+ egrave: '\u00E8',
+ eacute: '\u00E9',
+ ecirc: '\u00EA',
+ euml: '\u00EB',
+ igrave: '\u00EC',
+ iacute: '\u00ED',
+ icirc: '\u00EE',
+ iuml: '\u00EF',
+ eth: '\u00F0',
+ ntilde: '\u00F1',
+ ograve: '\u00F2',
+ oacute: '\u00F3',
+ ocirc: '\u00F4',
+ otilde: '\u00F5',
+ ouml: '\u00F6',
+ divide: '\u00F7',
+ oslash: '\u00F8',
+ ugrave: '\u00F9',
+ uacute: '\u00FA',
+ ucirc: '\u00FB',
+ uuml: '\u00FC',
+ yacute: '\u00FD',
+ thorn: '\u00FE',
+ yuml: '\u00FF',
+ OElig: '\u0152',
+ oelig: '\u0153',
+ Scaron: '\u0160',
+ scaron: '\u0161',
+ Yuml: '\u0178',
+ fnof: '\u0192',
+ circ: '\u02C6',
+ tilde: '\u02DC',
+ Alpha: '\u0391',
+ Beta: '\u0392',
+ Gamma: '\u0393',
+ Delta: '\u0394',
+ Epsilon: '\u0395',
+ Zeta: '\u0396',
+ Eta: '\u0397',
+ Theta: '\u0398',
+ Iota: '\u0399',
+ Kappa: '\u039A',
+ Lambda: '\u039B',
+ Mu: '\u039C',
+ Nu: '\u039D',
+ Xi: '\u039E',
+ Omicron: '\u039F',
+ Pi: '\u03A0',
+ Rho: '\u03A1',
+ Sigma: '\u03A3',
+ Tau: '\u03A4',
+ Upsilon: '\u03A5',
+ Phi: '\u03A6',
+ Chi: '\u03A7',
+ Psi: '\u03A8',
+ Omega: '\u03A9',
+ alpha: '\u03B1',
+ beta: '\u03B2',
+ gamma: '\u03B3',
+ delta: '\u03B4',
+ epsilon: '\u03B5',
+ zeta: '\u03B6',
+ eta: '\u03B7',
+ theta: '\u03B8',
+ iota: '\u03B9',
+ kappa: '\u03BA',
+ lambda: '\u03BB',
+ mu: '\u03BC',
+ nu: '\u03BD',
+ xi: '\u03BE',
+ omicron: '\u03BF',
+ pi: '\u03C0',
+ rho: '\u03C1',
+ sigmaf: '\u03C2',
+ sigma: '\u03C3',
+ tau: '\u03C4',
+ upsilon: '\u03C5',
+ phi: '\u03C6',
+ chi: '\u03C7',
+ psi: '\u03C8',
+ omega: '\u03C9',
+ thetasym: '\u03D1',
+ upsih: '\u03D2',
+ piv: '\u03D6',
+ ensp: '\u2002',
+ emsp: '\u2003',
+ thinsp: '\u2009',
+ zwnj: '\u200C',
+ zwj: '\u200D',
+ lrm: '\u200E',
+ rlm: '\u200F',
+ ndash: '\u2013',
+ mdash: '\u2014',
+ lsquo: '\u2018',
+ rsquo: '\u2019',
+ sbquo: '\u201A',
+ ldquo: '\u201C',
+ rdquo: '\u201D',
+ bdquo: '\u201E',
+ dagger: '\u2020',
+ Dagger: '\u2021',
+ bull: '\u2022',
+ hellip: '\u2026',
+ permil: '\u2030',
+ prime: '\u2032',
+ Prime: '\u2033',
+ lsaquo: '\u2039',
+ rsaquo: '\u203A',
+ oline: '\u203E',
+ frasl: '\u2044',
+ euro: '\u20AC',
+ image: '\u2111',
+ weierp: '\u2118',
+ real: '\u211C',
+ trade: '\u2122',
+ alefsym: '\u2135',
+ larr: '\u2190',
+ uarr: '\u2191',
+ rarr: '\u2192',
+ darr: '\u2193',
+ harr: '\u2194',
+ crarr: '\u21B5',
+ lArr: '\u21D0',
+ uArr: '\u21D1',
+ rArr: '\u21D2',
+ dArr: '\u21D3',
+ hArr: '\u21D4',
+ forall: '\u2200',
+ part: '\u2202',
+ exist: '\u2203',
+ empty: '\u2205',
+ nabla: '\u2207',
+ isin: '\u2208',
+ notin: '\u2209',
+ ni: '\u220B',
+ prod: '\u220F',
+ sum: '\u2211',
+ minus: '\u2212',
+ lowast: '\u2217',
+ radic: '\u221A',
+ prop: '\u221D',
+ infin: '\u221E',
+ ang: '\u2220',
+ and: '\u2227',
+ or: '\u2228',
+ cap: '\u2229',
+ cup: '\u222A',
+ int: '\u222B',
+ there4: '\u2234',
+ sim: '\u223C',
+ cong: '\u2245',
+ asymp: '\u2248',
+ ne: '\u2260',
+ equiv: '\u2261',
+ le: '\u2264',
+ ge: '\u2265',
+ sub: '\u2282',
+ sup: '\u2283',
+ nsub: '\u2284',
+ sube: '\u2286',
+ supe: '\u2287',
+ oplus: '\u2295',
+ otimes: '\u2297',
+ perp: '\u22A5',
+ sdot: '\u22C5',
+ lceil: '\u2308',
+ rceil: '\u2309',
+ lfloor: '\u230A',
+ rfloor: '\u230B',
+ loz: '\u25CA',
+ spades: '\u2660',
+ clubs: '\u2663',
+ hearts: '\u2665',
+ diams: '\u2666',
+ lang: '\u27E8',
+ rang: '\u27E9'
+ };
+
+
+/***/ },
+/* 15 */
+/***/ function(module, exports, __webpack_require__) {
+
+ "use strict";
+ Object.defineProperty(exports, "__esModule", { value: true });
+ var error_handler_1 = __webpack_require__(10);
+ var scanner_1 = __webpack_require__(12);
+ var token_1 = __webpack_require__(13);
+ var Reader = (function () {
+ function Reader() {
+ this.values = [];
+ this.curly = this.paren = -1;
+ }
+ // A function following one of those tokens is an expression.
+ Reader.prototype.beforeFunctionExpression = function (t) {
+ return ['(', '{', '[', 'in', 'typeof', 'instanceof', 'new',
+ 'return', 'case', 'delete', 'throw', 'void',
+ // assignment operators
+ '=', '+=', '-=', '*=', '**=', '/=', '%=', '<<=', '>>=', '>>>=',
+ '&=', '|=', '^=', ',',
+ // binary/unary operators
+ '+', '-', '*', '**', '/', '%', '++', '--', '<<', '>>', '>>>', '&',
+ '|', '^', '!', '~', '&&', '||', '?', ':', '===', '==', '>=',
+ '<=', '<', '>', '!=', '!=='].indexOf(t) >= 0;
+ };
+ // Determine if forward slash (/) is an operator or part of a regular expression
+ // https://github.com/mozilla/sweet.js/wiki/design
+ Reader.prototype.isRegexStart = function () {
+ var previous = this.values[this.values.length - 1];
+ var regex = (previous !== null);
+ switch (previous) {
+ case 'this':
+ case ']':
+ regex = false;
+ break;
+ case ')':
+ var keyword = this.values[this.paren - 1];
+ regex = (keyword === 'if' || keyword === 'while' || keyword === 'for' || keyword === 'with');
+ break;
+ case '}':
+ // Dividing a function by anything makes little sense,
+ // but we have to check for that.
+ regex = false;
+ if (this.values[this.curly - 3] === 'function') {
+ // Anonymous function, e.g. function(){} /42
+ var check = this.values[this.curly - 4];
+ regex = check ? !this.beforeFunctionExpression(check) : false;
+ }
+ else if (this.values[this.curly - 4] === 'function') {
+ // Named function, e.g. function f(){} /42/
+ var check = this.values[this.curly - 5];
+ regex = check ? !this.beforeFunctionExpression(check) : true;
+ }
+ break;
+ default:
+ break;
+ }
+ return regex;
+ };
+ Reader.prototype.push = function (token) {
+ if (token.type === 7 /* Punctuator */ || token.type === 4 /* Keyword */) {
+ if (token.value === '{') {
+ this.curly = this.values.length;
+ }
+ else if (token.value === '(') {
+ this.paren = this.values.length;
+ }
+ this.values.push(token.value);
+ }
+ else {
+ this.values.push(null);
+ }
+ };
+ return Reader;
+ }());
+ var Tokenizer = (function () {
+ function Tokenizer(code, config) {
+ this.errorHandler = new error_handler_1.ErrorHandler();
+ this.errorHandler.tolerant = config ? (typeof config.tolerant === 'boolean' && config.tolerant) : false;
+ this.scanner = new scanner_1.Scanner(code, this.errorHandler);
+ this.scanner.trackComment = config ? (typeof config.comment === 'boolean' && config.comment) : false;
+ this.trackRange = config ? (typeof config.range === 'boolean' && config.range) : false;
+ this.trackLoc = config ? (typeof config.loc === 'boolean' && config.loc) : false;
+ this.buffer = [];
+ this.reader = new Reader();
+ }
+ Tokenizer.prototype.errors = function () {
+ return this.errorHandler.errors;
+ };
+ Tokenizer.prototype.getNextToken = function () {
+ if (this.buffer.length === 0) {
+ var comments = this.scanner.scanComments();
+ if (this.scanner.trackComment) {
+ for (var i = 0; i < comments.length; ++i) {
+ var e = comments[i];
+ var value = this.scanner.source.slice(e.slice[0], e.slice[1]);
+ var comment = {
+ type: e.multiLine ? 'BlockComment' : 'LineComment',
+ value: value
+ };
+ if (this.trackRange) {
+ comment.range = e.range;
+ }
+ if (this.trackLoc) {
+ comment.loc = e.loc;
+ }
+ this.buffer.push(comment);
+ }
+ }
+ if (!this.scanner.eof()) {
+ var loc = void 0;
+ if (this.trackLoc) {
+ loc = {
+ start: {
+ line: this.scanner.lineNumber,
+ column: this.scanner.index - this.scanner.lineStart
+ },
+ end: {}
+ };
+ }
+ var startRegex = (this.scanner.source[this.scanner.index] === '/') && this.reader.isRegexStart();
+ var token = startRegex ? this.scanner.scanRegExp() : this.scanner.lex();
+ this.reader.push(token);
+ var entry = {
+ type: token_1.TokenName[token.type],
+ value: this.scanner.source.slice(token.start, token.end)
+ };
+ if (this.trackRange) {
+ entry.range = [token.start, token.end];
+ }
+ if (this.trackLoc) {
+ loc.end = {
+ line: this.scanner.lineNumber,
+ column: this.scanner.index - this.scanner.lineStart
+ };
+ entry.loc = loc;
+ }
+ if (token.type === 9 /* RegularExpression */) {
+ var pattern = token.pattern;
+ var flags = token.flags;
+ entry.regex = { pattern: pattern, flags: flags };
+ }
+ this.buffer.push(entry);
+ }
+ }
+ return this.buffer.shift();
+ };
+ return Tokenizer;
+ }());
+ exports.Tokenizer = Tokenizer;
+
+
+/***/ }
+/******/ ])
+});
+; \ No newline at end of file
diff --git a/tools/doc/node_modules/esprima/package.json b/tools/doc/node_modules/esprima/package.json
new file mode 100644
index 0000000000..d06834836d
--- /dev/null
+++ b/tools/doc/node_modules/esprima/package.json
@@ -0,0 +1,141 @@
+{
+ "_args": [
+ [
+ "esprima@4.0.0",
+ "/Users/rubys/git/node/tools/doc"
+ ]
+ ],
+ "_development": true,
+ "_from": "esprima@4.0.0",
+ "_id": "esprima@4.0.0",
+ "_inBundle": false,
+ "_integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==",
+ "_location": "/esprima",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "version",
+ "registry": true,
+ "raw": "esprima@4.0.0",
+ "name": "esprima",
+ "escapedName": "esprima",
+ "rawSpec": "4.0.0",
+ "saveSpec": null,
+ "fetchSpec": "4.0.0"
+ },
+ "_requiredBy": [
+ "/js-yaml"
+ ],
+ "_resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz",
+ "_spec": "4.0.0",
+ "_where": "/Users/rubys/git/node/tools/doc",
+ "author": {
+ "name": "Ariya Hidayat",
+ "email": "ariya.hidayat@gmail.com"
+ },
+ "bin": {
+ "esparse": "./bin/esparse.js",
+ "esvalidate": "./bin/esvalidate.js"
+ },
+ "bugs": {
+ "url": "https://github.com/jquery/esprima/issues"
+ },
+ "description": "ECMAScript parsing infrastructure for multipurpose analysis",
+ "devDependencies": {
+ "codecov.io": "~0.1.6",
+ "escomplex-js": "1.2.0",
+ "everything.js": "~1.0.3",
+ "glob": "~7.1.0",
+ "istanbul": "~0.4.0",
+ "json-diff": "~0.3.1",
+ "karma": "~1.3.0",
+ "karma-chrome-launcher": "~2.0.0",
+ "karma-detect-browsers": "~2.2.3",
+ "karma-edge-launcher": "~0.2.0",
+ "karma-firefox-launcher": "~1.0.0",
+ "karma-ie-launcher": "~1.0.0",
+ "karma-mocha": "~1.3.0",
+ "karma-safari-launcher": "~1.0.0",
+ "karma-safaritechpreview-launcher": "~0.0.4",
+ "karma-sauce-launcher": "~1.1.0",
+ "lodash": "~3.10.1",
+ "mocha": "~3.2.0",
+ "node-tick-processor": "~0.0.2",
+ "regenerate": "~1.3.2",
+ "temp": "~0.8.3",
+ "tslint": "~5.1.0",
+ "typescript": "~2.3.2",
+ "typescript-formatter": "~5.1.3",
+ "unicode-8.0.0": "~0.7.0",
+ "webpack": "~1.14.0"
+ },
+ "engines": {
+ "node": ">=4"
+ },
+ "files": [
+ "bin",
+ "dist/esprima.js"
+ ],
+ "homepage": "http://esprima.org",
+ "keywords": [
+ "ast",
+ "ecmascript",
+ "esprima",
+ "javascript",
+ "parser",
+ "syntax"
+ ],
+ "license": "BSD-2-Clause",
+ "main": "dist/esprima.js",
+ "maintainers": [
+ {
+ "name": "Ariya Hidayat",
+ "email": "ariya.hidayat@gmail.com",
+ "url": "http://ariya.ofilabs.com"
+ }
+ ],
+ "name": "esprima",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/jquery/esprima.git"
+ },
+ "scripts": {
+ "all-tests": "npm run verify-line-ending && npm run generate-fixtures && npm run unit-tests && npm run api-tests && npm run grammar-tests && npm run regression-tests && npm run hostile-env-tests",
+ "analyze-coverage": "istanbul cover test/unit-tests.js",
+ "api-tests": "mocha -R dot test/api-tests.js",
+ "appveyor": "npm run compile && npm run all-tests && npm run browser-tests",
+ "benchmark": "npm run benchmark-parser && npm run benchmark-tokenizer",
+ "benchmark-parser": "node -expose_gc test/benchmark-parser.js",
+ "benchmark-tokenizer": "node --expose_gc test/benchmark-tokenizer.js",
+ "browser-tests": "npm run compile && npm run generate-fixtures && cd test && karma start --single-run",
+ "check-coverage": "istanbul check-coverage --statement 100 --branch 100 --function 100",
+ "check-version": "node test/check-version.js",
+ "circleci": "npm test && npm run codecov && npm run downstream",
+ "code-style": "tsfmt --verify src/*.ts && tsfmt --verify test/*.js",
+ "codecov": "istanbul report cobertura && codecov < ./coverage/cobertura-coverage.xml",
+ "compile": "tsc -p src/ && webpack && node tools/fixupbundle.js",
+ "complexity": "node test/check-complexity.js",
+ "downstream": "node test/downstream.js",
+ "droneio": "npm run compile && npm run all-tests && npm run saucelabs",
+ "dynamic-analysis": "npm run analyze-coverage && npm run check-coverage",
+ "format-code": "tsfmt -r src/*.ts && tsfmt -r test/*.js",
+ "generate-fixtures": "node tools/generate-fixtures.js",
+ "generate-regex": "node tools/generate-identifier-regex.js",
+ "generate-xhtml-entities": "node tools/generate-xhtml-entities.js",
+ "grammar-tests": "node test/grammar-tests.js",
+ "hostile-env-tests": "node test/hostile-environment-tests.js",
+ "prepublish": "npm run compile",
+ "profile": "node --prof test/profile.js && mv isolate*.log v8.log && node-tick-processor",
+ "regression-tests": "node test/regression-tests.js",
+ "saucelabs": "npm run saucelabs-evergreen && npm run saucelabs-ie && npm run saucelabs-safari",
+ "saucelabs-evergreen": "cd test && karma start saucelabs-evergreen.conf.js",
+ "saucelabs-ie": "cd test && karma start saucelabs-ie.conf.js",
+ "saucelabs-safari": "cd test && karma start saucelabs-safari.conf.js",
+ "static-analysis": "npm run check-version && npm run tslint && npm run code-style && npm run complexity",
+ "test": "npm run compile && npm run all-tests && npm run static-analysis && npm run dynamic-analysis",
+ "travis": "npm test",
+ "tslint": "tslint src/*.ts",
+ "unit-tests": "node test/unit-tests.js",
+ "verify-line-ending": "node test/verify-line-ending.js"
+ },
+ "version": "4.0.0"
+}
diff --git a/tools/doc/node_modules/js-yaml/LICENSE b/tools/doc/node_modules/js-yaml/LICENSE
new file mode 100644
index 0000000000..09d3a29e93
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/LICENSE
@@ -0,0 +1,21 @@
+(The MIT License)
+
+Copyright (C) 2011-2015 by Vitaly Puzrin
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/tools/doc/node_modules/js-yaml/README.md b/tools/doc/node_modules/js-yaml/README.md
new file mode 100644
index 0000000000..c165c3576a
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/README.md
@@ -0,0 +1,313 @@
+JS-YAML - YAML 1.2 parser / writer for JavaScript
+=================================================
+
+[![Build Status](https://travis-ci.org/nodeca/js-yaml.svg?branch=master)](https://travis-ci.org/nodeca/js-yaml)
+[![NPM version](https://img.shields.io/npm/v/js-yaml.svg)](https://www.npmjs.org/package/js-yaml)
+
+__[Online Demo](http://nodeca.github.com/js-yaml/)__
+
+
+This is an implementation of [YAML](http://yaml.org/), a human-friendly data
+serialization language. Started as [PyYAML](http://pyyaml.org/) port, it was
+completely rewritten from scratch. Now it's very fast, and supports 1.2 spec.
+
+
+Installation
+------------
+
+### YAML module for node.js
+
+```
+npm install js-yaml
+```
+
+
+### CLI executable
+
+If you want to inspect your YAML files from CLI, install js-yaml globally:
+
+```
+npm install -g js-yaml
+```
+
+#### Usage
+
+```
+usage: js-yaml [-h] [-v] [-c] [-t] file
+
+Positional arguments:
+ file File with YAML document(s)
+
+Optional arguments:
+ -h, --help Show this help message and exit.
+ -v, --version Show program's version number and exit.
+ -c, --compact Display errors in compact mode
+ -t, --trace Show stack trace on error
+```
+
+
+### Bundled YAML library for browsers
+
+``` html
+<!-- esprima required only for !!js/function -->
+<script src="esprima.js"></script>
+<script src="js-yaml.min.js"></script>
+<script type="text/javascript">
+var doc = jsyaml.load('greeting: hello\nname: world');
+</script>
+```
+
+Browser support was done mostly for the online demo. If you find any errors - feel
+free to send pull requests with fixes. Also note, that IE and other old browsers
+needs [es5-shims](https://github.com/kriskowal/es5-shim) to operate.
+
+Notes:
+
+1. We have no resources to support browserified version. Don't expect it to be
+ well tested. Don't expect fast fixes if something goes wrong there.
+2. `!!js/function` in browser bundle will not work by default. If you really need
+ it - load `esprima` parser first (via amd or directly).
+3. `!!bin` in browser will return `Array`, because browsers do not support
+ node.js `Buffer` and adding Buffer shims is completely useless on practice.
+
+
+API
+---
+
+Here we cover the most 'useful' methods. If you need advanced details (creating
+your own tags), see [wiki](https://github.com/nodeca/js-yaml/wiki) and
+[examples](https://github.com/nodeca/js-yaml/tree/master/examples) for more
+info.
+
+``` javascript
+yaml = require('js-yaml');
+fs = require('fs');
+
+// Get document, or throw exception on error
+try {
+ var doc = yaml.safeLoad(fs.readFileSync('/home/ixti/example.yml', 'utf8'));
+ console.log(doc);
+} catch (e) {
+ console.log(e);
+}
+```
+
+
+### safeLoad (string [ , options ])
+
+**Recommended loading way.** Parses `string` as single YAML document. Returns a JavaScript
+object or throws `YAMLException` on error. By default, does not support regexps,
+functions and undefined. This method is safe for untrusted data.
+
+options:
+
+- `filename` _(default: null)_ - string to be used as a file path in
+ error/warning messages.
+- `onWarning` _(default: null)_ - function to call on warning messages.
+ Loader will throw on warnings if this function is not provided.
+- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ - specifies a schema to use.
+ - `FAILSAFE_SCHEMA` - only strings, arrays and plain objects:
+ http://www.yaml.org/spec/1.2/spec.html#id2802346
+ - `JSON_SCHEMA` - all JSON-supported types:
+ http://www.yaml.org/spec/1.2/spec.html#id2803231
+ - `CORE_SCHEMA` - same as `JSON_SCHEMA`:
+ http://www.yaml.org/spec/1.2/spec.html#id2804923
+ - `DEFAULT_SAFE_SCHEMA` - all supported YAML types, without unsafe ones
+ (`!!js/undefined`, `!!js/regexp` and `!!js/function`):
+ http://yaml.org/type/
+ - `DEFAULT_FULL_SCHEMA` - all supported YAML types.
+- `json` _(default: false)_ - compatibility with JSON.parse behaviour. If true, then duplicate keys in a mapping will override values rather than throwing an error.
+
+NOTE: This function **does not** understand multi-document sources, it throws
+exception on those.
+
+NOTE: JS-YAML **does not** support schema-specific tag resolution restrictions.
+So, the JSON schema is not as strictly defined in the YAML specification.
+It allows numbers in any notation, use `Null` and `NULL` as `null`, etc.
+The core schema also has no such restrictions. It allows binary notation for integers.
+
+
+### load (string [ , options ])
+
+**Use with care with untrusted sources**. The same as `safeLoad()` but uses
+`DEFAULT_FULL_SCHEMA` by default - adds some JavaScript-specific types:
+`!!js/function`, `!!js/regexp` and `!!js/undefined`. For untrusted sources, you
+must additionally validate object structure to avoid injections:
+
+``` javascript
+var untrusted_code = '"toString": !<tag:yaml.org,2002:js/function> "function (){very_evil_thing();}"';
+
+// I'm just converting that string, what could possibly go wrong?
+require('js-yaml').load(untrusted_code) + ''
+```
+
+
+### safeLoadAll (string [, iterator] [, options ])
+
+Same as `safeLoad()`, but understands multi-document sources. Applies
+`iterator` to each document if specified, or returns array of documents.
+
+``` javascript
+var yaml = require('js-yaml');
+
+yaml.safeLoadAll(data, function (doc) {
+ console.log(doc);
+});
+```
+
+
+### loadAll (string [, iterator] [ , options ])
+
+Same as `safeLoadAll()` but uses `DEFAULT_FULL_SCHEMA` by default.
+
+
+### safeDump (object [ , options ])
+
+Serializes `object` as a YAML document. Uses `DEFAULT_SAFE_SCHEMA`, so it will
+throw an exception if you try to dump regexps or functions. However, you can
+disable exceptions by setting the `skipInvalid` option to `true`.
+
+options:
+
+- `indent` _(default: 2)_ - indentation width to use (in spaces).
+- `skipInvalid` _(default: false)_ - do not throw on invalid types (like function
+ in the safe schema) and skip pairs and single values with such types.
+- `flowLevel` (default: -1) - specifies level of nesting, when to switch from
+ block to flow style for collections. -1 means block style everwhere
+- `styles` - "tag" => "style" map. Each tag may have own set of styles.
+- `schema` _(default: `DEFAULT_SAFE_SCHEMA`)_ specifies a schema to use.
+- `sortKeys` _(default: `false`)_ - if `true`, sort keys when dumping YAML. If a
+ function, use the function to sort the keys.
+- `lineWidth` _(default: `80`)_ - set max line width.
+- `noRefs` _(default: `false`)_ - if `true`, don't convert duplicate objects into references
+- `noCompatMode` _(default: `false`)_ - if `true` don't try to be compatible with older
+ yaml versions. Currently: don't quote "yes", "no" and so on, as required for YAML 1.1
+- `condenseFlow` _(default: `false`)_ - if `true` flow sequences will be condensed, omitting the space between `a, b`. Eg. `'[a,b]'`, and omitting the space between `key: value` and quoting the key. Eg. `'{"a":b}'` Can be useful when using yaml for pretty URL query params as spaces are %-encoded.
+
+The following table show availlable styles (e.g. "canonical",
+"binary"...) available for each tag (.e.g. !!null, !!int ...). Yaml
+output is shown on the right side after `=>` (default setting) or `->`:
+
+``` none
+!!null
+ "canonical" -> "~"
+ "lowercase" => "null"
+ "uppercase" -> "NULL"
+ "camelcase" -> "Null"
+
+!!int
+ "binary" -> "0b1", "0b101010", "0b1110001111010"
+ "octal" -> "01", "052", "016172"
+ "decimal" => "1", "42", "7290"
+ "hexadecimal" -> "0x1", "0x2A", "0x1C7A"
+
+!!bool
+ "lowercase" => "true", "false"
+ "uppercase" -> "TRUE", "FALSE"
+ "camelcase" -> "True", "False"
+
+!!float
+ "lowercase" => ".nan", '.inf'
+ "uppercase" -> ".NAN", '.INF'
+ "camelcase" -> ".NaN", '.Inf'
+```
+
+Example:
+
+``` javascript
+safeDump (object, {
+ 'styles': {
+ '!!null': 'canonical' // dump null as ~
+ },
+ 'sortKeys': true // sort object keys
+});
+```
+
+### dump (object [ , options ])
+
+Same as `safeDump()` but without limits (uses `DEFAULT_FULL_SCHEMA` by default).
+
+
+Supported YAML types
+--------------------
+
+The list of standard YAML tags and corresponding JavaScipt types. See also
+[YAML tag discussion](http://pyyaml.org/wiki/YAMLTagDiscussion) and
+[YAML types repository](http://yaml.org/type/).
+
+```
+!!null '' # null
+!!bool 'yes' # bool
+!!int '3...' # number
+!!float '3.14...' # number
+!!binary '...base64...' # buffer
+!!timestamp 'YYYY-...' # date
+!!omap [ ... ] # array of key-value pairs
+!!pairs [ ... ] # array or array pairs
+!!set { ... } # array of objects with given keys and null values
+!!str '...' # string
+!!seq [ ... ] # array
+!!map { ... } # object
+```
+
+**JavaScript-specific tags**
+
+```
+!!js/regexp /pattern/gim # RegExp
+!!js/undefined '' # Undefined
+!!js/function 'function () {...}' # Function
+```
+
+Caveats
+-------
+
+Note, that you use arrays or objects as key in JS-YAML. JS does not allow objects
+or arrays as keys, and stringifies (by calling `toString()` method) them at the
+moment of adding them.
+
+``` yaml
+---
+? [ foo, bar ]
+: - baz
+? { foo: bar }
+: - baz
+ - baz
+```
+
+``` javascript
+{ "foo,bar": ["baz"], "[object Object]": ["baz", "baz"] }
+```
+
+Also, reading of properties on implicit block mapping keys is not supported yet.
+So, the following YAML document cannot be loaded.
+
+``` yaml
+&anchor foo:
+ foo: bar
+ *anchor: duplicate key
+ baz: bat
+ *anchor: duplicate key
+```
+
+
+Breaking changes in 2.x.x -> 3.x.x
+----------------------------------
+
+If you have not used __custom__ tags or loader classes and not loaded yaml
+files via `require()`, no changes are needed. Just upgrade the library.
+
+Otherwise, you should:
+
+1. Replace all occurrences of `require('xxxx.yml')` by `fs.readFileSync()` +
+ `yaml.safeLoad()`.
+2. rewrite your custom tags constructors and custom loader
+ classes, to conform the new API. See
+ [examples](https://github.com/nodeca/js-yaml/tree/master/examples) and
+ [wiki](https://github.com/nodeca/js-yaml/wiki) for details.
+
+
+License
+-------
+
+View the [LICENSE](https://github.com/nodeca/js-yaml/blob/master/LICENSE) file
+(MIT).
diff --git a/tools/doc/node_modules/js-yaml/bin/js-yaml.js b/tools/doc/node_modules/js-yaml/bin/js-yaml.js
new file mode 100755
index 0000000000..e79186be6f
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/bin/js-yaml.js
@@ -0,0 +1,132 @@
+#!/usr/bin/env node
+
+
+'use strict';
+
+/*eslint-disable no-console*/
+
+
+// stdlib
+var fs = require('fs');
+
+
+// 3rd-party
+var argparse = require('argparse');
+
+
+// internal
+var yaml = require('..');
+
+
+////////////////////////////////////////////////////////////////////////////////
+
+
+var cli = new argparse.ArgumentParser({
+ prog: 'js-yaml',
+ version: require('../package.json').version,
+ addHelp: true
+});
+
+
+cli.addArgument([ '-c', '--compact' ], {
+ help: 'Display errors in compact mode',
+ action: 'storeTrue'
+});
+
+
+// deprecated (not needed after we removed output colors)
+// option suppressed, but not completely removed for compatibility
+cli.addArgument([ '-j', '--to-json' ], {
+ help: argparse.Const.SUPPRESS,
+ dest: 'json',
+ action: 'storeTrue'
+});
+
+
+cli.addArgument([ '-t', '--trace' ], {
+ help: 'Show stack trace on error',
+ action: 'storeTrue'
+});
+
+cli.addArgument([ 'file' ], {
+ help: 'File to read, utf-8 encoded without BOM',
+ nargs: '?',
+ defaultValue: '-'
+});
+
+
+////////////////////////////////////////////////////////////////////////////////
+
+
+var options = cli.parseArgs();
+
+
+////////////////////////////////////////////////////////////////////////////////
+
+function readFile(filename, encoding, callback) {
+ if (options.file === '-') {
+ // read from stdin
+
+ var chunks = [];
+
+ process.stdin.on('data', function (chunk) {
+ chunks.push(chunk);
+ });
+
+ process.stdin.on('end', function () {
+ return callback(null, Buffer.concat(chunks).toString(encoding));
+ });
+ } else {
+ fs.readFile(filename, encoding, callback);
+ }
+}
+
+readFile(options.file, 'utf8', function (error, input) {
+ var output, isYaml;
+
+ if (error) {
+ if (error.code === 'ENOENT') {
+ console.error('File not found: ' + options.file);
+ process.exit(2);
+ }
+
+ console.error(
+ options.trace && error.stack ||
+ error.message ||
+ String(error));
+
+ process.exit(1);
+ }
+
+ try {
+ output = JSON.parse(input);
+ isYaml = false;
+ } catch (err) {
+ if (err instanceof SyntaxError) {
+ try {
+ output = [];
+ yaml.loadAll(input, function (doc) { output.push(doc); }, {});
+ isYaml = true;
+
+ if (output.length === 0) output = null;
+ else if (output.length === 1) output = output[0];
+
+ } catch (e) {
+ if (options.trace && err.stack) console.error(e.stack);
+ else console.error(e.toString(options.compact));
+
+ process.exit(1);
+ }
+ } else {
+ console.error(
+ options.trace && err.stack ||
+ err.message ||
+ String(err));
+
+ process.exit(1);
+ }
+ }
+
+ if (isYaml) console.log(JSON.stringify(output, null, ' '));
+ else console.log(yaml.dump(output));
+});
diff --git a/tools/doc/node_modules/js-yaml/dist/js-yaml.js b/tools/doc/node_modules/js-yaml/dist/js-yaml.js
new file mode 100644
index 0000000000..df93be39d1
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/dist/js-yaml.js
@@ -0,0 +1,3905 @@
+/* js-yaml 3.11.0 https://github.com/nodeca/js-yaml */(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jsyaml = f()}})(function(){var define,module,exports;return (function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){
+'use strict';
+
+
+var loader = require('./js-yaml/loader');
+var dumper = require('./js-yaml/dumper');
+
+
+function deprecated(name) {
+ return function () {
+ throw new Error('Function ' + name + ' is deprecated and cannot be used.');
+ };
+}
+
+
+module.exports.Type = require('./js-yaml/type');
+module.exports.Schema = require('./js-yaml/schema');
+module.exports.FAILSAFE_SCHEMA = require('./js-yaml/schema/failsafe');
+module.exports.JSON_SCHEMA = require('./js-yaml/schema/json');
+module.exports.CORE_SCHEMA = require('./js-yaml/schema/core');
+module.exports.DEFAULT_SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
+module.exports.DEFAULT_FULL_SCHEMA = require('./js-yaml/schema/default_full');
+module.exports.load = loader.load;
+module.exports.loadAll = loader.loadAll;
+module.exports.safeLoad = loader.safeLoad;
+module.exports.safeLoadAll = loader.safeLoadAll;
+module.exports.dump = dumper.dump;
+module.exports.safeDump = dumper.safeDump;
+module.exports.YAMLException = require('./js-yaml/exception');
+
+// Deprecated schema names from JS-YAML 2.0.x
+module.exports.MINIMAL_SCHEMA = require('./js-yaml/schema/failsafe');
+module.exports.SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
+module.exports.DEFAULT_SCHEMA = require('./js-yaml/schema/default_full');
+
+// Deprecated functions from JS-YAML 1.x.x
+module.exports.scan = deprecated('scan');
+module.exports.parse = deprecated('parse');
+module.exports.compose = deprecated('compose');
+module.exports.addConstructor = deprecated('addConstructor');
+
+},{"./js-yaml/dumper":3,"./js-yaml/exception":4,"./js-yaml/loader":5,"./js-yaml/schema":7,"./js-yaml/schema/core":8,"./js-yaml/schema/default_full":9,"./js-yaml/schema/default_safe":10,"./js-yaml/schema/failsafe":11,"./js-yaml/schema/json":12,"./js-yaml/type":13}],2:[function(require,module,exports){
+'use strict';
+
+
+function isNothing(subject) {
+ return (typeof subject === 'undefined') || (subject === null);
+}
+
+
+function isObject(subject) {
+ return (typeof subject === 'object') && (subject !== null);
+}
+
+
+function toArray(sequence) {
+ if (Array.isArray(sequence)) return sequence;
+ else if (isNothing(sequence)) return [];
+
+ return [ sequence ];
+}
+
+
+function extend(target, source) {
+ var index, length, key, sourceKeys;
+
+ if (source) {
+ sourceKeys = Object.keys(source);
+
+ for (index = 0, length = sourceKeys.length; index < length; index += 1) {
+ key = sourceKeys[index];
+ target[key] = source[key];
+ }
+ }
+
+ return target;
+}
+
+
+function repeat(string, count) {
+ var result = '', cycle;
+
+ for (cycle = 0; cycle < count; cycle += 1) {
+ result += string;
+ }
+
+ return result;
+}
+
+
+function isNegativeZero(number) {
+ return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);
+}
+
+
+module.exports.isNothing = isNothing;
+module.exports.isObject = isObject;
+module.exports.toArray = toArray;
+module.exports.repeat = repeat;
+module.exports.isNegativeZero = isNegativeZero;
+module.exports.extend = extend;
+
+},{}],3:[function(require,module,exports){
+'use strict';
+
+/*eslint-disable no-use-before-define*/
+
+var common = require('./common');
+var YAMLException = require('./exception');
+var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
+var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
+
+var _toString = Object.prototype.toString;
+var _hasOwnProperty = Object.prototype.hasOwnProperty;
+
+var CHAR_TAB = 0x09; /* Tab */
+var CHAR_LINE_FEED = 0x0A; /* LF */
+var CHAR_SPACE = 0x20; /* Space */
+var CHAR_EXCLAMATION = 0x21; /* ! */
+var CHAR_DOUBLE_QUOTE = 0x22; /* " */
+var CHAR_SHARP = 0x23; /* # */
+var CHAR_PERCENT = 0x25; /* % */
+var CHAR_AMPERSAND = 0x26; /* & */
+var CHAR_SINGLE_QUOTE = 0x27; /* ' */
+var CHAR_ASTERISK = 0x2A; /* * */
+var CHAR_COMMA = 0x2C; /* , */
+var CHAR_MINUS = 0x2D; /* - */
+var CHAR_COLON = 0x3A; /* : */
+var CHAR_GREATER_THAN = 0x3E; /* > */
+var CHAR_QUESTION = 0x3F; /* ? */
+var CHAR_COMMERCIAL_AT = 0x40; /* @ */
+var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */
+var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */
+var CHAR_GRAVE_ACCENT = 0x60; /* ` */
+var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */
+var CHAR_VERTICAL_LINE = 0x7C; /* | */
+var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */
+
+var ESCAPE_SEQUENCES = {};
+
+ESCAPE_SEQUENCES[0x00] = '\\0';
+ESCAPE_SEQUENCES[0x07] = '\\a';
+ESCAPE_SEQUENCES[0x08] = '\\b';
+ESCAPE_SEQUENCES[0x09] = '\\t';
+ESCAPE_SEQUENCES[0x0A] = '\\n';
+ESCAPE_SEQUENCES[0x0B] = '\\v';
+ESCAPE_SEQUENCES[0x0C] = '\\f';
+ESCAPE_SEQUENCES[0x0D] = '\\r';
+ESCAPE_SEQUENCES[0x1B] = '\\e';
+ESCAPE_SEQUENCES[0x22] = '\\"';
+ESCAPE_SEQUENCES[0x5C] = '\\\\';
+ESCAPE_SEQUENCES[0x85] = '\\N';
+ESCAPE_SEQUENCES[0xA0] = '\\_';
+ESCAPE_SEQUENCES[0x2028] = '\\L';
+ESCAPE_SEQUENCES[0x2029] = '\\P';
+
+var DEPRECATED_BOOLEANS_SYNTAX = [
+ 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
+ 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
+];
+
+function compileStyleMap(schema, map) {
+ var result, keys, index, length, tag, style, type;
+
+ if (map === null) return {};
+
+ result = {};
+ keys = Object.keys(map);
+
+ for (index = 0, length = keys.length; index < length; index += 1) {
+ tag = keys[index];
+ style = String(map[tag]);
+
+ if (tag.slice(0, 2) === '!!') {
+ tag = 'tag:yaml.org,2002:' + tag.slice(2);
+ }
+ type = schema.compiledTypeMap['fallback'][tag];
+
+ if (type && _hasOwnProperty.call(type.styleAliases, style)) {
+ style = type.styleAliases[style];
+ }
+
+ result[tag] = style;
+ }
+
+ return result;
+}
+
+function encodeHex(character) {
+ var string, handle, length;
+
+ string = character.toString(16).toUpperCase();
+
+ if (character <= 0xFF) {
+ handle = 'x';
+ length = 2;
+ } else if (character <= 0xFFFF) {
+ handle = 'u';
+ length = 4;
+ } else if (character <= 0xFFFFFFFF) {
+ handle = 'U';
+ length = 8;
+ } else {
+ throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');
+ }
+
+ return '\\' + handle + common.repeat('0', length - string.length) + string;
+}
+
+function State(options) {
+ this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
+ this.indent = Math.max(1, (options['indent'] || 2));
+ this.skipInvalid = options['skipInvalid'] || false;
+ this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
+ this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
+ this.sortKeys = options['sortKeys'] || false;
+ this.lineWidth = options['lineWidth'] || 80;
+ this.noRefs = options['noRefs'] || false;
+ this.noCompatMode = options['noCompatMode'] || false;
+ this.condenseFlow = options['condenseFlow'] || false;
+
+ this.implicitTypes = this.schema.compiledImplicit;
+ this.explicitTypes = this.schema.compiledExplicit;
+
+ this.tag = null;
+ this.result = '';
+
+ this.duplicates = [];
+ this.usedDuplicates = null;
+}
+
+// Indents every line in a string. Empty lines (\n only) are not indented.
+function indentString(string, spaces) {
+ var ind = common.repeat(' ', spaces),
+ position = 0,
+ next = -1,
+ result = '',
+ line,
+ length = string.length;
+
+ while (position < length) {
+ next = string.indexOf('\n', position);
+ if (next === -1) {
+ line = string.slice(position);
+ position = length;
+ } else {
+ line = string.slice(position, next + 1);
+ position = next + 1;
+ }
+
+ if (line.length && line !== '\n') result += ind;
+
+ result += line;
+ }
+
+ return result;
+}
+
+function generateNextLine(state, level) {
+ return '\n' + common.repeat(' ', state.indent * level);
+}
+
+function testImplicitResolving(state, str) {
+ var index, length, type;
+
+ for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
+ type = state.implicitTypes[index];
+
+ if (type.resolve(str)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// [33] s-white ::= s-space | s-tab
+function isWhitespace(c) {
+ return c === CHAR_SPACE || c === CHAR_TAB;
+}
+
+// Returns true if the character can be printed without escaping.
+// From YAML 1.2: "any allowed characters known to be non-printable
+// should also be escaped. [However,] This isn’t mandatory"
+// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029.
+function isPrintable(c) {
+ return (0x00020 <= c && c <= 0x00007E)
+ || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029)
+ || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */)
+ || (0x10000 <= c && c <= 0x10FFFF);
+}
+
+// Simplified test for values allowed after the first character in plain style.
+function isPlainSafe(c) {
+ // Uses a subset of nb-char - c-flow-indicator - ":" - "#"
+ // where nb-char ::= c-printable - b-char - c-byte-order-mark.
+ return isPrintable(c) && c !== 0xFEFF
+ // - c-flow-indicator
+ && c !== CHAR_COMMA
+ && c !== CHAR_LEFT_SQUARE_BRACKET
+ && c !== CHAR_RIGHT_SQUARE_BRACKET
+ && c !== CHAR_LEFT_CURLY_BRACKET
+ && c !== CHAR_RIGHT_CURLY_BRACKET
+ // - ":" - "#"
+ && c !== CHAR_COLON
+ && c !== CHAR_SHARP;
+}
+
+// Simplified test for values allowed as the first character in plain style.
+function isPlainSafeFirst(c) {
+ // Uses a subset of ns-char - c-indicator
+ // where ns-char = nb-char - s-white.
+ return isPrintable(c) && c !== 0xFEFF
+ && !isWhitespace(c) // - s-white
+ // - (c-indicator ::=
+ // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”
+ && c !== CHAR_MINUS
+ && c !== CHAR_QUESTION
+ && c !== CHAR_COLON
+ && c !== CHAR_COMMA
+ && c !== CHAR_LEFT_SQUARE_BRACKET
+ && c !== CHAR_RIGHT_SQUARE_BRACKET
+ && c !== CHAR_LEFT_CURLY_BRACKET
+ && c !== CHAR_RIGHT_CURLY_BRACKET
+ // | “#” | “&” | “*” | “!” | “|” | “>” | “'” | “"”
+ && c !== CHAR_SHARP
+ && c !== CHAR_AMPERSAND
+ && c !== CHAR_ASTERISK
+ && c !== CHAR_EXCLAMATION
+ && c !== CHAR_VERTICAL_LINE
+ && c !== CHAR_GREATER_THAN
+ && c !== CHAR_SINGLE_QUOTE
+ && c !== CHAR_DOUBLE_QUOTE
+ // | “%” | “@” | “`”)
+ && c !== CHAR_PERCENT
+ && c !== CHAR_COMMERCIAL_AT
+ && c !== CHAR_GRAVE_ACCENT;
+}
+
+var STYLE_PLAIN = 1,
+ STYLE_SINGLE = 2,
+ STYLE_LITERAL = 3,
+ STYLE_FOLDED = 4,
+ STYLE_DOUBLE = 5;
+
+// Determines which scalar styles are possible and returns the preferred style.
+// lineWidth = -1 => no limit.
+// Pre-conditions: str.length > 0.
+// Post-conditions:
+// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string.
+// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1).
+// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).
+function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
+ var i;
+ var char;
+ var hasLineBreak = false;
+ var hasFoldableLine = false; // only checked if shouldTrackWidth
+ var shouldTrackWidth = lineWidth !== -1;
+ var previousLineBreak = -1; // count the first line correctly
+ var plain = isPlainSafeFirst(string.charCodeAt(0))
+ && !isWhitespace(string.charCodeAt(string.length - 1));
+
+ if (singleLineOnly) {
+ // Case: no block styles.
+ // Check for disallowed characters to rule out plain and single.
+ for (i = 0; i < string.length; i++) {
+ char = string.charCodeAt(i);
+ if (!isPrintable(char)) {
+ return STYLE_DOUBLE;
+ }
+ plain = plain && isPlainSafe(char);
+ }
+ } else {
+ // Case: block styles permitted.
+ for (i = 0; i < string.length; i++) {
+ char = string.charCodeAt(i);
+ if (char === CHAR_LINE_FEED) {
+ hasLineBreak = true;
+ // Check if any line can be folded.
+ if (shouldTrackWidth) {
+ hasFoldableLine = hasFoldableLine ||
+ // Foldable line = too long, and not more-indented.
+ (i - previousLineBreak - 1 > lineWidth &&
+ string[previousLineBreak + 1] !== ' ');
+ previousLineBreak = i;
+ }
+ } else if (!isPrintable(char)) {
+ return STYLE_DOUBLE;
+ }
+ plain = plain && isPlainSafe(char);
+ }
+ // in case the end is missing a \n
+ hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&
+ (i - previousLineBreak - 1 > lineWidth &&
+ string[previousLineBreak + 1] !== ' '));
+ }
+ // Although every style can represent \n without escaping, prefer block styles
+ // for multiline, since they're more readable and they don't add empty lines.
+ // Also prefer folding a super-long line.
+ if (!hasLineBreak && !hasFoldableLine) {
+ // Strings interpretable as another type have to be quoted;
+ // e.g. the string 'true' vs. the boolean true.
+ return plain && !testAmbiguousType(string)
+ ? STYLE_PLAIN : STYLE_SINGLE;
+ }
+ // Edge case: block indentation indicator can only have one digit.
+ if (string[0] === ' ' && indentPerLevel > 9) {
+ return STYLE_DOUBLE;
+ }
+ // At this point we know block styles are valid.
+ // Prefer literal style unless we want to fold.
+ return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
+}
+
+// Note: line breaking/folding is implemented for only the folded style.
+// NB. We drop the last trailing newline (if any) of a returned block scalar
+// since the dumper adds its own newline. This always works:
+// • No ending newline => unaffected; already using strip "-" chomping.
+// • Ending newline => removed then restored.
+// Importantly, this keeps the "+" chomp indicator from gaining an extra line.
+function writeScalar(state, string, level, iskey) {
+ state.dump = (function () {
+ if (string.length === 0) {
+ return "''";
+ }
+ if (!state.noCompatMode &&
+ DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) {
+ return "'" + string + "'";
+ }
+
+ var indent = state.indent * Math.max(1, level); // no 0-indent scalars
+ // As indentation gets deeper, let the width decrease monotonically
+ // to the lower bound min(state.lineWidth, 40).
+ // Note that this implies
+ // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound.
+ // state.lineWidth > 40 + state.indent: width decreases until the lower bound.
+ // This behaves better than a constant minimum width which disallows narrower options,
+ // or an indent threshold which causes the width to suddenly increase.
+ var lineWidth = state.lineWidth === -1
+ ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
+
+ // Without knowing if keys are implicit/explicit, assume implicit for safety.
+ var singleLineOnly = iskey
+ // No block styles in flow mode.
+ || (state.flowLevel > -1 && level >= state.flowLevel);
+ function testAmbiguity(string) {
+ return testImplicitResolving(state, string);
+ }
+
+ switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
+ case STYLE_PLAIN:
+ return string;
+ case STYLE_SINGLE:
+ return "'" + string.replace(/'/g, "''") + "'";
+ case STYLE_LITERAL:
+ return '|' + blockHeader(string, state.indent)
+ + dropEndingNewline(indentString(string, indent));
+ case STYLE_FOLDED:
+ return '>' + blockHeader(string, state.indent)
+ + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
+ case STYLE_DOUBLE:
+ return '"' + escapeString(string, lineWidth) + '"';
+ default:
+ throw new YAMLException('impossible error: invalid scalar style');
+ }
+ }());
+}
+
+// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.
+function blockHeader(string, indentPerLevel) {
+ var indentIndicator = (string[0] === ' ') ? String(indentPerLevel) : '';
+
+ // note the special case: the string '\n' counts as a "trailing" empty line.
+ var clip = string[string.length - 1] === '\n';
+ var keep = clip && (string[string.length - 2] === '\n' || string === '\n');
+ var chomp = keep ? '+' : (clip ? '' : '-');
+
+ return indentIndicator + chomp + '\n';
+}
+
+// (See the note for writeScalar.)
+function dropEndingNewline(string) {
+ return string[string.length - 1] === '\n' ? string.slice(0, -1) : string;
+}
+
+// Note: a long line without a suitable break point will exceed the width limit.
+// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0.
+function foldString(string, width) {
+ // In folded style, $k$ consecutive newlines output as $k+1$ newlines—
+ // unless they're before or after a more-indented line, or at the very
+ // beginning or end, in which case $k$ maps to $k$.
+ // Therefore, parse each chunk as newline(s) followed by a content line.
+ var lineRe = /(\n+)([^\n]*)/g;
+
+ // first line (possibly an empty line)
+ var result = (function () {
+ var nextLF = string.indexOf('\n');
+ nextLF = nextLF !== -1 ? nextLF : string.length;
+ lineRe.lastIndex = nextLF;
+ return foldLine(string.slice(0, nextLF), width);
+ }());
+ // If we haven't reached the first content line yet, don't add an extra \n.
+ var prevMoreIndented = string[0] === '\n' || string[0] === ' ';
+ var moreIndented;
+
+ // rest of the lines
+ var match;
+ while ((match = lineRe.exec(string))) {
+ var prefix = match[1], line = match[2];
+ moreIndented = (line[0] === ' ');
+ result += prefix
+ + (!prevMoreIndented && !moreIndented && line !== ''
+ ? '\n' : '')
+ + foldLine(line, width);
+ prevMoreIndented = moreIndented;
+ }
+
+ return result;
+}
+
+// Greedy line breaking.
+// Picks the longest line under the limit each time,
+// otherwise settles for the shortest line over the limit.
+// NB. More-indented lines *cannot* be folded, as that would add an extra \n.
+function foldLine(line, width) {
+ if (line === '' || line[0] === ' ') return line;
+
+ // Since a more-indented line adds a \n, breaks can't be followed by a space.
+ var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.
+ var match;
+ // start is an inclusive index. end, curr, and next are exclusive.
+ var start = 0, end, curr = 0, next = 0;
+ var result = '';
+
+ // Invariants: 0 <= start <= length-1.
+ // 0 <= curr <= next <= max(0, length-2). curr - start <= width.
+ // Inside the loop:
+ // A match implies length >= 2, so curr and next are <= length-2.
+ while ((match = breakRe.exec(line))) {
+ next = match.index;
+ // maintain invariant: curr - start <= width
+ if (next - start > width) {
+ end = (curr > start) ? curr : next; // derive end <= length-2
+ result += '\n' + line.slice(start, end);
+ // skip the space that was output as \n
+ start = end + 1; // derive start <= length-1
+ }
+ curr = next;
+ }
+
+ // By the invariants, start <= length-1, so there is something left over.
+ // It is either the whole string or a part starting from non-whitespace.
+ result += '\n';
+ // Insert a break if the remainder is too long and there is a break available.
+ if (line.length - start > width && curr > start) {
+ result += line.slice(start, curr) + '\n' + line.slice(curr + 1);
+ } else {
+ result += line.slice(start);
+ }
+
+ return result.slice(1); // drop extra \n joiner
+}
+
+// Escapes a double-quoted string.
+function escapeString(string) {
+ var result = '';
+ var char, nextChar;
+ var escapeSeq;
+
+ for (var i = 0; i < string.length; i++) {
+ char = string.charCodeAt(i);
+ // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates").
+ if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) {
+ nextChar = string.charCodeAt(i + 1);
+ if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) {
+ // Combine the surrogate pair and store it escaped.
+ result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000);
+ // Advance index one extra since we already used that char here.
+ i++; continue;
+ }
+ }
+ escapeSeq = ESCAPE_SEQUENCES[char];
+ result += !escapeSeq && isPrintable(char)
+ ? string[i]
+ : escapeSeq || encodeHex(char);
+ }
+
+ return result;
+}
+
+function writeFlowSequence(state, level, object) {
+ var _result = '',
+ _tag = state.tag,
+ index,
+ length;
+
+ for (index = 0, length = object.length; index < length; index += 1) {
+ // Write only valid elements.
+ if (writeNode(state, level, object[index], false, false)) {
+ if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : '');
+ _result += state.dump;
+ }
+ }
+
+ state.tag = _tag;
+ state.dump = '[' + _result + ']';
+}
+
+function writeBlockSequence(state, level, object, compact) {
+ var _result = '',
+ _tag = state.tag,
+ index,
+ length;
+
+ for (index = 0, length = object.length; index < length; index += 1) {
+ // Write only valid elements.
+ if (writeNode(state, level + 1, object[index], true, true)) {
+ if (!compact || index !== 0) {
+ _result += generateNextLine(state, level);
+ }
+
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
+ _result += '-';
+ } else {
+ _result += '- ';
+ }
+
+ _result += state.dump;
+ }
+ }
+
+ state.tag = _tag;
+ state.dump = _result || '[]'; // Empty sequence if no valid values.
+}
+
+function writeFlowMapping(state, level, object) {
+ var _result = '',
+ _tag = state.tag,
+ objectKeyList = Object.keys(object),
+ index,
+ length,
+ objectKey,
+ objectValue,
+ pairBuffer;
+
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
+ pairBuffer = state.condenseFlow ? '"' : '';
+
+ if (index !== 0) pairBuffer += ', ';
+
+ objectKey = objectKeyList[index];
+ objectValue = object[objectKey];
+
+ if (!writeNode(state, level, objectKey, false, false)) {
+ continue; // Skip this pair because of invalid key;
+ }
+
+ if (state.dump.length > 1024) pairBuffer += '? ';
+
+ pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' ');
+
+ if (!writeNode(state, level, objectValue, false, false)) {
+ continue; // Skip this pair because of invalid value.
+ }
+
+ pairBuffer += state.dump;
+
+ // Both key and value are valid.
+ _result += pairBuffer;
+ }
+
+ state.tag = _tag;
+ state.dump = '{' + _result + '}';
+}
+
+function writeBlockMapping(state, level, object, compact) {
+ var _result = '',
+ _tag = state.tag,
+ objectKeyList = Object.keys(object),
+ index,
+ length,
+ objectKey,
+ objectValue,
+ explicitPair,
+ pairBuffer;
+
+ // Allow sorting keys so that the output file is deterministic
+ if (state.sortKeys === true) {
+ // Default sorting
+ objectKeyList.sort();
+ } else if (typeof state.sortKeys === 'function') {
+ // Custom sort function
+ objectKeyList.sort(state.sortKeys);
+ } else if (state.sortKeys) {
+ // Something is wrong
+ throw new YAMLException('sortKeys must be a boolean or a function');
+ }
+
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
+ pairBuffer = '';
+
+ if (!compact || index !== 0) {
+ pairBuffer += generateNextLine(state, level);
+ }
+
+ objectKey = objectKeyList[index];
+ objectValue = object[objectKey];
+
+ if (!writeNode(state, level + 1, objectKey, true, true, true)) {
+ continue; // Skip this pair because of invalid key.
+ }
+
+ explicitPair = (state.tag !== null && state.tag !== '?') ||
+ (state.dump && state.dump.length > 1024);
+
+ if (explicitPair) {
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
+ pairBuffer += '?';
+ } else {
+ pairBuffer += '? ';
+ }
+ }
+
+ pairBuffer += state.dump;
+
+ if (explicitPair) {
+ pairBuffer += generateNextLine(state, level);
+ }
+
+ if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
+ continue; // Skip this pair because of invalid value.
+ }
+
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
+ pairBuffer += ':';
+ } else {
+ pairBuffer += ': ';
+ }
+
+ pairBuffer += state.dump;
+
+ // Both key and value are valid.
+ _result += pairBuffer;
+ }
+
+ state.tag = _tag;
+ state.dump = _result || '{}'; // Empty mapping if no valid pairs.
+}
+
+function detectType(state, object, explicit) {
+ var _result, typeList, index, length, type, style;
+
+ typeList = explicit ? state.explicitTypes : state.implicitTypes;
+
+ for (index = 0, length = typeList.length; index < length; index += 1) {
+ type = typeList[index];
+
+ if ((type.instanceOf || type.predicate) &&
+ (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&
+ (!type.predicate || type.predicate(object))) {
+
+ state.tag = explicit ? type.tag : '?';
+
+ if (type.represent) {
+ style = state.styleMap[type.tag] || type.defaultStyle;
+
+ if (_toString.call(type.represent) === '[object Function]') {
+ _result = type.represent(object, style);
+ } else if (_hasOwnProperty.call(type.represent, style)) {
+ _result = type.represent[style](object, style);
+ } else {
+ throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
+ }
+
+ state.dump = _result;
+ }
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// Serializes `object` and writes it to global `result`.
+// Returns true on success, or false on invalid object.
+//
+function writeNode(state, level, object, block, compact, iskey) {
+ state.tag = null;
+ state.dump = object;
+
+ if (!detectType(state, object, false)) {
+ detectType(state, object, true);
+ }
+
+ var type = _toString.call(state.dump);
+
+ if (block) {
+ block = (state.flowLevel < 0 || state.flowLevel > level);
+ }
+
+ var objectOrArray = type === '[object Object]' || type === '[object Array]',
+ duplicateIndex,
+ duplicate;
+
+ if (objectOrArray) {
+ duplicateIndex = state.duplicates.indexOf(object);
+ duplicate = duplicateIndex !== -1;
+ }
+
+ if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) {
+ compact = false;
+ }
+
+ if (duplicate && state.usedDuplicates[duplicateIndex]) {
+ state.dump = '*ref_' + duplicateIndex;
+ } else {
+ if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
+ state.usedDuplicates[duplicateIndex] = true;
+ }
+ if (type === '[object Object]') {
+ if (block && (Object.keys(state.dump).length !== 0)) {
+ writeBlockMapping(state, level, state.dump, compact);
+ if (duplicate) {
+ state.dump = '&ref_' + duplicateIndex + state.dump;
+ }
+ } else {
+ writeFlowMapping(state, level, state.dump);
+ if (duplicate) {
+ state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
+ }
+ }
+ } else if (type === '[object Array]') {
+ if (block && (state.dump.length !== 0)) {
+ writeBlockSequence(state, level, state.dump, compact);
+ if (duplicate) {
+ state.dump = '&ref_' + duplicateIndex + state.dump;
+ }
+ } else {
+ writeFlowSequence(state, level, state.dump);
+ if (duplicate) {
+ state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
+ }
+ }
+ } else if (type === '[object String]') {
+ if (state.tag !== '?') {
+ writeScalar(state, state.dump, level, iskey);
+ }
+ } else {
+ if (state.skipInvalid) return false;
+ throw new YAMLException('unacceptable kind of an object to dump ' + type);
+ }
+
+ if (state.tag !== null && state.tag !== '?') {
+ state.dump = '!<' + state.tag + '> ' + state.dump;
+ }
+ }
+
+ return true;
+}
+
+function getDuplicateReferences(object, state) {
+ var objects = [],
+ duplicatesIndexes = [],
+ index,
+ length;
+
+ inspectNode(object, objects, duplicatesIndexes);
+
+ for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
+ state.duplicates.push(objects[duplicatesIndexes[index]]);
+ }
+ state.usedDuplicates = new Array(length);
+}
+
+function inspectNode(object, objects, duplicatesIndexes) {
+ var objectKeyList,
+ index,
+ length;
+
+ if (object !== null && typeof object === 'object') {
+ index = objects.indexOf(object);
+ if (index !== -1) {
+ if (duplicatesIndexes.indexOf(index) === -1) {
+ duplicatesIndexes.push(index);
+ }
+ } else {
+ objects.push(object);
+
+ if (Array.isArray(object)) {
+ for (index = 0, length = object.length; index < length; index += 1) {
+ inspectNode(object[index], objects, duplicatesIndexes);
+ }
+ } else {
+ objectKeyList = Object.keys(object);
+
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
+ inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
+ }
+ }
+ }
+ }
+}
+
+function dump(input, options) {
+ options = options || {};
+
+ var state = new State(options);
+
+ if (!state.noRefs) getDuplicateReferences(input, state);
+
+ if (writeNode(state, 0, input, true, true)) return state.dump + '\n';
+
+ return '';
+}
+
+function safeDump(input, options) {
+ return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
+}
+
+module.exports.dump = dump;
+module.exports.safeDump = safeDump;
+
+},{"./common":2,"./exception":4,"./schema/default_full":9,"./schema/default_safe":10}],4:[function(require,module,exports){
+// YAML error class. http://stackoverflow.com/questions/8458984
+//
+'use strict';
+
+function YAMLException(reason, mark) {
+ // Super constructor
+ Error.call(this);
+
+ this.name = 'YAMLException';
+ this.reason = reason;
+ this.mark = mark;
+ this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');
+
+ // Include stack trace in error object
+ if (Error.captureStackTrace) {
+ // Chrome and NodeJS
+ Error.captureStackTrace(this, this.constructor);
+ } else {
+ // FF, IE 10+ and Safari 6+. Fallback for others
+ this.stack = (new Error()).stack || '';
+ }
+}
+
+
+// Inherit from Error
+YAMLException.prototype = Object.create(Error.prototype);
+YAMLException.prototype.constructor = YAMLException;
+
+
+YAMLException.prototype.toString = function toString(compact) {
+ var result = this.name + ': ';
+
+ result += this.reason || '(unknown reason)';
+
+ if (!compact && this.mark) {
+ result += ' ' + this.mark.toString();
+ }
+
+ return result;
+};
+
+
+module.exports = YAMLException;
+
+},{}],5:[function(require,module,exports){
+'use strict';
+
+/*eslint-disable max-len,no-use-before-define*/
+
+var common = require('./common');
+var YAMLException = require('./exception');
+var Mark = require('./mark');
+var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
+var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
+
+
+var _hasOwnProperty = Object.prototype.hasOwnProperty;
+
+
+var CONTEXT_FLOW_IN = 1;
+var CONTEXT_FLOW_OUT = 2;
+var CONTEXT_BLOCK_IN = 3;
+var CONTEXT_BLOCK_OUT = 4;
+
+
+var CHOMPING_CLIP = 1;
+var CHOMPING_STRIP = 2;
+var CHOMPING_KEEP = 3;
+
+
+var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
+var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
+var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
+var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
+var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
+
+
+function is_EOL(c) {
+ return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);
+}
+
+function is_WHITE_SPACE(c) {
+ return (c === 0x09/* Tab */) || (c === 0x20/* Space */);
+}
+
+function is_WS_OR_EOL(c) {
+ return (c === 0x09/* Tab */) ||
+ (c === 0x20/* Space */) ||
+ (c === 0x0A/* LF */) ||
+ (c === 0x0D/* CR */);
+}
+
+function is_FLOW_INDICATOR(c) {
+ return c === 0x2C/* , */ ||
+ c === 0x5B/* [ */ ||
+ c === 0x5D/* ] */ ||
+ c === 0x7B/* { */ ||
+ c === 0x7D/* } */;
+}
+
+function fromHexCode(c) {
+ var lc;
+
+ if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
+ return c - 0x30;
+ }
+
+ /*eslint-disable no-bitwise*/
+ lc = c | 0x20;
+
+ if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {
+ return lc - 0x61 + 10;
+ }
+
+ return -1;
+}
+
+function escapedHexLen(c) {
+ if (c === 0x78/* x */) { return 2; }
+ if (c === 0x75/* u */) { return 4; }
+ if (c === 0x55/* U */) { return 8; }
+ return 0;
+}
+
+function fromDecimalCode(c) {
+ if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
+ return c - 0x30;
+ }
+
+ return -1;
+}
+
+function simpleEscapeSequence(c) {
+ /* eslint-disable indent */
+ return (c === 0x30/* 0 */) ? '\x00' :
+ (c === 0x61/* a */) ? '\x07' :
+ (c === 0x62/* b */) ? '\x08' :
+ (c === 0x74/* t */) ? '\x09' :
+ (c === 0x09/* Tab */) ? '\x09' :
+ (c === 0x6E/* n */) ? '\x0A' :
+ (c === 0x76/* v */) ? '\x0B' :
+ (c === 0x66/* f */) ? '\x0C' :
+ (c === 0x72/* r */) ? '\x0D' :
+ (c === 0x65/* e */) ? '\x1B' :
+ (c === 0x20/* Space */) ? ' ' :
+ (c === 0x22/* " */) ? '\x22' :
+ (c === 0x2F/* / */) ? '/' :
+ (c === 0x5C/* \ */) ? '\x5C' :
+ (c === 0x4E/* N */) ? '\x85' :
+ (c === 0x5F/* _ */) ? '\xA0' :
+ (c === 0x4C/* L */) ? '\u2028' :
+ (c === 0x50/* P */) ? '\u2029' : '';
+}
+
+function charFromCodepoint(c) {
+ if (c <= 0xFFFF) {
+ return String.fromCharCode(c);
+ }
+ // Encode UTF-16 surrogate pair
+ // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
+ return String.fromCharCode(
+ ((c - 0x010000) >> 10) + 0xD800,
+ ((c - 0x010000) & 0x03FF) + 0xDC00
+ );
+}
+
+var simpleEscapeCheck = new Array(256); // integer, for fast access
+var simpleEscapeMap = new Array(256);
+for (var i = 0; i < 256; i++) {
+ simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
+ simpleEscapeMap[i] = simpleEscapeSequence(i);
+}
+
+
+function State(input, options) {
+ this.input = input;
+
+ this.filename = options['filename'] || null;
+ this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
+ this.onWarning = options['onWarning'] || null;
+ this.legacy = options['legacy'] || false;
+ this.json = options['json'] || false;
+ this.listener = options['listener'] || null;
+
+ this.implicitTypes = this.schema.compiledImplicit;
+ this.typeMap = this.schema.compiledTypeMap;
+
+ this.length = input.length;
+ this.position = 0;
+ this.line = 0;
+ this.lineStart = 0;
+ this.lineIndent = 0;
+
+ this.documents = [];
+
+ /*
+ this.version;
+ this.checkLineBreaks;
+ this.tagMap;
+ this.anchorMap;
+ this.tag;
+ this.anchor;
+ this.kind;
+ this.result;*/
+
+}
+
+
+function generateError(state, message) {
+ return new YAMLException(
+ message,
+ new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart)));
+}
+
+function throwError(state, message) {
+ throw generateError(state, message);
+}
+
+function throwWarning(state, message) {
+ if (state.onWarning) {
+ state.onWarning.call(null, generateError(state, message));
+ }
+}
+
+
+var directiveHandlers = {
+
+ YAML: function handleYamlDirective(state, name, args) {
+
+ var match, major, minor;
+
+ if (state.version !== null) {
+ throwError(state, 'duplication of %YAML directive');
+ }
+
+ if (args.length !== 1) {
+ throwError(state, 'YAML directive accepts exactly one argument');
+ }
+
+ match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
+
+ if (match === null) {
+ throwError(state, 'ill-formed argument of the YAML directive');
+ }
+
+ major = parseInt(match[1], 10);
+ minor = parseInt(match[2], 10);
+
+ if (major !== 1) {
+ throwError(state, 'unacceptable YAML version of the document');
+ }
+
+ state.version = args[0];
+ state.checkLineBreaks = (minor < 2);
+
+ if (minor !== 1 && minor !== 2) {
+ throwWarning(state, 'unsupported YAML version of the document');
+ }
+ },
+
+ TAG: function handleTagDirective(state, name, args) {
+
+ var handle, prefix;
+
+ if (args.length !== 2) {
+ throwError(state, 'TAG directive accepts exactly two arguments');
+ }
+
+ handle = args[0];
+ prefix = args[1];
+
+ if (!PATTERN_TAG_HANDLE.test(handle)) {
+ throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
+ }
+
+ if (_hasOwnProperty.call(state.tagMap, handle)) {
+ throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
+ }
+
+ if (!PATTERN_TAG_URI.test(prefix)) {
+ throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
+ }
+
+ state.tagMap[handle] = prefix;
+ }
+};
+
+
+function captureSegment(state, start, end, checkJson) {
+ var _position, _length, _character, _result;
+
+ if (start < end) {
+ _result = state.input.slice(start, end);
+
+ if (checkJson) {
+ for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
+ _character = _result.charCodeAt(_position);
+ if (!(_character === 0x09 ||
+ (0x20 <= _character && _character <= 0x10FFFF))) {
+ throwError(state, 'expected valid JSON character');
+ }
+ }
+ } else if (PATTERN_NON_PRINTABLE.test(_result)) {
+ throwError(state, 'the stream contains non-printable characters');
+ }
+
+ state.result += _result;
+ }
+}
+
+function mergeMappings(state, destination, source, overridableKeys) {
+ var sourceKeys, key, index, quantity;
+
+ if (!common.isObject(source)) {
+ throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
+ }
+
+ sourceKeys = Object.keys(source);
+
+ for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
+ key = sourceKeys[index];
+
+ if (!_hasOwnProperty.call(destination, key)) {
+ destination[key] = source[key];
+ overridableKeys[key] = true;
+ }
+ }
+}
+
+function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) {
+ var index, quantity;
+
+ keyNode = String(keyNode);
+
+ if (_result === null) {
+ _result = {};
+ }
+
+ if (keyTag === 'tag:yaml.org,2002:merge') {
+ if (Array.isArray(valueNode)) {
+ for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
+ mergeMappings(state, _result, valueNode[index], overridableKeys);
+ }
+ } else {
+ mergeMappings(state, _result, valueNode, overridableKeys);
+ }
+ } else {
+ if (!state.json &&
+ !_hasOwnProperty.call(overridableKeys, keyNode) &&
+ _hasOwnProperty.call(_result, keyNode)) {
+ state.line = startLine || state.line;
+ state.position = startPos || state.position;
+ throwError(state, 'duplicated mapping key');
+ }
+ _result[keyNode] = valueNode;
+ delete overridableKeys[keyNode];
+ }
+
+ return _result;
+}
+
+function readLineBreak(state) {
+ var ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch === 0x0A/* LF */) {
+ state.position++;
+ } else if (ch === 0x0D/* CR */) {
+ state.position++;
+ if (state.input.charCodeAt(state.position) === 0x0A/* LF */) {
+ state.position++;
+ }
+ } else {
+ throwError(state, 'a line break is expected');
+ }
+
+ state.line += 1;
+ state.lineStart = state.position;
+}
+
+function skipSeparationSpace(state, allowComments, checkIndent) {
+ var lineBreaks = 0,
+ ch = state.input.charCodeAt(state.position);
+
+ while (ch !== 0) {
+ while (is_WHITE_SPACE(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ if (allowComments && ch === 0x23/* # */) {
+ do {
+ ch = state.input.charCodeAt(++state.position);
+ } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0);
+ }
+
+ if (is_EOL(ch)) {
+ readLineBreak(state);
+
+ ch = state.input.charCodeAt(state.position);
+ lineBreaks++;
+ state.lineIndent = 0;
+
+ while (ch === 0x20/* Space */) {
+ state.lineIndent++;
+ ch = state.input.charCodeAt(++state.position);
+ }
+ } else {
+ break;
+ }
+ }
+
+ if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
+ throwWarning(state, 'deficient indentation');
+ }
+
+ return lineBreaks;
+}
+
+function testDocumentSeparator(state) {
+ var _position = state.position,
+ ch;
+
+ ch = state.input.charCodeAt(_position);
+
+ // Condition state.position === state.lineStart is tested
+ // in parent on each call, for efficiency. No needs to test here again.
+ if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&
+ ch === state.input.charCodeAt(_position + 1) &&
+ ch === state.input.charCodeAt(_position + 2)) {
+
+ _position += 3;
+
+ ch = state.input.charCodeAt(_position);
+
+ if (ch === 0 || is_WS_OR_EOL(ch)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+function writeFoldedLines(state, count) {
+ if (count === 1) {
+ state.result += ' ';
+ } else if (count > 1) {
+ state.result += common.repeat('\n', count - 1);
+ }
+}
+
+
+function readPlainScalar(state, nodeIndent, withinFlowCollection) {
+ var preceding,
+ following,
+ captureStart,
+ captureEnd,
+ hasPendingContent,
+ _line,
+ _lineStart,
+ _lineIndent,
+ _kind = state.kind,
+ _result = state.result,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (is_WS_OR_EOL(ch) ||
+ is_FLOW_INDICATOR(ch) ||
+ ch === 0x23/* # */ ||
+ ch === 0x26/* & */ ||
+ ch === 0x2A/* * */ ||
+ ch === 0x21/* ! */ ||
+ ch === 0x7C/* | */ ||
+ ch === 0x3E/* > */ ||
+ ch === 0x27/* ' */ ||
+ ch === 0x22/* " */ ||
+ ch === 0x25/* % */ ||
+ ch === 0x40/* @ */ ||
+ ch === 0x60/* ` */) {
+ return false;
+ }
+
+ if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {
+ following = state.input.charCodeAt(state.position + 1);
+
+ if (is_WS_OR_EOL(following) ||
+ withinFlowCollection && is_FLOW_INDICATOR(following)) {
+ return false;
+ }
+ }
+
+ state.kind = 'scalar';
+ state.result = '';
+ captureStart = captureEnd = state.position;
+ hasPendingContent = false;
+
+ while (ch !== 0) {
+ if (ch === 0x3A/* : */) {
+ following = state.input.charCodeAt(state.position + 1);
+
+ if (is_WS_OR_EOL(following) ||
+ withinFlowCollection && is_FLOW_INDICATOR(following)) {
+ break;
+ }
+
+ } else if (ch === 0x23/* # */) {
+ preceding = state.input.charCodeAt(state.position - 1);
+
+ if (is_WS_OR_EOL(preceding)) {
+ break;
+ }
+
+ } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||
+ withinFlowCollection && is_FLOW_INDICATOR(ch)) {
+ break;
+
+ } else if (is_EOL(ch)) {
+ _line = state.line;
+ _lineStart = state.lineStart;
+ _lineIndent = state.lineIndent;
+ skipSeparationSpace(state, false, -1);
+
+ if (state.lineIndent >= nodeIndent) {
+ hasPendingContent = true;
+ ch = state.input.charCodeAt(state.position);
+ continue;
+ } else {
+ state.position = captureEnd;
+ state.line = _line;
+ state.lineStart = _lineStart;
+ state.lineIndent = _lineIndent;
+ break;
+ }
+ }
+
+ if (hasPendingContent) {
+ captureSegment(state, captureStart, captureEnd, false);
+ writeFoldedLines(state, state.line - _line);
+ captureStart = captureEnd = state.position;
+ hasPendingContent = false;
+ }
+
+ if (!is_WHITE_SPACE(ch)) {
+ captureEnd = state.position + 1;
+ }
+
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ captureSegment(state, captureStart, captureEnd, false);
+
+ if (state.result) {
+ return true;
+ }
+
+ state.kind = _kind;
+ state.result = _result;
+ return false;
+}
+
+function readSingleQuotedScalar(state, nodeIndent) {
+ var ch,
+ captureStart, captureEnd;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch !== 0x27/* ' */) {
+ return false;
+ }
+
+ state.kind = 'scalar';
+ state.result = '';
+ state.position++;
+ captureStart = captureEnd = state.position;
+
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
+ if (ch === 0x27/* ' */) {
+ captureSegment(state, captureStart, state.position, true);
+ ch = state.input.charCodeAt(++state.position);
+
+ if (ch === 0x27/* ' */) {
+ captureStart = state.position;
+ state.position++;
+ captureEnd = state.position;
+ } else {
+ return true;
+ }
+
+ } else if (is_EOL(ch)) {
+ captureSegment(state, captureStart, captureEnd, true);
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
+ captureStart = captureEnd = state.position;
+
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
+ throwError(state, 'unexpected end of the document within a single quoted scalar');
+
+ } else {
+ state.position++;
+ captureEnd = state.position;
+ }
+ }
+
+ throwError(state, 'unexpected end of the stream within a single quoted scalar');
+}
+
+function readDoubleQuotedScalar(state, nodeIndent) {
+ var captureStart,
+ captureEnd,
+ hexLength,
+ hexResult,
+ tmp,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch !== 0x22/* " */) {
+ return false;
+ }
+
+ state.kind = 'scalar';
+ state.result = '';
+ state.position++;
+ captureStart = captureEnd = state.position;
+
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
+ if (ch === 0x22/* " */) {
+ captureSegment(state, captureStart, state.position, true);
+ state.position++;
+ return true;
+
+ } else if (ch === 0x5C/* \ */) {
+ captureSegment(state, captureStart, state.position, true);
+ ch = state.input.charCodeAt(++state.position);
+
+ if (is_EOL(ch)) {
+ skipSeparationSpace(state, false, nodeIndent);
+
+ // TODO: rework to inline fn with no type cast?
+ } else if (ch < 256 && simpleEscapeCheck[ch]) {
+ state.result += simpleEscapeMap[ch];
+ state.position++;
+
+ } else if ((tmp = escapedHexLen(ch)) > 0) {
+ hexLength = tmp;
+ hexResult = 0;
+
+ for (; hexLength > 0; hexLength--) {
+ ch = state.input.charCodeAt(++state.position);
+
+ if ((tmp = fromHexCode(ch)) >= 0) {
+ hexResult = (hexResult << 4) + tmp;
+
+ } else {
+ throwError(state, 'expected hexadecimal character');
+ }
+ }
+
+ state.result += charFromCodepoint(hexResult);
+
+ state.position++;
+
+ } else {
+ throwError(state, 'unknown escape sequence');
+ }
+
+ captureStart = captureEnd = state.position;
+
+ } else if (is_EOL(ch)) {
+ captureSegment(state, captureStart, captureEnd, true);
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
+ captureStart = captureEnd = state.position;
+
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
+ throwError(state, 'unexpected end of the document within a double quoted scalar');
+
+ } else {
+ state.position++;
+ captureEnd = state.position;
+ }
+ }
+
+ throwError(state, 'unexpected end of the stream within a double quoted scalar');
+}
+
+function readFlowCollection(state, nodeIndent) {
+ var readNext = true,
+ _line,
+ _tag = state.tag,
+ _result,
+ _anchor = state.anchor,
+ following,
+ terminator,
+ isPair,
+ isExplicitPair,
+ isMapping,
+ overridableKeys = {},
+ keyNode,
+ keyTag,
+ valueNode,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch === 0x5B/* [ */) {
+ terminator = 0x5D;/* ] */
+ isMapping = false;
+ _result = [];
+ } else if (ch === 0x7B/* { */) {
+ terminator = 0x7D;/* } */
+ isMapping = true;
+ _result = {};
+ } else {
+ return false;
+ }
+
+ if (state.anchor !== null) {
+ state.anchorMap[state.anchor] = _result;
+ }
+
+ ch = state.input.charCodeAt(++state.position);
+
+ while (ch !== 0) {
+ skipSeparationSpace(state, true, nodeIndent);
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch === terminator) {
+ state.position++;
+ state.tag = _tag;
+ state.anchor = _anchor;
+ state.kind = isMapping ? 'mapping' : 'sequence';
+ state.result = _result;
+ return true;
+ } else if (!readNext) {
+ throwError(state, 'missed comma between flow collection entries');
+ }
+
+ keyTag = keyNode = valueNode = null;
+ isPair = isExplicitPair = false;
+
+ if (ch === 0x3F/* ? */) {
+ following = state.input.charCodeAt(state.position + 1);
+
+ if (is_WS_OR_EOL(following)) {
+ isPair = isExplicitPair = true;
+ state.position++;
+ skipSeparationSpace(state, true, nodeIndent);
+ }
+ }
+
+ _line = state.line;
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
+ keyTag = state.tag;
+ keyNode = state.result;
+ skipSeparationSpace(state, true, nodeIndent);
+
+ ch = state.input.charCodeAt(state.position);
+
+ if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) {
+ isPair = true;
+ ch = state.input.charCodeAt(++state.position);
+ skipSeparationSpace(state, true, nodeIndent);
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
+ valueNode = state.result;
+ }
+
+ if (isMapping) {
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
+ } else if (isPair) {
+ _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode));
+ } else {
+ _result.push(keyNode);
+ }
+
+ skipSeparationSpace(state, true, nodeIndent);
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch === 0x2C/* , */) {
+ readNext = true;
+ ch = state.input.charCodeAt(++state.position);
+ } else {
+ readNext = false;
+ }
+ }
+
+ throwError(state, 'unexpected end of the stream within a flow collection');
+}
+
+function readBlockScalar(state, nodeIndent) {
+ var captureStart,
+ folding,
+ chomping = CHOMPING_CLIP,
+ didReadContent = false,
+ detectedIndent = false,
+ textIndent = nodeIndent,
+ emptyLines = 0,
+ atMoreIndented = false,
+ tmp,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch === 0x7C/* | */) {
+ folding = false;
+ } else if (ch === 0x3E/* > */) {
+ folding = true;
+ } else {
+ return false;
+ }
+
+ state.kind = 'scalar';
+ state.result = '';
+
+ while (ch !== 0) {
+ ch = state.input.charCodeAt(++state.position);
+
+ if (ch === 0x2B/* + */ || ch === 0x2D/* - */) {
+ if (CHOMPING_CLIP === chomping) {
+ chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;
+ } else {
+ throwError(state, 'repeat of a chomping mode identifier');
+ }
+
+ } else if ((tmp = fromDecimalCode(ch)) >= 0) {
+ if (tmp === 0) {
+ throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
+ } else if (!detectedIndent) {
+ textIndent = nodeIndent + tmp - 1;
+ detectedIndent = true;
+ } else {
+ throwError(state, 'repeat of an indentation width identifier');
+ }
+
+ } else {
+ break;
+ }
+ }
+
+ if (is_WHITE_SPACE(ch)) {
+ do { ch = state.input.charCodeAt(++state.position); }
+ while (is_WHITE_SPACE(ch));
+
+ if (ch === 0x23/* # */) {
+ do { ch = state.input.charCodeAt(++state.position); }
+ while (!is_EOL(ch) && (ch !== 0));
+ }
+ }
+
+ while (ch !== 0) {
+ readLineBreak(state);
+ state.lineIndent = 0;
+
+ ch = state.input.charCodeAt(state.position);
+
+ while ((!detectedIndent || state.lineIndent < textIndent) &&
+ (ch === 0x20/* Space */)) {
+ state.lineIndent++;
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ if (!detectedIndent && state.lineIndent > textIndent) {
+ textIndent = state.lineIndent;
+ }
+
+ if (is_EOL(ch)) {
+ emptyLines++;
+ continue;
+ }
+
+ // End of the scalar.
+ if (state.lineIndent < textIndent) {
+
+ // Perform the chomping.
+ if (chomping === CHOMPING_KEEP) {
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
+ } else if (chomping === CHOMPING_CLIP) {
+ if (didReadContent) { // i.e. only if the scalar is not empty.
+ state.result += '\n';
+ }
+ }
+
+ // Break this `while` cycle and go to the funciton's epilogue.
+ break;
+ }
+
+ // Folded style: use fancy rules to handle line breaks.
+ if (folding) {
+
+ // Lines starting with white space characters (more-indented lines) are not folded.
+ if (is_WHITE_SPACE(ch)) {
+ atMoreIndented = true;
+ // except for the first content line (cf. Example 8.1)
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
+
+ // End of more-indented block.
+ } else if (atMoreIndented) {
+ atMoreIndented = false;
+ state.result += common.repeat('\n', emptyLines + 1);
+
+ // Just one line break - perceive as the same line.
+ } else if (emptyLines === 0) {
+ if (didReadContent) { // i.e. only if we have already read some scalar content.
+ state.result += ' ';
+ }
+
+ // Several line breaks - perceive as different lines.
+ } else {
+ state.result += common.repeat('\n', emptyLines);
+ }
+
+ // Literal style: just add exact number of line breaks between content lines.
+ } else {
+ // Keep all line breaks except the header line break.
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
+ }
+
+ didReadContent = true;
+ detectedIndent = true;
+ emptyLines = 0;
+ captureStart = state.position;
+
+ while (!is_EOL(ch) && (ch !== 0)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ captureSegment(state, captureStart, state.position, false);
+ }
+
+ return true;
+}
+
+function readBlockSequence(state, nodeIndent) {
+ var _line,
+ _tag = state.tag,
+ _anchor = state.anchor,
+ _result = [],
+ following,
+ detected = false,
+ ch;
+
+ if (state.anchor !== null) {
+ state.anchorMap[state.anchor] = _result;
+ }
+
+ ch = state.input.charCodeAt(state.position);
+
+ while (ch !== 0) {
+
+ if (ch !== 0x2D/* - */) {
+ break;
+ }
+
+ following = state.input.charCodeAt(state.position + 1);
+
+ if (!is_WS_OR_EOL(following)) {
+ break;
+ }
+
+ detected = true;
+ state.position++;
+
+ if (skipSeparationSpace(state, true, -1)) {
+ if (state.lineIndent <= nodeIndent) {
+ _result.push(null);
+ ch = state.input.charCodeAt(state.position);
+ continue;
+ }
+ }
+
+ _line = state.line;
+ composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
+ _result.push(state.result);
+ skipSeparationSpace(state, true, -1);
+
+ ch = state.input.charCodeAt(state.position);
+
+ if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
+ throwError(state, 'bad indentation of a sequence entry');
+ } else if (state.lineIndent < nodeIndent) {
+ break;
+ }
+ }
+
+ if (detected) {
+ state.tag = _tag;
+ state.anchor = _anchor;
+ state.kind = 'sequence';
+ state.result = _result;
+ return true;
+ }
+ return false;
+}
+
+function readBlockMapping(state, nodeIndent, flowIndent) {
+ var following,
+ allowCompact,
+ _line,
+ _pos,
+ _tag = state.tag,
+ _anchor = state.anchor,
+ _result = {},
+ overridableKeys = {},
+ keyTag = null,
+ keyNode = null,
+ valueNode = null,
+ atExplicitKey = false,
+ detected = false,
+ ch;
+
+ if (state.anchor !== null) {
+ state.anchorMap[state.anchor] = _result;
+ }
+
+ ch = state.input.charCodeAt(state.position);
+
+ while (ch !== 0) {
+ following = state.input.charCodeAt(state.position + 1);
+ _line = state.line; // Save the current line.
+ _pos = state.position;
+
+ //
+ // Explicit notation case. There are two separate blocks:
+ // first for the key (denoted by "?") and second for the value (denoted by ":")
+ //
+ if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) {
+
+ if (ch === 0x3F/* ? */) {
+ if (atExplicitKey) {
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
+ keyTag = keyNode = valueNode = null;
+ }
+
+ detected = true;
+ atExplicitKey = true;
+ allowCompact = true;
+
+ } else if (atExplicitKey) {
+ // i.e. 0x3A/* : */ === character after the explicit key.
+ atExplicitKey = false;
+ allowCompact = true;
+
+ } else {
+ throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line');
+ }
+
+ state.position += 1;
+ ch = following;
+
+ //
+ // Implicit notation case. Flow-style node as the key first, then ":", and the value.
+ //
+ } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
+
+ if (state.line === _line) {
+ ch = state.input.charCodeAt(state.position);
+
+ while (is_WHITE_SPACE(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ if (ch === 0x3A/* : */) {
+ ch = state.input.charCodeAt(++state.position);
+
+ if (!is_WS_OR_EOL(ch)) {
+ throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');
+ }
+
+ if (atExplicitKey) {
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
+ keyTag = keyNode = valueNode = null;
+ }
+
+ detected = true;
+ atExplicitKey = false;
+ allowCompact = false;
+ keyTag = state.tag;
+ keyNode = state.result;
+
+ } else if (detected) {
+ throwError(state, 'can not read an implicit mapping pair; a colon is missed');
+
+ } else {
+ state.tag = _tag;
+ state.anchor = _anchor;
+ return true; // Keep the result of `composeNode`.
+ }
+
+ } else if (detected) {
+ throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
+
+ } else {
+ state.tag = _tag;
+ state.anchor = _anchor;
+ return true; // Keep the result of `composeNode`.
+ }
+
+ } else {
+ break; // Reading is done. Go to the epilogue.
+ }
+
+ //
+ // Common reading code for both explicit and implicit notations.
+ //
+ if (state.line === _line || state.lineIndent > nodeIndent) {
+ if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
+ if (atExplicitKey) {
+ keyNode = state.result;
+ } else {
+ valueNode = state.result;
+ }
+ }
+
+ if (!atExplicitKey) {
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos);
+ keyTag = keyNode = valueNode = null;
+ }
+
+ skipSeparationSpace(state, true, -1);
+ ch = state.input.charCodeAt(state.position);
+ }
+
+ if (state.lineIndent > nodeIndent && (ch !== 0)) {
+ throwError(state, 'bad indentation of a mapping entry');
+ } else if (state.lineIndent < nodeIndent) {
+ break;
+ }
+ }
+
+ //
+ // Epilogue.
+ //
+
+ // Special case: last mapping's node contains only the key in explicit notation.
+ if (atExplicitKey) {
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
+ }
+
+ // Expose the resulting mapping.
+ if (detected) {
+ state.tag = _tag;
+ state.anchor = _anchor;
+ state.kind = 'mapping';
+ state.result = _result;
+ }
+
+ return detected;
+}
+
+function readTagProperty(state) {
+ var _position,
+ isVerbatim = false,
+ isNamed = false,
+ tagHandle,
+ tagName,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch !== 0x21/* ! */) return false;
+
+ if (state.tag !== null) {
+ throwError(state, 'duplication of a tag property');
+ }
+
+ ch = state.input.charCodeAt(++state.position);
+
+ if (ch === 0x3C/* < */) {
+ isVerbatim = true;
+ ch = state.input.charCodeAt(++state.position);
+
+ } else if (ch === 0x21/* ! */) {
+ isNamed = true;
+ tagHandle = '!!';
+ ch = state.input.charCodeAt(++state.position);
+
+ } else {
+ tagHandle = '!';
+ }
+
+ _position = state.position;
+
+ if (isVerbatim) {
+ do { ch = state.input.charCodeAt(++state.position); }
+ while (ch !== 0 && ch !== 0x3E/* > */);
+
+ if (state.position < state.length) {
+ tagName = state.input.slice(_position, state.position);
+ ch = state.input.charCodeAt(++state.position);
+ } else {
+ throwError(state, 'unexpected end of the stream within a verbatim tag');
+ }
+ } else {
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
+
+ if (ch === 0x21/* ! */) {
+ if (!isNamed) {
+ tagHandle = state.input.slice(_position - 1, state.position + 1);
+
+ if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
+ throwError(state, 'named tag handle cannot contain such characters');
+ }
+
+ isNamed = true;
+ _position = state.position + 1;
+ } else {
+ throwError(state, 'tag suffix cannot contain exclamation marks');
+ }
+ }
+
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ tagName = state.input.slice(_position, state.position);
+
+ if (PATTERN_FLOW_INDICATORS.test(tagName)) {
+ throwError(state, 'tag suffix cannot contain flow indicator characters');
+ }
+ }
+
+ if (tagName && !PATTERN_TAG_URI.test(tagName)) {
+ throwError(state, 'tag name cannot contain such characters: ' + tagName);
+ }
+
+ if (isVerbatim) {
+ state.tag = tagName;
+
+ } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
+ state.tag = state.tagMap[tagHandle] + tagName;
+
+ } else if (tagHandle === '!') {
+ state.tag = '!' + tagName;
+
+ } else if (tagHandle === '!!') {
+ state.tag = 'tag:yaml.org,2002:' + tagName;
+
+ } else {
+ throwError(state, 'undeclared tag handle "' + tagHandle + '"');
+ }
+
+ return true;
+}
+
+function readAnchorProperty(state) {
+ var _position,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch !== 0x26/* & */) return false;
+
+ if (state.anchor !== null) {
+ throwError(state, 'duplication of an anchor property');
+ }
+
+ ch = state.input.charCodeAt(++state.position);
+ _position = state.position;
+
+ while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ if (state.position === _position) {
+ throwError(state, 'name of an anchor node must contain at least one character');
+ }
+
+ state.anchor = state.input.slice(_position, state.position);
+ return true;
+}
+
+function readAlias(state) {
+ var _position, alias,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch !== 0x2A/* * */) return false;
+
+ ch = state.input.charCodeAt(++state.position);
+ _position = state.position;
+
+ while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ if (state.position === _position) {
+ throwError(state, 'name of an alias node must contain at least one character');
+ }
+
+ alias = state.input.slice(_position, state.position);
+
+ if (!state.anchorMap.hasOwnProperty(alias)) {
+ throwError(state, 'unidentified alias "' + alias + '"');
+ }
+
+ state.result = state.anchorMap[alias];
+ skipSeparationSpace(state, true, -1);
+ return true;
+}
+
+function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
+ var allowBlockStyles,
+ allowBlockScalars,
+ allowBlockCollections,
+ indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent
+ atNewLine = false,
+ hasContent = false,
+ typeIndex,
+ typeQuantity,
+ type,
+ flowIndent,
+ blockIndent;
+
+ if (state.listener !== null) {
+ state.listener('open', state);
+ }
+
+ state.tag = null;
+ state.anchor = null;
+ state.kind = null;
+ state.result = null;
+
+ allowBlockStyles = allowBlockScalars = allowBlockCollections =
+ CONTEXT_BLOCK_OUT === nodeContext ||
+ CONTEXT_BLOCK_IN === nodeContext;
+
+ if (allowToSeek) {
+ if (skipSeparationSpace(state, true, -1)) {
+ atNewLine = true;
+
+ if (state.lineIndent > parentIndent) {
+ indentStatus = 1;
+ } else if (state.lineIndent === parentIndent) {
+ indentStatus = 0;
+ } else if (state.lineIndent < parentIndent) {
+ indentStatus = -1;
+ }
+ }
+ }
+
+ if (indentStatus === 1) {
+ while (readTagProperty(state) || readAnchorProperty(state)) {
+ if (skipSeparationSpace(state, true, -1)) {
+ atNewLine = true;
+ allowBlockCollections = allowBlockStyles;
+
+ if (state.lineIndent > parentIndent) {
+ indentStatus = 1;
+ } else if (state.lineIndent === parentIndent) {
+ indentStatus = 0;
+ } else if (state.lineIndent < parentIndent) {
+ indentStatus = -1;
+ }
+ } else {
+ allowBlockCollections = false;
+ }
+ }
+ }
+
+ if (allowBlockCollections) {
+ allowBlockCollections = atNewLine || allowCompact;
+ }
+
+ if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
+ if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
+ flowIndent = parentIndent;
+ } else {
+ flowIndent = parentIndent + 1;
+ }
+
+ blockIndent = state.position - state.lineStart;
+
+ if (indentStatus === 1) {
+ if (allowBlockCollections &&
+ (readBlockSequence(state, blockIndent) ||
+ readBlockMapping(state, blockIndent, flowIndent)) ||
+ readFlowCollection(state, flowIndent)) {
+ hasContent = true;
+ } else {
+ if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
+ readSingleQuotedScalar(state, flowIndent) ||
+ readDoubleQuotedScalar(state, flowIndent)) {
+ hasContent = true;
+
+ } else if (readAlias(state)) {
+ hasContent = true;
+
+ if (state.tag !== null || state.anchor !== null) {
+ throwError(state, 'alias node should not have any properties');
+ }
+
+ } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
+ hasContent = true;
+
+ if (state.tag === null) {
+ state.tag = '?';
+ }
+ }
+
+ if (state.anchor !== null) {
+ state.anchorMap[state.anchor] = state.result;
+ }
+ }
+ } else if (indentStatus === 0) {
+ // Special case: block sequences are allowed to have same indentation level as the parent.
+ // http://www.yaml.org/spec/1.2/spec.html#id2799784
+ hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
+ }
+ }
+
+ if (state.tag !== null && state.tag !== '!') {
+ if (state.tag === '?') {
+ for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
+ type = state.implicitTypes[typeIndex];
+
+ // Implicit resolving is not allowed for non-scalar types, and '?'
+ // non-specific tag is only assigned to plain scalars. So, it isn't
+ // needed to check for 'kind' conformity.
+
+ if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
+ state.result = type.construct(state.result);
+ state.tag = type.tag;
+ if (state.anchor !== null) {
+ state.anchorMap[state.anchor] = state.result;
+ }
+ break;
+ }
+ }
+ } else if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) {
+ type = state.typeMap[state.kind || 'fallback'][state.tag];
+
+ if (state.result !== null && type.kind !== state.kind) {
+ throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
+ }
+
+ if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched
+ throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
+ } else {
+ state.result = type.construct(state.result);
+ if (state.anchor !== null) {
+ state.anchorMap[state.anchor] = state.result;
+ }
+ }
+ } else {
+ throwError(state, 'unknown tag !<' + state.tag + '>');
+ }
+ }
+
+ if (state.listener !== null) {
+ state.listener('close', state);
+ }
+ return state.tag !== null || state.anchor !== null || hasContent;
+}
+
+function readDocument(state) {
+ var documentStart = state.position,
+ _position,
+ directiveName,
+ directiveArgs,
+ hasDirectives = false,
+ ch;
+
+ state.version = null;
+ state.checkLineBreaks = state.legacy;
+ state.tagMap = {};
+ state.anchorMap = {};
+
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
+ skipSeparationSpace(state, true, -1);
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (state.lineIndent > 0 || ch !== 0x25/* % */) {
+ break;
+ }
+
+ hasDirectives = true;
+ ch = state.input.charCodeAt(++state.position);
+ _position = state.position;
+
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ directiveName = state.input.slice(_position, state.position);
+ directiveArgs = [];
+
+ if (directiveName.length < 1) {
+ throwError(state, 'directive name must not be less than one character in length');
+ }
+
+ while (ch !== 0) {
+ while (is_WHITE_SPACE(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ if (ch === 0x23/* # */) {
+ do { ch = state.input.charCodeAt(++state.position); }
+ while (ch !== 0 && !is_EOL(ch));
+ break;
+ }
+
+ if (is_EOL(ch)) break;
+
+ _position = state.position;
+
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ directiveArgs.push(state.input.slice(_position, state.position));
+ }
+
+ if (ch !== 0) readLineBreak(state);
+
+ if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
+ directiveHandlers[directiveName](state, directiveName, directiveArgs);
+ } else {
+ throwWarning(state, 'unknown document directive "' + directiveName + '"');
+ }
+ }
+
+ skipSeparationSpace(state, true, -1);
+
+ if (state.lineIndent === 0 &&
+ state.input.charCodeAt(state.position) === 0x2D/* - */ &&
+ state.input.charCodeAt(state.position + 1) === 0x2D/* - */ &&
+ state.input.charCodeAt(state.position + 2) === 0x2D/* - */) {
+ state.position += 3;
+ skipSeparationSpace(state, true, -1);
+
+ } else if (hasDirectives) {
+ throwError(state, 'directives end mark is expected');
+ }
+
+ composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
+ skipSeparationSpace(state, true, -1);
+
+ if (state.checkLineBreaks &&
+ PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
+ throwWarning(state, 'non-ASCII line breaks are interpreted as content');
+ }
+
+ state.documents.push(state.result);
+
+ if (state.position === state.lineStart && testDocumentSeparator(state)) {
+
+ if (state.input.charCodeAt(state.position) === 0x2E/* . */) {
+ state.position += 3;
+ skipSeparationSpace(state, true, -1);
+ }
+ return;
+ }
+
+ if (state.position < (state.length - 1)) {
+ throwError(state, 'end of the stream or a document separator is expected');
+ } else {
+ return;
+ }
+}
+
+
+function loadDocuments(input, options) {
+ input = String(input);
+ options = options || {};
+
+ if (input.length !== 0) {
+
+ // Add tailing `\n` if not exists
+ if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ &&
+ input.charCodeAt(input.length - 1) !== 0x0D/* CR */) {
+ input += '\n';
+ }
+
+ // Strip BOM
+ if (input.charCodeAt(0) === 0xFEFF) {
+ input = input.slice(1);
+ }
+ }
+
+ var state = new State(input, options);
+
+ // Use 0 as string terminator. That significantly simplifies bounds check.
+ state.input += '\0';
+
+ while (state.input.charCodeAt(state.position) === 0x20/* Space */) {
+ state.lineIndent += 1;
+ state.position += 1;
+ }
+
+ while (state.position < (state.length - 1)) {
+ readDocument(state);
+ }
+
+ return state.documents;
+}
+
+
+function loadAll(input, iterator, options) {
+ var documents = loadDocuments(input, options), index, length;
+
+ if (typeof iterator !== 'function') {
+ return documents;
+ }
+
+ for (index = 0, length = documents.length; index < length; index += 1) {
+ iterator(documents[index]);
+ }
+}
+
+
+function load(input, options) {
+ var documents = loadDocuments(input, options);
+
+ if (documents.length === 0) {
+ /*eslint-disable no-undefined*/
+ return undefined;
+ } else if (documents.length === 1) {
+ return documents[0];
+ }
+ throw new YAMLException('expected a single document in the stream, but found more');
+}
+
+
+function safeLoadAll(input, output, options) {
+ if (typeof output === 'function') {
+ loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
+ } else {
+ return loadAll(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
+ }
+}
+
+
+function safeLoad(input, options) {
+ return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
+}
+
+
+module.exports.loadAll = loadAll;
+module.exports.load = load;
+module.exports.safeLoadAll = safeLoadAll;
+module.exports.safeLoad = safeLoad;
+
+},{"./common":2,"./exception":4,"./mark":6,"./schema/default_full":9,"./schema/default_safe":10}],6:[function(require,module,exports){
+'use strict';
+
+
+var common = require('./common');
+
+
+function Mark(name, buffer, position, line, column) {
+ this.name = name;
+ this.buffer = buffer;
+ this.position = position;
+ this.line = line;
+ this.column = column;
+}
+
+
+Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
+ var head, start, tail, end, snippet;
+
+ if (!this.buffer) return null;
+
+ indent = indent || 4;
+ maxLength = maxLength || 75;
+
+ head = '';
+ start = this.position;
+
+ while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) {
+ start -= 1;
+ if (this.position - start > (maxLength / 2 - 1)) {
+ head = ' ... ';
+ start += 5;
+ break;
+ }
+ }
+
+ tail = '';
+ end = this.position;
+
+ while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) {
+ end += 1;
+ if (end - this.position > (maxLength / 2 - 1)) {
+ tail = ' ... ';
+ end -= 5;
+ break;
+ }
+ }
+
+ snippet = this.buffer.slice(start, end);
+
+ return common.repeat(' ', indent) + head + snippet + tail + '\n' +
+ common.repeat(' ', indent + this.position - start + head.length) + '^';
+};
+
+
+Mark.prototype.toString = function toString(compact) {
+ var snippet, where = '';
+
+ if (this.name) {
+ where += 'in "' + this.name + '" ';
+ }
+
+ where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);
+
+ if (!compact) {
+ snippet = this.getSnippet();
+
+ if (snippet) {
+ where += ':\n' + snippet;
+ }
+ }
+
+ return where;
+};
+
+
+module.exports = Mark;
+
+},{"./common":2}],7:[function(require,module,exports){
+'use strict';
+
+/*eslint-disable max-len*/
+
+var common = require('./common');
+var YAMLException = require('./exception');
+var Type = require('./type');
+
+
+function compileList(schema, name, result) {
+ var exclude = [];
+
+ schema.include.forEach(function (includedSchema) {
+ result = compileList(includedSchema, name, result);
+ });
+
+ schema[name].forEach(function (currentType) {
+ result.forEach(function (previousType, previousIndex) {
+ if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
+ exclude.push(previousIndex);
+ }
+ });
+
+ result.push(currentType);
+ });
+
+ return result.filter(function (type, index) {
+ return exclude.indexOf(index) === -1;
+ });
+}
+
+
+function compileMap(/* lists... */) {
+ var result = {
+ scalar: {},
+ sequence: {},
+ mapping: {},
+ fallback: {}
+ }, index, length;
+
+ function collectType(type) {
+ result[type.kind][type.tag] = result['fallback'][type.tag] = type;
+ }
+
+ for (index = 0, length = arguments.length; index < length; index += 1) {
+ arguments[index].forEach(collectType);
+ }
+ return result;
+}
+
+
+function Schema(definition) {
+ this.include = definition.include || [];
+ this.implicit = definition.implicit || [];
+ this.explicit = definition.explicit || [];
+
+ this.implicit.forEach(function (type) {
+ if (type.loadKind && type.loadKind !== 'scalar') {
+ throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
+ }
+ });
+
+ this.compiledImplicit = compileList(this, 'implicit', []);
+ this.compiledExplicit = compileList(this, 'explicit', []);
+ this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
+}
+
+
+Schema.DEFAULT = null;
+
+
+Schema.create = function createSchema() {
+ var schemas, types;
+
+ switch (arguments.length) {
+ case 1:
+ schemas = Schema.DEFAULT;
+ types = arguments[0];
+ break;
+
+ case 2:
+ schemas = arguments[0];
+ types = arguments[1];
+ break;
+
+ default:
+ throw new YAMLException('Wrong number of arguments for Schema.create function');
+ }
+
+ schemas = common.toArray(schemas);
+ types = common.toArray(types);
+
+ if (!schemas.every(function (schema) { return schema instanceof Schema; })) {
+ throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.');
+ }
+
+ if (!types.every(function (type) { return type instanceof Type; })) {
+ throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
+ }
+
+ return new Schema({
+ include: schemas,
+ explicit: types
+ });
+};
+
+
+module.exports = Schema;
+
+},{"./common":2,"./exception":4,"./type":13}],8:[function(require,module,exports){
+// Standard YAML's Core schema.
+// http://www.yaml.org/spec/1.2/spec.html#id2804923
+//
+// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
+// So, Core schema has no distinctions from JSON schema is JS-YAML.
+
+
+'use strict';
+
+
+var Schema = require('../schema');
+
+
+module.exports = new Schema({
+ include: [
+ require('./json')
+ ]
+});
+
+},{"../schema":7,"./json":12}],9:[function(require,module,exports){
+// JS-YAML's default schema for `load` function.
+// It is not described in the YAML specification.
+//
+// This schema is based on JS-YAML's default safe schema and includes
+// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function.
+//
+// Also this schema is used as default base schema at `Schema.create` function.
+
+
+'use strict';
+
+
+var Schema = require('../schema');
+
+
+module.exports = Schema.DEFAULT = new Schema({
+ include: [
+ require('./default_safe')
+ ],
+ explicit: [
+ require('../type/js/undefined'),
+ require('../type/js/regexp'),
+ require('../type/js/function')
+ ]
+});
+
+},{"../schema":7,"../type/js/function":18,"../type/js/regexp":19,"../type/js/undefined":20,"./default_safe":10}],10:[function(require,module,exports){
+// JS-YAML's default schema for `safeLoad` function.
+// It is not described in the YAML specification.
+//
+// This schema is based on standard YAML's Core schema and includes most of
+// extra types described at YAML tag repository. (http://yaml.org/type/)
+
+
+'use strict';
+
+
+var Schema = require('../schema');
+
+
+module.exports = new Schema({
+ include: [
+ require('./core')
+ ],
+ implicit: [
+ require('../type/timestamp'),
+ require('../type/merge')
+ ],
+ explicit: [
+ require('../type/binary'),
+ require('../type/omap'),
+ require('../type/pairs'),
+ require('../type/set')
+ ]
+});
+
+},{"../schema":7,"../type/binary":14,"../type/merge":22,"../type/omap":24,"../type/pairs":25,"../type/set":27,"../type/timestamp":29,"./core":8}],11:[function(require,module,exports){
+// Standard YAML's Failsafe schema.
+// http://www.yaml.org/spec/1.2/spec.html#id2802346
+
+
+'use strict';
+
+
+var Schema = require('../schema');
+
+
+module.exports = new Schema({
+ explicit: [
+ require('../type/str'),
+ require('../type/seq'),
+ require('../type/map')
+ ]
+});
+
+},{"../schema":7,"../type/map":21,"../type/seq":26,"../type/str":28}],12:[function(require,module,exports){
+// Standard YAML's JSON schema.
+// http://www.yaml.org/spec/1.2/spec.html#id2803231
+//
+// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
+// So, this schema is not such strict as defined in the YAML specification.
+// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.
+
+
+'use strict';
+
+
+var Schema = require('../schema');
+
+
+module.exports = new Schema({
+ include: [
+ require('./failsafe')
+ ],
+ implicit: [
+ require('../type/null'),
+ require('../type/bool'),
+ require('../type/int'),
+ require('../type/float')
+ ]
+});
+
+},{"../schema":7,"../type/bool":15,"../type/float":16,"../type/int":17,"../type/null":23,"./failsafe":11}],13:[function(require,module,exports){
+'use strict';
+
+var YAMLException = require('./exception');
+
+var TYPE_CONSTRUCTOR_OPTIONS = [
+ 'kind',
+ 'resolve',
+ 'construct',
+ 'instanceOf',
+ 'predicate',
+ 'represent',
+ 'defaultStyle',
+ 'styleAliases'
+];
+
+var YAML_NODE_KINDS = [
+ 'scalar',
+ 'sequence',
+ 'mapping'
+];
+
+function compileStyleAliases(map) {
+ var result = {};
+
+ if (map !== null) {
+ Object.keys(map).forEach(function (style) {
+ map[style].forEach(function (alias) {
+ result[String(alias)] = style;
+ });
+ });
+ }
+
+ return result;
+}
+
+function Type(tag, options) {
+ options = options || {};
+
+ Object.keys(options).forEach(function (name) {
+ if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
+ throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
+ }
+ });
+
+ // TODO: Add tag format check.
+ this.tag = tag;
+ this.kind = options['kind'] || null;
+ this.resolve = options['resolve'] || function () { return true; };
+ this.construct = options['construct'] || function (data) { return data; };
+ this.instanceOf = options['instanceOf'] || null;
+ this.predicate = options['predicate'] || null;
+ this.represent = options['represent'] || null;
+ this.defaultStyle = options['defaultStyle'] || null;
+ this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
+
+ if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
+ throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
+ }
+}
+
+module.exports = Type;
+
+},{"./exception":4}],14:[function(require,module,exports){
+'use strict';
+
+/*eslint-disable no-bitwise*/
+
+var NodeBuffer;
+
+try {
+ // A trick for browserified version, to not include `Buffer` shim
+ var _require = require;
+ NodeBuffer = _require('buffer').Buffer;
+} catch (__) {}
+
+var Type = require('../type');
+
+
+// [ 64, 65, 66 ] -> [ padding, CR, LF ]
+var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
+
+
+function resolveYamlBinary(data) {
+ if (data === null) return false;
+
+ var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
+
+ // Convert one by one.
+ for (idx = 0; idx < max; idx++) {
+ code = map.indexOf(data.charAt(idx));
+
+ // Skip CR/LF
+ if (code > 64) continue;
+
+ // Fail on illegal characters
+ if (code < 0) return false;
+
+ bitlen += 6;
+ }
+
+ // If there are any bits left, source was corrupted
+ return (bitlen % 8) === 0;
+}
+
+function constructYamlBinary(data) {
+ var idx, tailbits,
+ input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
+ max = input.length,
+ map = BASE64_MAP,
+ bits = 0,
+ result = [];
+
+ // Collect by 6*4 bits (3 bytes)
+
+ for (idx = 0; idx < max; idx++) {
+ if ((idx % 4 === 0) && idx) {
+ result.push((bits >> 16) & 0xFF);
+ result.push((bits >> 8) & 0xFF);
+ result.push(bits & 0xFF);
+ }
+
+ bits = (bits << 6) | map.indexOf(input.charAt(idx));
+ }
+
+ // Dump tail
+
+ tailbits = (max % 4) * 6;
+
+ if (tailbits === 0) {
+ result.push((bits >> 16) & 0xFF);
+ result.push((bits >> 8) & 0xFF);
+ result.push(bits & 0xFF);
+ } else if (tailbits === 18) {
+ result.push((bits >> 10) & 0xFF);
+ result.push((bits >> 2) & 0xFF);
+ } else if (tailbits === 12) {
+ result.push((bits >> 4) & 0xFF);
+ }
+
+ // Wrap into Buffer for NodeJS and leave Array for browser
+ if (NodeBuffer) {
+ // Support node 6.+ Buffer API when available
+ return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result);
+ }
+
+ return result;
+}
+
+function representYamlBinary(object /*, style*/) {
+ var result = '', bits = 0, idx, tail,
+ max = object.length,
+ map = BASE64_MAP;
+
+ // Convert every three bytes to 4 ASCII characters.
+
+ for (idx = 0; idx < max; idx++) {
+ if ((idx % 3 === 0) && idx) {
+ result += map[(bits >> 18) & 0x3F];
+ result += map[(bits >> 12) & 0x3F];
+ result += map[(bits >> 6) & 0x3F];
+ result += map[bits & 0x3F];
+ }
+
+ bits = (bits << 8) + object[idx];
+ }
+
+ // Dump tail
+
+ tail = max % 3;
+
+ if (tail === 0) {
+ result += map[(bits >> 18) & 0x3F];
+ result += map[(bits >> 12) & 0x3F];
+ result += map[(bits >> 6) & 0x3F];
+ result += map[bits & 0x3F];
+ } else if (tail === 2) {
+ result += map[(bits >> 10) & 0x3F];
+ result += map[(bits >> 4) & 0x3F];
+ result += map[(bits << 2) & 0x3F];
+ result += map[64];
+ } else if (tail === 1) {
+ result += map[(bits >> 2) & 0x3F];
+ result += map[(bits << 4) & 0x3F];
+ result += map[64];
+ result += map[64];
+ }
+
+ return result;
+}
+
+function isBinary(object) {
+ return NodeBuffer && NodeBuffer.isBuffer(object);
+}
+
+module.exports = new Type('tag:yaml.org,2002:binary', {
+ kind: 'scalar',
+ resolve: resolveYamlBinary,
+ construct: constructYamlBinary,
+ predicate: isBinary,
+ represent: representYamlBinary
+});
+
+},{"../type":13}],15:[function(require,module,exports){
+'use strict';
+
+var Type = require('../type');
+
+function resolveYamlBoolean(data) {
+ if (data === null) return false;
+
+ var max = data.length;
+
+ return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
+ (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
+}
+
+function constructYamlBoolean(data) {
+ return data === 'true' ||
+ data === 'True' ||
+ data === 'TRUE';
+}
+
+function isBoolean(object) {
+ return Object.prototype.toString.call(object) === '[object Boolean]';
+}
+
+module.exports = new Type('tag:yaml.org,2002:bool', {
+ kind: 'scalar',
+ resolve: resolveYamlBoolean,
+ construct: constructYamlBoolean,
+ predicate: isBoolean,
+ represent: {
+ lowercase: function (object) { return object ? 'true' : 'false'; },
+ uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
+ camelcase: function (object) { return object ? 'True' : 'False'; }
+ },
+ defaultStyle: 'lowercase'
+});
+
+},{"../type":13}],16:[function(require,module,exports){
+'use strict';
+
+var common = require('../common');
+var Type = require('../type');
+
+var YAML_FLOAT_PATTERN = new RegExp(
+ // 2.5e4, 2.5 and integers
+ '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
+ // .2e4, .2
+ // special case, seems not from spec
+ '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
+ // 20:59
+ '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' +
+ // .inf
+ '|[-+]?\\.(?:inf|Inf|INF)' +
+ // .nan
+ '|\\.(?:nan|NaN|NAN))$');
+
+function resolveYamlFloat(data) {
+ if (data === null) return false;
+
+ if (!YAML_FLOAT_PATTERN.test(data) ||
+ // Quick hack to not allow integers end with `_`
+ // Probably should update regexp & check speed
+ data[data.length - 1] === '_') {
+ return false;
+ }
+
+ return true;
+}
+
+function constructYamlFloat(data) {
+ var value, sign, base, digits;
+
+ value = data.replace(/_/g, '').toLowerCase();
+ sign = value[0] === '-' ? -1 : 1;
+ digits = [];
+
+ if ('+-'.indexOf(value[0]) >= 0) {
+ value = value.slice(1);
+ }
+
+ if (value === '.inf') {
+ return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
+
+ } else if (value === '.nan') {
+ return NaN;
+
+ } else if (value.indexOf(':') >= 0) {
+ value.split(':').forEach(function (v) {
+ digits.unshift(parseFloat(v, 10));
+ });
+
+ value = 0.0;
+ base = 1;
+
+ digits.forEach(function (d) {
+ value += d * base;
+ base *= 60;
+ });
+
+ return sign * value;
+
+ }
+ return sign * parseFloat(value, 10);
+}
+
+
+var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
+
+function representYamlFloat(object, style) {
+ var res;
+
+ if (isNaN(object)) {
+ switch (style) {
+ case 'lowercase': return '.nan';
+ case 'uppercase': return '.NAN';
+ case 'camelcase': return '.NaN';
+ }
+ } else if (Number.POSITIVE_INFINITY === object) {
+ switch (style) {
+ case 'lowercase': return '.inf';
+ case 'uppercase': return '.INF';
+ case 'camelcase': return '.Inf';
+ }
+ } else if (Number.NEGATIVE_INFINITY === object) {
+ switch (style) {
+ case 'lowercase': return '-.inf';
+ case 'uppercase': return '-.INF';
+ case 'camelcase': return '-.Inf';
+ }
+ } else if (common.isNegativeZero(object)) {
+ return '-0.0';
+ }
+
+ res = object.toString(10);
+
+ // JS stringifier can build scientific format without dots: 5e-100,
+ // while YAML requres dot: 5.e-100. Fix it with simple hack
+
+ return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;
+}
+
+function isFloat(object) {
+ return (Object.prototype.toString.call(object) === '[object Number]') &&
+ (object % 1 !== 0 || common.isNegativeZero(object));
+}
+
+module.exports = new Type('tag:yaml.org,2002:float', {
+ kind: 'scalar',
+ resolve: resolveYamlFloat,
+ construct: constructYamlFloat,
+ predicate: isFloat,
+ represent: representYamlFloat,
+ defaultStyle: 'lowercase'
+});
+
+},{"../common":2,"../type":13}],17:[function(require,module,exports){
+'use strict';
+
+var common = require('../common');
+var Type = require('../type');
+
+function isHexCode(c) {
+ return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
+ ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
+ ((0x61/* a */ <= c) && (c <= 0x66/* f */));
+}
+
+function isOctCode(c) {
+ return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
+}
+
+function isDecCode(c) {
+ return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
+}
+
+function resolveYamlInteger(data) {
+ if (data === null) return false;
+
+ var max = data.length,
+ index = 0,
+ hasDigits = false,
+ ch;
+
+ if (!max) return false;
+
+ ch = data[index];
+
+ // sign
+ if (ch === '-' || ch === '+') {
+ ch = data[++index];
+ }
+
+ if (ch === '0') {
+ // 0
+ if (index + 1 === max) return true;
+ ch = data[++index];
+
+ // base 2, base 8, base 16
+
+ if (ch === 'b') {
+ // base 2
+ index++;
+
+ for (; index < max; index++) {
+ ch = data[index];
+ if (ch === '_') continue;
+ if (ch !== '0' && ch !== '1') return false;
+ hasDigits = true;
+ }
+ return hasDigits && ch !== '_';
+ }
+
+
+ if (ch === 'x') {
+ // base 16
+ index++;
+
+ for (; index < max; index++) {
+ ch = data[index];
+ if (ch === '_') continue;
+ if (!isHexCode(data.charCodeAt(index))) return false;
+ hasDigits = true;
+ }
+ return hasDigits && ch !== '_';
+ }
+
+ // base 8
+ for (; index < max; index++) {
+ ch = data[index];
+ if (ch === '_') continue;
+ if (!isOctCode(data.charCodeAt(index))) return false;
+ hasDigits = true;
+ }
+ return hasDigits && ch !== '_';
+ }
+
+ // base 10 (except 0) or base 60
+
+ // value should not start with `_`;
+ if (ch === '_') return false;
+
+ for (; index < max; index++) {
+ ch = data[index];
+ if (ch === '_') continue;
+ if (ch === ':') break;
+ if (!isDecCode(data.charCodeAt(index))) {
+ return false;
+ }
+ hasDigits = true;
+ }
+
+ // Should have digits and should not end with `_`
+ if (!hasDigits || ch === '_') return false;
+
+ // if !base60 - done;
+ if (ch !== ':') return true;
+
+ // base60 almost not used, no needs to optimize
+ return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
+}
+
+function constructYamlInteger(data) {
+ var value = data, sign = 1, ch, base, digits = [];
+
+ if (value.indexOf('_') !== -1) {
+ value = value.replace(/_/g, '');
+ }
+
+ ch = value[0];
+
+ if (ch === '-' || ch === '+') {
+ if (ch === '-') sign = -1;
+ value = value.slice(1);
+ ch = value[0];
+ }
+
+ if (value === '0') return 0;
+
+ if (ch === '0') {
+ if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);
+ if (value[1] === 'x') return sign * parseInt(value, 16);
+ return sign * parseInt(value, 8);
+ }
+
+ if (value.indexOf(':') !== -1) {
+ value.split(':').forEach(function (v) {
+ digits.unshift(parseInt(v, 10));
+ });
+
+ value = 0;
+ base = 1;
+
+ digits.forEach(function (d) {
+ value += (d * base);
+ base *= 60;
+ });
+
+ return sign * value;
+
+ }
+
+ return sign * parseInt(value, 10);
+}
+
+function isInteger(object) {
+ return (Object.prototype.toString.call(object)) === '[object Number]' &&
+ (object % 1 === 0 && !common.isNegativeZero(object));
+}
+
+module.exports = new Type('tag:yaml.org,2002:int', {
+ kind: 'scalar',
+ resolve: resolveYamlInteger,
+ construct: constructYamlInteger,
+ predicate: isInteger,
+ represent: {
+ binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); },
+ octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); },
+ decimal: function (obj) { return obj.toString(10); },
+ /* eslint-disable max-len */
+ hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); }
+ },
+ defaultStyle: 'decimal',
+ styleAliases: {
+ binary: [ 2, 'bin' ],
+ octal: [ 8, 'oct' ],
+ decimal: [ 10, 'dec' ],
+ hexadecimal: [ 16, 'hex' ]
+ }
+});
+
+},{"../common":2,"../type":13}],18:[function(require,module,exports){
+'use strict';
+
+var esprima;
+
+// Browserified version does not have esprima
+//
+// 1. For node.js just require module as deps
+// 2. For browser try to require mudule via external AMD system.
+// If not found - try to fallback to window.esprima. If not
+// found too - then fail to parse.
+//
+try {
+ // workaround to exclude package from browserify list.
+ var _require = require;
+ esprima = _require('esprima');
+} catch (_) {
+ /*global window */
+ if (typeof window !== 'undefined') esprima = window.esprima;
+}
+
+var Type = require('../../type');
+
+function resolveJavascriptFunction(data) {
+ if (data === null) return false;
+
+ try {
+ var source = '(' + data + ')',
+ ast = esprima.parse(source, { range: true });
+
+ if (ast.type !== 'Program' ||
+ ast.body.length !== 1 ||
+ ast.body[0].type !== 'ExpressionStatement' ||
+ (ast.body[0].expression.type !== 'ArrowFunctionExpression' &&
+ ast.body[0].expression.type !== 'FunctionExpression')) {
+ return false;
+ }
+
+ return true;
+ } catch (err) {
+ return false;
+ }
+}
+
+function constructJavascriptFunction(data) {
+ /*jslint evil:true*/
+
+ var source = '(' + data + ')',
+ ast = esprima.parse(source, { range: true }),
+ params = [],
+ body;
+
+ if (ast.type !== 'Program' ||
+ ast.body.length !== 1 ||
+ ast.body[0].type !== 'ExpressionStatement' ||
+ (ast.body[0].expression.type !== 'ArrowFunctionExpression' &&
+ ast.body[0].expression.type !== 'FunctionExpression')) {
+ throw new Error('Failed to resolve function');
+ }
+
+ ast.body[0].expression.params.forEach(function (param) {
+ params.push(param.name);
+ });
+
+ body = ast.body[0].expression.body.range;
+
+ // Esprima's ranges include the first '{' and the last '}' characters on
+ // function expressions. So cut them out.
+ /*eslint-disable no-new-func*/
+ return new Function(params, source.slice(body[0] + 1, body[1] - 1));
+}
+
+function representJavascriptFunction(object /*, style*/) {
+ return object.toString();
+}
+
+function isFunction(object) {
+ return Object.prototype.toString.call(object) === '[object Function]';
+}
+
+module.exports = new Type('tag:yaml.org,2002:js/function', {
+ kind: 'scalar',
+ resolve: resolveJavascriptFunction,
+ construct: constructJavascriptFunction,
+ predicate: isFunction,
+ represent: representJavascriptFunction
+});
+
+},{"../../type":13}],19:[function(require,module,exports){
+'use strict';
+
+var Type = require('../../type');
+
+function resolveJavascriptRegExp(data) {
+ if (data === null) return false;
+ if (data.length === 0) return false;
+
+ var regexp = data,
+ tail = /\/([gim]*)$/.exec(data),
+ modifiers = '';
+
+ // if regexp starts with '/' it can have modifiers and must be properly closed
+ // `/foo/gim` - modifiers tail can be maximum 3 chars
+ if (regexp[0] === '/') {
+ if (tail) modifiers = tail[1];
+
+ if (modifiers.length > 3) return false;
+ // if expression starts with /, is should be properly terminated
+ if (regexp[regexp.length - modifiers.length - 1] !== '/') return false;
+ }
+
+ return true;
+}
+
+function constructJavascriptRegExp(data) {
+ var regexp = data,
+ tail = /\/([gim]*)$/.exec(data),
+ modifiers = '';
+
+ // `/foo/gim` - tail can be maximum 4 chars
+ if (regexp[0] === '/') {
+ if (tail) modifiers = tail[1];
+ regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
+ }
+
+ return new RegExp(regexp, modifiers);
+}
+
+function representJavascriptRegExp(object /*, style*/) {
+ var result = '/' + object.source + '/';
+
+ if (object.global) result += 'g';
+ if (object.multiline) result += 'm';
+ if (object.ignoreCase) result += 'i';
+
+ return result;
+}
+
+function isRegExp(object) {
+ return Object.prototype.toString.call(object) === '[object RegExp]';
+}
+
+module.exports = new Type('tag:yaml.org,2002:js/regexp', {
+ kind: 'scalar',
+ resolve: resolveJavascriptRegExp,
+ construct: constructJavascriptRegExp,
+ predicate: isRegExp,
+ represent: representJavascriptRegExp
+});
+
+},{"../../type":13}],20:[function(require,module,exports){
+'use strict';
+
+var Type = require('../../type');
+
+function resolveJavascriptUndefined() {
+ return true;
+}
+
+function constructJavascriptUndefined() {
+ /*eslint-disable no-undefined*/
+ return undefined;
+}
+
+function representJavascriptUndefined() {
+ return '';
+}
+
+function isUndefined(object) {
+ return typeof object === 'undefined';
+}
+
+module.exports = new Type('tag:yaml.org,2002:js/undefined', {
+ kind: 'scalar',
+ resolve: resolveJavascriptUndefined,
+ construct: constructJavascriptUndefined,
+ predicate: isUndefined,
+ represent: representJavascriptUndefined
+});
+
+},{"../../type":13}],21:[function(require,module,exports){
+'use strict';
+
+var Type = require('../type');
+
+module.exports = new Type('tag:yaml.org,2002:map', {
+ kind: 'mapping',
+ construct: function (data) { return data !== null ? data : {}; }
+});
+
+},{"../type":13}],22:[function(require,module,exports){
+'use strict';
+
+var Type = require('../type');
+
+function resolveYamlMerge(data) {
+ return data === '<<' || data === null;
+}
+
+module.exports = new Type('tag:yaml.org,2002:merge', {
+ kind: 'scalar',
+ resolve: resolveYamlMerge
+});
+
+},{"../type":13}],23:[function(require,module,exports){
+'use strict';
+
+var Type = require('../type');
+
+function resolveYamlNull(data) {
+ if (data === null) return true;
+
+ var max = data.length;
+
+ return (max === 1 && data === '~') ||
+ (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
+}
+
+function constructYamlNull() {
+ return null;
+}
+
+function isNull(object) {
+ return object === null;
+}
+
+module.exports = new Type('tag:yaml.org,2002:null', {
+ kind: 'scalar',
+ resolve: resolveYamlNull,
+ construct: constructYamlNull,
+ predicate: isNull,
+ represent: {
+ canonical: function () { return '~'; },
+ lowercase: function () { return 'null'; },
+ uppercase: function () { return 'NULL'; },
+ camelcase: function () { return 'Null'; }
+ },
+ defaultStyle: 'lowercase'
+});
+
+},{"../type":13}],24:[function(require,module,exports){
+'use strict';
+
+var Type = require('../type');
+
+var _hasOwnProperty = Object.prototype.hasOwnProperty;
+var _toString = Object.prototype.toString;
+
+function resolveYamlOmap(data) {
+ if (data === null) return true;
+
+ var objectKeys = [], index, length, pair, pairKey, pairHasKey,
+ object = data;
+
+ for (index = 0, length = object.length; index < length; index += 1) {
+ pair = object[index];
+ pairHasKey = false;
+
+ if (_toString.call(pair) !== '[object Object]') return false;
+
+ for (pairKey in pair) {
+ if (_hasOwnProperty.call(pair, pairKey)) {
+ if (!pairHasKey) pairHasKey = true;
+ else return false;
+ }
+ }
+
+ if (!pairHasKey) return false;
+
+ if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
+ else return false;
+ }
+
+ return true;
+}
+
+function constructYamlOmap(data) {
+ return data !== null ? data : [];
+}
+
+module.exports = new Type('tag:yaml.org,2002:omap', {
+ kind: 'sequence',
+ resolve: resolveYamlOmap,
+ construct: constructYamlOmap
+});
+
+},{"../type":13}],25:[function(require,module,exports){
+'use strict';
+
+var Type = require('../type');
+
+var _toString = Object.prototype.toString;
+
+function resolveYamlPairs(data) {
+ if (data === null) return true;
+
+ var index, length, pair, keys, result,
+ object = data;
+
+ result = new Array(object.length);
+
+ for (index = 0, length = object.length; index < length; index += 1) {
+ pair = object[index];
+
+ if (_toString.call(pair) !== '[object Object]') return false;
+
+ keys = Object.keys(pair);
+
+ if (keys.length !== 1) return false;
+
+ result[index] = [ keys[0], pair[keys[0]] ];
+ }
+
+ return true;
+}
+
+function constructYamlPairs(data) {
+ if (data === null) return [];
+
+ var index, length, pair, keys, result,
+ object = data;
+
+ result = new Array(object.length);
+
+ for (index = 0, length = object.length; index < length; index += 1) {
+ pair = object[index];
+
+ keys = Object.keys(pair);
+
+ result[index] = [ keys[0], pair[keys[0]] ];
+ }
+
+ return result;
+}
+
+module.exports = new Type('tag:yaml.org,2002:pairs', {
+ kind: 'sequence',
+ resolve: resolveYamlPairs,
+ construct: constructYamlPairs
+});
+
+},{"../type":13}],26:[function(require,module,exports){
+'use strict';
+
+var Type = require('../type');
+
+module.exports = new Type('tag:yaml.org,2002:seq', {
+ kind: 'sequence',
+ construct: function (data) { return data !== null ? data : []; }
+});
+
+},{"../type":13}],27:[function(require,module,exports){
+'use strict';
+
+var Type = require('../type');
+
+var _hasOwnProperty = Object.prototype.hasOwnProperty;
+
+function resolveYamlSet(data) {
+ if (data === null) return true;
+
+ var key, object = data;
+
+ for (key in object) {
+ if (_hasOwnProperty.call(object, key)) {
+ if (object[key] !== null) return false;
+ }
+ }
+
+ return true;
+}
+
+function constructYamlSet(data) {
+ return data !== null ? data : {};
+}
+
+module.exports = new Type('tag:yaml.org,2002:set', {
+ kind: 'mapping',
+ resolve: resolveYamlSet,
+ construct: constructYamlSet
+});
+
+},{"../type":13}],28:[function(require,module,exports){
+'use strict';
+
+var Type = require('../type');
+
+module.exports = new Type('tag:yaml.org,2002:str', {
+ kind: 'scalar',
+ construct: function (data) { return data !== null ? data : ''; }
+});
+
+},{"../type":13}],29:[function(require,module,exports){
+'use strict';
+
+var Type = require('../type');
+
+var YAML_DATE_REGEXP = new RegExp(
+ '^([0-9][0-9][0-9][0-9])' + // [1] year
+ '-([0-9][0-9])' + // [2] month
+ '-([0-9][0-9])$'); // [3] day
+
+var YAML_TIMESTAMP_REGEXP = new RegExp(
+ '^([0-9][0-9][0-9][0-9])' + // [1] year
+ '-([0-9][0-9]?)' + // [2] month
+ '-([0-9][0-9]?)' + // [3] day
+ '(?:[Tt]|[ \\t]+)' + // ...
+ '([0-9][0-9]?)' + // [4] hour
+ ':([0-9][0-9])' + // [5] minute
+ ':([0-9][0-9])' + // [6] second
+ '(?:\\.([0-9]*))?' + // [7] fraction
+ '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
+ '(?::([0-9][0-9]))?))?$'); // [11] tz_minute
+
+function resolveYamlTimestamp(data) {
+ if (data === null) return false;
+ if (YAML_DATE_REGEXP.exec(data) !== null) return true;
+ if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
+ return false;
+}
+
+function constructYamlTimestamp(data) {
+ var match, year, month, day, hour, minute, second, fraction = 0,
+ delta = null, tz_hour, tz_minute, date;
+
+ match = YAML_DATE_REGEXP.exec(data);
+ if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
+
+ if (match === null) throw new Error('Date resolve error');
+
+ // match: [1] year [2] month [3] day
+
+ year = +(match[1]);
+ month = +(match[2]) - 1; // JS month starts with 0
+ day = +(match[3]);
+
+ if (!match[4]) { // no hour
+ return new Date(Date.UTC(year, month, day));
+ }
+
+ // match: [4] hour [5] minute [6] second [7] fraction
+
+ hour = +(match[4]);
+ minute = +(match[5]);
+ second = +(match[6]);
+
+ if (match[7]) {
+ fraction = match[7].slice(0, 3);
+ while (fraction.length < 3) { // milli-seconds
+ fraction += '0';
+ }
+ fraction = +fraction;
+ }
+
+ // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
+
+ if (match[9]) {
+ tz_hour = +(match[10]);
+ tz_minute = +(match[11] || 0);
+ delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
+ if (match[9] === '-') delta = -delta;
+ }
+
+ date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
+
+ if (delta) date.setTime(date.getTime() - delta);
+
+ return date;
+}
+
+function representYamlTimestamp(object /*, style*/) {
+ return object.toISOString();
+}
+
+module.exports = new Type('tag:yaml.org,2002:timestamp', {
+ kind: 'scalar',
+ resolve: resolveYamlTimestamp,
+ construct: constructYamlTimestamp,
+ instanceOf: Date,
+ represent: representYamlTimestamp
+});
+
+},{"../type":13}],"/":[function(require,module,exports){
+'use strict';
+
+
+var yaml = require('./lib/js-yaml.js');
+
+
+module.exports = yaml;
+
+},{"./lib/js-yaml.js":1}]},{},[])("/")
+}); \ No newline at end of file
diff --git a/tools/doc/node_modules/js-yaml/dist/js-yaml.min.js b/tools/doc/node_modules/js-yaml/dist/js-yaml.min.js
new file mode 100644
index 0000000000..7ca018420d
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/dist/js-yaml.min.js
@@ -0,0 +1 @@
+!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).jsyaml=e()}}(function(){return function o(a,s,c){function u(n,e){if(!s[n]){if(!a[n]){var t="function"==typeof require&&require;if(!e&&t)return t(n,!0);if(l)return l(n,!0);var i=new Error("Cannot find module '"+n+"'");throw i.code="MODULE_NOT_FOUND",i}var r=s[n]={exports:{}};a[n][0].call(r.exports,function(e){var t=a[n][1][e];return u(t||e)},r,r.exports,o,a,s,c)}return s[n].exports}for(var l="function"==typeof require&&require,e=0;e<c.length;e++)u(c[e]);return u}({1:[function(e,t,n){"use strict";var i=e("./js-yaml/loader"),r=e("./js-yaml/dumper");function o(e){return function(){throw new Error("Function "+e+" is deprecated and cannot be used.")}}t.exports.Type=e("./js-yaml/type"),t.exports.Schema=e("./js-yaml/schema"),t.exports.FAILSAFE_SCHEMA=e("./js-yaml/schema/failsafe"),t.exports.JSON_SCHEMA=e("./js-yaml/schema/json"),t.exports.CORE_SCHEMA=e("./js-yaml/schema/core"),t.exports.DEFAULT_SAFE_SCHEMA=e("./js-yaml/schema/default_safe"),t.exports.DEFAULT_FULL_SCHEMA=e("./js-yaml/schema/default_full"),t.exports.load=i.load,t.exports.loadAll=i.loadAll,t.exports.safeLoad=i.safeLoad,t.exports.safeLoadAll=i.safeLoadAll,t.exports.dump=r.dump,t.exports.safeDump=r.safeDump,t.exports.YAMLException=e("./js-yaml/exception"),t.exports.MINIMAL_SCHEMA=e("./js-yaml/schema/failsafe"),t.exports.SAFE_SCHEMA=e("./js-yaml/schema/default_safe"),t.exports.DEFAULT_SCHEMA=e("./js-yaml/schema/default_full"),t.exports.scan=o("scan"),t.exports.parse=o("parse"),t.exports.compose=o("compose"),t.exports.addConstructor=o("addConstructor")},{"./js-yaml/dumper":3,"./js-yaml/exception":4,"./js-yaml/loader":5,"./js-yaml/schema":7,"./js-yaml/schema/core":8,"./js-yaml/schema/default_full":9,"./js-yaml/schema/default_safe":10,"./js-yaml/schema/failsafe":11,"./js-yaml/schema/json":12,"./js-yaml/type":13}],2:[function(e,t,n){"use strict";function i(e){return null==e}t.exports.isNothing=i,t.exports.isObject=function(e){return"object"==typeof e&&null!==e},t.exports.toArray=function(e){return Array.isArray(e)?e:i(e)?[]:[e]},t.exports.repeat=function(e,t){var n,i="";for(n=0;n<t;n+=1)i+=e;return i},t.exports.isNegativeZero=function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},t.exports.extend=function(e,t){var n,i,r,o;if(t)for(n=0,i=(o=Object.keys(t)).length;n<i;n+=1)e[r=o[n]]=t[r];return e}},{}],3:[function(e,t,n){"use strict";var c=e("./common"),d=e("./exception"),i=e("./schema/default_full"),r=e("./schema/default_safe"),l=Object.prototype.toString,u=Object.prototype.hasOwnProperty,o=9,h=10,a=32,m=33,g=34,y=35,x=37,v=38,A=39,b=42,w=44,C=45,k=58,j=62,S=63,I=64,E=91,O=93,F=96,_=123,N=124,M=125,s={0:"\\0",7:"\\a",8:"\\b",9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r",27:"\\e",34:'\\"',92:"\\\\",133:"\\N",160:"\\_",8232:"\\L",8233:"\\P"},p=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"];function f(e){var t,n,i;if(t=e.toString(16).toUpperCase(),e<=255)n="x",i=2;else if(e<=65535)n="u",i=4;else{if(!(e<=4294967295))throw new d("code point within a string may not be greater than 0xFFFFFFFF");n="U",i=8}return"\\"+n+c.repeat("0",i-t.length)+t}function T(e){this.schema=e.schema||i,this.indent=Math.max(1,e.indent||2),this.skipInvalid=e.skipInvalid||!1,this.flowLevel=c.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=function(e,t){var n,i,r,o,a,s,c;if(null===t)return{};for(n={},r=0,o=(i=Object.keys(t)).length;r<o;r+=1)a=i[r],s=String(t[a]),"!!"===a.slice(0,2)&&(a="tag:yaml.org,2002:"+a.slice(2)),(c=e.compiledTypeMap.fallback[a])&&u.call(c.styleAliases,s)&&(s=c.styleAliases[s]),n[a]=s;return n}(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function L(e,t){for(var n,i=c.repeat(" ",t),r=0,o=-1,a="",s=e.length;r<s;)-1===(o=e.indexOf("\n",r))?(n=e.slice(r),r=s):(n=e.slice(r,o+1),r=o+1),n.length&&"\n"!==n&&(a+=i),a+=n;return a}function D(e,t){return"\n"+c.repeat(" ",e.indent*t)}function U(e){return e===a||e===o}function q(e){return 32<=e&&e<=126||161<=e&&e<=55295&&8232!==e&&8233!==e||57344<=e&&e<=65533&&65279!==e||65536<=e&&e<=1114111}function Y(e){return q(e)&&65279!==e&&e!==w&&e!==E&&e!==O&&e!==_&&e!==M&&e!==k&&e!==y}var R=1,P=2,W=3,B=4,K=5;function $(e,t,n,i,r){var o,a,s,c=!1,u=!1,l=-1!==i,p=-1,f=q(s=e.charCodeAt(0))&&65279!==s&&!U(s)&&s!==C&&s!==S&&s!==k&&s!==w&&s!==E&&s!==O&&s!==_&&s!==M&&s!==y&&s!==v&&s!==b&&s!==m&&s!==N&&s!==j&&s!==A&&s!==g&&s!==x&&s!==I&&s!==F&&!U(e.charCodeAt(e.length-1));if(t)for(o=0;o<e.length;o++){if(!q(a=e.charCodeAt(o)))return K;f=f&&Y(a)}else{for(o=0;o<e.length;o++){if((a=e.charCodeAt(o))===h)c=!0,l&&(u=u||i<o-p-1&&" "!==e[p+1],p=o);else if(!q(a))return K;f=f&&Y(a)}u=u||l&&i<o-p-1&&" "!==e[p+1]}return c||u?" "===e[0]&&9<n?K:u?B:W:f&&!r(e)?R:P}function H(i,r,o,a){i.dump=function(){if(0===r.length)return"''";if(!i.noCompatMode&&-1!==p.indexOf(r))return"'"+r+"'";var e=i.indent*Math.max(1,o),t=-1===i.lineWidth?-1:Math.max(Math.min(i.lineWidth,40),i.lineWidth-e),n=a||-1<i.flowLevel&&o>=i.flowLevel;switch($(r,n,i.indent,t,function(e){return function(e,t){var n,i;for(n=0,i=e.implicitTypes.length;n<i;n+=1)if(e.implicitTypes[n].resolve(t))return!0;return!1}(i,e)})){case R:return r;case P:return"'"+r.replace(/'/g,"''")+"'";case W:return"|"+G(r,i.indent)+V(L(r,e));case B:return">"+G(r,i.indent)+V(L(function(e,t){var n,i,r=/(\n+)([^\n]*)/g,o=(s=e.indexOf("\n"),s=-1!==s?s:e.length,r.lastIndex=s,Z(e.slice(0,s),t)),a="\n"===e[0]||" "===e[0];var s;for(;i=r.exec(e);){var c=i[1],u=i[2];n=" "===u[0],o+=c+(a||n||""===u?"":"\n")+Z(u,t),a=n}return o}(r,t),e));case K:return'"'+function(e){for(var t,n,i,r="",o=0;o<e.length;o++)55296<=(t=e.charCodeAt(o))&&t<=56319&&56320<=(n=e.charCodeAt(o+1))&&n<=57343?(r+=f(1024*(t-55296)+n-56320+65536),o++):(i=s[t],r+=!i&&q(t)?e[o]:i||f(t));return r}(r)+'"';default:throw new d("impossible error: invalid scalar style")}}()}function G(e,t){var n=" "===e[0]?String(t):"",i="\n"===e[e.length-1];return n+(i&&("\n"===e[e.length-2]||"\n"===e)?"+":i?"":"-")+"\n"}function V(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function Z(e,t){if(""===e||" "===e[0])return e;for(var n,i,r=/ [^ ]/g,o=0,a=0,s=0,c="";n=r.exec(e);)t<(s=n.index)-o&&(i=o<a?a:s,c+="\n"+e.slice(o,i),o=i+1),a=s;return c+="\n",e.length-o>t&&o<a?c+=e.slice(o,a)+"\n"+e.slice(a+1):c+=e.slice(o),c.slice(1)}function z(e,t,n){var i,r,o,a,s,c;for(o=0,a=(r=n?e.explicitTypes:e.implicitTypes).length;o<a;o+=1)if(((s=r[o]).instanceOf||s.predicate)&&(!s.instanceOf||"object"==typeof t&&t instanceof s.instanceOf)&&(!s.predicate||s.predicate(t))){if(e.tag=n?s.tag:"?",s.represent){if(c=e.styleMap[s.tag]||s.defaultStyle,"[object Function]"===l.call(s.represent))i=s.represent(t,c);else{if(!u.call(s.represent,c))throw new d("!<"+s.tag+'> tag resolver accepts not "'+c+'" style');i=s.represent[c](t,c)}e.dump=i}return!0}return!1}function J(e,t,n,i,r,o){e.tag=null,e.dump=n,z(e,n,!1)||z(e,n,!0);var a=l.call(e.dump);i&&(i=e.flowLevel<0||e.flowLevel>t);var s,c,u="[object Object]"===a||"[object Array]"===a;if(u&&(c=-1!==(s=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||c||2!==e.indent&&0<t)&&(r=!1),c&&e.usedDuplicates[s])e.dump="*ref_"+s;else{if(u&&c&&!e.usedDuplicates[s]&&(e.usedDuplicates[s]=!0),"[object Object]"===a)i&&0!==Object.keys(e.dump).length?(!function(e,t,n,i){var r,o,a,s,c,u,l="",p=e.tag,f=Object.keys(n);if(!0===e.sortKeys)f.sort();else if("function"==typeof e.sortKeys)f.sort(e.sortKeys);else if(e.sortKeys)throw new d("sortKeys must be a boolean or a function");for(r=0,o=f.length;r<o;r+=1)u="",i&&0===r||(u+=D(e,t)),s=n[a=f[r]],J(e,t+1,a,!0,!0,!0)&&((c=null!==e.tag&&"?"!==e.tag||e.dump&&1024<e.dump.length)&&(e.dump&&h===e.dump.charCodeAt(0)?u+="?":u+="? "),u+=e.dump,c&&(u+=D(e,t)),J(e,t+1,s,!0,c)&&(e.dump&&h===e.dump.charCodeAt(0)?u+=":":u+=": ",l+=u+=e.dump));e.tag=p,e.dump=l||"{}"}(e,t,e.dump,r),c&&(e.dump="&ref_"+s+e.dump)):(!function(e,t,n){var i,r,o,a,s,c="",u=e.tag,l=Object.keys(n);for(i=0,r=l.length;i<r;i+=1)s=e.condenseFlow?'"':"",0!==i&&(s+=", "),a=n[o=l[i]],J(e,t,o,!1,!1)&&(1024<e.dump.length&&(s+="? "),s+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),J(e,t,a,!1,!1)&&(c+=s+=e.dump));e.tag=u,e.dump="{"+c+"}"}(e,t,e.dump),c&&(e.dump="&ref_"+s+" "+e.dump));else if("[object Array]"===a)i&&0!==e.dump.length?(!function(e,t,n,i){var r,o,a="",s=e.tag;for(r=0,o=n.length;r<o;r+=1)J(e,t+1,n[r],!0,!0)&&(i&&0===r||(a+=D(e,t)),e.dump&&h===e.dump.charCodeAt(0)?a+="-":a+="- ",a+=e.dump);e.tag=s,e.dump=a||"[]"}(e,t,e.dump,r),c&&(e.dump="&ref_"+s+e.dump)):(!function(e,t,n){var i,r,o="",a=e.tag;for(i=0,r=n.length;i<r;i+=1)J(e,t,n[i],!1,!1)&&(0!==i&&(o+=","+(e.condenseFlow?"":" ")),o+=e.dump);e.tag=a,e.dump="["+o+"]"}(e,t,e.dump),c&&(e.dump="&ref_"+s+" "+e.dump));else{if("[object String]"!==a){if(e.skipInvalid)return!1;throw new d("unacceptable kind of an object to dump "+a)}"?"!==e.tag&&H(e,e.dump,t,o)}null!==e.tag&&"?"!==e.tag&&(e.dump="!<"+e.tag+"> "+e.dump)}return!0}function Q(e,t){var n,i,r=[],o=[];for(function e(t,n,i){var r,o,a;if(null!==t&&"object"==typeof t)if(-1!==(o=n.indexOf(t)))-1===i.indexOf(o)&&i.push(o);else if(n.push(t),Array.isArray(t))for(o=0,a=t.length;o<a;o+=1)e(t[o],n,i);else for(r=Object.keys(t),o=0,a=r.length;o<a;o+=1)e(t[r[o]],n,i)}(e,r,o),n=0,i=o.length;n<i;n+=1)t.duplicates.push(r[o[n]]);t.usedDuplicates=new Array(i)}function X(e,t){var n=new T(t=t||{});return n.noRefs||Q(e,n),J(n,0,e,!0,!0)?n.dump+"\n":""}t.exports.dump=X,t.exports.safeDump=function(e,t){return X(e,c.extend({schema:r},t))}},{"./common":2,"./exception":4,"./schema/default_full":9,"./schema/default_safe":10}],4:[function(e,t,n){"use strict";function i(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=(this.reason||"(unknown reason)")+(this.mark?" "+this.mark.toString():""),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}((i.prototype=Object.create(Error.prototype)).constructor=i).prototype.toString=function(e){var t=this.name+": ";return t+=this.reason||"(unknown reason)",!e&&this.mark&&(t+=" "+this.mark.toString()),t},t.exports=i},{}],5:[function(e,t,n){"use strict";var g=e("./common"),i=e("./exception"),r=e("./mark"),o=e("./schema/default_safe"),a=e("./schema/default_full"),y=Object.prototype.hasOwnProperty,x=1,v=2,A=3,b=4,w=1,C=2,k=3,c=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,s=/[\x85\u2028\u2029]/,u=/[,\[\]\{\}]/,l=/^(?:!|!!|![a-z\-]+!)$/i,p=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;function j(e){return 10===e||13===e}function S(e){return 9===e||32===e}function I(e){return 9===e||32===e||10===e||13===e}function E(e){return 44===e||91===e||93===e||123===e||125===e}function f(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e?"\t":9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}for(var O=new Array(256),F=new Array(256),d=0;d<256;d++)O[d]=f(d)?1:0,F[d]=f(d);function h(e,t){return new i(t,new r(e.filename,e.input,e.position,e.line,e.position-e.lineStart))}function _(e,t){throw h(e,t)}function m(e,t){e.onWarning&&e.onWarning.call(null,h(e,t))}var N={YAML:function(e,t,n){var i,r,o;null!==e.version&&_(e,"duplication of %YAML directive"),1!==n.length&&_(e,"YAML directive accepts exactly one argument"),null===(i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&_(e,"ill-formed argument of the YAML directive"),r=parseInt(i[1],10),o=parseInt(i[2],10),1!==r&&_(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,1!==o&&2!==o&&m(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,r;2!==n.length&&_(e,"TAG directive accepts exactly two arguments"),i=n[0],r=n[1],l.test(i)||_(e,"ill-formed tag handle (first argument) of the TAG directive"),y.call(e.tagMap,i)&&_(e,'there is a previously declared suffix for "'+i+'" tag handle'),p.test(r)||_(e,"ill-formed tag prefix (second argument) of the TAG directive"),e.tagMap[i]=r}};function M(e,t,n,i){var r,o,a,s;if(t<n){if(s=e.input.slice(t,n),i)for(r=0,o=s.length;r<o;r+=1)9===(a=s.charCodeAt(r))||32<=a&&a<=1114111||_(e,"expected valid JSON character");else c.test(s)&&_(e,"the stream contains non-printable characters");e.result+=s}}function T(e,t,n,i){var r,o,a,s;for(g.isObject(n)||_(e,"cannot merge mappings; the provided source object is unacceptable"),a=0,s=(r=Object.keys(n)).length;a<s;a+=1)o=r[a],y.call(t,o)||(t[o]=n[o],i[o]=!0)}function L(e,t,n,i,r,o,a,s){var c,u;if(r=String(r),null===t&&(t={}),"tag:yaml.org,2002:merge"===i)if(Array.isArray(o))for(c=0,u=o.length;c<u;c+=1)T(e,t,o[c],n);else T(e,t,o,n);else e.json||y.call(n,r)||!y.call(t,r)||(e.line=a||e.line,e.position=s||e.position,_(e,"duplicated mapping key")),t[r]=o,delete n[r];return t}function D(e){var t;10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):_(e,"a line break is expected"),e.line+=1,e.lineStart=e.position}function U(e,t,n){for(var i=0,r=e.input.charCodeAt(e.position);0!==r;){for(;S(r);)r=e.input.charCodeAt(++e.position);if(t&&35===r)for(;10!==(r=e.input.charCodeAt(++e.position))&&13!==r&&0!==r;);if(!j(r))break;for(D(e),r=e.input.charCodeAt(e.position),i++,e.lineIndent=0;32===r;)e.lineIndent++,r=e.input.charCodeAt(++e.position)}return-1!==n&&0!==i&&e.lineIndent<n&&m(e,"deficient indentation"),i}function q(e){var t,n=e.position;return!(45!==(t=e.input.charCodeAt(n))&&46!==t||t!==e.input.charCodeAt(n+1)||t!==e.input.charCodeAt(n+2)||(n+=3,0!==(t=e.input.charCodeAt(n))&&!I(t)))}function Y(e,t){1===t?e.result+=" ":1<t&&(e.result+=g.repeat("\n",t-1))}function R(e,t){var n,i,r=e.tag,o=e.anchor,a=[],s=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),i=e.input.charCodeAt(e.position);0!==i&&45===i&&I(e.input.charCodeAt(e.position+1));)if(s=!0,e.position++,U(e,!0,-1)&&e.lineIndent<=t)a.push(null),i=e.input.charCodeAt(e.position);else if(n=e.line,B(e,t,A,!1,!0),a.push(e.result),U(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==i)_(e,"bad indentation of a sequence entry");else if(e.lineIndent<t)break;return!!s&&(e.tag=r,e.anchor=o,e.kind="sequence",e.result=a,!0)}function P(e){var t,n,i,r,o=!1,a=!1;if(33!==(r=e.input.charCodeAt(e.position)))return!1;if(null!==e.tag&&_(e,"duplication of a tag property"),60===(r=e.input.charCodeAt(++e.position))?(o=!0,r=e.input.charCodeAt(++e.position)):33===r?(a=!0,n="!!",r=e.input.charCodeAt(++e.position)):n="!",t=e.position,o){for(;0!==(r=e.input.charCodeAt(++e.position))&&62!==r;);e.position<e.length?(i=e.input.slice(t,e.position),r=e.input.charCodeAt(++e.position)):_(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==r&&!I(r);)33===r&&(a?_(e,"tag suffix cannot contain exclamation marks"):(n=e.input.slice(t-1,e.position+1),l.test(n)||_(e,"named tag handle cannot contain such characters"),a=!0,t=e.position+1)),r=e.input.charCodeAt(++e.position);i=e.input.slice(t,e.position),u.test(i)&&_(e,"tag suffix cannot contain flow indicator characters")}return i&&!p.test(i)&&_(e,"tag name cannot contain such characters: "+i),o?e.tag=i:y.call(e.tagMap,n)?e.tag=e.tagMap[n]+i:"!"===n?e.tag="!"+i:"!!"===n?e.tag="tag:yaml.org,2002:"+i:_(e,'undeclared tag handle "'+n+'"'),!0}function W(e){var t,n;if(38!==(n=e.input.charCodeAt(e.position)))return!1;for(null!==e.anchor&&_(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!I(n)&&!E(n);)n=e.input.charCodeAt(++e.position);return e.position===t&&_(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function B(e,t,n,i,r){var o,a,s,c,u,l,p,f,d=1,h=!1,m=!1;if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,o=a=s=b===n||A===n,i&&U(e,!0,-1)&&(h=!0,e.lineIndent>t?d=1:e.lineIndent===t?d=0:e.lineIndent<t&&(d=-1)),1===d)for(;P(e)||W(e);)U(e,!0,-1)?(h=!0,s=o,e.lineIndent>t?d=1:e.lineIndent===t?d=0:e.lineIndent<t&&(d=-1)):s=!1;if(s&&(s=h||r),1!==d&&b!==n||(p=x===n||v===n?t:t+1,f=e.position-e.lineStart,1===d?s&&(R(e,f)||function(e,t,n){var i,r,o,a,s,c=e.tag,u=e.anchor,l={},p={},f=null,d=null,h=null,m=!1,g=!1;for(null!==e.anchor&&(e.anchorMap[e.anchor]=l),s=e.input.charCodeAt(e.position);0!==s;){if(i=e.input.charCodeAt(e.position+1),o=e.line,a=e.position,63!==s&&58!==s||!I(i)){if(!B(e,n,v,!1,!0))break;if(e.line===o){for(s=e.input.charCodeAt(e.position);S(s);)s=e.input.charCodeAt(++e.position);if(58===s)I(s=e.input.charCodeAt(++e.position))||_(e,"a whitespace character is expected after the key-value separator within a block mapping"),m&&(L(e,l,p,f,d,null),f=d=h=null),g=!0,r=m=!1,f=e.tag,d=e.result;else{if(!g)return e.tag=c,e.anchor=u,!0;_(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!g)return e.tag=c,e.anchor=u,!0;_(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===s?(m&&(L(e,l,p,f,d,null),f=d=h=null),r=m=g=!0):m?(m=!1,r=!0):_(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,s=i;if((e.line===o||e.lineIndent>t)&&(B(e,t,b,!0,r)&&(m?d=e.result:h=e.result),m||(L(e,l,p,f,d,h,o,a),f=d=h=null),U(e,!0,-1),s=e.input.charCodeAt(e.position)),e.lineIndent>t&&0!==s)_(e,"bad indentation of a mapping entry");else if(e.lineIndent<t)break}return m&&L(e,l,p,f,d,null),g&&(e.tag=c,e.anchor=u,e.kind="mapping",e.result=l),g}(e,f,p))||function(e,t){var n,i,r,o,a,s,c,u,l,p,f=!0,d=e.tag,h=e.anchor,m={};if(91===(p=e.input.charCodeAt(e.position)))r=93,s=!1,i=[];else{if(123!==p)return!1;r=125,s=!0,i={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=i),p=e.input.charCodeAt(++e.position);0!==p;){if(U(e,!0,t),(p=e.input.charCodeAt(e.position))===r)return e.position++,e.tag=d,e.anchor=h,e.kind=s?"mapping":"sequence",e.result=i,!0;f||_(e,"missed comma between flow collection entries"),l=null,o=a=!1,63===p&&I(e.input.charCodeAt(e.position+1))&&(o=a=!0,e.position++,U(e,!0,t)),n=e.line,B(e,t,x,!1,!0),u=e.tag,c=e.result,U(e,!0,t),p=e.input.charCodeAt(e.position),!a&&e.line!==n||58!==p||(o=!0,p=e.input.charCodeAt(++e.position),U(e,!0,t),B(e,t,x,!1,!0),l=e.result),s?L(e,i,m,u,c,l):o?i.push(L(e,null,m,u,c,l)):i.push(c),U(e,!0,t),44===(p=e.input.charCodeAt(e.position))?(f=!0,p=e.input.charCodeAt(++e.position)):f=!1}_(e,"unexpected end of the stream within a flow collection")}(e,p)?m=!0:(a&&function(e,t){var n,i,r,o,a,s=w,c=!1,u=!1,l=t,p=0,f=!1;if(124===(o=e.input.charCodeAt(e.position)))i=!1;else{if(62!==o)return!1;i=!0}for(e.kind="scalar",e.result="";0!==o;)if(43===(o=e.input.charCodeAt(++e.position))||45===o)w===s?s=43===o?k:C:_(e,"repeat of a chomping mode identifier");else{if(!(0<=(r=48<=(a=o)&&a<=57?a-48:-1)))break;0===r?_(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?_(e,"repeat of an indentation width identifier"):(l=t+r-1,u=!0)}if(S(o)){for(;S(o=e.input.charCodeAt(++e.position)););if(35===o)for(;!j(o=e.input.charCodeAt(++e.position))&&0!==o;);}for(;0!==o;){for(D(e),e.lineIndent=0,o=e.input.charCodeAt(e.position);(!u||e.lineIndent<l)&&32===o;)e.lineIndent++,o=e.input.charCodeAt(++e.position);if(!u&&e.lineIndent>l&&(l=e.lineIndent),j(o))p++;else{if(e.lineIndent<l){s===k?e.result+=g.repeat("\n",c?1+p:p):s===w&&c&&(e.result+="\n");break}for(i?S(o)?(f=!0,e.result+=g.repeat("\n",c?1+p:p)):f?(f=!1,e.result+=g.repeat("\n",p+1)):0===p?c&&(e.result+=" "):e.result+=g.repeat("\n",p):e.result+=g.repeat("\n",c?1+p:p),u=c=!0,p=0,n=e.position;!j(o)&&0!==o;)o=e.input.charCodeAt(++e.position);M(e,n,e.position,!1)}}return!0}(e,p)||function(e,t){var n,i,r;if(39!==(n=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,i=r=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(M(e,i,e.position,!0),39!==(n=e.input.charCodeAt(++e.position)))return!0;i=e.position,e.position++,r=e.position}else j(n)?(M(e,i,r,!0),Y(e,U(e,!1,t)),i=r=e.position):e.position===e.lineStart&&q(e)?_(e,"unexpected end of the document within a single quoted scalar"):(e.position++,r=e.position);_(e,"unexpected end of the stream within a single quoted scalar")}(e,p)||function(e,t){var n,i,r,o,a,s,c,u,l,p;if(34!==(s=e.input.charCodeAt(e.position)))return!1;for(e.kind="scalar",e.result="",e.position++,n=i=e.position;0!==(s=e.input.charCodeAt(e.position));){if(34===s)return M(e,n,e.position,!0),e.position++,!0;if(92===s){if(M(e,n,e.position,!0),j(s=e.input.charCodeAt(++e.position)))U(e,!1,t);else if(s<256&&O[s])e.result+=F[s],e.position++;else if(0<(a=120===(p=s)?2:117===p?4:85===p?8:0)){for(r=a,o=0;0<r;r--)s=e.input.charCodeAt(++e.position),l=void 0,0<=(a=48<=(u=s)&&u<=57?u-48:97<=(l=32|u)&&l<=102?l-97+10:-1)?o=(o<<4)+a:_(e,"expected hexadecimal character");e.result+=(c=o)<=65535?String.fromCharCode(c):String.fromCharCode(55296+(c-65536>>10),56320+(c-65536&1023)),e.position++}else _(e,"unknown escape sequence");n=i=e.position}else j(s)?(M(e,n,i,!0),Y(e,U(e,!1,t)),n=i=e.position):e.position===e.lineStart&&q(e)?_(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}_(e,"unexpected end of the stream within a double quoted scalar")}(e,p)?m=!0:!function(e){var t,n,i;if(42!==(i=e.input.charCodeAt(e.position)))return!1;for(i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!I(i)&&!E(i);)i=e.input.charCodeAt(++e.position);return e.position===t&&_(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),e.anchorMap.hasOwnProperty(n)||_(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],U(e,!0,-1),!0}(e)?function(e,t,n){var i,r,o,a,s,c,u,l,p=e.kind,f=e.result;if(I(l=e.input.charCodeAt(e.position))||E(l)||35===l||38===l||42===l||33===l||124===l||62===l||39===l||34===l||37===l||64===l||96===l)return!1;if((63===l||45===l)&&(I(i=e.input.charCodeAt(e.position+1))||n&&E(i)))return!1;for(e.kind="scalar",e.result="",r=o=e.position,a=!1;0!==l;){if(58===l){if(I(i=e.input.charCodeAt(e.position+1))||n&&E(i))break}else if(35===l){if(I(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&q(e)||n&&E(l))break;if(j(l)){if(s=e.line,c=e.lineStart,u=e.lineIndent,U(e,!1,-1),e.lineIndent>=t){a=!0,l=e.input.charCodeAt(e.position);continue}e.position=o,e.line=s,e.lineStart=c,e.lineIndent=u;break}}a&&(M(e,r,o,!1),Y(e,e.line-s),r=o=e.position,a=!1),S(l)||(o=e.position+1),l=e.input.charCodeAt(++e.position)}return M(e,r,o,!1),!!e.result||(e.kind=p,e.result=f,!1)}(e,p,x===n)&&(m=!0,null===e.tag&&(e.tag="?")):(m=!0,null===e.tag&&null===e.anchor||_(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===d&&(m=s&&R(e,f))),null!==e.tag&&"!"!==e.tag)if("?"===e.tag){for(c=0,u=e.implicitTypes.length;c<u;c+=1)if((l=e.implicitTypes[c]).resolve(e.result)){e.result=l.construct(e.result),e.tag=l.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result);break}}else y.call(e.typeMap[e.kind||"fallback"],e.tag)?(l=e.typeMap[e.kind||"fallback"][e.tag],null!==e.result&&l.kind!==e.kind&&_(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+l.kind+'", not "'+e.kind+'"'),l.resolve(e.result)?(e.result=l.construct(e.result),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):_(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")):_(e,"unknown tag !<"+e.tag+">");return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||m}function K(e){var t,n,i,r,o=e.position,a=!1;for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap={},e.anchorMap={};0!==(r=e.input.charCodeAt(e.position))&&(U(e,!0,-1),r=e.input.charCodeAt(e.position),!(0<e.lineIndent||37!==r));){for(a=!0,r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!I(r);)r=e.input.charCodeAt(++e.position);for(i=[],(n=e.input.slice(t,e.position)).length<1&&_(e,"directive name must not be less than one character in length");0!==r;){for(;S(r);)r=e.input.charCodeAt(++e.position);if(35===r){for(;0!==(r=e.input.charCodeAt(++e.position))&&!j(r););break}if(j(r))break;for(t=e.position;0!==r&&!I(r);)r=e.input.charCodeAt(++e.position);i.push(e.input.slice(t,e.position))}0!==r&&D(e),y.call(N,n)?N[n](e,n,i):m(e,'unknown document directive "'+n+'"')}U(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,U(e,!0,-1)):a&&_(e,"directives end mark is expected"),B(e,e.lineIndent-1,b,!1,!0),U(e,!0,-1),e.checkLineBreaks&&s.test(e.input.slice(o,e.position))&&m(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&q(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,U(e,!0,-1)):e.position<e.length-1&&_(e,"end of the stream or a document separator is expected")}function $(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)));var n=new function(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||a,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.documents=[]}(e,t);for(n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1;for(;n.position<n.length-1;)K(n);return n.documents}function H(e,t,n){var i,r,o=$(e,n);if("function"!=typeof t)return o;for(i=0,r=o.length;i<r;i+=1)t(o[i])}function G(e,t){var n=$(e,t);if(0!==n.length){if(1===n.length)return n[0];throw new i("expected a single document in the stream, but found more")}}t.exports.loadAll=H,t.exports.load=G,t.exports.safeLoadAll=function(e,t,n){if("function"!=typeof t)return H(e,g.extend({schema:o},n));H(e,t,g.extend({schema:o},n))},t.exports.safeLoad=function(e,t){return G(e,g.extend({schema:o},t))}},{"./common":2,"./exception":4,"./mark":6,"./schema/default_full":9,"./schema/default_safe":10}],6:[function(e,t,n){"use strict";var s=e("./common");function i(e,t,n,i,r){this.name=e,this.buffer=t,this.position=n,this.line=i,this.column=r}i.prototype.getSnippet=function(e,t){var n,i,r,o,a;if(!this.buffer)return null;for(e=e||4,t=t||75,n="",i=this.position;0<i&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(i-1));)if(i-=1,this.position-i>t/2-1){n=" ... ",i+=5;break}for(r="",o=this.position;o<this.buffer.length&&-1==="\0\r\n…\u2028\u2029".indexOf(this.buffer.charAt(o));)if((o+=1)-this.position>t/2-1){r=" ... ",o-=5;break}return a=this.buffer.slice(i,o),s.repeat(" ",e)+n+a+r+"\n"+s.repeat(" ",e+this.position-i+n.length)+"^"},i.prototype.toString=function(e){var t,n="";return this.name&&(n+='in "'+this.name+'" '),n+="at line "+(this.line+1)+", column "+(this.column+1),e||(t=this.getSnippet())&&(n+=":\n"+t),n},t.exports=i},{"./common":2}],7:[function(e,t,n){"use strict";var i=e("./common"),r=e("./exception"),o=e("./type");function a(e,t,i){var r=[];return e.include.forEach(function(e){i=a(e,t,i)}),e[t].forEach(function(n){i.forEach(function(e,t){e.tag===n.tag&&e.kind===n.kind&&r.push(t)}),i.push(n)}),i.filter(function(e,t){return-1===r.indexOf(t)})}function s(e){this.include=e.include||[],this.implicit=e.implicit||[],this.explicit=e.explicit||[],this.implicit.forEach(function(e){if(e.loadKind&&"scalar"!==e.loadKind)throw new r("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")}),this.compiledImplicit=a(this,"implicit",[]),this.compiledExplicit=a(this,"explicit",[]),this.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{}};function i(e){n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(i);return n}(this.compiledImplicit,this.compiledExplicit)}s.DEFAULT=null,s.create=function(){var e,t;switch(arguments.length){case 1:e=s.DEFAULT,t=arguments[0];break;case 2:e=arguments[0],t=arguments[1];break;default:throw new r("Wrong number of arguments for Schema.create function")}if(e=i.toArray(e),t=i.toArray(t),!e.every(function(e){return e instanceof s}))throw new r("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");if(!t.every(function(e){return e instanceof o}))throw new r("Specified list of YAML types (or a single Type object) contains a non-Type object.");return new s({include:e,explicit:t})},t.exports=s},{"./common":2,"./exception":4,"./type":13}],8:[function(e,t,n){"use strict";var i=e("../schema");t.exports=new i({include:[e("./json")]})},{"../schema":7,"./json":12}],9:[function(e,t,n){"use strict";var i=e("../schema");t.exports=i.DEFAULT=new i({include:[e("./default_safe")],explicit:[e("../type/js/undefined"),e("../type/js/regexp"),e("../type/js/function")]})},{"../schema":7,"../type/js/function":18,"../type/js/regexp":19,"../type/js/undefined":20,"./default_safe":10}],10:[function(e,t,n){"use strict";var i=e("../schema");t.exports=new i({include:[e("./core")],implicit:[e("../type/timestamp"),e("../type/merge")],explicit:[e("../type/binary"),e("../type/omap"),e("../type/pairs"),e("../type/set")]})},{"../schema":7,"../type/binary":14,"../type/merge":22,"../type/omap":24,"../type/pairs":25,"../type/set":27,"../type/timestamp":29,"./core":8}],11:[function(e,t,n){"use strict";var i=e("../schema");t.exports=new i({explicit:[e("../type/str"),e("../type/seq"),e("../type/map")]})},{"../schema":7,"../type/map":21,"../type/seq":26,"../type/str":28}],12:[function(e,t,n){"use strict";var i=e("../schema");t.exports=new i({include:[e("./failsafe")],implicit:[e("../type/null"),e("../type/bool"),e("../type/int"),e("../type/float")]})},{"../schema":7,"../type/bool":15,"../type/float":16,"../type/int":17,"../type/null":23,"./failsafe":11}],13:[function(e,t,n){"use strict";var r=e("./exception"),o=["kind","resolve","construct","instanceOf","predicate","represent","defaultStyle","styleAliases"],a=["scalar","sequence","mapping"];t.exports=function(t,e){var n,i;if(e=e||{},Object.keys(e).forEach(function(e){if(-1===o.indexOf(e))throw new r('Unknown option "'+e+'" is met in definition of "'+t+'" YAML type.')}),this.tag=t,this.kind=e.kind||null,this.resolve=e.resolve||function(){return!0},this.construct=e.construct||function(e){return e},this.instanceOf=e.instanceOf||null,this.predicate=e.predicate||null,this.represent=e.represent||null,this.defaultStyle=e.defaultStyle||null,this.styleAliases=(n=e.styleAliases||null,i={},null!==n&&Object.keys(n).forEach(function(t){n[t].forEach(function(e){i[String(e)]=t})}),i),-1===a.indexOf(this.kind))throw new r('Unknown kind "'+this.kind+'" is specified for "'+t+'" YAML type.')}},{"./exception":4}],14:[function(e,t,n){"use strict";var c;try{c=e("buffer").Buffer}catch(e){}var i=e("../type"),u="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r";t.exports=new i("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i=0,r=e.length,o=u;for(n=0;n<r;n++)if(!(64<(t=o.indexOf(e.charAt(n))))){if(t<0)return!1;i+=6}return i%8==0},construct:function(e){var t,n,i=e.replace(/[\r\n=]/g,""),r=i.length,o=u,a=0,s=[];for(t=0;t<r;t++)t%4==0&&t&&(s.push(a>>16&255),s.push(a>>8&255),s.push(255&a)),a=a<<6|o.indexOf(i.charAt(t));return 0==(n=r%4*6)?(s.push(a>>16&255),s.push(a>>8&255),s.push(255&a)):18===n?(s.push(a>>10&255),s.push(a>>2&255)):12===n&&s.push(a>>4&255),c?c.from?c.from(s):new c(s):s},predicate:function(e){return c&&c.isBuffer(e)},represent:function(e){var t,n,i="",r=0,o=e.length,a=u;for(t=0;t<o;t++)t%3==0&&t&&(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]),r=(r<<8)+e[t];return 0==(n=o%3)?(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]):2===n?(i+=a[r>>10&63],i+=a[r>>4&63],i+=a[r<<2&63],i+=a[64]):1===n&&(i+=a[r>>2&63],i+=a[r<<4&63],i+=a[64],i+=a[64]),i}})},{"../type":13}],15:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t=e.length;return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})},{"../type":13}],16:[function(e,t,n){"use strict";var i=e("../common"),r=e("../type"),o=new RegExp("^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$");var a=/^[-+]?[0-9]+e/;t.exports=new r("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!o.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n,i,r;return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,r=[],0<="+-".indexOf(t[0])&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:0<=t.indexOf(":")?(t.split(":").forEach(function(e){r.unshift(parseFloat(e,10))}),t=0,i=1,r.forEach(function(e){t+=e*i,i*=60}),n*t):n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||i.isNegativeZero(e))},represent:function(e,t){var n;if(isNaN(e))switch(t){case"lowercase":return".nan";case"uppercase":return".NAN";case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf";case"uppercase":return".INF";case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf";case"uppercase":return"-.INF";case"camelcase":return"-.Inf"}else if(i.isNegativeZero(e))return"-0.0";return n=e.toString(10),a.test(n)?n.replace("e",".e"):n},defaultStyle:"lowercase"})},{"../common":2,"../type":13}],17:[function(e,t,n){"use strict";var i=e("../common"),r=e("../type");t.exports=new r("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1;var t,n,i,r,o=e.length,a=0,s=!1;if(!o)return!1;if("-"!==(t=e[a])&&"+"!==t||(t=e[++a]),"0"===t){if(a+1===o)return!0;if("b"===(t=e[++a])){for(a++;a<o;a++)if("_"!==(t=e[a])){if("0"!==t&&"1"!==t)return!1;s=!0}return s&&"_"!==t}if("x"===t){for(a++;a<o;a++)if("_"!==(t=e[a])){if(!(48<=(i=e.charCodeAt(a))&&i<=57||65<=i&&i<=70||97<=i&&i<=102))return!1;s=!0}return s&&"_"!==t}for(;a<o;a++)if("_"!==(t=e[a])){if(!(48<=(n=e.charCodeAt(a))&&n<=55))return!1;s=!0}return s&&"_"!==t}if("_"===t)return!1;for(;a<o;a++)if("_"!==(t=e[a])){if(":"===t)break;if(!(48<=(r=e.charCodeAt(a))&&r<=57))return!1;s=!0}return!(!s||"_"===t)&&(":"!==t||/^(:[0-5]?[0-9])+$/.test(e.slice(a)))},construct:function(e){var t,n,i=e,r=1,o=[];return-1!==i.indexOf("_")&&(i=i.replace(/_/g,"")),"-"!==(t=i[0])&&"+"!==t||("-"===t&&(r=-1),t=(i=i.slice(1))[0]),"0"===i?0:"0"===t?"b"===i[1]?r*parseInt(i.slice(2),2):"x"===i[1]?r*parseInt(i,16):r*parseInt(i,8):-1!==i.indexOf(":")?(i.split(":").forEach(function(e){o.unshift(parseInt(e,10))}),i=0,n=1,o.forEach(function(e){i+=e*n,n*=60}),r*i):r*parseInt(i,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1==0&&!i.isNegativeZero(e)},represent:{binary:function(e){return 0<=e?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return 0<=e?"0"+e.toString(8):"-0"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return 0<=e?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}})},{"../common":2,"../type":13}],18:[function(e,t,n){"use strict";var o;try{o=e("esprima")}catch(e){"undefined"!=typeof window&&(o=window.esprima)}var i=e("../../type");t.exports=new i("tag:yaml.org,2002:js/function",{kind:"scalar",resolve:function(e){if(null===e)return!1;try{var t="("+e+")",n=o.parse(t,{range:!0});return"Program"===n.type&&1===n.body.length&&"ExpressionStatement"===n.body[0].type&&("ArrowFunctionExpression"===n.body[0].expression.type||"FunctionExpression"===n.body[0].expression.type)}catch(e){return!1}},construct:function(e){var t,n="("+e+")",i=o.parse(n,{range:!0}),r=[];if("Program"!==i.type||1!==i.body.length||"ExpressionStatement"!==i.body[0].type||"ArrowFunctionExpression"!==i.body[0].expression.type&&"FunctionExpression"!==i.body[0].expression.type)throw new Error("Failed to resolve function");return i.body[0].expression.params.forEach(function(e){r.push(e.name)}),t=i.body[0].expression.body.range,new Function(r,n.slice(t[0]+1,t[1]-1))},predicate:function(e){return"[object Function]"===Object.prototype.toString.call(e)},represent:function(e){return e.toString()}})},{"../../type":13}],19:[function(e,t,n){"use strict";var i=e("../../type");t.exports=new i("tag:yaml.org,2002:js/regexp",{kind:"scalar",resolve:function(e){if(null===e)return!1;if(0===e.length)return!1;var t=e,n=/\/([gim]*)$/.exec(e),i="";if("/"===t[0]){if(n&&(i=n[1]),3<i.length)return!1;if("/"!==t[t.length-i.length-1])return!1}return!0},construct:function(e){var t=e,n=/\/([gim]*)$/.exec(e),i="";return"/"===t[0]&&(n&&(i=n[1]),t=t.slice(1,t.length-i.length-1)),new RegExp(t,i)},predicate:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},represent:function(e){var t="/"+e.source+"/";return e.global&&(t+="g"),e.multiline&&(t+="m"),e.ignoreCase&&(t+="i"),t}})},{"../../type":13}],20:[function(e,t,n){"use strict";var i=e("../../type");t.exports=new i("tag:yaml.org,2002:js/undefined",{kind:"scalar",resolve:function(){return!0},construct:function(){},predicate:function(e){return void 0===e},represent:function(){return""}})},{"../../type":13}],21:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})},{"../type":13}],22:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}})},{"../type":13}],23:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0;var t=e.length;return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"}},defaultStyle:"lowercase"})},{"../type":13}],24:[function(e,t,n){"use strict";var i=e("../type"),c=Object.prototype.hasOwnProperty,u=Object.prototype.toString;t.exports=new i("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,r,o,a=[],s=e;for(t=0,n=s.length;t<n;t+=1){if(i=s[t],o=!1,"[object Object]"!==u.call(i))return!1;for(r in i)if(c.call(i,r)){if(o)return!1;o=!0}if(!o)return!1;if(-1!==a.indexOf(r))return!1;a.push(r)}return!0},construct:function(e){return null!==e?e:[]}})},{"../type":13}],25:[function(e,t,n){"use strict";var i=e("../type"),s=Object.prototype.toString;t.exports=new i("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0;var t,n,i,r,o,a=e;for(o=new Array(a.length),t=0,n=a.length;t<n;t+=1){if(i=a[t],"[object Object]"!==s.call(i))return!1;if(1!==(r=Object.keys(i)).length)return!1;o[t]=[r[0],i[r[0]]]}return!0},construct:function(e){if(null===e)return[];var t,n,i,r,o,a=e;for(o=new Array(a.length),t=0,n=a.length;t<n;t+=1)i=a[t],r=Object.keys(i),o[t]=[r[0],i[r[0]]];return o}})},{"../type":13}],26:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}})},{"../type":13}],27:[function(e,t,n){"use strict";var i=e("../type"),r=Object.prototype.hasOwnProperty;t.exports=new i("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0;var t,n=e;for(t in n)if(r.call(n,t)&&null!==n[t])return!1;return!0},construct:function(e){return null!==e?e:{}}})},{"../type":13}],28:[function(e,t,n){"use strict";var i=e("../type");t.exports=new i("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}})},{"../type":13}],29:[function(e,t,n){"use strict";var i=e("../type"),p=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),f=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$");t.exports=new i("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==p.exec(e)||null!==f.exec(e))},construct:function(e){var t,n,i,r,o,a,s,c,u=0,l=null;if(null===(t=p.exec(e))&&(t=f.exec(e)),null===t)throw new Error("Date resolve error");if(n=+t[1],i=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,i,r));if(o=+t[4],a=+t[5],s=+t[6],t[7]){for(u=t[7].slice(0,3);u.length<3;)u+="0";u=+u}return t[9]&&(l=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(l=-l)),c=new Date(Date.UTC(n,i,r,o,a,s,u)),l&&c.setTime(c.getTime()-l),c},instanceOf:Date,represent:function(e){return e.toISOString()}})},{"../type":13}],"/":[function(e,t,n){"use strict";var i=e("./lib/js-yaml.js");t.exports=i},{"./lib/js-yaml.js":1}]},{},[])("/")});
diff --git a/tools/doc/node_modules/js-yaml/index.js b/tools/doc/node_modules/js-yaml/index.js
new file mode 100644
index 0000000000..1374435244
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/index.js
@@ -0,0 +1,7 @@
+'use strict';
+
+
+var yaml = require('./lib/js-yaml.js');
+
+
+module.exports = yaml;
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml.js b/tools/doc/node_modules/js-yaml/lib/js-yaml.js
new file mode 100644
index 0000000000..f0e92818e9
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml.js
@@ -0,0 +1,39 @@
+'use strict';
+
+
+var loader = require('./js-yaml/loader');
+var dumper = require('./js-yaml/dumper');
+
+
+function deprecated(name) {
+ return function () {
+ throw new Error('Function ' + name + ' is deprecated and cannot be used.');
+ };
+}
+
+
+module.exports.Type = require('./js-yaml/type');
+module.exports.Schema = require('./js-yaml/schema');
+module.exports.FAILSAFE_SCHEMA = require('./js-yaml/schema/failsafe');
+module.exports.JSON_SCHEMA = require('./js-yaml/schema/json');
+module.exports.CORE_SCHEMA = require('./js-yaml/schema/core');
+module.exports.DEFAULT_SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
+module.exports.DEFAULT_FULL_SCHEMA = require('./js-yaml/schema/default_full');
+module.exports.load = loader.load;
+module.exports.loadAll = loader.loadAll;
+module.exports.safeLoad = loader.safeLoad;
+module.exports.safeLoadAll = loader.safeLoadAll;
+module.exports.dump = dumper.dump;
+module.exports.safeDump = dumper.safeDump;
+module.exports.YAMLException = require('./js-yaml/exception');
+
+// Deprecated schema names from JS-YAML 2.0.x
+module.exports.MINIMAL_SCHEMA = require('./js-yaml/schema/failsafe');
+module.exports.SAFE_SCHEMA = require('./js-yaml/schema/default_safe');
+module.exports.DEFAULT_SCHEMA = require('./js-yaml/schema/default_full');
+
+// Deprecated functions from JS-YAML 1.x.x
+module.exports.scan = deprecated('scan');
+module.exports.parse = deprecated('parse');
+module.exports.compose = deprecated('compose');
+module.exports.addConstructor = deprecated('addConstructor');
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/common.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/common.js
new file mode 100644
index 0000000000..25ef7d8e4a
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/common.js
@@ -0,0 +1,59 @@
+'use strict';
+
+
+function isNothing(subject) {
+ return (typeof subject === 'undefined') || (subject === null);
+}
+
+
+function isObject(subject) {
+ return (typeof subject === 'object') && (subject !== null);
+}
+
+
+function toArray(sequence) {
+ if (Array.isArray(sequence)) return sequence;
+ else if (isNothing(sequence)) return [];
+
+ return [ sequence ];
+}
+
+
+function extend(target, source) {
+ var index, length, key, sourceKeys;
+
+ if (source) {
+ sourceKeys = Object.keys(source);
+
+ for (index = 0, length = sourceKeys.length; index < length; index += 1) {
+ key = sourceKeys[index];
+ target[key] = source[key];
+ }
+ }
+
+ return target;
+}
+
+
+function repeat(string, count) {
+ var result = '', cycle;
+
+ for (cycle = 0; cycle < count; cycle += 1) {
+ result += string;
+ }
+
+ return result;
+}
+
+
+function isNegativeZero(number) {
+ return (number === 0) && (Number.NEGATIVE_INFINITY === 1 / number);
+}
+
+
+module.exports.isNothing = isNothing;
+module.exports.isObject = isObject;
+module.exports.toArray = toArray;
+module.exports.repeat = repeat;
+module.exports.isNegativeZero = isNegativeZero;
+module.exports.extend = extend;
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/dumper.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/dumper.js
new file mode 100644
index 0000000000..025b18552d
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/dumper.js
@@ -0,0 +1,819 @@
+'use strict';
+
+/*eslint-disable no-use-before-define*/
+
+var common = require('./common');
+var YAMLException = require('./exception');
+var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
+var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
+
+var _toString = Object.prototype.toString;
+var _hasOwnProperty = Object.prototype.hasOwnProperty;
+
+var CHAR_TAB = 0x09; /* Tab */
+var CHAR_LINE_FEED = 0x0A; /* LF */
+var CHAR_SPACE = 0x20; /* Space */
+var CHAR_EXCLAMATION = 0x21; /* ! */
+var CHAR_DOUBLE_QUOTE = 0x22; /* " */
+var CHAR_SHARP = 0x23; /* # */
+var CHAR_PERCENT = 0x25; /* % */
+var CHAR_AMPERSAND = 0x26; /* & */
+var CHAR_SINGLE_QUOTE = 0x27; /* ' */
+var CHAR_ASTERISK = 0x2A; /* * */
+var CHAR_COMMA = 0x2C; /* , */
+var CHAR_MINUS = 0x2D; /* - */
+var CHAR_COLON = 0x3A; /* : */
+var CHAR_GREATER_THAN = 0x3E; /* > */
+var CHAR_QUESTION = 0x3F; /* ? */
+var CHAR_COMMERCIAL_AT = 0x40; /* @ */
+var CHAR_LEFT_SQUARE_BRACKET = 0x5B; /* [ */
+var CHAR_RIGHT_SQUARE_BRACKET = 0x5D; /* ] */
+var CHAR_GRAVE_ACCENT = 0x60; /* ` */
+var CHAR_LEFT_CURLY_BRACKET = 0x7B; /* { */
+var CHAR_VERTICAL_LINE = 0x7C; /* | */
+var CHAR_RIGHT_CURLY_BRACKET = 0x7D; /* } */
+
+var ESCAPE_SEQUENCES = {};
+
+ESCAPE_SEQUENCES[0x00] = '\\0';
+ESCAPE_SEQUENCES[0x07] = '\\a';
+ESCAPE_SEQUENCES[0x08] = '\\b';
+ESCAPE_SEQUENCES[0x09] = '\\t';
+ESCAPE_SEQUENCES[0x0A] = '\\n';
+ESCAPE_SEQUENCES[0x0B] = '\\v';
+ESCAPE_SEQUENCES[0x0C] = '\\f';
+ESCAPE_SEQUENCES[0x0D] = '\\r';
+ESCAPE_SEQUENCES[0x1B] = '\\e';
+ESCAPE_SEQUENCES[0x22] = '\\"';
+ESCAPE_SEQUENCES[0x5C] = '\\\\';
+ESCAPE_SEQUENCES[0x85] = '\\N';
+ESCAPE_SEQUENCES[0xA0] = '\\_';
+ESCAPE_SEQUENCES[0x2028] = '\\L';
+ESCAPE_SEQUENCES[0x2029] = '\\P';
+
+var DEPRECATED_BOOLEANS_SYNTAX = [
+ 'y', 'Y', 'yes', 'Yes', 'YES', 'on', 'On', 'ON',
+ 'n', 'N', 'no', 'No', 'NO', 'off', 'Off', 'OFF'
+];
+
+function compileStyleMap(schema, map) {
+ var result, keys, index, length, tag, style, type;
+
+ if (map === null) return {};
+
+ result = {};
+ keys = Object.keys(map);
+
+ for (index = 0, length = keys.length; index < length; index += 1) {
+ tag = keys[index];
+ style = String(map[tag]);
+
+ if (tag.slice(0, 2) === '!!') {
+ tag = 'tag:yaml.org,2002:' + tag.slice(2);
+ }
+ type = schema.compiledTypeMap['fallback'][tag];
+
+ if (type && _hasOwnProperty.call(type.styleAliases, style)) {
+ style = type.styleAliases[style];
+ }
+
+ result[tag] = style;
+ }
+
+ return result;
+}
+
+function encodeHex(character) {
+ var string, handle, length;
+
+ string = character.toString(16).toUpperCase();
+
+ if (character <= 0xFF) {
+ handle = 'x';
+ length = 2;
+ } else if (character <= 0xFFFF) {
+ handle = 'u';
+ length = 4;
+ } else if (character <= 0xFFFFFFFF) {
+ handle = 'U';
+ length = 8;
+ } else {
+ throw new YAMLException('code point within a string may not be greater than 0xFFFFFFFF');
+ }
+
+ return '\\' + handle + common.repeat('0', length - string.length) + string;
+}
+
+function State(options) {
+ this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
+ this.indent = Math.max(1, (options['indent'] || 2));
+ this.skipInvalid = options['skipInvalid'] || false;
+ this.flowLevel = (common.isNothing(options['flowLevel']) ? -1 : options['flowLevel']);
+ this.styleMap = compileStyleMap(this.schema, options['styles'] || null);
+ this.sortKeys = options['sortKeys'] || false;
+ this.lineWidth = options['lineWidth'] || 80;
+ this.noRefs = options['noRefs'] || false;
+ this.noCompatMode = options['noCompatMode'] || false;
+ this.condenseFlow = options['condenseFlow'] || false;
+
+ this.implicitTypes = this.schema.compiledImplicit;
+ this.explicitTypes = this.schema.compiledExplicit;
+
+ this.tag = null;
+ this.result = '';
+
+ this.duplicates = [];
+ this.usedDuplicates = null;
+}
+
+// Indents every line in a string. Empty lines (\n only) are not indented.
+function indentString(string, spaces) {
+ var ind = common.repeat(' ', spaces),
+ position = 0,
+ next = -1,
+ result = '',
+ line,
+ length = string.length;
+
+ while (position < length) {
+ next = string.indexOf('\n', position);
+ if (next === -1) {
+ line = string.slice(position);
+ position = length;
+ } else {
+ line = string.slice(position, next + 1);
+ position = next + 1;
+ }
+
+ if (line.length && line !== '\n') result += ind;
+
+ result += line;
+ }
+
+ return result;
+}
+
+function generateNextLine(state, level) {
+ return '\n' + common.repeat(' ', state.indent * level);
+}
+
+function testImplicitResolving(state, str) {
+ var index, length, type;
+
+ for (index = 0, length = state.implicitTypes.length; index < length; index += 1) {
+ type = state.implicitTypes[index];
+
+ if (type.resolve(str)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// [33] s-white ::= s-space | s-tab
+function isWhitespace(c) {
+ return c === CHAR_SPACE || c === CHAR_TAB;
+}
+
+// Returns true if the character can be printed without escaping.
+// From YAML 1.2: "any allowed characters known to be non-printable
+// should also be escaped. [However,] This isn’t mandatory"
+// Derived from nb-char - \t - #x85 - #xA0 - #x2028 - #x2029.
+function isPrintable(c) {
+ return (0x00020 <= c && c <= 0x00007E)
+ || ((0x000A1 <= c && c <= 0x00D7FF) && c !== 0x2028 && c !== 0x2029)
+ || ((0x0E000 <= c && c <= 0x00FFFD) && c !== 0xFEFF /* BOM */)
+ || (0x10000 <= c && c <= 0x10FFFF);
+}
+
+// Simplified test for values allowed after the first character in plain style.
+function isPlainSafe(c) {
+ // Uses a subset of nb-char - c-flow-indicator - ":" - "#"
+ // where nb-char ::= c-printable - b-char - c-byte-order-mark.
+ return isPrintable(c) && c !== 0xFEFF
+ // - c-flow-indicator
+ && c !== CHAR_COMMA
+ && c !== CHAR_LEFT_SQUARE_BRACKET
+ && c !== CHAR_RIGHT_SQUARE_BRACKET
+ && c !== CHAR_LEFT_CURLY_BRACKET
+ && c !== CHAR_RIGHT_CURLY_BRACKET
+ // - ":" - "#"
+ && c !== CHAR_COLON
+ && c !== CHAR_SHARP;
+}
+
+// Simplified test for values allowed as the first character in plain style.
+function isPlainSafeFirst(c) {
+ // Uses a subset of ns-char - c-indicator
+ // where ns-char = nb-char - s-white.
+ return isPrintable(c) && c !== 0xFEFF
+ && !isWhitespace(c) // - s-white
+ // - (c-indicator ::=
+ // “-” | “?” | “:” | “,” | “[” | “]” | “{” | “}”
+ && c !== CHAR_MINUS
+ && c !== CHAR_QUESTION
+ && c !== CHAR_COLON
+ && c !== CHAR_COMMA
+ && c !== CHAR_LEFT_SQUARE_BRACKET
+ && c !== CHAR_RIGHT_SQUARE_BRACKET
+ && c !== CHAR_LEFT_CURLY_BRACKET
+ && c !== CHAR_RIGHT_CURLY_BRACKET
+ // | “#” | “&” | “*” | “!” | “|” | “>” | “'” | “"”
+ && c !== CHAR_SHARP
+ && c !== CHAR_AMPERSAND
+ && c !== CHAR_ASTERISK
+ && c !== CHAR_EXCLAMATION
+ && c !== CHAR_VERTICAL_LINE
+ && c !== CHAR_GREATER_THAN
+ && c !== CHAR_SINGLE_QUOTE
+ && c !== CHAR_DOUBLE_QUOTE
+ // | “%” | “@” | “`”)
+ && c !== CHAR_PERCENT
+ && c !== CHAR_COMMERCIAL_AT
+ && c !== CHAR_GRAVE_ACCENT;
+}
+
+var STYLE_PLAIN = 1,
+ STYLE_SINGLE = 2,
+ STYLE_LITERAL = 3,
+ STYLE_FOLDED = 4,
+ STYLE_DOUBLE = 5;
+
+// Determines which scalar styles are possible and returns the preferred style.
+// lineWidth = -1 => no limit.
+// Pre-conditions: str.length > 0.
+// Post-conditions:
+// STYLE_PLAIN or STYLE_SINGLE => no \n are in the string.
+// STYLE_LITERAL => no lines are suitable for folding (or lineWidth is -1).
+// STYLE_FOLDED => a line > lineWidth and can be folded (and lineWidth != -1).
+function chooseScalarStyle(string, singleLineOnly, indentPerLevel, lineWidth, testAmbiguousType) {
+ var i;
+ var char;
+ var hasLineBreak = false;
+ var hasFoldableLine = false; // only checked if shouldTrackWidth
+ var shouldTrackWidth = lineWidth !== -1;
+ var previousLineBreak = -1; // count the first line correctly
+ var plain = isPlainSafeFirst(string.charCodeAt(0))
+ && !isWhitespace(string.charCodeAt(string.length - 1));
+
+ if (singleLineOnly) {
+ // Case: no block styles.
+ // Check for disallowed characters to rule out plain and single.
+ for (i = 0; i < string.length; i++) {
+ char = string.charCodeAt(i);
+ if (!isPrintable(char)) {
+ return STYLE_DOUBLE;
+ }
+ plain = plain && isPlainSafe(char);
+ }
+ } else {
+ // Case: block styles permitted.
+ for (i = 0; i < string.length; i++) {
+ char = string.charCodeAt(i);
+ if (char === CHAR_LINE_FEED) {
+ hasLineBreak = true;
+ // Check if any line can be folded.
+ if (shouldTrackWidth) {
+ hasFoldableLine = hasFoldableLine ||
+ // Foldable line = too long, and not more-indented.
+ (i - previousLineBreak - 1 > lineWidth &&
+ string[previousLineBreak + 1] !== ' ');
+ previousLineBreak = i;
+ }
+ } else if (!isPrintable(char)) {
+ return STYLE_DOUBLE;
+ }
+ plain = plain && isPlainSafe(char);
+ }
+ // in case the end is missing a \n
+ hasFoldableLine = hasFoldableLine || (shouldTrackWidth &&
+ (i - previousLineBreak - 1 > lineWidth &&
+ string[previousLineBreak + 1] !== ' '));
+ }
+ // Although every style can represent \n without escaping, prefer block styles
+ // for multiline, since they're more readable and they don't add empty lines.
+ // Also prefer folding a super-long line.
+ if (!hasLineBreak && !hasFoldableLine) {
+ // Strings interpretable as another type have to be quoted;
+ // e.g. the string 'true' vs. the boolean true.
+ return plain && !testAmbiguousType(string)
+ ? STYLE_PLAIN : STYLE_SINGLE;
+ }
+ // Edge case: block indentation indicator can only have one digit.
+ if (string[0] === ' ' && indentPerLevel > 9) {
+ return STYLE_DOUBLE;
+ }
+ // At this point we know block styles are valid.
+ // Prefer literal style unless we want to fold.
+ return hasFoldableLine ? STYLE_FOLDED : STYLE_LITERAL;
+}
+
+// Note: line breaking/folding is implemented for only the folded style.
+// NB. We drop the last trailing newline (if any) of a returned block scalar
+// since the dumper adds its own newline. This always works:
+// • No ending newline => unaffected; already using strip "-" chomping.
+// • Ending newline => removed then restored.
+// Importantly, this keeps the "+" chomp indicator from gaining an extra line.
+function writeScalar(state, string, level, iskey) {
+ state.dump = (function () {
+ if (string.length === 0) {
+ return "''";
+ }
+ if (!state.noCompatMode &&
+ DEPRECATED_BOOLEANS_SYNTAX.indexOf(string) !== -1) {
+ return "'" + string + "'";
+ }
+
+ var indent = state.indent * Math.max(1, level); // no 0-indent scalars
+ // As indentation gets deeper, let the width decrease monotonically
+ // to the lower bound min(state.lineWidth, 40).
+ // Note that this implies
+ // state.lineWidth ≤ 40 + state.indent: width is fixed at the lower bound.
+ // state.lineWidth > 40 + state.indent: width decreases until the lower bound.
+ // This behaves better than a constant minimum width which disallows narrower options,
+ // or an indent threshold which causes the width to suddenly increase.
+ var lineWidth = state.lineWidth === -1
+ ? -1 : Math.max(Math.min(state.lineWidth, 40), state.lineWidth - indent);
+
+ // Without knowing if keys are implicit/explicit, assume implicit for safety.
+ var singleLineOnly = iskey
+ // No block styles in flow mode.
+ || (state.flowLevel > -1 && level >= state.flowLevel);
+ function testAmbiguity(string) {
+ return testImplicitResolving(state, string);
+ }
+
+ switch (chooseScalarStyle(string, singleLineOnly, state.indent, lineWidth, testAmbiguity)) {
+ case STYLE_PLAIN:
+ return string;
+ case STYLE_SINGLE:
+ return "'" + string.replace(/'/g, "''") + "'";
+ case STYLE_LITERAL:
+ return '|' + blockHeader(string, state.indent)
+ + dropEndingNewline(indentString(string, indent));
+ case STYLE_FOLDED:
+ return '>' + blockHeader(string, state.indent)
+ + dropEndingNewline(indentString(foldString(string, lineWidth), indent));
+ case STYLE_DOUBLE:
+ return '"' + escapeString(string, lineWidth) + '"';
+ default:
+ throw new YAMLException('impossible error: invalid scalar style');
+ }
+ }());
+}
+
+// Pre-conditions: string is valid for a block scalar, 1 <= indentPerLevel <= 9.
+function blockHeader(string, indentPerLevel) {
+ var indentIndicator = (string[0] === ' ') ? String(indentPerLevel) : '';
+
+ // note the special case: the string '\n' counts as a "trailing" empty line.
+ var clip = string[string.length - 1] === '\n';
+ var keep = clip && (string[string.length - 2] === '\n' || string === '\n');
+ var chomp = keep ? '+' : (clip ? '' : '-');
+
+ return indentIndicator + chomp + '\n';
+}
+
+// (See the note for writeScalar.)
+function dropEndingNewline(string) {
+ return string[string.length - 1] === '\n' ? string.slice(0, -1) : string;
+}
+
+// Note: a long line without a suitable break point will exceed the width limit.
+// Pre-conditions: every char in str isPrintable, str.length > 0, width > 0.
+function foldString(string, width) {
+ // In folded style, $k$ consecutive newlines output as $k+1$ newlines—
+ // unless they're before or after a more-indented line, or at the very
+ // beginning or end, in which case $k$ maps to $k$.
+ // Therefore, parse each chunk as newline(s) followed by a content line.
+ var lineRe = /(\n+)([^\n]*)/g;
+
+ // first line (possibly an empty line)
+ var result = (function () {
+ var nextLF = string.indexOf('\n');
+ nextLF = nextLF !== -1 ? nextLF : string.length;
+ lineRe.lastIndex = nextLF;
+ return foldLine(string.slice(0, nextLF), width);
+ }());
+ // If we haven't reached the first content line yet, don't add an extra \n.
+ var prevMoreIndented = string[0] === '\n' || string[0] === ' ';
+ var moreIndented;
+
+ // rest of the lines
+ var match;
+ while ((match = lineRe.exec(string))) {
+ var prefix = match[1], line = match[2];
+ moreIndented = (line[0] === ' ');
+ result += prefix
+ + (!prevMoreIndented && !moreIndented && line !== ''
+ ? '\n' : '')
+ + foldLine(line, width);
+ prevMoreIndented = moreIndented;
+ }
+
+ return result;
+}
+
+// Greedy line breaking.
+// Picks the longest line under the limit each time,
+// otherwise settles for the shortest line over the limit.
+// NB. More-indented lines *cannot* be folded, as that would add an extra \n.
+function foldLine(line, width) {
+ if (line === '' || line[0] === ' ') return line;
+
+ // Since a more-indented line adds a \n, breaks can't be followed by a space.
+ var breakRe = / [^ ]/g; // note: the match index will always be <= length-2.
+ var match;
+ // start is an inclusive index. end, curr, and next are exclusive.
+ var start = 0, end, curr = 0, next = 0;
+ var result = '';
+
+ // Invariants: 0 <= start <= length-1.
+ // 0 <= curr <= next <= max(0, length-2). curr - start <= width.
+ // Inside the loop:
+ // A match implies length >= 2, so curr and next are <= length-2.
+ while ((match = breakRe.exec(line))) {
+ next = match.index;
+ // maintain invariant: curr - start <= width
+ if (next - start > width) {
+ end = (curr > start) ? curr : next; // derive end <= length-2
+ result += '\n' + line.slice(start, end);
+ // skip the space that was output as \n
+ start = end + 1; // derive start <= length-1
+ }
+ curr = next;
+ }
+
+ // By the invariants, start <= length-1, so there is something left over.
+ // It is either the whole string or a part starting from non-whitespace.
+ result += '\n';
+ // Insert a break if the remainder is too long and there is a break available.
+ if (line.length - start > width && curr > start) {
+ result += line.slice(start, curr) + '\n' + line.slice(curr + 1);
+ } else {
+ result += line.slice(start);
+ }
+
+ return result.slice(1); // drop extra \n joiner
+}
+
+// Escapes a double-quoted string.
+function escapeString(string) {
+ var result = '';
+ var char, nextChar;
+ var escapeSeq;
+
+ for (var i = 0; i < string.length; i++) {
+ char = string.charCodeAt(i);
+ // Check for surrogate pairs (reference Unicode 3.0 section "3.7 Surrogates").
+ if (char >= 0xD800 && char <= 0xDBFF/* high surrogate */) {
+ nextChar = string.charCodeAt(i + 1);
+ if (nextChar >= 0xDC00 && nextChar <= 0xDFFF/* low surrogate */) {
+ // Combine the surrogate pair and store it escaped.
+ result += encodeHex((char - 0xD800) * 0x400 + nextChar - 0xDC00 + 0x10000);
+ // Advance index one extra since we already used that char here.
+ i++; continue;
+ }
+ }
+ escapeSeq = ESCAPE_SEQUENCES[char];
+ result += !escapeSeq && isPrintable(char)
+ ? string[i]
+ : escapeSeq || encodeHex(char);
+ }
+
+ return result;
+}
+
+function writeFlowSequence(state, level, object) {
+ var _result = '',
+ _tag = state.tag,
+ index,
+ length;
+
+ for (index = 0, length = object.length; index < length; index += 1) {
+ // Write only valid elements.
+ if (writeNode(state, level, object[index], false, false)) {
+ if (index !== 0) _result += ',' + (!state.condenseFlow ? ' ' : '');
+ _result += state.dump;
+ }
+ }
+
+ state.tag = _tag;
+ state.dump = '[' + _result + ']';
+}
+
+function writeBlockSequence(state, level, object, compact) {
+ var _result = '',
+ _tag = state.tag,
+ index,
+ length;
+
+ for (index = 0, length = object.length; index < length; index += 1) {
+ // Write only valid elements.
+ if (writeNode(state, level + 1, object[index], true, true)) {
+ if (!compact || index !== 0) {
+ _result += generateNextLine(state, level);
+ }
+
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
+ _result += '-';
+ } else {
+ _result += '- ';
+ }
+
+ _result += state.dump;
+ }
+ }
+
+ state.tag = _tag;
+ state.dump = _result || '[]'; // Empty sequence if no valid values.
+}
+
+function writeFlowMapping(state, level, object) {
+ var _result = '',
+ _tag = state.tag,
+ objectKeyList = Object.keys(object),
+ index,
+ length,
+ objectKey,
+ objectValue,
+ pairBuffer;
+
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
+ pairBuffer = state.condenseFlow ? '"' : '';
+
+ if (index !== 0) pairBuffer += ', ';
+
+ objectKey = objectKeyList[index];
+ objectValue = object[objectKey];
+
+ if (!writeNode(state, level, objectKey, false, false)) {
+ continue; // Skip this pair because of invalid key;
+ }
+
+ if (state.dump.length > 1024) pairBuffer += '? ';
+
+ pairBuffer += state.dump + (state.condenseFlow ? '"' : '') + ':' + (state.condenseFlow ? '' : ' ');
+
+ if (!writeNode(state, level, objectValue, false, false)) {
+ continue; // Skip this pair because of invalid value.
+ }
+
+ pairBuffer += state.dump;
+
+ // Both key and value are valid.
+ _result += pairBuffer;
+ }
+
+ state.tag = _tag;
+ state.dump = '{' + _result + '}';
+}
+
+function writeBlockMapping(state, level, object, compact) {
+ var _result = '',
+ _tag = state.tag,
+ objectKeyList = Object.keys(object),
+ index,
+ length,
+ objectKey,
+ objectValue,
+ explicitPair,
+ pairBuffer;
+
+ // Allow sorting keys so that the output file is deterministic
+ if (state.sortKeys === true) {
+ // Default sorting
+ objectKeyList.sort();
+ } else if (typeof state.sortKeys === 'function') {
+ // Custom sort function
+ objectKeyList.sort(state.sortKeys);
+ } else if (state.sortKeys) {
+ // Something is wrong
+ throw new YAMLException('sortKeys must be a boolean or a function');
+ }
+
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
+ pairBuffer = '';
+
+ if (!compact || index !== 0) {
+ pairBuffer += generateNextLine(state, level);
+ }
+
+ objectKey = objectKeyList[index];
+ objectValue = object[objectKey];
+
+ if (!writeNode(state, level + 1, objectKey, true, true, true)) {
+ continue; // Skip this pair because of invalid key.
+ }
+
+ explicitPair = (state.tag !== null && state.tag !== '?') ||
+ (state.dump && state.dump.length > 1024);
+
+ if (explicitPair) {
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
+ pairBuffer += '?';
+ } else {
+ pairBuffer += '? ';
+ }
+ }
+
+ pairBuffer += state.dump;
+
+ if (explicitPair) {
+ pairBuffer += generateNextLine(state, level);
+ }
+
+ if (!writeNode(state, level + 1, objectValue, true, explicitPair)) {
+ continue; // Skip this pair because of invalid value.
+ }
+
+ if (state.dump && CHAR_LINE_FEED === state.dump.charCodeAt(0)) {
+ pairBuffer += ':';
+ } else {
+ pairBuffer += ': ';
+ }
+
+ pairBuffer += state.dump;
+
+ // Both key and value are valid.
+ _result += pairBuffer;
+ }
+
+ state.tag = _tag;
+ state.dump = _result || '{}'; // Empty mapping if no valid pairs.
+}
+
+function detectType(state, object, explicit) {
+ var _result, typeList, index, length, type, style;
+
+ typeList = explicit ? state.explicitTypes : state.implicitTypes;
+
+ for (index = 0, length = typeList.length; index < length; index += 1) {
+ type = typeList[index];
+
+ if ((type.instanceOf || type.predicate) &&
+ (!type.instanceOf || ((typeof object === 'object') && (object instanceof type.instanceOf))) &&
+ (!type.predicate || type.predicate(object))) {
+
+ state.tag = explicit ? type.tag : '?';
+
+ if (type.represent) {
+ style = state.styleMap[type.tag] || type.defaultStyle;
+
+ if (_toString.call(type.represent) === '[object Function]') {
+ _result = type.represent(object, style);
+ } else if (_hasOwnProperty.call(type.represent, style)) {
+ _result = type.represent[style](object, style);
+ } else {
+ throw new YAMLException('!<' + type.tag + '> tag resolver accepts not "' + style + '" style');
+ }
+
+ state.dump = _result;
+ }
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+// Serializes `object` and writes it to global `result`.
+// Returns true on success, or false on invalid object.
+//
+function writeNode(state, level, object, block, compact, iskey) {
+ state.tag = null;
+ state.dump = object;
+
+ if (!detectType(state, object, false)) {
+ detectType(state, object, true);
+ }
+
+ var type = _toString.call(state.dump);
+
+ if (block) {
+ block = (state.flowLevel < 0 || state.flowLevel > level);
+ }
+
+ var objectOrArray = type === '[object Object]' || type === '[object Array]',
+ duplicateIndex,
+ duplicate;
+
+ if (objectOrArray) {
+ duplicateIndex = state.duplicates.indexOf(object);
+ duplicate = duplicateIndex !== -1;
+ }
+
+ if ((state.tag !== null && state.tag !== '?') || duplicate || (state.indent !== 2 && level > 0)) {
+ compact = false;
+ }
+
+ if (duplicate && state.usedDuplicates[duplicateIndex]) {
+ state.dump = '*ref_' + duplicateIndex;
+ } else {
+ if (objectOrArray && duplicate && !state.usedDuplicates[duplicateIndex]) {
+ state.usedDuplicates[duplicateIndex] = true;
+ }
+ if (type === '[object Object]') {
+ if (block && (Object.keys(state.dump).length !== 0)) {
+ writeBlockMapping(state, level, state.dump, compact);
+ if (duplicate) {
+ state.dump = '&ref_' + duplicateIndex + state.dump;
+ }
+ } else {
+ writeFlowMapping(state, level, state.dump);
+ if (duplicate) {
+ state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
+ }
+ }
+ } else if (type === '[object Array]') {
+ if (block && (state.dump.length !== 0)) {
+ writeBlockSequence(state, level, state.dump, compact);
+ if (duplicate) {
+ state.dump = '&ref_' + duplicateIndex + state.dump;
+ }
+ } else {
+ writeFlowSequence(state, level, state.dump);
+ if (duplicate) {
+ state.dump = '&ref_' + duplicateIndex + ' ' + state.dump;
+ }
+ }
+ } else if (type === '[object String]') {
+ if (state.tag !== '?') {
+ writeScalar(state, state.dump, level, iskey);
+ }
+ } else {
+ if (state.skipInvalid) return false;
+ throw new YAMLException('unacceptable kind of an object to dump ' + type);
+ }
+
+ if (state.tag !== null && state.tag !== '?') {
+ state.dump = '!<' + state.tag + '> ' + state.dump;
+ }
+ }
+
+ return true;
+}
+
+function getDuplicateReferences(object, state) {
+ var objects = [],
+ duplicatesIndexes = [],
+ index,
+ length;
+
+ inspectNode(object, objects, duplicatesIndexes);
+
+ for (index = 0, length = duplicatesIndexes.length; index < length; index += 1) {
+ state.duplicates.push(objects[duplicatesIndexes[index]]);
+ }
+ state.usedDuplicates = new Array(length);
+}
+
+function inspectNode(object, objects, duplicatesIndexes) {
+ var objectKeyList,
+ index,
+ length;
+
+ if (object !== null && typeof object === 'object') {
+ index = objects.indexOf(object);
+ if (index !== -1) {
+ if (duplicatesIndexes.indexOf(index) === -1) {
+ duplicatesIndexes.push(index);
+ }
+ } else {
+ objects.push(object);
+
+ if (Array.isArray(object)) {
+ for (index = 0, length = object.length; index < length; index += 1) {
+ inspectNode(object[index], objects, duplicatesIndexes);
+ }
+ } else {
+ objectKeyList = Object.keys(object);
+
+ for (index = 0, length = objectKeyList.length; index < length; index += 1) {
+ inspectNode(object[objectKeyList[index]], objects, duplicatesIndexes);
+ }
+ }
+ }
+ }
+}
+
+function dump(input, options) {
+ options = options || {};
+
+ var state = new State(options);
+
+ if (!state.noRefs) getDuplicateReferences(input, state);
+
+ if (writeNode(state, 0, input, true, true)) return state.dump + '\n';
+
+ return '';
+}
+
+function safeDump(input, options) {
+ return dump(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
+}
+
+module.exports.dump = dump;
+module.exports.safeDump = safeDump;
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/exception.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/exception.js
new file mode 100644
index 0000000000..b744a1ee4e
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/exception.js
@@ -0,0 +1,43 @@
+// YAML error class. http://stackoverflow.com/questions/8458984
+//
+'use strict';
+
+function YAMLException(reason, mark) {
+ // Super constructor
+ Error.call(this);
+
+ this.name = 'YAMLException';
+ this.reason = reason;
+ this.mark = mark;
+ this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : '');
+
+ // Include stack trace in error object
+ if (Error.captureStackTrace) {
+ // Chrome and NodeJS
+ Error.captureStackTrace(this, this.constructor);
+ } else {
+ // FF, IE 10+ and Safari 6+. Fallback for others
+ this.stack = (new Error()).stack || '';
+ }
+}
+
+
+// Inherit from Error
+YAMLException.prototype = Object.create(Error.prototype);
+YAMLException.prototype.constructor = YAMLException;
+
+
+YAMLException.prototype.toString = function toString(compact) {
+ var result = this.name + ': ';
+
+ result += this.reason || '(unknown reason)';
+
+ if (!compact && this.mark) {
+ result += ' ' + this.mark.toString();
+ }
+
+ return result;
+};
+
+
+module.exports = YAMLException;
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/loader.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/loader.js
new file mode 100644
index 0000000000..fe2cb4d07a
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/loader.js
@@ -0,0 +1,1598 @@
+'use strict';
+
+/*eslint-disable max-len,no-use-before-define*/
+
+var common = require('./common');
+var YAMLException = require('./exception');
+var Mark = require('./mark');
+var DEFAULT_SAFE_SCHEMA = require('./schema/default_safe');
+var DEFAULT_FULL_SCHEMA = require('./schema/default_full');
+
+
+var _hasOwnProperty = Object.prototype.hasOwnProperty;
+
+
+var CONTEXT_FLOW_IN = 1;
+var CONTEXT_FLOW_OUT = 2;
+var CONTEXT_BLOCK_IN = 3;
+var CONTEXT_BLOCK_OUT = 4;
+
+
+var CHOMPING_CLIP = 1;
+var CHOMPING_STRIP = 2;
+var CHOMPING_KEEP = 3;
+
+
+var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/;
+var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/;
+var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/;
+var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i;
+var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i;
+
+
+function is_EOL(c) {
+ return (c === 0x0A/* LF */) || (c === 0x0D/* CR */);
+}
+
+function is_WHITE_SPACE(c) {
+ return (c === 0x09/* Tab */) || (c === 0x20/* Space */);
+}
+
+function is_WS_OR_EOL(c) {
+ return (c === 0x09/* Tab */) ||
+ (c === 0x20/* Space */) ||
+ (c === 0x0A/* LF */) ||
+ (c === 0x0D/* CR */);
+}
+
+function is_FLOW_INDICATOR(c) {
+ return c === 0x2C/* , */ ||
+ c === 0x5B/* [ */ ||
+ c === 0x5D/* ] */ ||
+ c === 0x7B/* { */ ||
+ c === 0x7D/* } */;
+}
+
+function fromHexCode(c) {
+ var lc;
+
+ if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
+ return c - 0x30;
+ }
+
+ /*eslint-disable no-bitwise*/
+ lc = c | 0x20;
+
+ if ((0x61/* a */ <= lc) && (lc <= 0x66/* f */)) {
+ return lc - 0x61 + 10;
+ }
+
+ return -1;
+}
+
+function escapedHexLen(c) {
+ if (c === 0x78/* x */) { return 2; }
+ if (c === 0x75/* u */) { return 4; }
+ if (c === 0x55/* U */) { return 8; }
+ return 0;
+}
+
+function fromDecimalCode(c) {
+ if ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) {
+ return c - 0x30;
+ }
+
+ return -1;
+}
+
+function simpleEscapeSequence(c) {
+ /* eslint-disable indent */
+ return (c === 0x30/* 0 */) ? '\x00' :
+ (c === 0x61/* a */) ? '\x07' :
+ (c === 0x62/* b */) ? '\x08' :
+ (c === 0x74/* t */) ? '\x09' :
+ (c === 0x09/* Tab */) ? '\x09' :
+ (c === 0x6E/* n */) ? '\x0A' :
+ (c === 0x76/* v */) ? '\x0B' :
+ (c === 0x66/* f */) ? '\x0C' :
+ (c === 0x72/* r */) ? '\x0D' :
+ (c === 0x65/* e */) ? '\x1B' :
+ (c === 0x20/* Space */) ? ' ' :
+ (c === 0x22/* " */) ? '\x22' :
+ (c === 0x2F/* / */) ? '/' :
+ (c === 0x5C/* \ */) ? '\x5C' :
+ (c === 0x4E/* N */) ? '\x85' :
+ (c === 0x5F/* _ */) ? '\xA0' :
+ (c === 0x4C/* L */) ? '\u2028' :
+ (c === 0x50/* P */) ? '\u2029' : '';
+}
+
+function charFromCodepoint(c) {
+ if (c <= 0xFFFF) {
+ return String.fromCharCode(c);
+ }
+ // Encode UTF-16 surrogate pair
+ // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF
+ return String.fromCharCode(
+ ((c - 0x010000) >> 10) + 0xD800,
+ ((c - 0x010000) & 0x03FF) + 0xDC00
+ );
+}
+
+var simpleEscapeCheck = new Array(256); // integer, for fast access
+var simpleEscapeMap = new Array(256);
+for (var i = 0; i < 256; i++) {
+ simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0;
+ simpleEscapeMap[i] = simpleEscapeSequence(i);
+}
+
+
+function State(input, options) {
+ this.input = input;
+
+ this.filename = options['filename'] || null;
+ this.schema = options['schema'] || DEFAULT_FULL_SCHEMA;
+ this.onWarning = options['onWarning'] || null;
+ this.legacy = options['legacy'] || false;
+ this.json = options['json'] || false;
+ this.listener = options['listener'] || null;
+
+ this.implicitTypes = this.schema.compiledImplicit;
+ this.typeMap = this.schema.compiledTypeMap;
+
+ this.length = input.length;
+ this.position = 0;
+ this.line = 0;
+ this.lineStart = 0;
+ this.lineIndent = 0;
+
+ this.documents = [];
+
+ /*
+ this.version;
+ this.checkLineBreaks;
+ this.tagMap;
+ this.anchorMap;
+ this.tag;
+ this.anchor;
+ this.kind;
+ this.result;*/
+
+}
+
+
+function generateError(state, message) {
+ return new YAMLException(
+ message,
+ new Mark(state.filename, state.input, state.position, state.line, (state.position - state.lineStart)));
+}
+
+function throwError(state, message) {
+ throw generateError(state, message);
+}
+
+function throwWarning(state, message) {
+ if (state.onWarning) {
+ state.onWarning.call(null, generateError(state, message));
+ }
+}
+
+
+var directiveHandlers = {
+
+ YAML: function handleYamlDirective(state, name, args) {
+
+ var match, major, minor;
+
+ if (state.version !== null) {
+ throwError(state, 'duplication of %YAML directive');
+ }
+
+ if (args.length !== 1) {
+ throwError(state, 'YAML directive accepts exactly one argument');
+ }
+
+ match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
+
+ if (match === null) {
+ throwError(state, 'ill-formed argument of the YAML directive');
+ }
+
+ major = parseInt(match[1], 10);
+ minor = parseInt(match[2], 10);
+
+ if (major !== 1) {
+ throwError(state, 'unacceptable YAML version of the document');
+ }
+
+ state.version = args[0];
+ state.checkLineBreaks = (minor < 2);
+
+ if (minor !== 1 && minor !== 2) {
+ throwWarning(state, 'unsupported YAML version of the document');
+ }
+ },
+
+ TAG: function handleTagDirective(state, name, args) {
+
+ var handle, prefix;
+
+ if (args.length !== 2) {
+ throwError(state, 'TAG directive accepts exactly two arguments');
+ }
+
+ handle = args[0];
+ prefix = args[1];
+
+ if (!PATTERN_TAG_HANDLE.test(handle)) {
+ throwError(state, 'ill-formed tag handle (first argument) of the TAG directive');
+ }
+
+ if (_hasOwnProperty.call(state.tagMap, handle)) {
+ throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle');
+ }
+
+ if (!PATTERN_TAG_URI.test(prefix)) {
+ throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive');
+ }
+
+ state.tagMap[handle] = prefix;
+ }
+};
+
+
+function captureSegment(state, start, end, checkJson) {
+ var _position, _length, _character, _result;
+
+ if (start < end) {
+ _result = state.input.slice(start, end);
+
+ if (checkJson) {
+ for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
+ _character = _result.charCodeAt(_position);
+ if (!(_character === 0x09 ||
+ (0x20 <= _character && _character <= 0x10FFFF))) {
+ throwError(state, 'expected valid JSON character');
+ }
+ }
+ } else if (PATTERN_NON_PRINTABLE.test(_result)) {
+ throwError(state, 'the stream contains non-printable characters');
+ }
+
+ state.result += _result;
+ }
+}
+
+function mergeMappings(state, destination, source, overridableKeys) {
+ var sourceKeys, key, index, quantity;
+
+ if (!common.isObject(source)) {
+ throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
+ }
+
+ sourceKeys = Object.keys(source);
+
+ for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
+ key = sourceKeys[index];
+
+ if (!_hasOwnProperty.call(destination, key)) {
+ destination[key] = source[key];
+ overridableKeys[key] = true;
+ }
+ }
+}
+
+function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) {
+ var index, quantity;
+
+ keyNode = String(keyNode);
+
+ if (_result === null) {
+ _result = {};
+ }
+
+ if (keyTag === 'tag:yaml.org,2002:merge') {
+ if (Array.isArray(valueNode)) {
+ for (index = 0, quantity = valueNode.length; index < quantity; index += 1) {
+ mergeMappings(state, _result, valueNode[index], overridableKeys);
+ }
+ } else {
+ mergeMappings(state, _result, valueNode, overridableKeys);
+ }
+ } else {
+ if (!state.json &&
+ !_hasOwnProperty.call(overridableKeys, keyNode) &&
+ _hasOwnProperty.call(_result, keyNode)) {
+ state.line = startLine || state.line;
+ state.position = startPos || state.position;
+ throwError(state, 'duplicated mapping key');
+ }
+ _result[keyNode] = valueNode;
+ delete overridableKeys[keyNode];
+ }
+
+ return _result;
+}
+
+function readLineBreak(state) {
+ var ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch === 0x0A/* LF */) {
+ state.position++;
+ } else if (ch === 0x0D/* CR */) {
+ state.position++;
+ if (state.input.charCodeAt(state.position) === 0x0A/* LF */) {
+ state.position++;
+ }
+ } else {
+ throwError(state, 'a line break is expected');
+ }
+
+ state.line += 1;
+ state.lineStart = state.position;
+}
+
+function skipSeparationSpace(state, allowComments, checkIndent) {
+ var lineBreaks = 0,
+ ch = state.input.charCodeAt(state.position);
+
+ while (ch !== 0) {
+ while (is_WHITE_SPACE(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ if (allowComments && ch === 0x23/* # */) {
+ do {
+ ch = state.input.charCodeAt(++state.position);
+ } while (ch !== 0x0A/* LF */ && ch !== 0x0D/* CR */ && ch !== 0);
+ }
+
+ if (is_EOL(ch)) {
+ readLineBreak(state);
+
+ ch = state.input.charCodeAt(state.position);
+ lineBreaks++;
+ state.lineIndent = 0;
+
+ while (ch === 0x20/* Space */) {
+ state.lineIndent++;
+ ch = state.input.charCodeAt(++state.position);
+ }
+ } else {
+ break;
+ }
+ }
+
+ if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) {
+ throwWarning(state, 'deficient indentation');
+ }
+
+ return lineBreaks;
+}
+
+function testDocumentSeparator(state) {
+ var _position = state.position,
+ ch;
+
+ ch = state.input.charCodeAt(_position);
+
+ // Condition state.position === state.lineStart is tested
+ // in parent on each call, for efficiency. No needs to test here again.
+ if ((ch === 0x2D/* - */ || ch === 0x2E/* . */) &&
+ ch === state.input.charCodeAt(_position + 1) &&
+ ch === state.input.charCodeAt(_position + 2)) {
+
+ _position += 3;
+
+ ch = state.input.charCodeAt(_position);
+
+ if (ch === 0 || is_WS_OR_EOL(ch)) {
+ return true;
+ }
+ }
+
+ return false;
+}
+
+function writeFoldedLines(state, count) {
+ if (count === 1) {
+ state.result += ' ';
+ } else if (count > 1) {
+ state.result += common.repeat('\n', count - 1);
+ }
+}
+
+
+function readPlainScalar(state, nodeIndent, withinFlowCollection) {
+ var preceding,
+ following,
+ captureStart,
+ captureEnd,
+ hasPendingContent,
+ _line,
+ _lineStart,
+ _lineIndent,
+ _kind = state.kind,
+ _result = state.result,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (is_WS_OR_EOL(ch) ||
+ is_FLOW_INDICATOR(ch) ||
+ ch === 0x23/* # */ ||
+ ch === 0x26/* & */ ||
+ ch === 0x2A/* * */ ||
+ ch === 0x21/* ! */ ||
+ ch === 0x7C/* | */ ||
+ ch === 0x3E/* > */ ||
+ ch === 0x27/* ' */ ||
+ ch === 0x22/* " */ ||
+ ch === 0x25/* % */ ||
+ ch === 0x40/* @ */ ||
+ ch === 0x60/* ` */) {
+ return false;
+ }
+
+ if (ch === 0x3F/* ? */ || ch === 0x2D/* - */) {
+ following = state.input.charCodeAt(state.position + 1);
+
+ if (is_WS_OR_EOL(following) ||
+ withinFlowCollection && is_FLOW_INDICATOR(following)) {
+ return false;
+ }
+ }
+
+ state.kind = 'scalar';
+ state.result = '';
+ captureStart = captureEnd = state.position;
+ hasPendingContent = false;
+
+ while (ch !== 0) {
+ if (ch === 0x3A/* : */) {
+ following = state.input.charCodeAt(state.position + 1);
+
+ if (is_WS_OR_EOL(following) ||
+ withinFlowCollection && is_FLOW_INDICATOR(following)) {
+ break;
+ }
+
+ } else if (ch === 0x23/* # */) {
+ preceding = state.input.charCodeAt(state.position - 1);
+
+ if (is_WS_OR_EOL(preceding)) {
+ break;
+ }
+
+ } else if ((state.position === state.lineStart && testDocumentSeparator(state)) ||
+ withinFlowCollection && is_FLOW_INDICATOR(ch)) {
+ break;
+
+ } else if (is_EOL(ch)) {
+ _line = state.line;
+ _lineStart = state.lineStart;
+ _lineIndent = state.lineIndent;
+ skipSeparationSpace(state, false, -1);
+
+ if (state.lineIndent >= nodeIndent) {
+ hasPendingContent = true;
+ ch = state.input.charCodeAt(state.position);
+ continue;
+ } else {
+ state.position = captureEnd;
+ state.line = _line;
+ state.lineStart = _lineStart;
+ state.lineIndent = _lineIndent;
+ break;
+ }
+ }
+
+ if (hasPendingContent) {
+ captureSegment(state, captureStart, captureEnd, false);
+ writeFoldedLines(state, state.line - _line);
+ captureStart = captureEnd = state.position;
+ hasPendingContent = false;
+ }
+
+ if (!is_WHITE_SPACE(ch)) {
+ captureEnd = state.position + 1;
+ }
+
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ captureSegment(state, captureStart, captureEnd, false);
+
+ if (state.result) {
+ return true;
+ }
+
+ state.kind = _kind;
+ state.result = _result;
+ return false;
+}
+
+function readSingleQuotedScalar(state, nodeIndent) {
+ var ch,
+ captureStart, captureEnd;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch !== 0x27/* ' */) {
+ return false;
+ }
+
+ state.kind = 'scalar';
+ state.result = '';
+ state.position++;
+ captureStart = captureEnd = state.position;
+
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
+ if (ch === 0x27/* ' */) {
+ captureSegment(state, captureStart, state.position, true);
+ ch = state.input.charCodeAt(++state.position);
+
+ if (ch === 0x27/* ' */) {
+ captureStart = state.position;
+ state.position++;
+ captureEnd = state.position;
+ } else {
+ return true;
+ }
+
+ } else if (is_EOL(ch)) {
+ captureSegment(state, captureStart, captureEnd, true);
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
+ captureStart = captureEnd = state.position;
+
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
+ throwError(state, 'unexpected end of the document within a single quoted scalar');
+
+ } else {
+ state.position++;
+ captureEnd = state.position;
+ }
+ }
+
+ throwError(state, 'unexpected end of the stream within a single quoted scalar');
+}
+
+function readDoubleQuotedScalar(state, nodeIndent) {
+ var captureStart,
+ captureEnd,
+ hexLength,
+ hexResult,
+ tmp,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch !== 0x22/* " */) {
+ return false;
+ }
+
+ state.kind = 'scalar';
+ state.result = '';
+ state.position++;
+ captureStart = captureEnd = state.position;
+
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
+ if (ch === 0x22/* " */) {
+ captureSegment(state, captureStart, state.position, true);
+ state.position++;
+ return true;
+
+ } else if (ch === 0x5C/* \ */) {
+ captureSegment(state, captureStart, state.position, true);
+ ch = state.input.charCodeAt(++state.position);
+
+ if (is_EOL(ch)) {
+ skipSeparationSpace(state, false, nodeIndent);
+
+ // TODO: rework to inline fn with no type cast?
+ } else if (ch < 256 && simpleEscapeCheck[ch]) {
+ state.result += simpleEscapeMap[ch];
+ state.position++;
+
+ } else if ((tmp = escapedHexLen(ch)) > 0) {
+ hexLength = tmp;
+ hexResult = 0;
+
+ for (; hexLength > 0; hexLength--) {
+ ch = state.input.charCodeAt(++state.position);
+
+ if ((tmp = fromHexCode(ch)) >= 0) {
+ hexResult = (hexResult << 4) + tmp;
+
+ } else {
+ throwError(state, 'expected hexadecimal character');
+ }
+ }
+
+ state.result += charFromCodepoint(hexResult);
+
+ state.position++;
+
+ } else {
+ throwError(state, 'unknown escape sequence');
+ }
+
+ captureStart = captureEnd = state.position;
+
+ } else if (is_EOL(ch)) {
+ captureSegment(state, captureStart, captureEnd, true);
+ writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent));
+ captureStart = captureEnd = state.position;
+
+ } else if (state.position === state.lineStart && testDocumentSeparator(state)) {
+ throwError(state, 'unexpected end of the document within a double quoted scalar');
+
+ } else {
+ state.position++;
+ captureEnd = state.position;
+ }
+ }
+
+ throwError(state, 'unexpected end of the stream within a double quoted scalar');
+}
+
+function readFlowCollection(state, nodeIndent) {
+ var readNext = true,
+ _line,
+ _tag = state.tag,
+ _result,
+ _anchor = state.anchor,
+ following,
+ terminator,
+ isPair,
+ isExplicitPair,
+ isMapping,
+ overridableKeys = {},
+ keyNode,
+ keyTag,
+ valueNode,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch === 0x5B/* [ */) {
+ terminator = 0x5D;/* ] */
+ isMapping = false;
+ _result = [];
+ } else if (ch === 0x7B/* { */) {
+ terminator = 0x7D;/* } */
+ isMapping = true;
+ _result = {};
+ } else {
+ return false;
+ }
+
+ if (state.anchor !== null) {
+ state.anchorMap[state.anchor] = _result;
+ }
+
+ ch = state.input.charCodeAt(++state.position);
+
+ while (ch !== 0) {
+ skipSeparationSpace(state, true, nodeIndent);
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch === terminator) {
+ state.position++;
+ state.tag = _tag;
+ state.anchor = _anchor;
+ state.kind = isMapping ? 'mapping' : 'sequence';
+ state.result = _result;
+ return true;
+ } else if (!readNext) {
+ throwError(state, 'missed comma between flow collection entries');
+ }
+
+ keyTag = keyNode = valueNode = null;
+ isPair = isExplicitPair = false;
+
+ if (ch === 0x3F/* ? */) {
+ following = state.input.charCodeAt(state.position + 1);
+
+ if (is_WS_OR_EOL(following)) {
+ isPair = isExplicitPair = true;
+ state.position++;
+ skipSeparationSpace(state, true, nodeIndent);
+ }
+ }
+
+ _line = state.line;
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
+ keyTag = state.tag;
+ keyNode = state.result;
+ skipSeparationSpace(state, true, nodeIndent);
+
+ ch = state.input.charCodeAt(state.position);
+
+ if ((isExplicitPair || state.line === _line) && ch === 0x3A/* : */) {
+ isPair = true;
+ ch = state.input.charCodeAt(++state.position);
+ skipSeparationSpace(state, true, nodeIndent);
+ composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true);
+ valueNode = state.result;
+ }
+
+ if (isMapping) {
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode);
+ } else if (isPair) {
+ _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode));
+ } else {
+ _result.push(keyNode);
+ }
+
+ skipSeparationSpace(state, true, nodeIndent);
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch === 0x2C/* , */) {
+ readNext = true;
+ ch = state.input.charCodeAt(++state.position);
+ } else {
+ readNext = false;
+ }
+ }
+
+ throwError(state, 'unexpected end of the stream within a flow collection');
+}
+
+function readBlockScalar(state, nodeIndent) {
+ var captureStart,
+ folding,
+ chomping = CHOMPING_CLIP,
+ didReadContent = false,
+ detectedIndent = false,
+ textIndent = nodeIndent,
+ emptyLines = 0,
+ atMoreIndented = false,
+ tmp,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch === 0x7C/* | */) {
+ folding = false;
+ } else if (ch === 0x3E/* > */) {
+ folding = true;
+ } else {
+ return false;
+ }
+
+ state.kind = 'scalar';
+ state.result = '';
+
+ while (ch !== 0) {
+ ch = state.input.charCodeAt(++state.position);
+
+ if (ch === 0x2B/* + */ || ch === 0x2D/* - */) {
+ if (CHOMPING_CLIP === chomping) {
+ chomping = (ch === 0x2B/* + */) ? CHOMPING_KEEP : CHOMPING_STRIP;
+ } else {
+ throwError(state, 'repeat of a chomping mode identifier');
+ }
+
+ } else if ((tmp = fromDecimalCode(ch)) >= 0) {
+ if (tmp === 0) {
+ throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one');
+ } else if (!detectedIndent) {
+ textIndent = nodeIndent + tmp - 1;
+ detectedIndent = true;
+ } else {
+ throwError(state, 'repeat of an indentation width identifier');
+ }
+
+ } else {
+ break;
+ }
+ }
+
+ if (is_WHITE_SPACE(ch)) {
+ do { ch = state.input.charCodeAt(++state.position); }
+ while (is_WHITE_SPACE(ch));
+
+ if (ch === 0x23/* # */) {
+ do { ch = state.input.charCodeAt(++state.position); }
+ while (!is_EOL(ch) && (ch !== 0));
+ }
+ }
+
+ while (ch !== 0) {
+ readLineBreak(state);
+ state.lineIndent = 0;
+
+ ch = state.input.charCodeAt(state.position);
+
+ while ((!detectedIndent || state.lineIndent < textIndent) &&
+ (ch === 0x20/* Space */)) {
+ state.lineIndent++;
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ if (!detectedIndent && state.lineIndent > textIndent) {
+ textIndent = state.lineIndent;
+ }
+
+ if (is_EOL(ch)) {
+ emptyLines++;
+ continue;
+ }
+
+ // End of the scalar.
+ if (state.lineIndent < textIndent) {
+
+ // Perform the chomping.
+ if (chomping === CHOMPING_KEEP) {
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
+ } else if (chomping === CHOMPING_CLIP) {
+ if (didReadContent) { // i.e. only if the scalar is not empty.
+ state.result += '\n';
+ }
+ }
+
+ // Break this `while` cycle and go to the funciton's epilogue.
+ break;
+ }
+
+ // Folded style: use fancy rules to handle line breaks.
+ if (folding) {
+
+ // Lines starting with white space characters (more-indented lines) are not folded.
+ if (is_WHITE_SPACE(ch)) {
+ atMoreIndented = true;
+ // except for the first content line (cf. Example 8.1)
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
+
+ // End of more-indented block.
+ } else if (atMoreIndented) {
+ atMoreIndented = false;
+ state.result += common.repeat('\n', emptyLines + 1);
+
+ // Just one line break - perceive as the same line.
+ } else if (emptyLines === 0) {
+ if (didReadContent) { // i.e. only if we have already read some scalar content.
+ state.result += ' ';
+ }
+
+ // Several line breaks - perceive as different lines.
+ } else {
+ state.result += common.repeat('\n', emptyLines);
+ }
+
+ // Literal style: just add exact number of line breaks between content lines.
+ } else {
+ // Keep all line breaks except the header line break.
+ state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines);
+ }
+
+ didReadContent = true;
+ detectedIndent = true;
+ emptyLines = 0;
+ captureStart = state.position;
+
+ while (!is_EOL(ch) && (ch !== 0)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ captureSegment(state, captureStart, state.position, false);
+ }
+
+ return true;
+}
+
+function readBlockSequence(state, nodeIndent) {
+ var _line,
+ _tag = state.tag,
+ _anchor = state.anchor,
+ _result = [],
+ following,
+ detected = false,
+ ch;
+
+ if (state.anchor !== null) {
+ state.anchorMap[state.anchor] = _result;
+ }
+
+ ch = state.input.charCodeAt(state.position);
+
+ while (ch !== 0) {
+
+ if (ch !== 0x2D/* - */) {
+ break;
+ }
+
+ following = state.input.charCodeAt(state.position + 1);
+
+ if (!is_WS_OR_EOL(following)) {
+ break;
+ }
+
+ detected = true;
+ state.position++;
+
+ if (skipSeparationSpace(state, true, -1)) {
+ if (state.lineIndent <= nodeIndent) {
+ _result.push(null);
+ ch = state.input.charCodeAt(state.position);
+ continue;
+ }
+ }
+
+ _line = state.line;
+ composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true);
+ _result.push(state.result);
+ skipSeparationSpace(state, true, -1);
+
+ ch = state.input.charCodeAt(state.position);
+
+ if ((state.line === _line || state.lineIndent > nodeIndent) && (ch !== 0)) {
+ throwError(state, 'bad indentation of a sequence entry');
+ } else if (state.lineIndent < nodeIndent) {
+ break;
+ }
+ }
+
+ if (detected) {
+ state.tag = _tag;
+ state.anchor = _anchor;
+ state.kind = 'sequence';
+ state.result = _result;
+ return true;
+ }
+ return false;
+}
+
+function readBlockMapping(state, nodeIndent, flowIndent) {
+ var following,
+ allowCompact,
+ _line,
+ _pos,
+ _tag = state.tag,
+ _anchor = state.anchor,
+ _result = {},
+ overridableKeys = {},
+ keyTag = null,
+ keyNode = null,
+ valueNode = null,
+ atExplicitKey = false,
+ detected = false,
+ ch;
+
+ if (state.anchor !== null) {
+ state.anchorMap[state.anchor] = _result;
+ }
+
+ ch = state.input.charCodeAt(state.position);
+
+ while (ch !== 0) {
+ following = state.input.charCodeAt(state.position + 1);
+ _line = state.line; // Save the current line.
+ _pos = state.position;
+
+ //
+ // Explicit notation case. There are two separate blocks:
+ // first for the key (denoted by "?") and second for the value (denoted by ":")
+ //
+ if ((ch === 0x3F/* ? */ || ch === 0x3A/* : */) && is_WS_OR_EOL(following)) {
+
+ if (ch === 0x3F/* ? */) {
+ if (atExplicitKey) {
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
+ keyTag = keyNode = valueNode = null;
+ }
+
+ detected = true;
+ atExplicitKey = true;
+ allowCompact = true;
+
+ } else if (atExplicitKey) {
+ // i.e. 0x3A/* : */ === character after the explicit key.
+ atExplicitKey = false;
+ allowCompact = true;
+
+ } else {
+ throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line');
+ }
+
+ state.position += 1;
+ ch = following;
+
+ //
+ // Implicit notation case. Flow-style node as the key first, then ":", and the value.
+ //
+ } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) {
+
+ if (state.line === _line) {
+ ch = state.input.charCodeAt(state.position);
+
+ while (is_WHITE_SPACE(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ if (ch === 0x3A/* : */) {
+ ch = state.input.charCodeAt(++state.position);
+
+ if (!is_WS_OR_EOL(ch)) {
+ throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping');
+ }
+
+ if (atExplicitKey) {
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
+ keyTag = keyNode = valueNode = null;
+ }
+
+ detected = true;
+ atExplicitKey = false;
+ allowCompact = false;
+ keyTag = state.tag;
+ keyNode = state.result;
+
+ } else if (detected) {
+ throwError(state, 'can not read an implicit mapping pair; a colon is missed');
+
+ } else {
+ state.tag = _tag;
+ state.anchor = _anchor;
+ return true; // Keep the result of `composeNode`.
+ }
+
+ } else if (detected) {
+ throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key');
+
+ } else {
+ state.tag = _tag;
+ state.anchor = _anchor;
+ return true; // Keep the result of `composeNode`.
+ }
+
+ } else {
+ break; // Reading is done. Go to the epilogue.
+ }
+
+ //
+ // Common reading code for both explicit and implicit notations.
+ //
+ if (state.line === _line || state.lineIndent > nodeIndent) {
+ if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) {
+ if (atExplicitKey) {
+ keyNode = state.result;
+ } else {
+ valueNode = state.result;
+ }
+ }
+
+ if (!atExplicitKey) {
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos);
+ keyTag = keyNode = valueNode = null;
+ }
+
+ skipSeparationSpace(state, true, -1);
+ ch = state.input.charCodeAt(state.position);
+ }
+
+ if (state.lineIndent > nodeIndent && (ch !== 0)) {
+ throwError(state, 'bad indentation of a mapping entry');
+ } else if (state.lineIndent < nodeIndent) {
+ break;
+ }
+ }
+
+ //
+ // Epilogue.
+ //
+
+ // Special case: last mapping's node contains only the key in explicit notation.
+ if (atExplicitKey) {
+ storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null);
+ }
+
+ // Expose the resulting mapping.
+ if (detected) {
+ state.tag = _tag;
+ state.anchor = _anchor;
+ state.kind = 'mapping';
+ state.result = _result;
+ }
+
+ return detected;
+}
+
+function readTagProperty(state) {
+ var _position,
+ isVerbatim = false,
+ isNamed = false,
+ tagHandle,
+ tagName,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch !== 0x21/* ! */) return false;
+
+ if (state.tag !== null) {
+ throwError(state, 'duplication of a tag property');
+ }
+
+ ch = state.input.charCodeAt(++state.position);
+
+ if (ch === 0x3C/* < */) {
+ isVerbatim = true;
+ ch = state.input.charCodeAt(++state.position);
+
+ } else if (ch === 0x21/* ! */) {
+ isNamed = true;
+ tagHandle = '!!';
+ ch = state.input.charCodeAt(++state.position);
+
+ } else {
+ tagHandle = '!';
+ }
+
+ _position = state.position;
+
+ if (isVerbatim) {
+ do { ch = state.input.charCodeAt(++state.position); }
+ while (ch !== 0 && ch !== 0x3E/* > */);
+
+ if (state.position < state.length) {
+ tagName = state.input.slice(_position, state.position);
+ ch = state.input.charCodeAt(++state.position);
+ } else {
+ throwError(state, 'unexpected end of the stream within a verbatim tag');
+ }
+ } else {
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
+
+ if (ch === 0x21/* ! */) {
+ if (!isNamed) {
+ tagHandle = state.input.slice(_position - 1, state.position + 1);
+
+ if (!PATTERN_TAG_HANDLE.test(tagHandle)) {
+ throwError(state, 'named tag handle cannot contain such characters');
+ }
+
+ isNamed = true;
+ _position = state.position + 1;
+ } else {
+ throwError(state, 'tag suffix cannot contain exclamation marks');
+ }
+ }
+
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ tagName = state.input.slice(_position, state.position);
+
+ if (PATTERN_FLOW_INDICATORS.test(tagName)) {
+ throwError(state, 'tag suffix cannot contain flow indicator characters');
+ }
+ }
+
+ if (tagName && !PATTERN_TAG_URI.test(tagName)) {
+ throwError(state, 'tag name cannot contain such characters: ' + tagName);
+ }
+
+ if (isVerbatim) {
+ state.tag = tagName;
+
+ } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) {
+ state.tag = state.tagMap[tagHandle] + tagName;
+
+ } else if (tagHandle === '!') {
+ state.tag = '!' + tagName;
+
+ } else if (tagHandle === '!!') {
+ state.tag = 'tag:yaml.org,2002:' + tagName;
+
+ } else {
+ throwError(state, 'undeclared tag handle "' + tagHandle + '"');
+ }
+
+ return true;
+}
+
+function readAnchorProperty(state) {
+ var _position,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch !== 0x26/* & */) return false;
+
+ if (state.anchor !== null) {
+ throwError(state, 'duplication of an anchor property');
+ }
+
+ ch = state.input.charCodeAt(++state.position);
+ _position = state.position;
+
+ while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ if (state.position === _position) {
+ throwError(state, 'name of an anchor node must contain at least one character');
+ }
+
+ state.anchor = state.input.slice(_position, state.position);
+ return true;
+}
+
+function readAlias(state) {
+ var _position, alias,
+ ch;
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (ch !== 0x2A/* * */) return false;
+
+ ch = state.input.charCodeAt(++state.position);
+ _position = state.position;
+
+ while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ if (state.position === _position) {
+ throwError(state, 'name of an alias node must contain at least one character');
+ }
+
+ alias = state.input.slice(_position, state.position);
+
+ if (!state.anchorMap.hasOwnProperty(alias)) {
+ throwError(state, 'unidentified alias "' + alias + '"');
+ }
+
+ state.result = state.anchorMap[alias];
+ skipSeparationSpace(state, true, -1);
+ return true;
+}
+
+function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) {
+ var allowBlockStyles,
+ allowBlockScalars,
+ allowBlockCollections,
+ indentStatus = 1, // 1: this>parent, 0: this=parent, -1: this<parent
+ atNewLine = false,
+ hasContent = false,
+ typeIndex,
+ typeQuantity,
+ type,
+ flowIndent,
+ blockIndent;
+
+ if (state.listener !== null) {
+ state.listener('open', state);
+ }
+
+ state.tag = null;
+ state.anchor = null;
+ state.kind = null;
+ state.result = null;
+
+ allowBlockStyles = allowBlockScalars = allowBlockCollections =
+ CONTEXT_BLOCK_OUT === nodeContext ||
+ CONTEXT_BLOCK_IN === nodeContext;
+
+ if (allowToSeek) {
+ if (skipSeparationSpace(state, true, -1)) {
+ atNewLine = true;
+
+ if (state.lineIndent > parentIndent) {
+ indentStatus = 1;
+ } else if (state.lineIndent === parentIndent) {
+ indentStatus = 0;
+ } else if (state.lineIndent < parentIndent) {
+ indentStatus = -1;
+ }
+ }
+ }
+
+ if (indentStatus === 1) {
+ while (readTagProperty(state) || readAnchorProperty(state)) {
+ if (skipSeparationSpace(state, true, -1)) {
+ atNewLine = true;
+ allowBlockCollections = allowBlockStyles;
+
+ if (state.lineIndent > parentIndent) {
+ indentStatus = 1;
+ } else if (state.lineIndent === parentIndent) {
+ indentStatus = 0;
+ } else if (state.lineIndent < parentIndent) {
+ indentStatus = -1;
+ }
+ } else {
+ allowBlockCollections = false;
+ }
+ }
+ }
+
+ if (allowBlockCollections) {
+ allowBlockCollections = atNewLine || allowCompact;
+ }
+
+ if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) {
+ if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) {
+ flowIndent = parentIndent;
+ } else {
+ flowIndent = parentIndent + 1;
+ }
+
+ blockIndent = state.position - state.lineStart;
+
+ if (indentStatus === 1) {
+ if (allowBlockCollections &&
+ (readBlockSequence(state, blockIndent) ||
+ readBlockMapping(state, blockIndent, flowIndent)) ||
+ readFlowCollection(state, flowIndent)) {
+ hasContent = true;
+ } else {
+ if ((allowBlockScalars && readBlockScalar(state, flowIndent)) ||
+ readSingleQuotedScalar(state, flowIndent) ||
+ readDoubleQuotedScalar(state, flowIndent)) {
+ hasContent = true;
+
+ } else if (readAlias(state)) {
+ hasContent = true;
+
+ if (state.tag !== null || state.anchor !== null) {
+ throwError(state, 'alias node should not have any properties');
+ }
+
+ } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) {
+ hasContent = true;
+
+ if (state.tag === null) {
+ state.tag = '?';
+ }
+ }
+
+ if (state.anchor !== null) {
+ state.anchorMap[state.anchor] = state.result;
+ }
+ }
+ } else if (indentStatus === 0) {
+ // Special case: block sequences are allowed to have same indentation level as the parent.
+ // http://www.yaml.org/spec/1.2/spec.html#id2799784
+ hasContent = allowBlockCollections && readBlockSequence(state, blockIndent);
+ }
+ }
+
+ if (state.tag !== null && state.tag !== '!') {
+ if (state.tag === '?') {
+ for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) {
+ type = state.implicitTypes[typeIndex];
+
+ // Implicit resolving is not allowed for non-scalar types, and '?'
+ // non-specific tag is only assigned to plain scalars. So, it isn't
+ // needed to check for 'kind' conformity.
+
+ if (type.resolve(state.result)) { // `state.result` updated in resolver if matched
+ state.result = type.construct(state.result);
+ state.tag = type.tag;
+ if (state.anchor !== null) {
+ state.anchorMap[state.anchor] = state.result;
+ }
+ break;
+ }
+ }
+ } else if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) {
+ type = state.typeMap[state.kind || 'fallback'][state.tag];
+
+ if (state.result !== null && type.kind !== state.kind) {
+ throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"');
+ }
+
+ if (!type.resolve(state.result)) { // `state.result` updated in resolver if matched
+ throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag');
+ } else {
+ state.result = type.construct(state.result);
+ if (state.anchor !== null) {
+ state.anchorMap[state.anchor] = state.result;
+ }
+ }
+ } else {
+ throwError(state, 'unknown tag !<' + state.tag + '>');
+ }
+ }
+
+ if (state.listener !== null) {
+ state.listener('close', state);
+ }
+ return state.tag !== null || state.anchor !== null || hasContent;
+}
+
+function readDocument(state) {
+ var documentStart = state.position,
+ _position,
+ directiveName,
+ directiveArgs,
+ hasDirectives = false,
+ ch;
+
+ state.version = null;
+ state.checkLineBreaks = state.legacy;
+ state.tagMap = {};
+ state.anchorMap = {};
+
+ while ((ch = state.input.charCodeAt(state.position)) !== 0) {
+ skipSeparationSpace(state, true, -1);
+
+ ch = state.input.charCodeAt(state.position);
+
+ if (state.lineIndent > 0 || ch !== 0x25/* % */) {
+ break;
+ }
+
+ hasDirectives = true;
+ ch = state.input.charCodeAt(++state.position);
+ _position = state.position;
+
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ directiveName = state.input.slice(_position, state.position);
+ directiveArgs = [];
+
+ if (directiveName.length < 1) {
+ throwError(state, 'directive name must not be less than one character in length');
+ }
+
+ while (ch !== 0) {
+ while (is_WHITE_SPACE(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ if (ch === 0x23/* # */) {
+ do { ch = state.input.charCodeAt(++state.position); }
+ while (ch !== 0 && !is_EOL(ch));
+ break;
+ }
+
+ if (is_EOL(ch)) break;
+
+ _position = state.position;
+
+ while (ch !== 0 && !is_WS_OR_EOL(ch)) {
+ ch = state.input.charCodeAt(++state.position);
+ }
+
+ directiveArgs.push(state.input.slice(_position, state.position));
+ }
+
+ if (ch !== 0) readLineBreak(state);
+
+ if (_hasOwnProperty.call(directiveHandlers, directiveName)) {
+ directiveHandlers[directiveName](state, directiveName, directiveArgs);
+ } else {
+ throwWarning(state, 'unknown document directive "' + directiveName + '"');
+ }
+ }
+
+ skipSeparationSpace(state, true, -1);
+
+ if (state.lineIndent === 0 &&
+ state.input.charCodeAt(state.position) === 0x2D/* - */ &&
+ state.input.charCodeAt(state.position + 1) === 0x2D/* - */ &&
+ state.input.charCodeAt(state.position + 2) === 0x2D/* - */) {
+ state.position += 3;
+ skipSeparationSpace(state, true, -1);
+
+ } else if (hasDirectives) {
+ throwError(state, 'directives end mark is expected');
+ }
+
+ composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true);
+ skipSeparationSpace(state, true, -1);
+
+ if (state.checkLineBreaks &&
+ PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) {
+ throwWarning(state, 'non-ASCII line breaks are interpreted as content');
+ }
+
+ state.documents.push(state.result);
+
+ if (state.position === state.lineStart && testDocumentSeparator(state)) {
+
+ if (state.input.charCodeAt(state.position) === 0x2E/* . */) {
+ state.position += 3;
+ skipSeparationSpace(state, true, -1);
+ }
+ return;
+ }
+
+ if (state.position < (state.length - 1)) {
+ throwError(state, 'end of the stream or a document separator is expected');
+ } else {
+ return;
+ }
+}
+
+
+function loadDocuments(input, options) {
+ input = String(input);
+ options = options || {};
+
+ if (input.length !== 0) {
+
+ // Add tailing `\n` if not exists
+ if (input.charCodeAt(input.length - 1) !== 0x0A/* LF */ &&
+ input.charCodeAt(input.length - 1) !== 0x0D/* CR */) {
+ input += '\n';
+ }
+
+ // Strip BOM
+ if (input.charCodeAt(0) === 0xFEFF) {
+ input = input.slice(1);
+ }
+ }
+
+ var state = new State(input, options);
+
+ // Use 0 as string terminator. That significantly simplifies bounds check.
+ state.input += '\0';
+
+ while (state.input.charCodeAt(state.position) === 0x20/* Space */) {
+ state.lineIndent += 1;
+ state.position += 1;
+ }
+
+ while (state.position < (state.length - 1)) {
+ readDocument(state);
+ }
+
+ return state.documents;
+}
+
+
+function loadAll(input, iterator, options) {
+ var documents = loadDocuments(input, options), index, length;
+
+ if (typeof iterator !== 'function') {
+ return documents;
+ }
+
+ for (index = 0, length = documents.length; index < length; index += 1) {
+ iterator(documents[index]);
+ }
+}
+
+
+function load(input, options) {
+ var documents = loadDocuments(input, options);
+
+ if (documents.length === 0) {
+ /*eslint-disable no-undefined*/
+ return undefined;
+ } else if (documents.length === 1) {
+ return documents[0];
+ }
+ throw new YAMLException('expected a single document in the stream, but found more');
+}
+
+
+function safeLoadAll(input, output, options) {
+ if (typeof output === 'function') {
+ loadAll(input, output, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
+ } else {
+ return loadAll(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
+ }
+}
+
+
+function safeLoad(input, options) {
+ return load(input, common.extend({ schema: DEFAULT_SAFE_SCHEMA }, options));
+}
+
+
+module.exports.loadAll = loadAll;
+module.exports.load = load;
+module.exports.safeLoadAll = safeLoadAll;
+module.exports.safeLoad = safeLoad;
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/mark.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/mark.js
new file mode 100644
index 0000000000..47b265c20c
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/mark.js
@@ -0,0 +1,76 @@
+'use strict';
+
+
+var common = require('./common');
+
+
+function Mark(name, buffer, position, line, column) {
+ this.name = name;
+ this.buffer = buffer;
+ this.position = position;
+ this.line = line;
+ this.column = column;
+}
+
+
+Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
+ var head, start, tail, end, snippet;
+
+ if (!this.buffer) return null;
+
+ indent = indent || 4;
+ maxLength = maxLength || 75;
+
+ head = '';
+ start = this.position;
+
+ while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) {
+ start -= 1;
+ if (this.position - start > (maxLength / 2 - 1)) {
+ head = ' ... ';
+ start += 5;
+ break;
+ }
+ }
+
+ tail = '';
+ end = this.position;
+
+ while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) {
+ end += 1;
+ if (end - this.position > (maxLength / 2 - 1)) {
+ tail = ' ... ';
+ end -= 5;
+ break;
+ }
+ }
+
+ snippet = this.buffer.slice(start, end);
+
+ return common.repeat(' ', indent) + head + snippet + tail + '\n' +
+ common.repeat(' ', indent + this.position - start + head.length) + '^';
+};
+
+
+Mark.prototype.toString = function toString(compact) {
+ var snippet, where = '';
+
+ if (this.name) {
+ where += 'in "' + this.name + '" ';
+ }
+
+ where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1);
+
+ if (!compact) {
+ snippet = this.getSnippet();
+
+ if (snippet) {
+ where += ':\n' + snippet;
+ }
+ }
+
+ return where;
+};
+
+
+module.exports = Mark;
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/schema.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/schema.js
new file mode 100644
index 0000000000..ca7cf47e70
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/schema.js
@@ -0,0 +1,108 @@
+'use strict';
+
+/*eslint-disable max-len*/
+
+var common = require('./common');
+var YAMLException = require('./exception');
+var Type = require('./type');
+
+
+function compileList(schema, name, result) {
+ var exclude = [];
+
+ schema.include.forEach(function (includedSchema) {
+ result = compileList(includedSchema, name, result);
+ });
+
+ schema[name].forEach(function (currentType) {
+ result.forEach(function (previousType, previousIndex) {
+ if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) {
+ exclude.push(previousIndex);
+ }
+ });
+
+ result.push(currentType);
+ });
+
+ return result.filter(function (type, index) {
+ return exclude.indexOf(index) === -1;
+ });
+}
+
+
+function compileMap(/* lists... */) {
+ var result = {
+ scalar: {},
+ sequence: {},
+ mapping: {},
+ fallback: {}
+ }, index, length;
+
+ function collectType(type) {
+ result[type.kind][type.tag] = result['fallback'][type.tag] = type;
+ }
+
+ for (index = 0, length = arguments.length; index < length; index += 1) {
+ arguments[index].forEach(collectType);
+ }
+ return result;
+}
+
+
+function Schema(definition) {
+ this.include = definition.include || [];
+ this.implicit = definition.implicit || [];
+ this.explicit = definition.explicit || [];
+
+ this.implicit.forEach(function (type) {
+ if (type.loadKind && type.loadKind !== 'scalar') {
+ throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.');
+ }
+ });
+
+ this.compiledImplicit = compileList(this, 'implicit', []);
+ this.compiledExplicit = compileList(this, 'explicit', []);
+ this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit);
+}
+
+
+Schema.DEFAULT = null;
+
+
+Schema.create = function createSchema() {
+ var schemas, types;
+
+ switch (arguments.length) {
+ case 1:
+ schemas = Schema.DEFAULT;
+ types = arguments[0];
+ break;
+
+ case 2:
+ schemas = arguments[0];
+ types = arguments[1];
+ break;
+
+ default:
+ throw new YAMLException('Wrong number of arguments for Schema.create function');
+ }
+
+ schemas = common.toArray(schemas);
+ types = common.toArray(types);
+
+ if (!schemas.every(function (schema) { return schema instanceof Schema; })) {
+ throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.');
+ }
+
+ if (!types.every(function (type) { return type instanceof Type; })) {
+ throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.');
+ }
+
+ return new Schema({
+ include: schemas,
+ explicit: types
+ });
+};
+
+
+module.exports = Schema;
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/schema/core.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/schema/core.js
new file mode 100644
index 0000000000..206daab56c
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/schema/core.js
@@ -0,0 +1,18 @@
+// Standard YAML's Core schema.
+// http://www.yaml.org/spec/1.2/spec.html#id2804923
+//
+// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
+// So, Core schema has no distinctions from JSON schema is JS-YAML.
+
+
+'use strict';
+
+
+var Schema = require('../schema');
+
+
+module.exports = new Schema({
+ include: [
+ require('./json')
+ ]
+});
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/schema/default_full.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/schema/default_full.js
new file mode 100644
index 0000000000..a55ef42acc
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/schema/default_full.js
@@ -0,0 +1,25 @@
+// JS-YAML's default schema for `load` function.
+// It is not described in the YAML specification.
+//
+// This schema is based on JS-YAML's default safe schema and includes
+// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function.
+//
+// Also this schema is used as default base schema at `Schema.create` function.
+
+
+'use strict';
+
+
+var Schema = require('../schema');
+
+
+module.exports = Schema.DEFAULT = new Schema({
+ include: [
+ require('./default_safe')
+ ],
+ explicit: [
+ require('../type/js/undefined'),
+ require('../type/js/regexp'),
+ require('../type/js/function')
+ ]
+});
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js
new file mode 100644
index 0000000000..11d89bbfbb
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js
@@ -0,0 +1,28 @@
+// JS-YAML's default schema for `safeLoad` function.
+// It is not described in the YAML specification.
+//
+// This schema is based on standard YAML's Core schema and includes most of
+// extra types described at YAML tag repository. (http://yaml.org/type/)
+
+
+'use strict';
+
+
+var Schema = require('../schema');
+
+
+module.exports = new Schema({
+ include: [
+ require('./core')
+ ],
+ implicit: [
+ require('../type/timestamp'),
+ require('../type/merge')
+ ],
+ explicit: [
+ require('../type/binary'),
+ require('../type/omap'),
+ require('../type/pairs'),
+ require('../type/set')
+ ]
+});
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js
new file mode 100644
index 0000000000..b7a33eb7a1
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js
@@ -0,0 +1,17 @@
+// Standard YAML's Failsafe schema.
+// http://www.yaml.org/spec/1.2/spec.html#id2802346
+
+
+'use strict';
+
+
+var Schema = require('../schema');
+
+
+module.exports = new Schema({
+ explicit: [
+ require('../type/str'),
+ require('../type/seq'),
+ require('../type/map')
+ ]
+});
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/schema/json.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/schema/json.js
new file mode 100644
index 0000000000..5be3dbf805
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/schema/json.js
@@ -0,0 +1,25 @@
+// Standard YAML's JSON schema.
+// http://www.yaml.org/spec/1.2/spec.html#id2803231
+//
+// NOTE: JS-YAML does not support schema-specific tag resolution restrictions.
+// So, this schema is not such strict as defined in the YAML specification.
+// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc.
+
+
+'use strict';
+
+
+var Schema = require('../schema');
+
+
+module.exports = new Schema({
+ include: [
+ require('./failsafe')
+ ],
+ implicit: [
+ require('../type/null'),
+ require('../type/bool'),
+ require('../type/int'),
+ require('../type/float')
+ ]
+});
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/type.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/type.js
new file mode 100644
index 0000000000..90b702ac06
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/type.js
@@ -0,0 +1,61 @@
+'use strict';
+
+var YAMLException = require('./exception');
+
+var TYPE_CONSTRUCTOR_OPTIONS = [
+ 'kind',
+ 'resolve',
+ 'construct',
+ 'instanceOf',
+ 'predicate',
+ 'represent',
+ 'defaultStyle',
+ 'styleAliases'
+];
+
+var YAML_NODE_KINDS = [
+ 'scalar',
+ 'sequence',
+ 'mapping'
+];
+
+function compileStyleAliases(map) {
+ var result = {};
+
+ if (map !== null) {
+ Object.keys(map).forEach(function (style) {
+ map[style].forEach(function (alias) {
+ result[String(alias)] = style;
+ });
+ });
+ }
+
+ return result;
+}
+
+function Type(tag, options) {
+ options = options || {};
+
+ Object.keys(options).forEach(function (name) {
+ if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) {
+ throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.');
+ }
+ });
+
+ // TODO: Add tag format check.
+ this.tag = tag;
+ this.kind = options['kind'] || null;
+ this.resolve = options['resolve'] || function () { return true; };
+ this.construct = options['construct'] || function (data) { return data; };
+ this.instanceOf = options['instanceOf'] || null;
+ this.predicate = options['predicate'] || null;
+ this.represent = options['represent'] || null;
+ this.defaultStyle = options['defaultStyle'] || null;
+ this.styleAliases = compileStyleAliases(options['styleAliases'] || null);
+
+ if (YAML_NODE_KINDS.indexOf(this.kind) === -1) {
+ throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.');
+ }
+}
+
+module.exports = Type;
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/type/binary.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/binary.js
new file mode 100644
index 0000000000..10b1875595
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/binary.js
@@ -0,0 +1,138 @@
+'use strict';
+
+/*eslint-disable no-bitwise*/
+
+var NodeBuffer;
+
+try {
+ // A trick for browserified version, to not include `Buffer` shim
+ var _require = require;
+ NodeBuffer = _require('buffer').Buffer;
+} catch (__) {}
+
+var Type = require('../type');
+
+
+// [ 64, 65, 66 ] -> [ padding, CR, LF ]
+var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r';
+
+
+function resolveYamlBinary(data) {
+ if (data === null) return false;
+
+ var code, idx, bitlen = 0, max = data.length, map = BASE64_MAP;
+
+ // Convert one by one.
+ for (idx = 0; idx < max; idx++) {
+ code = map.indexOf(data.charAt(idx));
+
+ // Skip CR/LF
+ if (code > 64) continue;
+
+ // Fail on illegal characters
+ if (code < 0) return false;
+
+ bitlen += 6;
+ }
+
+ // If there are any bits left, source was corrupted
+ return (bitlen % 8) === 0;
+}
+
+function constructYamlBinary(data) {
+ var idx, tailbits,
+ input = data.replace(/[\r\n=]/g, ''), // remove CR/LF & padding to simplify scan
+ max = input.length,
+ map = BASE64_MAP,
+ bits = 0,
+ result = [];
+
+ // Collect by 6*4 bits (3 bytes)
+
+ for (idx = 0; idx < max; idx++) {
+ if ((idx % 4 === 0) && idx) {
+ result.push((bits >> 16) & 0xFF);
+ result.push((bits >> 8) & 0xFF);
+ result.push(bits & 0xFF);
+ }
+
+ bits = (bits << 6) | map.indexOf(input.charAt(idx));
+ }
+
+ // Dump tail
+
+ tailbits = (max % 4) * 6;
+
+ if (tailbits === 0) {
+ result.push((bits >> 16) & 0xFF);
+ result.push((bits >> 8) & 0xFF);
+ result.push(bits & 0xFF);
+ } else if (tailbits === 18) {
+ result.push((bits >> 10) & 0xFF);
+ result.push((bits >> 2) & 0xFF);
+ } else if (tailbits === 12) {
+ result.push((bits >> 4) & 0xFF);
+ }
+
+ // Wrap into Buffer for NodeJS and leave Array for browser
+ if (NodeBuffer) {
+ // Support node 6.+ Buffer API when available
+ return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result);
+ }
+
+ return result;
+}
+
+function representYamlBinary(object /*, style*/) {
+ var result = '', bits = 0, idx, tail,
+ max = object.length,
+ map = BASE64_MAP;
+
+ // Convert every three bytes to 4 ASCII characters.
+
+ for (idx = 0; idx < max; idx++) {
+ if ((idx % 3 === 0) && idx) {
+ result += map[(bits >> 18) & 0x3F];
+ result += map[(bits >> 12) & 0x3F];
+ result += map[(bits >> 6) & 0x3F];
+ result += map[bits & 0x3F];
+ }
+
+ bits = (bits << 8) + object[idx];
+ }
+
+ // Dump tail
+
+ tail = max % 3;
+
+ if (tail === 0) {
+ result += map[(bits >> 18) & 0x3F];
+ result += map[(bits >> 12) & 0x3F];
+ result += map[(bits >> 6) & 0x3F];
+ result += map[bits & 0x3F];
+ } else if (tail === 2) {
+ result += map[(bits >> 10) & 0x3F];
+ result += map[(bits >> 4) & 0x3F];
+ result += map[(bits << 2) & 0x3F];
+ result += map[64];
+ } else if (tail === 1) {
+ result += map[(bits >> 2) & 0x3F];
+ result += map[(bits << 4) & 0x3F];
+ result += map[64];
+ result += map[64];
+ }
+
+ return result;
+}
+
+function isBinary(object) {
+ return NodeBuffer && NodeBuffer.isBuffer(object);
+}
+
+module.exports = new Type('tag:yaml.org,2002:binary', {
+ kind: 'scalar',
+ resolve: resolveYamlBinary,
+ construct: constructYamlBinary,
+ predicate: isBinary,
+ represent: representYamlBinary
+});
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/type/bool.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/bool.js
new file mode 100644
index 0000000000..cb7745930a
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/bool.js
@@ -0,0 +1,35 @@
+'use strict';
+
+var Type = require('../type');
+
+function resolveYamlBoolean(data) {
+ if (data === null) return false;
+
+ var max = data.length;
+
+ return (max === 4 && (data === 'true' || data === 'True' || data === 'TRUE')) ||
+ (max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'));
+}
+
+function constructYamlBoolean(data) {
+ return data === 'true' ||
+ data === 'True' ||
+ data === 'TRUE';
+}
+
+function isBoolean(object) {
+ return Object.prototype.toString.call(object) === '[object Boolean]';
+}
+
+module.exports = new Type('tag:yaml.org,2002:bool', {
+ kind: 'scalar',
+ resolve: resolveYamlBoolean,
+ construct: constructYamlBoolean,
+ predicate: isBoolean,
+ represent: {
+ lowercase: function (object) { return object ? 'true' : 'false'; },
+ uppercase: function (object) { return object ? 'TRUE' : 'FALSE'; },
+ camelcase: function (object) { return object ? 'True' : 'False'; }
+ },
+ defaultStyle: 'lowercase'
+});
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/type/float.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/float.js
new file mode 100644
index 0000000000..127671b213
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/float.js
@@ -0,0 +1,116 @@
+'use strict';
+
+var common = require('../common');
+var Type = require('../type');
+
+var YAML_FLOAT_PATTERN = new RegExp(
+ // 2.5e4, 2.5 and integers
+ '^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' +
+ // .2e4, .2
+ // special case, seems not from spec
+ '|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' +
+ // 20:59
+ '|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' +
+ // .inf
+ '|[-+]?\\.(?:inf|Inf|INF)' +
+ // .nan
+ '|\\.(?:nan|NaN|NAN))$');
+
+function resolveYamlFloat(data) {
+ if (data === null) return false;
+
+ if (!YAML_FLOAT_PATTERN.test(data) ||
+ // Quick hack to not allow integers end with `_`
+ // Probably should update regexp & check speed
+ data[data.length - 1] === '_') {
+ return false;
+ }
+
+ return true;
+}
+
+function constructYamlFloat(data) {
+ var value, sign, base, digits;
+
+ value = data.replace(/_/g, '').toLowerCase();
+ sign = value[0] === '-' ? -1 : 1;
+ digits = [];
+
+ if ('+-'.indexOf(value[0]) >= 0) {
+ value = value.slice(1);
+ }
+
+ if (value === '.inf') {
+ return (sign === 1) ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY;
+
+ } else if (value === '.nan') {
+ return NaN;
+
+ } else if (value.indexOf(':') >= 0) {
+ value.split(':').forEach(function (v) {
+ digits.unshift(parseFloat(v, 10));
+ });
+
+ value = 0.0;
+ base = 1;
+
+ digits.forEach(function (d) {
+ value += d * base;
+ base *= 60;
+ });
+
+ return sign * value;
+
+ }
+ return sign * parseFloat(value, 10);
+}
+
+
+var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/;
+
+function representYamlFloat(object, style) {
+ var res;
+
+ if (isNaN(object)) {
+ switch (style) {
+ case 'lowercase': return '.nan';
+ case 'uppercase': return '.NAN';
+ case 'camelcase': return '.NaN';
+ }
+ } else if (Number.POSITIVE_INFINITY === object) {
+ switch (style) {
+ case 'lowercase': return '.inf';
+ case 'uppercase': return '.INF';
+ case 'camelcase': return '.Inf';
+ }
+ } else if (Number.NEGATIVE_INFINITY === object) {
+ switch (style) {
+ case 'lowercase': return '-.inf';
+ case 'uppercase': return '-.INF';
+ case 'camelcase': return '-.Inf';
+ }
+ } else if (common.isNegativeZero(object)) {
+ return '-0.0';
+ }
+
+ res = object.toString(10);
+
+ // JS stringifier can build scientific format without dots: 5e-100,
+ // while YAML requres dot: 5.e-100. Fix it with simple hack
+
+ return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res;
+}
+
+function isFloat(object) {
+ return (Object.prototype.toString.call(object) === '[object Number]') &&
+ (object % 1 !== 0 || common.isNegativeZero(object));
+}
+
+module.exports = new Type('tag:yaml.org,2002:float', {
+ kind: 'scalar',
+ resolve: resolveYamlFloat,
+ construct: constructYamlFloat,
+ predicate: isFloat,
+ represent: representYamlFloat,
+ defaultStyle: 'lowercase'
+});
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/type/int.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/int.js
new file mode 100644
index 0000000000..ba61c5f958
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/int.js
@@ -0,0 +1,173 @@
+'use strict';
+
+var common = require('../common');
+var Type = require('../type');
+
+function isHexCode(c) {
+ return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */)) ||
+ ((0x41/* A */ <= c) && (c <= 0x46/* F */)) ||
+ ((0x61/* a */ <= c) && (c <= 0x66/* f */));
+}
+
+function isOctCode(c) {
+ return ((0x30/* 0 */ <= c) && (c <= 0x37/* 7 */));
+}
+
+function isDecCode(c) {
+ return ((0x30/* 0 */ <= c) && (c <= 0x39/* 9 */));
+}
+
+function resolveYamlInteger(data) {
+ if (data === null) return false;
+
+ var max = data.length,
+ index = 0,
+ hasDigits = false,
+ ch;
+
+ if (!max) return false;
+
+ ch = data[index];
+
+ // sign
+ if (ch === '-' || ch === '+') {
+ ch = data[++index];
+ }
+
+ if (ch === '0') {
+ // 0
+ if (index + 1 === max) return true;
+ ch = data[++index];
+
+ // base 2, base 8, base 16
+
+ if (ch === 'b') {
+ // base 2
+ index++;
+
+ for (; index < max; index++) {
+ ch = data[index];
+ if (ch === '_') continue;
+ if (ch !== '0' && ch !== '1') return false;
+ hasDigits = true;
+ }
+ return hasDigits && ch !== '_';
+ }
+
+
+ if (ch === 'x') {
+ // base 16
+ index++;
+
+ for (; index < max; index++) {
+ ch = data[index];
+ if (ch === '_') continue;
+ if (!isHexCode(data.charCodeAt(index))) return false;
+ hasDigits = true;
+ }
+ return hasDigits && ch !== '_';
+ }
+
+ // base 8
+ for (; index < max; index++) {
+ ch = data[index];
+ if (ch === '_') continue;
+ if (!isOctCode(data.charCodeAt(index))) return false;
+ hasDigits = true;
+ }
+ return hasDigits && ch !== '_';
+ }
+
+ // base 10 (except 0) or base 60
+
+ // value should not start with `_`;
+ if (ch === '_') return false;
+
+ for (; index < max; index++) {
+ ch = data[index];
+ if (ch === '_') continue;
+ if (ch === ':') break;
+ if (!isDecCode(data.charCodeAt(index))) {
+ return false;
+ }
+ hasDigits = true;
+ }
+
+ // Should have digits and should not end with `_`
+ if (!hasDigits || ch === '_') return false;
+
+ // if !base60 - done;
+ if (ch !== ':') return true;
+
+ // base60 almost not used, no needs to optimize
+ return /^(:[0-5]?[0-9])+$/.test(data.slice(index));
+}
+
+function constructYamlInteger(data) {
+ var value = data, sign = 1, ch, base, digits = [];
+
+ if (value.indexOf('_') !== -1) {
+ value = value.replace(/_/g, '');
+ }
+
+ ch = value[0];
+
+ if (ch === '-' || ch === '+') {
+ if (ch === '-') sign = -1;
+ value = value.slice(1);
+ ch = value[0];
+ }
+
+ if (value === '0') return 0;
+
+ if (ch === '0') {
+ if (value[1] === 'b') return sign * parseInt(value.slice(2), 2);
+ if (value[1] === 'x') return sign * parseInt(value, 16);
+ return sign * parseInt(value, 8);
+ }
+
+ if (value.indexOf(':') !== -1) {
+ value.split(':').forEach(function (v) {
+ digits.unshift(parseInt(v, 10));
+ });
+
+ value = 0;
+ base = 1;
+
+ digits.forEach(function (d) {
+ value += (d * base);
+ base *= 60;
+ });
+
+ return sign * value;
+
+ }
+
+ return sign * parseInt(value, 10);
+}
+
+function isInteger(object) {
+ return (Object.prototype.toString.call(object)) === '[object Number]' &&
+ (object % 1 === 0 && !common.isNegativeZero(object));
+}
+
+module.exports = new Type('tag:yaml.org,2002:int', {
+ kind: 'scalar',
+ resolve: resolveYamlInteger,
+ construct: constructYamlInteger,
+ predicate: isInteger,
+ represent: {
+ binary: function (obj) { return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); },
+ octal: function (obj) { return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); },
+ decimal: function (obj) { return obj.toString(10); },
+ /* eslint-disable max-len */
+ hexadecimal: function (obj) { return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); }
+ },
+ defaultStyle: 'decimal',
+ styleAliases: {
+ binary: [ 2, 'bin' ],
+ octal: [ 8, 'oct' ],
+ decimal: [ 10, 'dec' ],
+ hexadecimal: [ 16, 'hex' ]
+ }
+});
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/type/js/function.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/js/function.js
new file mode 100644
index 0000000000..ba2dfd45b6
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/js/function.js
@@ -0,0 +1,86 @@
+'use strict';
+
+var esprima;
+
+// Browserified version does not have esprima
+//
+// 1. For node.js just require module as deps
+// 2. For browser try to require mudule via external AMD system.
+// If not found - try to fallback to window.esprima. If not
+// found too - then fail to parse.
+//
+try {
+ // workaround to exclude package from browserify list.
+ var _require = require;
+ esprima = _require('esprima');
+} catch (_) {
+ /*global window */
+ if (typeof window !== 'undefined') esprima = window.esprima;
+}
+
+var Type = require('../../type');
+
+function resolveJavascriptFunction(data) {
+ if (data === null) return false;
+
+ try {
+ var source = '(' + data + ')',
+ ast = esprima.parse(source, { range: true });
+
+ if (ast.type !== 'Program' ||
+ ast.body.length !== 1 ||
+ ast.body[0].type !== 'ExpressionStatement' ||
+ (ast.body[0].expression.type !== 'ArrowFunctionExpression' &&
+ ast.body[0].expression.type !== 'FunctionExpression')) {
+ return false;
+ }
+
+ return true;
+ } catch (err) {
+ return false;
+ }
+}
+
+function constructJavascriptFunction(data) {
+ /*jslint evil:true*/
+
+ var source = '(' + data + ')',
+ ast = esprima.parse(source, { range: true }),
+ params = [],
+ body;
+
+ if (ast.type !== 'Program' ||
+ ast.body.length !== 1 ||
+ ast.body[0].type !== 'ExpressionStatement' ||
+ (ast.body[0].expression.type !== 'ArrowFunctionExpression' &&
+ ast.body[0].expression.type !== 'FunctionExpression')) {
+ throw new Error('Failed to resolve function');
+ }
+
+ ast.body[0].expression.params.forEach(function (param) {
+ params.push(param.name);
+ });
+
+ body = ast.body[0].expression.body.range;
+
+ // Esprima's ranges include the first '{' and the last '}' characters on
+ // function expressions. So cut them out.
+ /*eslint-disable no-new-func*/
+ return new Function(params, source.slice(body[0] + 1, body[1] - 1));
+}
+
+function representJavascriptFunction(object /*, style*/) {
+ return object.toString();
+}
+
+function isFunction(object) {
+ return Object.prototype.toString.call(object) === '[object Function]';
+}
+
+module.exports = new Type('tag:yaml.org,2002:js/function', {
+ kind: 'scalar',
+ resolve: resolveJavascriptFunction,
+ construct: constructJavascriptFunction,
+ predicate: isFunction,
+ represent: representJavascriptFunction
+});
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js
new file mode 100644
index 0000000000..43fa470176
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js
@@ -0,0 +1,60 @@
+'use strict';
+
+var Type = require('../../type');
+
+function resolveJavascriptRegExp(data) {
+ if (data === null) return false;
+ if (data.length === 0) return false;
+
+ var regexp = data,
+ tail = /\/([gim]*)$/.exec(data),
+ modifiers = '';
+
+ // if regexp starts with '/' it can have modifiers and must be properly closed
+ // `/foo/gim` - modifiers tail can be maximum 3 chars
+ if (regexp[0] === '/') {
+ if (tail) modifiers = tail[1];
+
+ if (modifiers.length > 3) return false;
+ // if expression starts with /, is should be properly terminated
+ if (regexp[regexp.length - modifiers.length - 1] !== '/') return false;
+ }
+
+ return true;
+}
+
+function constructJavascriptRegExp(data) {
+ var regexp = data,
+ tail = /\/([gim]*)$/.exec(data),
+ modifiers = '';
+
+ // `/foo/gim` - tail can be maximum 4 chars
+ if (regexp[0] === '/') {
+ if (tail) modifiers = tail[1];
+ regexp = regexp.slice(1, regexp.length - modifiers.length - 1);
+ }
+
+ return new RegExp(regexp, modifiers);
+}
+
+function representJavascriptRegExp(object /*, style*/) {
+ var result = '/' + object.source + '/';
+
+ if (object.global) result += 'g';
+ if (object.multiline) result += 'm';
+ if (object.ignoreCase) result += 'i';
+
+ return result;
+}
+
+function isRegExp(object) {
+ return Object.prototype.toString.call(object) === '[object RegExp]';
+}
+
+module.exports = new Type('tag:yaml.org,2002:js/regexp', {
+ kind: 'scalar',
+ resolve: resolveJavascriptRegExp,
+ construct: constructJavascriptRegExp,
+ predicate: isRegExp,
+ represent: representJavascriptRegExp
+});
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js
new file mode 100644
index 0000000000..95b5569fdf
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js
@@ -0,0 +1,28 @@
+'use strict';
+
+var Type = require('../../type');
+
+function resolveJavascriptUndefined() {
+ return true;
+}
+
+function constructJavascriptUndefined() {
+ /*eslint-disable no-undefined*/
+ return undefined;
+}
+
+function representJavascriptUndefined() {
+ return '';
+}
+
+function isUndefined(object) {
+ return typeof object === 'undefined';
+}
+
+module.exports = new Type('tag:yaml.org,2002:js/undefined', {
+ kind: 'scalar',
+ resolve: resolveJavascriptUndefined,
+ construct: constructJavascriptUndefined,
+ predicate: isUndefined,
+ represent: representJavascriptUndefined
+});
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/type/map.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/map.js
new file mode 100644
index 0000000000..f327beebd5
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/map.js
@@ -0,0 +1,8 @@
+'use strict';
+
+var Type = require('../type');
+
+module.exports = new Type('tag:yaml.org,2002:map', {
+ kind: 'mapping',
+ construct: function (data) { return data !== null ? data : {}; }
+});
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/type/merge.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/merge.js
new file mode 100644
index 0000000000..ae08a86444
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/merge.js
@@ -0,0 +1,12 @@
+'use strict';
+
+var Type = require('../type');
+
+function resolveYamlMerge(data) {
+ return data === '<<' || data === null;
+}
+
+module.exports = new Type('tag:yaml.org,2002:merge', {
+ kind: 'scalar',
+ resolve: resolveYamlMerge
+});
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/type/null.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/null.js
new file mode 100644
index 0000000000..6874daa647
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/null.js
@@ -0,0 +1,34 @@
+'use strict';
+
+var Type = require('../type');
+
+function resolveYamlNull(data) {
+ if (data === null) return true;
+
+ var max = data.length;
+
+ return (max === 1 && data === '~') ||
+ (max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'));
+}
+
+function constructYamlNull() {
+ return null;
+}
+
+function isNull(object) {
+ return object === null;
+}
+
+module.exports = new Type('tag:yaml.org,2002:null', {
+ kind: 'scalar',
+ resolve: resolveYamlNull,
+ construct: constructYamlNull,
+ predicate: isNull,
+ represent: {
+ canonical: function () { return '~'; },
+ lowercase: function () { return 'null'; },
+ uppercase: function () { return 'NULL'; },
+ camelcase: function () { return 'Null'; }
+ },
+ defaultStyle: 'lowercase'
+});
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/type/omap.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/omap.js
new file mode 100644
index 0000000000..b2b5323bd1
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/omap.js
@@ -0,0 +1,44 @@
+'use strict';
+
+var Type = require('../type');
+
+var _hasOwnProperty = Object.prototype.hasOwnProperty;
+var _toString = Object.prototype.toString;
+
+function resolveYamlOmap(data) {
+ if (data === null) return true;
+
+ var objectKeys = [], index, length, pair, pairKey, pairHasKey,
+ object = data;
+
+ for (index = 0, length = object.length; index < length; index += 1) {
+ pair = object[index];
+ pairHasKey = false;
+
+ if (_toString.call(pair) !== '[object Object]') return false;
+
+ for (pairKey in pair) {
+ if (_hasOwnProperty.call(pair, pairKey)) {
+ if (!pairHasKey) pairHasKey = true;
+ else return false;
+ }
+ }
+
+ if (!pairHasKey) return false;
+
+ if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);
+ else return false;
+ }
+
+ return true;
+}
+
+function constructYamlOmap(data) {
+ return data !== null ? data : [];
+}
+
+module.exports = new Type('tag:yaml.org,2002:omap', {
+ kind: 'sequence',
+ resolve: resolveYamlOmap,
+ construct: constructYamlOmap
+});
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/type/pairs.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/pairs.js
new file mode 100644
index 0000000000..74b52403fc
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/pairs.js
@@ -0,0 +1,53 @@
+'use strict';
+
+var Type = require('../type');
+
+var _toString = Object.prototype.toString;
+
+function resolveYamlPairs(data) {
+ if (data === null) return true;
+
+ var index, length, pair, keys, result,
+ object = data;
+
+ result = new Array(object.length);
+
+ for (index = 0, length = object.length; index < length; index += 1) {
+ pair = object[index];
+
+ if (_toString.call(pair) !== '[object Object]') return false;
+
+ keys = Object.keys(pair);
+
+ if (keys.length !== 1) return false;
+
+ result[index] = [ keys[0], pair[keys[0]] ];
+ }
+
+ return true;
+}
+
+function constructYamlPairs(data) {
+ if (data === null) return [];
+
+ var index, length, pair, keys, result,
+ object = data;
+
+ result = new Array(object.length);
+
+ for (index = 0, length = object.length; index < length; index += 1) {
+ pair = object[index];
+
+ keys = Object.keys(pair);
+
+ result[index] = [ keys[0], pair[keys[0]] ];
+ }
+
+ return result;
+}
+
+module.exports = new Type('tag:yaml.org,2002:pairs', {
+ kind: 'sequence',
+ resolve: resolveYamlPairs,
+ construct: constructYamlPairs
+});
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/type/seq.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/seq.js
new file mode 100644
index 0000000000..be8f77f284
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/seq.js
@@ -0,0 +1,8 @@
+'use strict';
+
+var Type = require('../type');
+
+module.exports = new Type('tag:yaml.org,2002:seq', {
+ kind: 'sequence',
+ construct: function (data) { return data !== null ? data : []; }
+});
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/type/set.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/set.js
new file mode 100644
index 0000000000..f885a329c2
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/set.js
@@ -0,0 +1,29 @@
+'use strict';
+
+var Type = require('../type');
+
+var _hasOwnProperty = Object.prototype.hasOwnProperty;
+
+function resolveYamlSet(data) {
+ if (data === null) return true;
+
+ var key, object = data;
+
+ for (key in object) {
+ if (_hasOwnProperty.call(object, key)) {
+ if (object[key] !== null) return false;
+ }
+ }
+
+ return true;
+}
+
+function constructYamlSet(data) {
+ return data !== null ? data : {};
+}
+
+module.exports = new Type('tag:yaml.org,2002:set', {
+ kind: 'mapping',
+ resolve: resolveYamlSet,
+ construct: constructYamlSet
+});
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/type/str.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/str.js
new file mode 100644
index 0000000000..27acc106ca
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/str.js
@@ -0,0 +1,8 @@
+'use strict';
+
+var Type = require('../type');
+
+module.exports = new Type('tag:yaml.org,2002:str', {
+ kind: 'scalar',
+ construct: function (data) { return data !== null ? data : ''; }
+});
diff --git a/tools/doc/node_modules/js-yaml/lib/js-yaml/type/timestamp.js b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/timestamp.js
new file mode 100644
index 0000000000..8fa9c58656
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/lib/js-yaml/type/timestamp.js
@@ -0,0 +1,88 @@
+'use strict';
+
+var Type = require('../type');
+
+var YAML_DATE_REGEXP = new RegExp(
+ '^([0-9][0-9][0-9][0-9])' + // [1] year
+ '-([0-9][0-9])' + // [2] month
+ '-([0-9][0-9])$'); // [3] day
+
+var YAML_TIMESTAMP_REGEXP = new RegExp(
+ '^([0-9][0-9][0-9][0-9])' + // [1] year
+ '-([0-9][0-9]?)' + // [2] month
+ '-([0-9][0-9]?)' + // [3] day
+ '(?:[Tt]|[ \\t]+)' + // ...
+ '([0-9][0-9]?)' + // [4] hour
+ ':([0-9][0-9])' + // [5] minute
+ ':([0-9][0-9])' + // [6] second
+ '(?:\\.([0-9]*))?' + // [7] fraction
+ '(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour
+ '(?::([0-9][0-9]))?))?$'); // [11] tz_minute
+
+function resolveYamlTimestamp(data) {
+ if (data === null) return false;
+ if (YAML_DATE_REGEXP.exec(data) !== null) return true;
+ if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true;
+ return false;
+}
+
+function constructYamlTimestamp(data) {
+ var match, year, month, day, hour, minute, second, fraction = 0,
+ delta = null, tz_hour, tz_minute, date;
+
+ match = YAML_DATE_REGEXP.exec(data);
+ if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data);
+
+ if (match === null) throw new Error('Date resolve error');
+
+ // match: [1] year [2] month [3] day
+
+ year = +(match[1]);
+ month = +(match[2]) - 1; // JS month starts with 0
+ day = +(match[3]);
+
+ if (!match[4]) { // no hour
+ return new Date(Date.UTC(year, month, day));
+ }
+
+ // match: [4] hour [5] minute [6] second [7] fraction
+
+ hour = +(match[4]);
+ minute = +(match[5]);
+ second = +(match[6]);
+
+ if (match[7]) {
+ fraction = match[7].slice(0, 3);
+ while (fraction.length < 3) { // milli-seconds
+ fraction += '0';
+ }
+ fraction = +fraction;
+ }
+
+ // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute
+
+ if (match[9]) {
+ tz_hour = +(match[10]);
+ tz_minute = +(match[11] || 0);
+ delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds
+ if (match[9] === '-') delta = -delta;
+ }
+
+ date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
+
+ if (delta) date.setTime(date.getTime() - delta);
+
+ return date;
+}
+
+function representYamlTimestamp(object /*, style*/) {
+ return object.toISOString();
+}
+
+module.exports = new Type('tag:yaml.org,2002:timestamp', {
+ kind: 'scalar',
+ resolve: resolveYamlTimestamp,
+ construct: constructYamlTimestamp,
+ instanceOf: Date,
+ represent: representYamlTimestamp
+});
diff --git a/tools/doc/node_modules/js-yaml/package.json b/tools/doc/node_modules/js-yaml/package.json
new file mode 100644
index 0000000000..0776bc5686
--- /dev/null
+++ b/tools/doc/node_modules/js-yaml/package.json
@@ -0,0 +1,96 @@
+{
+ "_args": [
+ [
+ "js-yaml@3.11.0",
+ "/Users/rubys/git/node/tools/doc"
+ ]
+ ],
+ "_development": true,
+ "_from": "js-yaml@3.11.0",
+ "_id": "js-yaml@3.11.0",
+ "_inBundle": false,
+ "_integrity": "sha512-saJstZWv7oNeOyBh3+Dx1qWzhW0+e6/8eDzo7p5rDFqxntSztloLtuKu+Ejhtq82jsilwOIZYsCz+lIjthg1Hw==",
+ "_location": "/js-yaml",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "version",
+ "registry": true,
+ "raw": "js-yaml@3.11.0",
+ "name": "js-yaml",
+ "escapedName": "js-yaml",
+ "rawSpec": "3.11.0",
+ "saveSpec": null,
+ "fetchSpec": "3.11.0"
+ },
+ "_requiredBy": [
+ "#DEV:/"
+ ],
+ "_resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.11.0.tgz",
+ "_spec": "3.11.0",
+ "_where": "/Users/rubys/git/node/tools/doc",
+ "author": {
+ "name": "Vladimir Zapparov",
+ "email": "dervus.grim@gmail.com"
+ },
+ "bin": {
+ "js-yaml": "bin/js-yaml.js"
+ },
+ "bugs": {
+ "url": "https://github.com/nodeca/js-yaml/issues"
+ },
+ "contributors": [
+ {
+ "name": "Aleksey V Zapparov",
+ "email": "ixti@member.fsf.org",
+ "url": "http://www.ixti.net/"
+ },
+ {
+ "name": "Vitaly Puzrin",
+ "email": "vitaly@rcdesign.ru",
+ "url": "https://github.com/puzrin"
+ },
+ {
+ "name": "Martin Grenfell",
+ "email": "martin.grenfell@gmail.com",
+ "url": "http://got-ravings.blogspot.com"
+ }
+ ],
+ "dependencies": {
+ "argparse": "^1.0.7",
+ "esprima": "^4.0.0"
+ },
+ "description": "YAML 1.2 parser and serializer",
+ "devDependencies": {
+ "ansi": "^0.3.1",
+ "benchmark": "^2.1.4",
+ "browserify": "^14.3.0",
+ "codemirror": "^5.13.4",
+ "eslint": "^4.1.1",
+ "istanbul": "^0.4.5",
+ "mocha": "^3.3.0",
+ "uglify-js": "^3.0.1"
+ },
+ "files": [
+ "index.js",
+ "lib/",
+ "bin/",
+ "dist/"
+ ],
+ "homepage": "https://github.com/nodeca/js-yaml",
+ "keywords": [
+ "yaml",
+ "parser",
+ "serializer",
+ "pyyaml"
+ ],
+ "license": "MIT",
+ "name": "js-yaml",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/nodeca/js-yaml.git"
+ },
+ "scripts": {
+ "test": "make test"
+ },
+ "version": "3.11.0"
+}
diff --git a/tools/doc/node_modules/marked/.npmignore b/tools/doc/node_modules/marked/.npmignore
deleted file mode 100644
index 3fb773c034..0000000000
--- a/tools/doc/node_modules/marked/.npmignore
+++ /dev/null
@@ -1,2 +0,0 @@
-.git*
-test/
diff --git a/tools/doc/node_modules/marked/.travis.yml b/tools/doc/node_modules/marked/.travis.yml
deleted file mode 100644
index 60d00ce140..0000000000
--- a/tools/doc/node_modules/marked/.travis.yml
+++ /dev/null
@@ -1,5 +0,0 @@
-language: node_js
-node_js:
- - "0.10"
- - "0.8"
- - "0.6"
diff --git a/tools/doc/node_modules/marked/Gulpfile.js b/tools/doc/node_modules/marked/Gulpfile.js
deleted file mode 100644
index cebc16a650..0000000000
--- a/tools/doc/node_modules/marked/Gulpfile.js
+++ /dev/null
@@ -1,22 +0,0 @@
-var gulp = require('gulp');
-var uglify = require('gulp-uglify');
-var concat = require('gulp-concat');
-
-var preserveFirstComment = function() {
- var set = false;
-
- return function() {
- if (set) return false;
- set = true;
- return true;
- };
-};
-
-gulp.task('uglify', function() {
- gulp.src('lib/marked.js')
- .pipe(uglify({preserveComments: preserveFirstComment()}))
- .pipe(concat('marked.min.js'))
- .pipe(gulp.dest('.'));
-});
-
-gulp.task('default', ['uglify']);
diff --git a/tools/doc/node_modules/marked/bower.json b/tools/doc/node_modules/marked/bower.json
deleted file mode 100644
index a2a8187759..0000000000
--- a/tools/doc/node_modules/marked/bower.json
+++ /dev/null
@@ -1,24 +0,0 @@
-{
- "name": "marked",
- "version": "0.3.4",
- "homepage": "https://github.com/chjj/marked",
- "authors": [
- "Christopher Jeffrey <chjjeffrey@gmail.com>"
- ],
- "description": "A markdown parser built for speed",
- "keywords": [
- "markdown",
- "markup",
- "html"
- ],
- "main": "lib/marked.js",
- "license": "MIT",
- "ignore": [
- "**/.*",
- "node_modules",
- "bower_components",
- "app/bower_components",
- "test",
- "tests"
- ]
-}
diff --git a/tools/doc/node_modules/marked/component.json b/tools/doc/node_modules/marked/component.json
deleted file mode 100644
index 1d672877f6..0000000000
--- a/tools/doc/node_modules/marked/component.json
+++ /dev/null
@@ -1,10 +0,0 @@
-{
- "name": "marked",
- "version": "0.3.4",
- "repo": "chjj/marked",
- "description": "A markdown parser built for speed",
- "keywords": ["markdown", "markup", "html"],
- "scripts": ["lib/marked.js"],
- "main": "lib/marked.js",
- "license": "MIT"
-}
diff --git a/tools/doc/node_modules/marked/doc/broken.md b/tools/doc/node_modules/marked/doc/broken.md
deleted file mode 100644
index 7bfa49e8a9..0000000000
--- a/tools/doc/node_modules/marked/doc/broken.md
+++ /dev/null
@@ -1,426 +0,0 @@
-# Markdown is broken
-
-I have a lot of scraps of markdown engine oddities that I've collected over the
-years. What you see below is slightly messy, but it's what I've managed to
-cobble together to illustrate the differences between markdown engines, and
-why, if there ever is a markdown specification, it has to be absolutely
-thorough. There are a lot more of these little differences I have documented
-elsewhere. I know I will find them lingering on my disk one day, but until
-then, I'll continue to add whatever strange nonsensical things I find.
-
-Some of these examples may only mention a particular engine compared to marked.
-However, the examples with markdown.pl could easily be swapped out for
-discount, upskirt, or markdown.js, and you would very easily see even more
-inconsistencies.
-
-A lot of this was written when I was very unsatisfied with the inconsistencies
-between markdown engines. Please excuse the frustration noticeable in my
-writing.
-
-## Examples of markdown's "stupid" list parsing
-
-```
-$ markdown.pl
-
- * item1
-
- * item2
-
- text
-^D
-<ul>
-<li><p>item1</p>
-
-<ul>
-<li>item2</li>
-</ul>
-
-<p><p>text</p></li>
-</ul></p>
-```
-
-
-```
-$ marked
- * item1
-
- * item2
-
- text
-^D
-<ul>
-<li><p>item1</p>
-<ul>
-<li>item2</li>
-</ul>
-<p>text</p>
-</li>
-</ul>
-```
-
-Which looks correct to you?
-
-- - -
-
-```
-$ markdown.pl
-* hello
- > world
-^D
-<p><ul>
-<li>hello</p>
-
-<blockquote>
- <p>world</li>
-</ul></p>
-</blockquote>
-```
-
-```
-$ marked
-* hello
- > world
-^D
-<ul>
-<li>hello<blockquote>
-<p>world</p>
-</blockquote>
-</li>
-</ul>
-```
-
-Again, which looks correct to you?
-
-- - -
-
-EXAMPLE:
-
-```
-$ markdown.pl
-* hello
- * world
- * hi
- code
-^D
-<ul>
-<li>hello
-<ul>
-<li>world</li>
-<li>hi
- code</li>
-</ul></li>
-</ul>
-```
-
-The code isn't a code block even though it's after the bullet margin. I know,
-lets give it two more spaces, effectively making it 8 spaces past the bullet.
-
-```
-$ markdown.pl
-* hello
- * world
- * hi
- code
-^D
-<ul>
-<li>hello
-<ul>
-<li>world</li>
-<li>hi
- code</li>
-</ul></li>
-</ul>
-```
-
-And, it's still not a code block. Did you also notice that the 3rd item isn't
-even its own list? Markdown screws that up too because of its indentation
-unaware parsing.
-
-- - -
-
-Let's look at some more examples of markdown's list parsing:
-
-```
-$ markdown.pl
-
- * item1
-
- * item2
-
- text
-^D
-<ul>
-<li><p>item1</p>
-
-<ul>
-<li>item2</li>
-</ul>
-
-<p><p>text</p></li>
-</ul></p>
-```
-
-Misnested tags.
-
-
-```
-$ marked
- * item1
-
- * item2
-
- text
-^D
-<ul>
-<li><p>item1</p>
-<ul>
-<li>item2</li>
-</ul>
-<p>text</p>
-</li>
-</ul>
-```
-
-Which looks correct to you?
-
-- - -
-
-```
-$ markdown.pl
-* hello
- > world
-^D
-<p><ul>
-<li>hello</p>
-
-<blockquote>
- <p>world</li>
-</ul></p>
-</blockquote>
-```
-
-More misnested tags.
-
-
-```
-$ marked
-* hello
- > world
-^D
-<ul>
-<li>hello<blockquote>
-<p>world</p>
-</blockquote>
-</li>
-</ul>
-```
-
-Again, which looks correct to you?
-
-- - -
-
-# Why quality matters - Part 2
-
-``` bash
-$ markdown.pl
-* hello
- > world
-^D
-<p><ul>
-<li>hello</p>
-
-<blockquote>
- <p>world</li>
-</ul></p>
-</blockquote>
-```
-
-``` bash
-$ sundown # upskirt
-* hello
- > world
-^D
-<ul>
-<li>hello
-&gt; world</li>
-</ul>
-```
-
-``` bash
-$ marked
-* hello
- > world
-^D
-<ul><li>hello <blockquote><p>world</p></blockquote></li></ul>
-```
-
-Which looks correct to you?
-
-- - -
-
-See: https://github.com/evilstreak/markdown-js/issues/23
-
-``` bash
-$ markdown.pl # upskirt/markdown.js/discount
-* hello
- var a = 1;
-* world
-^D
-<ul>
-<li>hello
-var a = 1;</li>
-<li>world</li>
-</ul>
-```
-
-``` bash
-$ marked
-* hello
- var a = 1;
-* world
-^D
-<ul><li>hello
-<pre>code>var a = 1;</code></pre></li>
-<li>world</li></ul>
-```
-
-Which looks more reasonable? Why shouldn't code blocks be able to appear in
-list items in a sane way?
-
-- - -
-
-``` bash
-$ markdown.js
-<div>hello</div>
-
-<span>hello</span>
-^D
-<p>&lt;div&gt;hello&lt;/div&gt;</p>
-
-<p>&lt;span&gt;hello&lt;/span&gt;</p>
-```
-
-``` bash
-$ marked
-<div>hello</div>
-
-<span>hello</span>
-^D
-<div>hello</div>
-
-
-<p><span>hello</span>
-</p>
-```
-
-- - -
-
-See: https://github.com/evilstreak/markdown-js/issues/27
-
-``` bash
-$ markdown.js
-[![an image](/image)](/link)
-^D
-<p><a href="/image)](/link">![an image</a></p>
-```
-
-``` bash
-$ marked
-[![an image](/image)](/link)
-^D
-<p><a href="/link"><img src="/image" alt="an image"></a>
-</p>
-```
-
-- - -
-
-See: https://github.com/evilstreak/markdown-js/issues/24
-
-``` bash
-$ markdown.js
-> a
-
-> b
-
-> c
-^D
-<blockquote><p>a</p><p>bundefined&gt; c</p></blockquote>
-```
-
-``` bash
-$ marked
-> a
-
-> b
-
-> c
-^D
-<blockquote><p>a
-
-</p></blockquote>
-<blockquote><p>b
-
-</p></blockquote>
-<blockquote><p>c
-</p></blockquote>
-```
-
-- - -
-
-``` bash
-$ markdown.pl
-* hello
- * world
- how
-
- are
- you
-
- * today
-* hi
-^D
-<ul>
-<li><p>hello</p>
-
-<ul>
-<li>world
-how</li>
-</ul>
-
-<p>are
-you</p>
-
-<ul>
-<li>today</li>
-</ul></li>
-<li>hi</li>
-</ul>
-```
-
-``` bash
-$ marked
-* hello
- * world
- how
-
- are
- you
-
- * today
-* hi
-^D
-<ul>
-<li><p>hello</p>
-<ul>
-<li><p>world
-how</p>
-<p>are
-you</p>
-</li>
-<li><p>today</p>
-</li>
-</ul>
-</li>
-<li>hi</li>
-</ul>
-```
diff --git a/tools/doc/node_modules/marked/doc/todo.md b/tools/doc/node_modules/marked/doc/todo.md
deleted file mode 100644
index 2e60b162ae..0000000000
--- a/tools/doc/node_modules/marked/doc/todo.md
+++ /dev/null
@@ -1,2 +0,0 @@
-# Todo
-
diff --git a/tools/doc/node_modules/sprintf-js/LICENSE b/tools/doc/node_modules/sprintf-js/LICENSE
new file mode 100644
index 0000000000..663ac52e4d
--- /dev/null
+++ b/tools/doc/node_modules/sprintf-js/LICENSE
@@ -0,0 +1,24 @@
+Copyright (c) 2007-2014, Alexandru Marasteanu <hello [at) alexei (dot] ro>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+* Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+* Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+* Neither the name of this software nor the names of its contributors may be
+ used to endorse or promote products derived from this software without
+ specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/tools/doc/node_modules/sprintf-js/README.md b/tools/doc/node_modules/sprintf-js/README.md
new file mode 100644
index 0000000000..83863561b2
--- /dev/null
+++ b/tools/doc/node_modules/sprintf-js/README.md
@@ -0,0 +1,88 @@
+# sprintf.js
+**sprintf.js** is a complete open source JavaScript sprintf implementation for the *browser* and *node.js*.
+
+Its prototype is simple:
+
+ string sprintf(string format , [mixed arg1 [, mixed arg2 [ ,...]]])
+
+The placeholders in the format string are marked by `%` and are followed by one or more of these elements, in this order:
+
+* An optional number followed by a `$` sign that selects which argument index to use for the value. If not specified, arguments will be placed in the same order as the placeholders in the input string.
+* An optional `+` sign that forces to preceed the result with a plus or minus sign on numeric values. By default, only the `-` sign is used on negative numbers.
+* An optional padding specifier that says what character to use for padding (if specified). Possible values are `0` or any other character precedeed by a `'` (single quote). The default is to pad with *spaces*.
+* An optional `-` sign, that causes sprintf to left-align the result of this placeholder. The default is to right-align the result.
+* An optional number, that says how many characters the result should have. If the value to be returned is shorter than this number, the result will be padded. When used with the `j` (JSON) type specifier, the padding length specifies the tab size used for indentation.
+* An optional precision modifier, consisting of a `.` (dot) followed by a number, that says how many digits should be displayed for floating point numbers. When used with the `g` type specifier, it specifies the number of significant digits. When used on a string, it causes the result to be truncated.
+* A type specifier that can be any of:
+ * `%` — yields a literal `%` character
+ * `b` — yields an integer as a binary number
+ * `c` — yields an integer as the character with that ASCII value
+ * `d` or `i` — yields an integer as a signed decimal number
+ * `e` — yields a float using scientific notation
+ * `u` — yields an integer as an unsigned decimal number
+ * `f` — yields a float as is; see notes on precision above
+ * `g` — yields a float as is; see notes on precision above
+ * `o` — yields an integer as an octal number
+ * `s` — yields a string as is
+ * `x` — yields an integer as a hexadecimal number (lower-case)
+ * `X` — yields an integer as a hexadecimal number (upper-case)
+ * `j` — yields a JavaScript object or array as a JSON encoded string
+
+## JavaScript `vsprintf`
+`vsprintf` is the same as `sprintf` except that it accepts an array of arguments, rather than a variable number of arguments:
+
+ vsprintf("The first 4 letters of the english alphabet are: %s, %s, %s and %s", ["a", "b", "c", "d"])
+
+## Argument swapping
+You can also swap the arguments. That is, the order of the placeholders doesn't have to match the order of the arguments. You can do that by simply indicating in the format string which arguments the placeholders refer to:
+
+ sprintf("%2$s %3$s a %1$s", "cracker", "Polly", "wants")
+And, of course, you can repeat the placeholders without having to increase the number of arguments.
+
+## Named arguments
+Format strings may contain replacement fields rather than positional placeholders. Instead of referring to a certain argument, you can now refer to a certain key within an object. Replacement fields are surrounded by rounded parentheses - `(` and `)` - and begin with a keyword that refers to a key:
+
+ var user = {
+ name: "Dolly"
+ }
+ sprintf("Hello %(name)s", user) // Hello Dolly
+Keywords in replacement fields can be optionally followed by any number of keywords or indexes:
+
+ var users = [
+ {name: "Dolly"},
+ {name: "Molly"},
+ {name: "Polly"}
+ ]
+ sprintf("Hello %(users[0].name)s, %(users[1].name)s and %(users[2].name)s", {users: users}) // Hello Dolly, Molly and Polly
+Note: mixing positional and named placeholders is not (yet) supported
+
+## Computed values
+You can pass in a function as a dynamic value and it will be invoked (with no arguments) in order to compute the value on-the-fly.
+
+ sprintf("Current timestamp: %d", Date.now) // Current timestamp: 1398005382890
+ sprintf("Current date and time: %s", function() { return new Date().toString() })
+
+# AngularJS
+You can now use `sprintf` and `vsprintf` (also aliased as `fmt` and `vfmt` respectively) in your AngularJS projects. See `demo/`.
+
+# Installation
+
+## Via Bower
+
+ bower install sprintf
+
+## Or as a node.js module
+
+ npm install sprintf-js
+
+### Usage
+
+ var sprintf = require("sprintf-js").sprintf,
+ vsprintf = require("sprintf-js").vsprintf
+
+ sprintf("%2$s %3$s a %1$s", "cracker", "Polly", "wants")
+ vsprintf("The first 4 letters of the english alphabet are: %s, %s, %s and %s", ["a", "b", "c", "d"])
+
+# License
+
+**sprintf.js** is licensed under the terms of the 3-clause BSD license.
diff --git a/tools/doc/node_modules/sprintf-js/dist/angular-sprintf.min.js b/tools/doc/node_modules/sprintf-js/dist/angular-sprintf.min.js
new file mode 100644
index 0000000000..dbaf744d83
--- /dev/null
+++ b/tools/doc/node_modules/sprintf-js/dist/angular-sprintf.min.js
@@ -0,0 +1,4 @@
+/*! sprintf-js | Alexandru Marasteanu <hello@alexei.ro> (http://alexei.ro/) | BSD-3-Clause */
+
+angular.module("sprintf",[]).filter("sprintf",function(){return function(){return sprintf.apply(null,arguments)}}).filter("fmt",["$filter",function(a){return a("sprintf")}]).filter("vsprintf",function(){return function(a,b){return vsprintf(a,b)}}).filter("vfmt",["$filter",function(a){return a("vsprintf")}]);
+//# sourceMappingURL=angular-sprintf.min.map \ No newline at end of file
diff --git a/tools/doc/node_modules/sprintf-js/dist/angular-sprintf.min.js.map b/tools/doc/node_modules/sprintf-js/dist/angular-sprintf.min.js.map
new file mode 100644
index 0000000000..055964c624
--- /dev/null
+++ b/tools/doc/node_modules/sprintf-js/dist/angular-sprintf.min.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"angular-sprintf.min.js","sources":["../src/angular-sprintf.js"],"names":["angular","module","filter","sprintf","apply","arguments","$filter","format","argv","vsprintf"],"mappings":";;AAAAA,QACIC,OAAO,cACPC,OAAO,UAAW,WACd,MAAO,YACH,MAAOC,SAAQC,MAAM,KAAMC,cAGnCH,OAAO,OAAQ,UAAW,SAASI,GAC/B,MAAOA,GAAQ,cAEnBJ,OAAO,WAAY,WACf,MAAO,UAASK,EAAQC,GACpB,MAAOC,UAASF,EAAQC,MAGhCN,OAAO,QAAS,UAAW,SAASI,GAChC,MAAOA,GAAQ"} \ No newline at end of file
diff --git a/tools/doc/node_modules/sprintf-js/dist/angular-sprintf.min.map b/tools/doc/node_modules/sprintf-js/dist/angular-sprintf.min.map
new file mode 100644
index 0000000000..055964c624
--- /dev/null
+++ b/tools/doc/node_modules/sprintf-js/dist/angular-sprintf.min.map
@@ -0,0 +1 @@
+{"version":3,"file":"angular-sprintf.min.js","sources":["../src/angular-sprintf.js"],"names":["angular","module","filter","sprintf","apply","arguments","$filter","format","argv","vsprintf"],"mappings":";;AAAAA,QACIC,OAAO,cACPC,OAAO,UAAW,WACd,MAAO,YACH,MAAOC,SAAQC,MAAM,KAAMC,cAGnCH,OAAO,OAAQ,UAAW,SAASI,GAC/B,MAAOA,GAAQ,cAEnBJ,OAAO,WAAY,WACf,MAAO,UAASK,EAAQC,GACpB,MAAOC,UAASF,EAAQC,MAGhCN,OAAO,QAAS,UAAW,SAASI,GAChC,MAAOA,GAAQ"} \ No newline at end of file
diff --git a/tools/doc/node_modules/sprintf-js/dist/sprintf.min.js b/tools/doc/node_modules/sprintf-js/dist/sprintf.min.js
new file mode 100644
index 0000000000..dc61e51add
--- /dev/null
+++ b/tools/doc/node_modules/sprintf-js/dist/sprintf.min.js
@@ -0,0 +1,4 @@
+/*! sprintf-js | Alexandru Marasteanu <hello@alexei.ro> (http://alexei.ro/) | BSD-3-Clause */
+
+!function(a){function b(){var a=arguments[0],c=b.cache;return c[a]&&c.hasOwnProperty(a)||(c[a]=b.parse(a)),b.format.call(null,c[a],arguments)}function c(a){return Object.prototype.toString.call(a).slice(8,-1).toLowerCase()}function d(a,b){return Array(b+1).join(a)}var e={not_string:/[^s]/,number:/[diefg]/,json:/[j]/,not_json:/[^j]/,text:/^[^\x25]+/,modulo:/^\x25{2}/,placeholder:/^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,key:/^([a-z_][a-z_\d]*)/i,key_access:/^\.([a-z_][a-z_\d]*)/i,index_access:/^\[(\d+)\]/,sign:/^[\+\-]/};b.format=function(a,f){var g,h,i,j,k,l,m,n=1,o=a.length,p="",q=[],r=!0,s="";for(h=0;o>h;h++)if(p=c(a[h]),"string"===p)q[q.length]=a[h];else if("array"===p){if(j=a[h],j[2])for(g=f[n],i=0;i<j[2].length;i++){if(!g.hasOwnProperty(j[2][i]))throw new Error(b("[sprintf] property '%s' does not exist",j[2][i]));g=g[j[2][i]]}else g=j[1]?f[j[1]]:f[n++];if("function"==c(g)&&(g=g()),e.not_string.test(j[8])&&e.not_json.test(j[8])&&"number"!=c(g)&&isNaN(g))throw new TypeError(b("[sprintf] expecting number but found %s",c(g)));switch(e.number.test(j[8])&&(r=g>=0),j[8]){case"b":g=g.toString(2);break;case"c":g=String.fromCharCode(g);break;case"d":case"i":g=parseInt(g,10);break;case"j":g=JSON.stringify(g,null,j[6]?parseInt(j[6]):0);break;case"e":g=j[7]?g.toExponential(j[7]):g.toExponential();break;case"f":g=j[7]?parseFloat(g).toFixed(j[7]):parseFloat(g);break;case"g":g=j[7]?parseFloat(g).toPrecision(j[7]):parseFloat(g);break;case"o":g=g.toString(8);break;case"s":g=(g=String(g))&&j[7]?g.substring(0,j[7]):g;break;case"u":g>>>=0;break;case"x":g=g.toString(16);break;case"X":g=g.toString(16).toUpperCase()}e.json.test(j[8])?q[q.length]=g:(!e.number.test(j[8])||r&&!j[3]?s="":(s=r?"+":"-",g=g.toString().replace(e.sign,"")),l=j[4]?"0"===j[4]?"0":j[4].charAt(1):" ",m=j[6]-(s+g).length,k=j[6]&&m>0?d(l,m):"",q[q.length]=j[5]?s+g+k:"0"===l?s+k+g:k+s+g)}return q.join("")},b.cache={},b.parse=function(a){for(var b=a,c=[],d=[],f=0;b;){if(null!==(c=e.text.exec(b)))d[d.length]=c[0];else if(null!==(c=e.modulo.exec(b)))d[d.length]="%";else{if(null===(c=e.placeholder.exec(b)))throw new SyntaxError("[sprintf] unexpected placeholder");if(c[2]){f|=1;var g=[],h=c[2],i=[];if(null===(i=e.key.exec(h)))throw new SyntaxError("[sprintf] failed to parse named argument key");for(g[g.length]=i[1];""!==(h=h.substring(i[0].length));)if(null!==(i=e.key_access.exec(h)))g[g.length]=i[1];else{if(null===(i=e.index_access.exec(h)))throw new SyntaxError("[sprintf] failed to parse named argument key");g[g.length]=i[1]}c[2]=g}else f|=2;if(3===f)throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported");d[d.length]=c}b=b.substring(c[0].length)}return d};var f=function(a,c,d){return d=(c||[]).slice(0),d.splice(0,0,a),b.apply(null,d)};"undefined"!=typeof exports?(exports.sprintf=b,exports.vsprintf=f):(a.sprintf=b,a.vsprintf=f,"function"==typeof define&&define.amd&&define(function(){return{sprintf:b,vsprintf:f}}))}("undefined"==typeof window?this:window);
+//# sourceMappingURL=sprintf.min.map \ No newline at end of file
diff --git a/tools/doc/node_modules/sprintf-js/dist/sprintf.min.js.map b/tools/doc/node_modules/sprintf-js/dist/sprintf.min.js.map
new file mode 100644
index 0000000000..369dbafab1
--- /dev/null
+++ b/tools/doc/node_modules/sprintf-js/dist/sprintf.min.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"sprintf.min.js","sources":["../src/sprintf.js"],"names":["window","sprintf","key","arguments","cache","hasOwnProperty","parse","format","call","get_type","variable","Object","prototype","toString","slice","toLowerCase","str_repeat","input","multiplier","Array","join","re","not_string","number","json","not_json","text","modulo","placeholder","key_access","index_access","sign","parse_tree","argv","arg","i","k","match","pad","pad_character","pad_length","cursor","tree_length","length","node_type","output","is_positive","Error","test","isNaN","TypeError","String","fromCharCode","parseInt","JSON","stringify","toExponential","parseFloat","toFixed","substring","toUpperCase","replace","charAt","fmt","_fmt","arg_names","exec","SyntaxError","field_list","replacement_field","field_match","vsprintf","_argv","splice","apply","exports","define","amd","this"],"mappings":";;CAAA,SAAUA,GAeN,QAASC,KACL,GAAIC,GAAMC,UAAU,GAAIC,EAAQH,EAAQG,KAIxC,OAHMA,GAAMF,IAAQE,EAAMC,eAAeH,KACrCE,EAAMF,GAAOD,EAAQK,MAAMJ,IAExBD,EAAQM,OAAOC,KAAK,KAAMJ,EAAMF,GAAMC,WA4JjD,QAASM,GAASC,GACd,MAAOC,QAAOC,UAAUC,SAASL,KAAKE,GAAUI,MAAM,EAAG,IAAIC,cAGjE,QAASC,GAAWC,EAAOC,GACvB,MAAOC,OAAMD,EAAa,GAAGE,KAAKH,GApLtC,GAAII,IACAC,WAAY,OACZC,OAAQ,SACRC,KAAM,MACNC,SAAU,OACVC,KAAM,YACNC,OAAQ,WACRC,YAAa,yFACb1B,IAAK,sBACL2B,WAAY,wBACZC,aAAc,aACdC,KAAM,UAWV9B,GAAQM,OAAS,SAASyB,EAAYC,GAClC,GAAiEC,GAAkBC,EAAGC,EAAGC,EAAOC,EAAKC,EAAeC,EAAhHC,EAAS,EAAGC,EAAcV,EAAWW,OAAQC,EAAY,GAASC,KAA0DC,GAAc,EAAMf,EAAO,EAC3J,KAAKI,EAAI,EAAOO,EAAJP,EAAiBA,IAEzB,GADAS,EAAYnC,EAASuB,EAAWG,IACd,WAAdS,EACAC,EAAOA,EAAOF,QAAUX,EAAWG,OAElC,IAAkB,UAAdS,EAAuB,CAE5B,GADAP,EAAQL,EAAWG,GACfE,EAAM,GAEN,IADAH,EAAMD,EAAKQ,GACNL,EAAI,EAAGA,EAAIC,EAAM,GAAGM,OAAQP,IAAK,CAClC,IAAKF,EAAI7B,eAAegC,EAAM,GAAGD,IAC7B,KAAM,IAAIW,OAAM9C,EAAQ,yCAA0CoC,EAAM,GAAGD,IAE/EF,GAAMA,EAAIG,EAAM,GAAGD,QAIvBF,GADKG,EAAM,GACLJ,EAAKI,EAAM,IAGXJ,EAAKQ,IAOf,IAJqB,YAAjBhC,EAASyB,KACTA,EAAMA,KAGNb,EAAGC,WAAW0B,KAAKX,EAAM,KAAOhB,EAAGI,SAASuB,KAAKX,EAAM,KAAyB,UAAjB5B,EAASyB,IAAoBe,MAAMf,GAClG,KAAM,IAAIgB,WAAUjD,EAAQ,0CAA2CQ,EAASyB,IAOpF,QAJIb,EAAGE,OAAOyB,KAAKX,EAAM,MACrBS,EAAcZ,GAAO,GAGjBG,EAAM,IACV,IAAK,IACDH,EAAMA,EAAIrB,SAAS,EACvB,MACA,KAAK,IACDqB,EAAMiB,OAAOC,aAAalB,EAC9B,MACA,KAAK,IACL,IAAK,IACDA,EAAMmB,SAASnB,EAAK,GACxB,MACA,KAAK,IACDA,EAAMoB,KAAKC,UAAUrB,EAAK,KAAMG,EAAM,GAAKgB,SAAShB,EAAM,IAAM,EACpE,MACA,KAAK,IACDH,EAAMG,EAAM,GAAKH,EAAIsB,cAAcnB,EAAM,IAAMH,EAAIsB,eACvD,MACA,KAAK,IACDtB,EAAMG,EAAM,GAAKoB,WAAWvB,GAAKwB,QAAQrB,EAAM,IAAMoB,WAAWvB,EACpE,MACA,KAAK,IACDA,EAAMA,EAAIrB,SAAS,EACvB,MACA,KAAK,IACDqB,GAAQA,EAAMiB,OAAOjB,KAASG,EAAM,GAAKH,EAAIyB,UAAU,EAAGtB,EAAM,IAAMH,CAC1E,MACA,KAAK,IACDA,KAAc,CAClB,MACA,KAAK,IACDA,EAAMA,EAAIrB,SAAS,GACvB,MACA,KAAK,IACDqB,EAAMA,EAAIrB,SAAS,IAAI+C,cAG3BvC,EAAGG,KAAKwB,KAAKX,EAAM,IACnBQ,EAAOA,EAAOF,QAAUT,IAGpBb,EAAGE,OAAOyB,KAAKX,EAAM,KAASS,IAAeT,EAAM,GAKnDN,EAAO,IAJPA,EAAOe,EAAc,IAAM,IAC3BZ,EAAMA,EAAIrB,WAAWgD,QAAQxC,EAAGU,KAAM,KAK1CQ,EAAgBF,EAAM,GAAkB,MAAbA,EAAM,GAAa,IAAMA,EAAM,GAAGyB,OAAO,GAAK,IACzEtB,EAAaH,EAAM,IAAMN,EAAOG,GAAKS,OACrCL,EAAMD,EAAM,IAAMG,EAAa,EAAIxB,EAAWuB,EAAeC,GAAoB,GACjFK,EAAOA,EAAOF,QAAUN,EAAM,GAAKN,EAAOG,EAAMI,EAAyB,MAAlBC,EAAwBR,EAAOO,EAAMJ,EAAMI,EAAMP,EAAOG,GAI3H,MAAOW,GAAOzB,KAAK,KAGvBnB,EAAQG,SAERH,EAAQK,MAAQ,SAASyD,GAErB,IADA,GAAIC,GAAOD,EAAK1B,KAAYL,KAAiBiC,EAAY,EAClDD,GAAM,CACT,GAAqC,QAAhC3B,EAAQhB,EAAGK,KAAKwC,KAAKF,IACtBhC,EAAWA,EAAWW,QAAUN,EAAM,OAErC,IAAuC,QAAlCA,EAAQhB,EAAGM,OAAOuC,KAAKF,IAC7BhC,EAAWA,EAAWW,QAAU,QAE/B,CAAA,GAA4C,QAAvCN,EAAQhB,EAAGO,YAAYsC,KAAKF,IAgClC,KAAM,IAAIG,aAAY,mCA/BtB,IAAI9B,EAAM,GAAI,CACV4B,GAAa,CACb,IAAIG,MAAiBC,EAAoBhC,EAAM,GAAIiC,IACnD,IAAuD,QAAlDA,EAAcjD,EAAGnB,IAAIgE,KAAKG,IAe3B,KAAM,IAAIF,aAAY,+CAbtB,KADAC,EAAWA,EAAWzB,QAAU2B,EAAY,GACwC,MAA5ED,EAAoBA,EAAkBV,UAAUW,EAAY,GAAG3B,UACnE,GAA8D,QAAzD2B,EAAcjD,EAAGQ,WAAWqC,KAAKG,IAClCD,EAAWA,EAAWzB,QAAU2B,EAAY,OAE3C,CAAA,GAAgE,QAA3DA,EAAcjD,EAAGS,aAAaoC,KAAKG,IAIzC,KAAM,IAAIF,aAAY,+CAHtBC,GAAWA,EAAWzB,QAAU2B,EAAY,GAUxDjC,EAAM,GAAK+B,MAGXH,IAAa,CAEjB,IAAkB,IAAdA,EACA,KAAM,IAAIlB,OAAM,4EAEpBf,GAAWA,EAAWW,QAAUN,EAKpC2B,EAAOA,EAAKL,UAAUtB,EAAM,GAAGM,QAEnC,MAAOX,GAGX,IAAIuC,GAAW,SAASR,EAAK9B,EAAMuC,GAG/B,MAFAA,IAASvC,OAAYnB,MAAM,GAC3B0D,EAAMC,OAAO,EAAG,EAAGV,GACZ9D,EAAQyE,MAAM,KAAMF,GAiBR,oBAAZG,UACPA,QAAQ1E,QAAUA,EAClB0E,QAAQJ,SAAWA,IAGnBvE,EAAOC,QAAUA,EACjBD,EAAOuE,SAAWA,EAEI,kBAAXK,SAAyBA,OAAOC,KACvCD,OAAO,WACH,OACI3E,QAASA,EACTsE,SAAUA,OAKT,mBAAXvE,QAAyB8E,KAAO9E"} \ No newline at end of file
diff --git a/tools/doc/node_modules/sprintf-js/dist/sprintf.min.map b/tools/doc/node_modules/sprintf-js/dist/sprintf.min.map
new file mode 100644
index 0000000000..ee011aaa5a
--- /dev/null
+++ b/tools/doc/node_modules/sprintf-js/dist/sprintf.min.map
@@ -0,0 +1 @@
+{"version":3,"file":"sprintf.min.js","sources":["../src/sprintf.js"],"names":["window","sprintf","key","arguments","cache","hasOwnProperty","parse","format","call","get_type","variable","Object","prototype","toString","slice","toLowerCase","str_repeat","input","multiplier","Array","join","re","not_string","number","json","not_json","text","modulo","placeholder","key_access","index_access","sign","parse_tree","argv","arg","i","k","match","pad","pad_character","pad_length","cursor","tree_length","length","node_type","output","is_positive","Error","test","isNaN","TypeError","String","fromCharCode","parseInt","JSON","stringify","toExponential","parseFloat","toFixed","toPrecision","substring","toUpperCase","replace","charAt","fmt","_fmt","arg_names","exec","SyntaxError","field_list","replacement_field","field_match","vsprintf","_argv","splice","apply","exports","define","amd","this"],"mappings":";;CAAA,SAAUA,GAeN,QAASC,KACL,GAAIC,GAAMC,UAAU,GAAIC,EAAQH,EAAQG,KAIxC,OAHMA,GAAMF,IAAQE,EAAMC,eAAeH,KACrCE,EAAMF,GAAOD,EAAQK,MAAMJ,IAExBD,EAAQM,OAAOC,KAAK,KAAMJ,EAAMF,GAAMC,WA+JjD,QAASM,GAASC,GACd,MAAOC,QAAOC,UAAUC,SAASL,KAAKE,GAAUI,MAAM,EAAG,IAAIC,cAGjE,QAASC,GAAWC,EAAOC,GACvB,MAAOC,OAAMD,EAAa,GAAGE,KAAKH,GAvLtC,GAAII,IACAC,WAAY,OACZC,OAAQ,UACRC,KAAM,MACNC,SAAU,OACVC,KAAM,YACNC,OAAQ,WACRC,YAAa,yFACb1B,IAAK,sBACL2B,WAAY,wBACZC,aAAc,aACdC,KAAM,UAWV9B,GAAQM,OAAS,SAASyB,EAAYC,GAClC,GAAiEC,GAAkBC,EAAGC,EAAGC,EAAOC,EAAKC,EAAeC,EAAhHC,EAAS,EAAGC,EAAcV,EAAWW,OAAQC,EAAY,GAASC,KAA0DC,GAAc,EAAMf,EAAO,EAC3J,KAAKI,EAAI,EAAOO,EAAJP,EAAiBA,IAEzB,GADAS,EAAYnC,EAASuB,EAAWG,IACd,WAAdS,EACAC,EAAOA,EAAOF,QAAUX,EAAWG,OAElC,IAAkB,UAAdS,EAAuB,CAE5B,GADAP,EAAQL,EAAWG,GACfE,EAAM,GAEN,IADAH,EAAMD,EAAKQ,GACNL,EAAI,EAAGA,EAAIC,EAAM,GAAGM,OAAQP,IAAK,CAClC,IAAKF,EAAI7B,eAAegC,EAAM,GAAGD,IAC7B,KAAM,IAAIW,OAAM9C,EAAQ,yCAA0CoC,EAAM,GAAGD,IAE/EF,GAAMA,EAAIG,EAAM,GAAGD,QAIvBF,GADKG,EAAM,GACLJ,EAAKI,EAAM,IAGXJ,EAAKQ,IAOf,IAJqB,YAAjBhC,EAASyB,KACTA,EAAMA,KAGNb,EAAGC,WAAW0B,KAAKX,EAAM,KAAOhB,EAAGI,SAASuB,KAAKX,EAAM,KAAyB,UAAjB5B,EAASyB,IAAoBe,MAAMf,GAClG,KAAM,IAAIgB,WAAUjD,EAAQ,0CAA2CQ,EAASyB,IAOpF,QAJIb,EAAGE,OAAOyB,KAAKX,EAAM,MACrBS,EAAcZ,GAAO,GAGjBG,EAAM,IACV,IAAK,IACDH,EAAMA,EAAIrB,SAAS,EACvB,MACA,KAAK,IACDqB,EAAMiB,OAAOC,aAAalB,EAC9B,MACA,KAAK,IACL,IAAK,IACDA,EAAMmB,SAASnB,EAAK,GACxB,MACA,KAAK,IACDA,EAAMoB,KAAKC,UAAUrB,EAAK,KAAMG,EAAM,GAAKgB,SAAShB,EAAM,IAAM,EACpE,MACA,KAAK,IACDH,EAAMG,EAAM,GAAKH,EAAIsB,cAAcnB,EAAM,IAAMH,EAAIsB,eACvD,MACA,KAAK,IACDtB,EAAMG,EAAM,GAAKoB,WAAWvB,GAAKwB,QAAQrB,EAAM,IAAMoB,WAAWvB,EACpE,MACA,KAAK,IACDA,EAAMG,EAAM,GAAKoB,WAAWvB,GAAKyB,YAAYtB,EAAM,IAAMoB,WAAWvB,EACxE,MACA,KAAK,IACDA,EAAMA,EAAIrB,SAAS,EACvB,MACA,KAAK,IACDqB,GAAQA,EAAMiB,OAAOjB,KAASG,EAAM,GAAKH,EAAI0B,UAAU,EAAGvB,EAAM,IAAMH,CAC1E,MACA,KAAK,IACDA,KAAc,CAClB,MACA,KAAK,IACDA,EAAMA,EAAIrB,SAAS,GACvB,MACA,KAAK,IACDqB,EAAMA,EAAIrB,SAAS,IAAIgD,cAG3BxC,EAAGG,KAAKwB,KAAKX,EAAM,IACnBQ,EAAOA,EAAOF,QAAUT,IAGpBb,EAAGE,OAAOyB,KAAKX,EAAM,KAASS,IAAeT,EAAM,GAKnDN,EAAO,IAJPA,EAAOe,EAAc,IAAM,IAC3BZ,EAAMA,EAAIrB,WAAWiD,QAAQzC,EAAGU,KAAM,KAK1CQ,EAAgBF,EAAM,GAAkB,MAAbA,EAAM,GAAa,IAAMA,EAAM,GAAG0B,OAAO,GAAK,IACzEvB,EAAaH,EAAM,IAAMN,EAAOG,GAAKS,OACrCL,EAAMD,EAAM,IAAMG,EAAa,EAAIxB,EAAWuB,EAAeC,GAAoB,GACjFK,EAAOA,EAAOF,QAAUN,EAAM,GAAKN,EAAOG,EAAMI,EAAyB,MAAlBC,EAAwBR,EAAOO,EAAMJ,EAAMI,EAAMP,EAAOG,GAI3H,MAAOW,GAAOzB,KAAK,KAGvBnB,EAAQG,SAERH,EAAQK,MAAQ,SAAS0D,GAErB,IADA,GAAIC,GAAOD,EAAK3B,KAAYL,KAAiBkC,EAAY,EAClDD,GAAM,CACT,GAAqC,QAAhC5B,EAAQhB,EAAGK,KAAKyC,KAAKF,IACtBjC,EAAWA,EAAWW,QAAUN,EAAM,OAErC,IAAuC,QAAlCA,EAAQhB,EAAGM,OAAOwC,KAAKF,IAC7BjC,EAAWA,EAAWW,QAAU,QAE/B,CAAA,GAA4C,QAAvCN,EAAQhB,EAAGO,YAAYuC,KAAKF,IAgClC,KAAM,IAAIG,aAAY,mCA/BtB,IAAI/B,EAAM,GAAI,CACV6B,GAAa,CACb,IAAIG,MAAiBC,EAAoBjC,EAAM,GAAIkC,IACnD,IAAuD,QAAlDA,EAAclD,EAAGnB,IAAIiE,KAAKG,IAe3B,KAAM,IAAIF,aAAY,+CAbtB,KADAC,EAAWA,EAAW1B,QAAU4B,EAAY,GACwC,MAA5ED,EAAoBA,EAAkBV,UAAUW,EAAY,GAAG5B,UACnE,GAA8D,QAAzD4B,EAAclD,EAAGQ,WAAWsC,KAAKG,IAClCD,EAAWA,EAAW1B,QAAU4B,EAAY,OAE3C,CAAA,GAAgE,QAA3DA,EAAclD,EAAGS,aAAaqC,KAAKG,IAIzC,KAAM,IAAIF,aAAY,+CAHtBC,GAAWA,EAAW1B,QAAU4B,EAAY,GAUxDlC,EAAM,GAAKgC,MAGXH,IAAa,CAEjB,IAAkB,IAAdA,EACA,KAAM,IAAInB,OAAM,4EAEpBf,GAAWA,EAAWW,QAAUN,EAKpC4B,EAAOA,EAAKL,UAAUvB,EAAM,GAAGM,QAEnC,MAAOX,GAGX,IAAIwC,GAAW,SAASR,EAAK/B,EAAMwC,GAG/B,MAFAA,IAASxC,OAAYnB,MAAM,GAC3B2D,EAAMC,OAAO,EAAG,EAAGV,GACZ/D,EAAQ0E,MAAM,KAAMF,GAiBR,oBAAZG,UACPA,QAAQ3E,QAAUA,EAClB2E,QAAQJ,SAAWA,IAGnBxE,EAAOC,QAAUA,EACjBD,EAAOwE,SAAWA,EAEI,kBAAXK,SAAyBA,OAAOC,KACvCD,OAAO,WACH,OACI5E,QAASA,EACTuE,SAAUA,OAKT,mBAAXxE,QAAyB+E,KAAO/E"} \ No newline at end of file
diff --git a/tools/doc/node_modules/sprintf-js/package.json b/tools/doc/node_modules/sprintf-js/package.json
new file mode 100644
index 0000000000..3ec22029da
--- /dev/null
+++ b/tools/doc/node_modules/sprintf-js/package.json
@@ -0,0 +1,58 @@
+{
+ "_args": [
+ [
+ "sprintf-js@1.0.3",
+ "/Users/rubys/git/node/tools/doc"
+ ]
+ ],
+ "_development": true,
+ "_from": "sprintf-js@1.0.3",
+ "_id": "sprintf-js@1.0.3",
+ "_inBundle": false,
+ "_integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
+ "_location": "/sprintf-js",
+ "_phantomChildren": {},
+ "_requested": {
+ "type": "version",
+ "registry": true,
+ "raw": "sprintf-js@1.0.3",
+ "name": "sprintf-js",
+ "escapedName": "sprintf-js",
+ "rawSpec": "1.0.3",
+ "saveSpec": null,
+ "fetchSpec": "1.0.3"
+ },
+ "_requiredBy": [
+ "/argparse"
+ ],
+ "_resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
+ "_spec": "1.0.3",
+ "_where": "/Users/rubys/git/node/tools/doc",
+ "author": {
+ "name": "Alexandru Marasteanu",
+ "email": "hello@alexei.ro",
+ "url": "http://alexei.ro/"
+ },
+ "bugs": {
+ "url": "https://github.com/alexei/sprintf.js/issues"
+ },
+ "description": "JavaScript sprintf implementation",
+ "devDependencies": {
+ "grunt": "*",
+ "grunt-contrib-uglify": "*",
+ "grunt-contrib-watch": "*",
+ "mocha": "*"
+ },
+ "homepage": "https://github.com/alexei/sprintf.js#readme",
+ "license": "BSD-3-Clause",
+ "main": "src/sprintf.js",
+ "name": "sprintf-js",
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/alexei/sprintf.js.git"
+ },
+ "scripts": {
+ "test": "mocha test/test.js"
+ },
+ "version": "1.0.3"
+}
diff --git a/tools/doc/node_modules/sprintf-js/src/angular-sprintf.js b/tools/doc/node_modules/sprintf-js/src/angular-sprintf.js
new file mode 100644
index 0000000000..9c69123bea
--- /dev/null
+++ b/tools/doc/node_modules/sprintf-js/src/angular-sprintf.js
@@ -0,0 +1,18 @@
+angular.
+ module("sprintf", []).
+ filter("sprintf", function() {
+ return function() {
+ return sprintf.apply(null, arguments)
+ }
+ }).
+ filter("fmt", ["$filter", function($filter) {
+ return $filter("sprintf")
+ }]).
+ filter("vsprintf", function() {
+ return function(format, argv) {
+ return vsprintf(format, argv)
+ }
+ }).
+ filter("vfmt", ["$filter", function($filter) {
+ return $filter("vsprintf")
+ }])
diff --git a/tools/doc/node_modules/sprintf-js/src/sprintf.js b/tools/doc/node_modules/sprintf-js/src/sprintf.js
new file mode 100644
index 0000000000..c0fc7c08b2
--- /dev/null
+++ b/tools/doc/node_modules/sprintf-js/src/sprintf.js
@@ -0,0 +1,208 @@
+(function(window) {
+ var re = {
+ not_string: /[^s]/,
+ number: /[diefg]/,
+ json: /[j]/,
+ not_json: /[^j]/,
+ text: /^[^\x25]+/,
+ modulo: /^\x25{2}/,
+ placeholder: /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-gijosuxX])/,
+ key: /^([a-z_][a-z_\d]*)/i,
+ key_access: /^\.([a-z_][a-z_\d]*)/i,
+ index_access: /^\[(\d+)\]/,
+ sign: /^[\+\-]/
+ }
+
+ function sprintf() {
+ var key = arguments[0], cache = sprintf.cache
+ if (!(cache[key] && cache.hasOwnProperty(key))) {
+ cache[key] = sprintf.parse(key)
+ }
+ return sprintf.format.call(null, cache[key], arguments)
+ }
+
+ sprintf.format = function(parse_tree, argv) {
+ var cursor = 1, tree_length = parse_tree.length, node_type = "", arg, output = [], i, k, match, pad, pad_character, pad_length, is_positive = true, sign = ""
+ for (i = 0; i < tree_length; i++) {
+ node_type = get_type(parse_tree[i])
+ if (node_type === "string") {
+ output[output.length] = parse_tree[i]
+ }
+ else if (node_type === "array") {
+ match = parse_tree[i] // convenience purposes only
+ if (match[2]) { // keyword argument
+ arg = argv[cursor]
+ for (k = 0; k < match[2].length; k++) {
+ if (!arg.hasOwnProperty(match[2][k])) {
+ throw new Error(sprintf("[sprintf] property '%s' does not exist", match[2][k]))
+ }
+ arg = arg[match[2][k]]
+ }
+ }
+ else if (match[1]) { // positional argument (explicit)
+ arg = argv[match[1]]
+ }
+ else { // positional argument (implicit)
+ arg = argv[cursor++]
+ }
+
+ if (get_type(arg) == "function") {
+ arg = arg()
+ }
+
+ if (re.not_string.test(match[8]) && re.not_json.test(match[8]) && (get_type(arg) != "number" && isNaN(arg))) {
+ throw new TypeError(sprintf("[sprintf] expecting number but found %s", get_type(arg)))
+ }
+
+ if (re.number.test(match[8])) {
+ is_positive = arg >= 0
+ }
+
+ switch (match[8]) {
+ case "b":
+ arg = arg.toString(2)
+ break
+ case "c":
+ arg = String.fromCharCode(arg)
+ break
+ case "d":
+ case "i":
+ arg = parseInt(arg, 10)
+ break
+ case "j":
+ arg = JSON.stringify(arg, null, match[6] ? parseInt(match[6]) : 0)
+ break
+ case "e":
+ arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential()
+ break
+ case "f":
+ arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg)
+ break
+ case "g":
+ arg = match[7] ? parseFloat(arg).toPrecision(match[7]) : parseFloat(arg)
+ break
+ case "o":
+ arg = arg.toString(8)
+ break
+ case "s":
+ arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg)
+ break
+ case "u":
+ arg = arg >>> 0
+ break
+ case "x":
+ arg = arg.toString(16)
+ break
+ case "X":
+ arg = arg.toString(16).toUpperCase()
+ break
+ }
+ if (re.json.test(match[8])) {
+ output[output.length] = arg
+ }
+ else {
+ if (re.number.test(match[8]) && (!is_positive || match[3])) {
+ sign = is_positive ? "+" : "-"
+ arg = arg.toString().replace(re.sign, "")
+ }
+ else {
+ sign = ""
+ }
+ pad_character = match[4] ? match[4] === "0" ? "0" : match[4].charAt(1) : " "
+ pad_length = match[6] - (sign + arg).length
+ pad = match[6] ? (pad_length > 0 ? str_repeat(pad_character, pad_length) : "") : ""
+ output[output.length] = match[5] ? sign + arg + pad : (pad_character === "0" ? sign + pad + arg : pad + sign + arg)
+ }
+ }
+ }
+ return output.join("")
+ }
+
+ sprintf.cache = {}
+
+ sprintf.parse = function(fmt) {
+ var _fmt = fmt, match = [], parse_tree = [], arg_names = 0
+ while (_fmt) {
+ if ((match = re.text.exec(_fmt)) !== null) {
+ parse_tree[parse_tree.length] = match[0]
+ }
+ else if ((match = re.modulo.exec(_fmt)) !== null) {
+ parse_tree[parse_tree.length] = "%"
+ }
+ else if ((match = re.placeholder.exec(_fmt)) !== null) {
+ if (match[2]) {
+ arg_names |= 1
+ var field_list = [], replacement_field = match[2], field_match = []
+ if ((field_match = re.key.exec(replacement_field)) !== null) {
+ field_list[field_list.length] = field_match[1]
+ while ((replacement_field = replacement_field.substring(field_match[0].length)) !== "") {
+ if ((field_match = re.key_access.exec(replacement_field)) !== null) {
+ field_list[field_list.length] = field_match[1]
+ }
+ else if ((field_match = re.index_access.exec(replacement_field)) !== null) {
+ field_list[field_list.length] = field_match[1]
+ }
+ else {
+ throw new SyntaxError("[sprintf] failed to parse named argument key")
+ }
+ }
+ }
+ else {
+ throw new SyntaxError("[sprintf] failed to parse named argument key")
+ }
+ match[2] = field_list
+ }
+ else {
+ arg_names |= 2
+ }
+ if (arg_names === 3) {
+ throw new Error("[sprintf] mixing positional and named placeholders is not (yet) supported")
+ }
+ parse_tree[parse_tree.length] = match
+ }
+ else {
+ throw new SyntaxError("[sprintf] unexpected placeholder")
+ }
+ _fmt = _fmt.substring(match[0].length)
+ }
+ return parse_tree
+ }
+
+ var vsprintf = function(fmt, argv, _argv) {
+ _argv = (argv || []).slice(0)
+ _argv.splice(0, 0, fmt)
+ return sprintf.apply(null, _argv)
+ }
+
+ /**
+ * helpers
+ */
+ function get_type(variable) {
+ return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase()
+ }
+
+ function str_repeat(input, multiplier) {
+ return Array(multiplier + 1).join(input)
+ }
+
+ /**
+ * export to either browser or node.js
+ */
+ if (typeof exports !== "undefined") {
+ exports.sprintf = sprintf
+ exports.vsprintf = vsprintf
+ }
+ else {
+ window.sprintf = sprintf
+ window.vsprintf = vsprintf
+
+ if (typeof define === "function" && define.amd) {
+ define(function() {
+ return {
+ sprintf: sprintf,
+ vsprintf: vsprintf
+ }
+ })
+ }
+ }
+})(typeof window === "undefined" ? this : window);
diff --git a/tools/doc/package-lock.json b/tools/doc/package-lock.json
index 5da2020a1a..c89617c720 100644
--- a/tools/doc/package-lock.json
+++ b/tools/doc/package-lock.json
@@ -4,6 +4,40 @@
"lockfileVersion": 1,
"requires": true,
"dependencies": {
+ "@types/node": {
+ "version": "10.3.5",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-10.3.5.tgz",
+ "integrity": "sha512-6lRwZN0Y3TuglwaaZN2XPocobmzLlhxcqDjKFjNYSsXG/TFAGYkCqkzZh4+ms8iTHHQE6gJXLHPV7TziVGeWhg=="
+ },
+ "abab": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/abab/-/abab-1.0.4.tgz",
+ "integrity": "sha1-X6rZwsB/YN12dw9xzwJbYqY8/U4="
+ },
+ "acorn": {
+ "version": "5.7.1",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz",
+ "integrity": "sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ=="
+ },
+ "acorn-globals": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/acorn-globals/-/acorn-globals-4.1.0.tgz",
+ "integrity": "sha512-KjZwU26uG3u6eZcfGbTULzFcsoz6pegNKtHPksZPOUsiKo5bUmiBPa38FuHZ/Eun+XYh/JCCkS9AS3Lu4McQOQ==",
+ "requires": {
+ "acorn": "^5.0.0"
+ }
+ },
+ "ajv": {
+ "version": "5.5.2",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz",
+ "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=",
+ "requires": {
+ "co": "^4.6.0",
+ "fast-deep-equal": "^1.0.0",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.3.0"
+ }
+ },
"argparse": {
"version": "1.0.10",
"resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz",
@@ -13,12 +47,507 @@
"sprintf-js": "~1.0.2"
}
},
+ "array-equal": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/array-equal/-/array-equal-1.0.0.tgz",
+ "integrity": "sha1-jCpe8kcv2ep0KwTHenUJO6J1fJM="
+ },
+ "asn1": {
+ "version": "0.2.3",
+ "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz",
+ "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y="
+ },
+ "assert-plus": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
+ "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU="
+ },
+ "async-limiter": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
+ "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg=="
+ },
+ "asynckit": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+ "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
+ },
+ "aws-sign2": {
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
+ "integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg="
+ },
+ "aws4": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.7.0.tgz",
+ "integrity": "sha512-32NDda82rhwD9/JBCCkB+MRYDp0oSvlo2IL6rQWA10PQi7tDUM3eqMSltXmY+Oyl/7N3P3qNtAlv7X0d9bI28w=="
+ },
+ "bail": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/bail/-/bail-1.0.3.tgz",
+ "integrity": "sha512-1X8CnjFVQ+a+KW36uBNMTU5s8+v5FzeqrP7hTG5aTb4aPreSbZJlhwPon9VKMuEVgV++JM+SQrALY3kr7eswdg=="
+ },
+ "bcrypt-pbkdf": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz",
+ "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=",
+ "optional": true,
+ "requires": {
+ "tweetnacl": "^0.14.3"
+ }
+ },
+ "browser-process-hrtime": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-0.1.2.tgz",
+ "integrity": "sha1-Ql1opY00R/AqBKqJQYf86K+Le44="
+ },
+ "camelcase": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-3.0.0.tgz",
+ "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo="
+ },
+ "caseless": {
+ "version": "0.12.0",
+ "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
+ "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw="
+ },
+ "ccount": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/ccount/-/ccount-1.0.3.tgz",
+ "integrity": "sha512-Jt9tIBkRc9POUof7QA/VwWd+58fKkEEfI+/t1/eOlxKM7ZhrczNzMFefge7Ai+39y1pR/pP6cI19guHy3FSLmw=="
+ },
+ "character-entities": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.2.tgz",
+ "integrity": "sha512-sMoHX6/nBiy3KKfC78dnEalnpn0Az0oSNvqUWYTtYrhRI5iUIYsROU48G+E+kMFQzqXaJ8kHJZ85n7y6/PHgwQ=="
+ },
+ "character-entities-html4": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/character-entities-html4/-/character-entities-html4-1.1.2.tgz",
+ "integrity": "sha512-sIrXwyna2+5b0eB9W149izTPJk/KkJTg6mEzDGibwBUkyH1SbDa+nf515Ppdi3MaH35lW0JFJDWeq9Luzes1Iw=="
+ },
+ "character-entities-legacy": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.2.tgz",
+ "integrity": "sha512-9NB2VbXtXYWdXzqrvAHykE/f0QJxzaKIpZ5QzNZrrgQ7Iyxr2vnfS8fCBNVW9nUEZE0lo57nxKRqnzY/dKrwlA=="
+ },
+ "character-reference-invalid": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.2.tgz",
+ "integrity": "sha512-7I/xceXfKyUJmSAn/jw8ve/9DyOP7XxufNYLI9Px7CmsKgEUaZLUTax6nZxGQtaoiZCjpu6cHPj20xC/vqRReQ=="
+ },
+ "co": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
+ "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ="
+ },
+ "collapse-white-space": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/collapse-white-space/-/collapse-white-space-1.0.4.tgz",
+ "integrity": "sha512-YfQ1tAUZm561vpYD+5eyWN8+UsceQbSrqqlc/6zDY2gtAE+uZLSdkkovhnGpmCThsvKBFakq4EdY/FF93E8XIw=="
+ },
+ "combined-stream": {
+ "version": "1.0.6",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz",
+ "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=",
+ "requires": {
+ "delayed-stream": "~1.0.0"
+ }
+ },
+ "comma-separated-tokens": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-1.0.5.tgz",
+ "integrity": "sha512-Cg90/fcK93n0ecgYTAz1jaA3zvnQ0ExlmKY1rdbyHqAx6BHxwoJc+J7HDu0iuQ7ixEs1qaa+WyQ6oeuBpYP1iA==",
+ "requires": {
+ "trim": "0.0.1"
+ }
+ },
+ "core-util-is": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
+ "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
+ },
+ "cssom": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.2.tgz",
+ "integrity": "sha1-uANhcMefB6kP8vFuIihAJ6JDhIs="
+ },
+ "cssstyle": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-0.3.1.tgz",
+ "integrity": "sha512-tNvaxM5blOnxanyxI6panOsnfiyLRj3HV4qjqqS45WPNS1usdYWRUQjqTEEELK73lpeP/1KoIGYUwrBn/VcECA==",
+ "requires": {
+ "cssom": "0.3.x"
+ }
+ },
+ "dashdash": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
+ "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
+ "requires": {
+ "assert-plus": "^1.0.0"
+ }
+ },
+ "data-urls": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-1.0.0.tgz",
+ "integrity": "sha512-ai40PPQR0Fn1lD2PPie79CibnlMN2AYiDhwFX/rZHVsxbs5kNJSjegqXIprhouGXlRdEnfybva7kqRGnB6mypA==",
+ "requires": {
+ "abab": "^1.0.4",
+ "whatwg-mimetype": "^2.0.0",
+ "whatwg-url": "^6.4.0"
+ }
+ },
+ "deep-is": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz",
+ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ="
+ },
+ "define-properties": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz",
+ "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=",
+ "requires": {
+ "foreach": "^2.0.5",
+ "object-keys": "^1.0.8"
+ }
+ },
+ "delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
+ },
+ "detab": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/detab/-/detab-2.0.1.tgz",
+ "integrity": "sha512-/hhdqdQc5thGrqzjyO/pz76lDZ5GSuAs6goxOaKTsvPk7HNnzAyFN5lyHgqpX4/s1i66K8qMGj+VhA9504x7DQ==",
+ "requires": {
+ "repeat-string": "^1.5.4"
+ }
+ },
+ "domexception": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/domexception/-/domexception-1.0.1.tgz",
+ "integrity": "sha512-raigMkn7CJNNo6Ihro1fzG7wr3fHuYVytzquZKX5n0yizGsTcYgzdIUwj1X9pK0VvjeihV+XiclP+DjwbsSKug==",
+ "requires": {
+ "webidl-conversions": "^4.0.2"
+ }
+ },
+ "ecc-jsbn": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz",
+ "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=",
+ "optional": true,
+ "requires": {
+ "jsbn": "~0.1.0"
+ }
+ },
+ "escodegen": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.10.0.tgz",
+ "integrity": "sha512-fjUOf8johsv23WuIKdNQU4P9t9jhQ4Qzx6pC2uW890OloK3Zs1ZAoCNpg/2larNF501jLl3UNy0kIRcF6VI22g==",
+ "requires": {
+ "esprima": "^3.1.3",
+ "estraverse": "^4.2.0",
+ "esutils": "^2.0.2",
+ "optionator": "^0.8.1",
+ "source-map": "~0.6.1"
+ },
+ "dependencies": {
+ "esprima": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz",
+ "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM="
+ }
+ }
+ },
"esprima": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz",
"integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==",
"dev": true
},
+ "estraverse": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz",
+ "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM="
+ },
+ "esutils": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz",
+ "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs="
+ },
+ "extend": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz",
+ "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ="
+ },
+ "extsprintf": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
+ "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU="
+ },
+ "fast-deep-equal": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-1.1.0.tgz",
+ "integrity": "sha1-wFNHeBfIa1HaqFPIHgWbcz0CNhQ="
+ },
+ "fast-json-stable-stringify": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz",
+ "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I="
+ },
+ "fast-levenshtein": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
+ "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc="
+ },
+ "foreach": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz",
+ "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k="
+ },
+ "forever-agent": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
+ "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE="
+ },
+ "form-data": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz",
+ "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=",
+ "requires": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "1.0.6",
+ "mime-types": "^2.1.12"
+ }
+ },
+ "function-bind": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
+ "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
+ },
+ "getpass": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
+ "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
+ "requires": {
+ "assert-plus": "^1.0.0"
+ }
+ },
+ "har-schema": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
+ "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI="
+ },
+ "har-validator": {
+ "version": "5.0.3",
+ "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.0.3.tgz",
+ "integrity": "sha1-ukAsJmGU8VlW7xXg/PJCmT9qff0=",
+ "requires": {
+ "ajv": "^5.1.0",
+ "har-schema": "^2.0.0"
+ }
+ },
+ "has": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
+ "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==",
+ "requires": {
+ "function-bind": "^1.1.1"
+ }
+ },
+ "hast-to-hyperscript": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/hast-to-hyperscript/-/hast-to-hyperscript-3.1.0.tgz",
+ "integrity": "sha512-/At2y6sQLTAcL6y+3hRQFcaBoRlKrmHSpvvdOZqRz6uI2YyjrU8rJ7e1LbmLtWUmzaIqKEdNSku+AJC0pt4+aw==",
+ "requires": {
+ "comma-separated-tokens": "^1.0.0",
+ "is-nan": "^1.2.1",
+ "kebab-case": "^1.0.0",
+ "property-information": "^3.0.0",
+ "space-separated-tokens": "^1.0.0",
+ "trim": "0.0.1",
+ "unist-util-is": "^2.0.0"
+ }
+ },
+ "hast-util-from-parse5": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/hast-util-from-parse5/-/hast-util-from-parse5-2.1.0.tgz",
+ "integrity": "sha1-9hI9g9NoljCwl+E+Qw0W2dG9iIQ=",
+ "requires": {
+ "camelcase": "^3.0.0",
+ "hastscript": "^3.0.0",
+ "property-information": "^3.1.0",
+ "vfile-location": "^2.0.0"
+ }
+ },
+ "hast-util-is-element": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/hast-util-is-element/-/hast-util-is-element-1.0.1.tgz",
+ "integrity": "sha512-s/ggaNehYVqmLgTXEv12Lbb72bsOD2r5DhAqPgtDdaI/YFNXVzz0zHFVJnhjIjn7Nak8GbL4nzT2q0RA5div+A=="
+ },
+ "hast-util-parse-selector": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/hast-util-parse-selector/-/hast-util-parse-selector-2.1.1.tgz",
+ "integrity": "sha512-FlrdvixBzVHYSqtvGAl0wjH1hiCY5NEfs+zfFNAZNWKMVj4pH6x+uPPyrhvzU3NrwOqYVX6Essv4d5n+0b6faA=="
+ },
+ "hast-util-raw": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/hast-util-raw/-/hast-util-raw-2.0.2.tgz",
+ "integrity": "sha512-ujytXSAZC85bvh38f8ALzfE2IZDdCwB9XeHUs9l20C1p4/1YeAoZqq9z9U17vWQ9hMmqbVaROuSK8feL3wTCJg==",
+ "requires": {
+ "hast-util-from-parse5": "^2.0.0",
+ "hast-util-to-parse5": "^2.0.0",
+ "html-void-elements": "^1.0.1",
+ "parse5": "^3.0.3",
+ "unist-util-position": "^3.0.0",
+ "web-namespaces": "^1.0.0",
+ "zwitch": "^1.0.0"
+ }
+ },
+ "hast-util-to-html": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/hast-util-to-html/-/hast-util-to-html-3.1.0.tgz",
+ "integrity": "sha1-iCyZhJ5AEw6ZHAQuRW1FPZXDbP8=",
+ "requires": {
+ "ccount": "^1.0.0",
+ "comma-separated-tokens": "^1.0.1",
+ "hast-util-is-element": "^1.0.0",
+ "hast-util-whitespace": "^1.0.0",
+ "html-void-elements": "^1.0.0",
+ "kebab-case": "^1.0.0",
+ "property-information": "^3.1.0",
+ "space-separated-tokens": "^1.0.0",
+ "stringify-entities": "^1.0.1",
+ "unist-util-is": "^2.0.0",
+ "xtend": "^4.0.1"
+ }
+ },
+ "hast-util-to-parse5": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/hast-util-to-parse5/-/hast-util-to-parse5-2.2.0.tgz",
+ "integrity": "sha512-Eg1mrf0VTT/PipFN5z1+mVi+4GNhinKk/i/HKeX1h17IYiMdm3G8vgA0FU04XCuD1cWV58f5zziFKcBkr+WuKw==",
+ "requires": {
+ "hast-to-hyperscript": "^3.0.0",
+ "mapz": "^1.0.0",
+ "web-namespaces": "^1.0.0",
+ "xtend": "^4.0.1",
+ "zwitch": "^1.0.0"
+ }
+ },
+ "hast-util-whitespace": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/hast-util-whitespace/-/hast-util-whitespace-1.0.1.tgz",
+ "integrity": "sha512-Mfx2ZnmVMTAopZ8as42nKrNt650tCZYhy/MPeO1Imdg/cmCWK6GUSnFrrE3ezGjVifn7x5zMfu8jrjwIGyImSw=="
+ },
+ "hastscript": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/hastscript/-/hastscript-3.1.0.tgz",
+ "integrity": "sha512-8V34dMSDT1Ik+ZSgTzCLdyp89MrWxcxctXPxhmb72GQj1Xkw1aHPM9UaHCWewvH2Q+PVkYUm4ZJVw4T0dgEGNA==",
+ "requires": {
+ "camelcase": "^3.0.0",
+ "comma-separated-tokens": "^1.0.0",
+ "hast-util-parse-selector": "^2.0.0",
+ "property-information": "^3.0.0",
+ "space-separated-tokens": "^1.0.0"
+ }
+ },
+ "html-encoding-sniffer": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz",
+ "integrity": "sha512-71lZziiDnsuabfdYiUeWdCVyKuqwWi23L8YeIgV9jSSZHCtb6wB1BKWooH7L3tn4/FuZJMVWyNaIDr4RGmaSYw==",
+ "requires": {
+ "whatwg-encoding": "^1.0.1"
+ }
+ },
+ "html-void-elements": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/html-void-elements/-/html-void-elements-1.0.3.tgz",
+ "integrity": "sha512-SaGhCDPXJVNrQyKMtKy24q6IMdXg5FCPN3z+xizxw9l+oXQw5fOoaj/ERU5KqWhSYhXtW5bWthlDbTDLBhJQrA=="
+ },
+ "http-signature": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
+ "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
+ "requires": {
+ "assert-plus": "^1.0.0",
+ "jsprim": "^1.2.2",
+ "sshpk": "^1.7.0"
+ }
+ },
+ "iconv-lite": {
+ "version": "0.4.19",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.19.tgz",
+ "integrity": "sha512-oTZqweIP51xaGPI4uPa56/Pri/480R+mo7SeU+YETByQNhDG55ycFyNLIgta9vXhILrxXDmF7ZGhqZIcuN0gJQ=="
+ },
+ "inherits": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
+ "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4="
+ },
+ "is-alphabetical": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.2.tgz",
+ "integrity": "sha512-V0xN4BYezDHcBSKb1QHUFMlR4as/XEuCZBzMJUU4n7+Cbt33SmUnSol+pnXFvLxSHNq2CemUXNdaXV6Flg7+xg=="
+ },
+ "is-alphanumerical": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.2.tgz",
+ "integrity": "sha512-pyfU/0kHdISIgslFfZN9nfY1Gk3MquQgUm1mJTjdkEPpkAKNWuBTSqFwewOpR7N351VkErCiyV71zX7mlQQqsg==",
+ "requires": {
+ "is-alphabetical": "^1.0.0",
+ "is-decimal": "^1.0.0"
+ }
+ },
+ "is-buffer": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-2.0.3.tgz",
+ "integrity": "sha512-U15Q7MXTuZlrbymiz95PJpZxu8IlipAp4dtS3wOdgPXx3mqBnslrWU14kxfHB+Py/+2PVKSr37dMAgM2A4uArw=="
+ },
+ "is-decimal": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.2.tgz",
+ "integrity": "sha512-TRzl7mOCchnhchN+f3ICUCzYvL9ul7R+TYOsZ8xia++knyZAJfv/uA1FvQXsAnYIl1T3B2X5E/J7Wb1QXiIBXg=="
+ },
+ "is-hexadecimal": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.2.tgz",
+ "integrity": "sha512-but/G3sapV3MNyqiDBLrOi4x8uCIw0RY3o/Vb5GT0sMFHrVV7731wFSVy41T5FO1og7G0gXLJh0MkgPRouko/A=="
+ },
+ "is-nan": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.2.1.tgz",
+ "integrity": "sha1-n69ltvttskt/XAYoR16nH5iEAeI=",
+ "requires": {
+ "define-properties": "^1.1.1"
+ }
+ },
+ "is-plain-obj": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz",
+ "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4="
+ },
+ "is-typedarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
+ "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
+ },
+ "is-whitespace-character": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.2.tgz",
+ "integrity": "sha512-SzM+T5GKUCtLhlHFKt2SDAX2RFzfS6joT91F2/WSi9LxgFdsnhfPK/UIA+JhRR2xuyLdrCys2PiFDrtn1fU5hQ=="
+ },
+ "is-word-character": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/is-word-character/-/is-word-character-1.0.2.tgz",
+ "integrity": "sha512-T3FlsX8rCHAH8e7RE7PfOPZVFQlcV3XRF9eOOBQ1uf70OxO7CjjSOjeImMPCADBdYWcStAbVbYvJ1m2D3tb+EA=="
+ },
+ "isstream": {
+ "version": "0.1.2",
+ "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
+ "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
+ },
"js-yaml": {
"version": "3.11.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.11.0.tgz",
@@ -29,16 +558,801 @@
"esprima": "^4.0.0"
}
},
+ "jsbn": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
+ "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=",
+ "optional": true
+ },
+ "jsdom": {
+ "version": "11.11.0",
+ "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-11.11.0.tgz",
+ "integrity": "sha512-ou1VyfjwsSuWkudGxb03FotDajxAto6USAlmMZjE2lc0jCznt7sBWkhfRBRaWwbnmDqdMSTKTLT5d9sBFkkM7A==",
+ "requires": {
+ "abab": "^1.0.4",
+ "acorn": "^5.3.0",
+ "acorn-globals": "^4.1.0",
+ "array-equal": "^1.0.0",
+ "cssom": ">= 0.3.2 < 0.4.0",
+ "cssstyle": ">= 0.3.1 < 0.4.0",
+ "data-urls": "^1.0.0",
+ "domexception": "^1.0.0",
+ "escodegen": "^1.9.0",
+ "html-encoding-sniffer": "^1.0.2",
+ "left-pad": "^1.2.0",
+ "nwsapi": "^2.0.0",
+ "parse5": "4.0.0",
+ "pn": "^1.1.0",
+ "request": "^2.83.0",
+ "request-promise-native": "^1.0.5",
+ "sax": "^1.2.4",
+ "symbol-tree": "^3.2.2",
+ "tough-cookie": "^2.3.3",
+ "w3c-hr-time": "^1.0.1",
+ "webidl-conversions": "^4.0.2",
+ "whatwg-encoding": "^1.0.3",
+ "whatwg-mimetype": "^2.1.0",
+ "whatwg-url": "^6.4.1",
+ "ws": "^4.0.0",
+ "xml-name-validator": "^3.0.0"
+ },
+ "dependencies": {
+ "parse5": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/parse5/-/parse5-4.0.0.tgz",
+ "integrity": "sha512-VrZ7eOd3T1Fk4XWNXMgiGBK/z0MG48BWG2uQNU4I72fkQuKUTZpl+u9k+CxEG0twMVzSmXEEz12z5Fnw1jIQFA=="
+ }
+ }
+ },
+ "json-schema": {
+ "version": "0.2.3",
+ "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
+ "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM="
+ },
+ "json-schema-traverse": {
+ "version": "0.3.1",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz",
+ "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A="
+ },
+ "json-stringify-safe": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
+ "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus="
+ },
+ "jsprim": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
+ "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
+ "requires": {
+ "assert-plus": "1.0.0",
+ "extsprintf": "1.3.0",
+ "json-schema": "0.2.3",
+ "verror": "1.10.0"
+ }
+ },
+ "kebab-case": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/kebab-case/-/kebab-case-1.0.0.tgz",
+ "integrity": "sha1-P55JkK3K0MaGwOcB92RYaPdfkes="
+ },
+ "left-pad": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz",
+ "integrity": "sha512-XI5MPzVNApjAyhQzphX8BkmKsKUxD4LdyK24iZeQGinBN9yTQT3bFlCBy/aVx2HrNcqQGsdot8ghrjyrvMCoEA=="
+ },
+ "levn": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz",
+ "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=",
+ "requires": {
+ "prelude-ls": "~1.1.2",
+ "type-check": "~0.3.2"
+ }
+ },
+ "lodash": {
+ "version": "4.17.10",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz",
+ "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg=="
+ },
+ "lodash.iteratee": {
+ "version": "4.7.0",
+ "resolved": "https://registry.npmjs.org/lodash.iteratee/-/lodash.iteratee-4.7.0.tgz",
+ "integrity": "sha1-vkF32yiajMw8CZDx2ya1si/BVUw="
+ },
+ "lodash.sortby": {
+ "version": "4.7.0",
+ "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz",
+ "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg="
+ },
+ "longest-streak": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/longest-streak/-/longest-streak-1.0.0.tgz",
+ "integrity": "sha1-0GWXxNTDG1LMsfXY+P5xSOr9aWU="
+ },
+ "mapz": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/mapz/-/mapz-1.0.2.tgz",
+ "integrity": "sha512-NuY43BoHy5K4jVg3/oD+g8ysNwdXY3HB5UankVWoikxT9YMqgCYC77pNRENTm/DfslLxPFEOyJUw9h9isRty6w==",
+ "requires": {
+ "x-is-array": "^0.1.0"
+ }
+ },
+ "markdown-escapes": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.2.tgz",
+ "integrity": "sha512-lbRZ2mE3Q9RtLjxZBZ9+IMl68DKIXaVAhwvwn9pmjnPLS0h/6kyBMgNhqi1xFJ/2yv6cSyv0jbiZavZv93JkkA=="
+ },
+ "markdown-table": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-0.4.0.tgz",
+ "integrity": "sha1-iQwsGzv+g/sA5BKbjkz+ZFJw+dE="
+ },
"marked": {
"version": "0.3.6",
"resolved": "https://registry.npmjs.org/marked/-/marked-0.3.6.tgz",
"integrity": "sha1-ssbGGPzOzk74bE/Gy4p8v1rtqNc="
},
+ "mdast-util-definitions": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/mdast-util-definitions/-/mdast-util-definitions-1.2.2.tgz",
+ "integrity": "sha512-9NloPSwaB9f1PKcGqaScfqRf6zKOEjTIXVIbPOmgWI/JKxznlgVXC5C+8qgl3AjYg2vJBRgLYfLICaNiac89iA==",
+ "requires": {
+ "unist-util-visit": "^1.0.0"
+ }
+ },
+ "mdast-util-to-hast": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/mdast-util-to-hast/-/mdast-util-to-hast-3.0.1.tgz",
+ "integrity": "sha512-+eimV/12kdg0/T0EEfcK7IsDbSu2auVm92z5jdSEQ3DHF2HiU4OHmX9ir5wpQajr73nwabdxrUoxREvW2zVFFw==",
+ "requires": {
+ "collapse-white-space": "^1.0.0",
+ "detab": "^2.0.0",
+ "mdast-util-definitions": "^1.2.0",
+ "mdurl": "^1.0.1",
+ "trim": "0.0.1",
+ "trim-lines": "^1.0.0",
+ "unist-builder": "^1.0.1",
+ "unist-util-generated": "^1.1.0",
+ "unist-util-position": "^3.0.0",
+ "unist-util-visit": "^1.1.0",
+ "xtend": "^4.0.1"
+ }
+ },
+ "mdurl": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz",
+ "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4="
+ },
+ "mime-db": {
+ "version": "1.33.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.33.0.tgz",
+ "integrity": "sha512-BHJ/EKruNIqJf/QahvxwQZXKygOQ256myeN/Ew+THcAa5q+PjyTTMMeNQC4DZw5AwfvelsUrA6B67NKMqXDbzQ=="
+ },
+ "mime-types": {
+ "version": "2.1.18",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.18.tgz",
+ "integrity": "sha512-lc/aahn+t4/SWV/qcmumYjymLsWfN3ELhpmVuUFjgsORruuZPVSwAQryq+HHGvO/SI2KVX26bx+En+zhM8g8hQ==",
+ "requires": {
+ "mime-db": "~1.33.0"
+ }
+ },
+ "nwsapi": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.0.4.tgz",
+ "integrity": "sha512-Zt6HRR6RcJkuj5/N9zeE7FN6YitRW//hK2wTOwX274IBphbY3Zf5+yn5mZ9v/SzAOTMjQNxZf9KkmPLWn0cV4g=="
+ },
+ "oauth-sign": {
+ "version": "0.8.2",
+ "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz",
+ "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM="
+ },
+ "object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
+ },
+ "object-keys": {
+ "version": "1.0.12",
+ "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz",
+ "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag=="
+ },
+ "once": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
+ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
+ "requires": {
+ "wrappy": "1"
+ }
+ },
+ "optionator": {
+ "version": "0.8.2",
+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz",
+ "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=",
+ "requires": {
+ "deep-is": "~0.1.3",
+ "fast-levenshtein": "~2.0.4",
+ "levn": "~0.3.0",
+ "prelude-ls": "~1.1.2",
+ "type-check": "~0.3.2",
+ "wordwrap": "~1.0.0"
+ }
+ },
+ "parse-entities": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/parse-entities/-/parse-entities-1.1.2.tgz",
+ "integrity": "sha512-5N9lmQ7tmxfXf+hO3X6KRG6w7uYO/HL9fHalSySTdyn63C3WNvTM/1R8tn1u1larNcEbo3Slcy2bsVDQqvEpUg==",
+ "requires": {
+ "character-entities": "^1.0.0",
+ "character-entities-legacy": "^1.0.0",
+ "character-reference-invalid": "^1.0.0",
+ "is-alphanumerical": "^1.0.0",
+ "is-decimal": "^1.0.0",
+ "is-hexadecimal": "^1.0.0"
+ }
+ },
+ "parse5": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/parse5/-/parse5-3.0.3.tgz",
+ "integrity": "sha512-rgO9Zg5LLLkfJF9E6CCmXlSE4UVceloys8JrFqCcHloC3usd/kJCyPDwH2SOlzix2j3xaP9sUX3e8+kvkuleAA==",
+ "requires": {
+ "@types/node": "*"
+ }
+ },
+ "performance-now": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
+ "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns="
+ },
+ "pn": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/pn/-/pn-1.1.0.tgz",
+ "integrity": "sha512-2qHaIQr2VLRFoxe2nASzsV6ef4yOOH+Fi9FBOVH6cqeSgUnoyySPZkxzLuzd+RYOQTRpROA0ztTMqxROKSb/nA=="
+ },
+ "prelude-ls": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz",
+ "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ="
+ },
+ "property-information": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/property-information/-/property-information-3.2.0.tgz",
+ "integrity": "sha1-/RSDyPusYYCPX+NZ52k6H0ilgzE="
+ },
+ "psl": {
+ "version": "1.1.28",
+ "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.28.tgz",
+ "integrity": "sha512-+AqO1Ae+N/4r7Rvchrdm432afjT9hqJRyBN3DQv9At0tPz4hIFSGKbq64fN9dVoCow4oggIIax5/iONx0r9hZw=="
+ },
+ "punycode": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz",
+ "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A=="
+ },
+ "qs": {
+ "version": "6.5.2",
+ "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.2.tgz",
+ "integrity": "sha512-N5ZAX4/LxJmF+7wN74pUD6qAh9/wnvdQcjq9TZjevvXzSUo7bfmw91saqMjzGS2xq91/odN2dW/WOl7qQHNDGA=="
+ },
+ "rehype-raw": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/rehype-raw/-/rehype-raw-2.0.0.tgz",
+ "integrity": "sha1-Vjep/O7zSAD9fFfKMv2dWSf9Kqo=",
+ "requires": {
+ "hast-util-raw": "^2.0.0"
+ }
+ },
+ "rehype-stringify": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/rehype-stringify/-/rehype-stringify-3.0.0.tgz",
+ "integrity": "sha1-n+8IaCE8Lc4veAt289BIjIXoGes=",
+ "requires": {
+ "hast-util-to-html": "^3.0.0",
+ "xtend": "^4.0.1"
+ }
+ },
+ "remark": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/remark/-/remark-5.1.0.tgz",
+ "integrity": "sha1-y0Y709vLS5l5STXu4c9x16jjBow=",
+ "requires": {
+ "remark-parse": "^1.1.0",
+ "remark-stringify": "^1.1.0",
+ "unified": "^4.1.1"
+ },
+ "dependencies": {
+ "remark-parse": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-1.1.0.tgz",
+ "integrity": "sha1-w8oQ+ajaBGFcKPCapOMEUQUm7CE=",
+ "requires": {
+ "collapse-white-space": "^1.0.0",
+ "extend": "^3.0.0",
+ "parse-entities": "^1.0.2",
+ "repeat-string": "^1.5.4",
+ "trim": "0.0.1",
+ "trim-trailing-lines": "^1.0.0",
+ "unherit": "^1.0.4",
+ "unist-util-remove-position": "^1.0.0",
+ "vfile-location": "^2.0.0"
+ }
+ },
+ "unified": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/unified/-/unified-4.2.1.tgz",
+ "integrity": "sha1-dv9Dqo2kMPbn5KVchOusKtLPzS4=",
+ "requires": {
+ "bail": "^1.0.0",
+ "extend": "^3.0.0",
+ "has": "^1.0.1",
+ "once": "^1.3.3",
+ "trough": "^1.0.0",
+ "vfile": "^1.0.0"
+ }
+ },
+ "vfile": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/vfile/-/vfile-1.4.0.tgz",
+ "integrity": "sha1-wP1vpIT43r23cfaMMe112I2pf+c="
+ }
+ }
+ },
+ "remark-parse": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/remark-parse/-/remark-parse-5.0.0.tgz",
+ "integrity": "sha512-b3iXszZLH1TLoyUzrATcTQUZrwNl1rE70rVdSruJFlDaJ9z5aMkhrG43Pp68OgfHndL/ADz6V69Zow8cTQu+JA==",
+ "requires": {
+ "collapse-white-space": "^1.0.2",
+ "is-alphabetical": "^1.0.0",
+ "is-decimal": "^1.0.0",
+ "is-whitespace-character": "^1.0.0",
+ "is-word-character": "^1.0.0",
+ "markdown-escapes": "^1.0.0",
+ "parse-entities": "^1.1.0",
+ "repeat-string": "^1.5.4",
+ "state-toggle": "^1.0.0",
+ "trim": "0.0.1",
+ "trim-trailing-lines": "^1.0.0",
+ "unherit": "^1.0.4",
+ "unist-util-remove-position": "^1.0.0",
+ "vfile-location": "^2.0.0",
+ "xtend": "^4.0.1"
+ }
+ },
+ "remark-rehype": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/remark-rehype/-/remark-rehype-3.0.0.tgz",
+ "integrity": "sha512-WUinfb6vi34f4VYs2XS4HvuYNd0tCu68HOlG4aMp1dfFyVuVfL3aiL9WPw+Q6W99xTTHyxwr7BGO94jF0psoEA==",
+ "requires": {
+ "mdast-util-to-hast": "^3.0.0"
+ }
+ },
+ "remark-stringify": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/remark-stringify/-/remark-stringify-1.1.0.tgz",
+ "integrity": "sha1-pxBeJbnuK/mkm3XSxCPxGwauIJI=",
+ "requires": {
+ "ccount": "^1.0.0",
+ "extend": "^3.0.0",
+ "longest-streak": "^1.0.0",
+ "markdown-table": "^0.4.0",
+ "parse-entities": "^1.0.2",
+ "repeat-string": "^1.5.4",
+ "stringify-entities": "^1.0.1",
+ "unherit": "^1.0.4"
+ }
+ },
+ "repeat-string": {
+ "version": "1.6.1",
+ "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz",
+ "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc="
+ },
+ "replace-ext": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/replace-ext/-/replace-ext-1.0.0.tgz",
+ "integrity": "sha1-3mMSg3P8v3w8z6TeWkgMRaZ5WOs="
+ },
+ "request": {
+ "version": "2.87.0",
+ "resolved": "https://registry.npmjs.org/request/-/request-2.87.0.tgz",
+ "integrity": "sha512-fcogkm7Az5bsS6Sl0sibkbhcKsnyon/jV1kF3ajGmF0c8HrttdKTPRT9hieOaQHA5HEq6r8OyWOo/o781C1tNw==",
+ "requires": {
+ "aws-sign2": "~0.7.0",
+ "aws4": "^1.6.0",
+ "caseless": "~0.12.0",
+ "combined-stream": "~1.0.5",
+ "extend": "~3.0.1",
+ "forever-agent": "~0.6.1",
+ "form-data": "~2.3.1",
+ "har-validator": "~5.0.3",
+ "http-signature": "~1.2.0",
+ "is-typedarray": "~1.0.0",
+ "isstream": "~0.1.2",
+ "json-stringify-safe": "~5.0.1",
+ "mime-types": "~2.1.17",
+ "oauth-sign": "~0.8.2",
+ "performance-now": "^2.1.0",
+ "qs": "~6.5.1",
+ "safe-buffer": "^5.1.1",
+ "tough-cookie": "~2.3.3",
+ "tunnel-agent": "^0.6.0",
+ "uuid": "^3.1.0"
+ },
+ "dependencies": {
+ "punycode": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
+ "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4="
+ },
+ "tough-cookie": {
+ "version": "2.3.4",
+ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz",
+ "integrity": "sha512-TZ6TTfI5NtZnuyy/Kecv+CnoROnyXn2DN97LontgQpCwsX2XyLYCC0ENhYkehSOwAp8rTQKc/NUIF7BkQ5rKLA==",
+ "requires": {
+ "punycode": "^1.4.1"
+ }
+ }
+ }
+ },
+ "request-promise-core": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.1.tgz",
+ "integrity": "sha1-Pu4AssWqgyOc+wTFcA2jb4HNCLY=",
+ "requires": {
+ "lodash": "^4.13.1"
+ }
+ },
+ "request-promise-native": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.5.tgz",
+ "integrity": "sha1-UoF3D2jgyXGeUWP9P6tIIhX0/aU=",
+ "requires": {
+ "request-promise-core": "1.1.1",
+ "stealthy-require": "^1.1.0",
+ "tough-cookie": ">=2.3.3"
+ }
+ },
+ "safe-buffer": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g=="
+ },
+ "safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
+ },
+ "sax": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
+ "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "optional": true
+ },
+ "space-separated-tokens": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-1.1.2.tgz",
+ "integrity": "sha512-G3jprCEw+xFEs0ORweLmblJ3XLymGGr6hxZYTYZjIlvDti9vOBUjRQa1Rzjt012aRrocKstHwdNi+F7HguPsEA==",
+ "requires": {
+ "trim": "0.0.1"
+ }
+ },
"sprintf-js": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz",
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
"dev": true
+ },
+ "sshpk": {
+ "version": "1.14.2",
+ "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz",
+ "integrity": "sha1-xvxhZIo9nE52T9P8306hBeSSupg=",
+ "requires": {
+ "asn1": "~0.2.3",
+ "assert-plus": "^1.0.0",
+ "bcrypt-pbkdf": "^1.0.0",
+ "dashdash": "^1.12.0",
+ "ecc-jsbn": "~0.1.1",
+ "getpass": "^0.1.1",
+ "jsbn": "~0.1.0",
+ "safer-buffer": "^2.0.2",
+ "tweetnacl": "~0.14.0"
+ }
+ },
+ "state-toggle": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/state-toggle/-/state-toggle-1.0.1.tgz",
+ "integrity": "sha512-Qe8QntFrrpWTnHwvwj2FZTgv+PKIsp0B9VxLzLLbSpPXWOgRgc5LVj/aTiSfK1RqIeF9jeC1UeOH8Q8y60A7og=="
+ },
+ "stealthy-require": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz",
+ "integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks="
+ },
+ "stringify-entities": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/stringify-entities/-/stringify-entities-1.3.2.tgz",
+ "integrity": "sha512-nrBAQClJAPN2p+uGCVJRPIPakKeKWZ9GtBCmormE7pWOSlHat7+x5A8gx85M7HM5Dt0BP3pP5RhVW77WdbJJ3A==",
+ "requires": {
+ "character-entities-html4": "^1.0.0",
+ "character-entities-legacy": "^1.0.0",
+ "is-alphanumerical": "^1.0.0",
+ "is-hexadecimal": "^1.0.0"
+ }
+ },
+ "symbol-tree": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.2.tgz",
+ "integrity": "sha1-rifbOPZgp64uHDt9G8KQgZuFGeY="
+ },
+ "tough-cookie": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.2.tgz",
+ "integrity": "sha512-vahm+X8lSV/KjXziec8x5Vp0OTC9mq8EVCOApIsRAooeuMPSO8aT7PFACYkaL0yZ/3hVqw+8DzhCJwl8H2Ad6w==",
+ "requires": {
+ "psl": "^1.1.24",
+ "punycode": "^1.4.1"
+ },
+ "dependencies": {
+ "punycode": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz",
+ "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4="
+ }
+ }
+ },
+ "tr46": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz",
+ "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=",
+ "requires": {
+ "punycode": "^2.1.0"
+ }
+ },
+ "trim": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/trim/-/trim-0.0.1.tgz",
+ "integrity": "sha1-WFhUf2spB1fulczMZm+1AITEYN0="
+ },
+ "trim-lines": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/trim-lines/-/trim-lines-1.1.1.tgz",
+ "integrity": "sha512-X+eloHbgJGxczUk1WSjIvn7aC9oN3jVE3rQfRVKcgpavi3jxtCn0VVKtjOBj64Yop96UYn/ujJRpTbCdAF1vyg=="
+ },
+ "trim-trailing-lines": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/trim-trailing-lines/-/trim-trailing-lines-1.1.1.tgz",
+ "integrity": "sha512-bWLv9BbWbbd7mlqqs2oQYnLD/U/ZqeJeJwbO0FG2zA1aTq+HTvxfHNKFa/HGCVyJpDiioUYaBhfiT6rgk+l4mg=="
+ },
+ "trough": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/trough/-/trough-1.0.2.tgz",
+ "integrity": "sha512-FHkoUZvG6Egrv9XZAyYGKEyb1JMsFphgPjoczkZC2y6W93U1jswcVURB8MUvtsahEPEVACyxD47JAL63vF4JsQ=="
+ },
+ "tunnel-agent": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
+ "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
+ "requires": {
+ "safe-buffer": "^5.0.1"
+ }
+ },
+ "tweetnacl": {
+ "version": "0.14.5",
+ "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
+ "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",
+ "optional": true
+ },
+ "type-check": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
+ "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=",
+ "requires": {
+ "prelude-ls": "~1.1.2"
+ }
+ },
+ "unherit": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/unherit/-/unherit-1.1.1.tgz",
+ "integrity": "sha512-+XZuV691Cn4zHsK0vkKYwBEwB74T3IZIcxrgn2E4rKwTfFyI1zCh7X7grwh9Re08fdPlarIdyWgI8aVB3F5A5g==",
+ "requires": {
+ "inherits": "^2.0.1",
+ "xtend": "^4.0.1"
+ }
+ },
+ "unified": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/unified/-/unified-7.0.0.tgz",
+ "integrity": "sha512-j+Sm7upmmt3RXPBeA+KFGYBlHBxClnby2DtxezFKwMfhWTAklY4WbEdhwRo6c6GpuHdi04YDsyPKY/kh5a/xnQ==",
+ "requires": {
+ "bail": "^1.0.0",
+ "extend": "^3.0.0",
+ "is-plain-obj": "^1.1.0",
+ "trough": "^1.0.0",
+ "vfile": "^3.0.0",
+ "x-is-string": "^0.1.0"
+ }
+ },
+ "unist-builder": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/unist-builder/-/unist-builder-1.0.2.tgz",
+ "integrity": "sha1-jDuZA+9kvPsRfdfPal2Y/Bs7J7Y=",
+ "requires": {
+ "object-assign": "^4.1.0"
+ }
+ },
+ "unist-util-find": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/unist-util-find/-/unist-util-find-1.0.1.tgz",
+ "integrity": "sha1-EGK7tpKMepfGrcibU3RdTEbCIqI=",
+ "requires": {
+ "lodash.iteratee": "^4.5.0",
+ "remark": "^5.0.1",
+ "unist-util-visit": "^1.1.0"
+ }
+ },
+ "unist-util-generated": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/unist-util-generated/-/unist-util-generated-1.1.2.tgz",
+ "integrity": "sha512-1HcwiEO62dr0XWGT+abVK4f0aAm8Ik8N08c5nAYVmuSxfvpA9rCcNyX/le8xXj1pJK5nBrGlZefeWB6bN8Pstw=="
+ },
+ "unist-util-is": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/unist-util-is/-/unist-util-is-2.1.2.tgz",
+ "integrity": "sha512-YkXBK/H9raAmG7KXck+UUpnKiNmUdB+aBGrknfQ4EreE1banuzrKABx3jP6Z5Z3fMSPMQQmeXBlKpCbMwBkxVw=="
+ },
+ "unist-util-position": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/unist-util-position/-/unist-util-position-3.0.1.tgz",
+ "integrity": "sha512-05QfJDPI7PE1BIUtAxeSV+cDx21xP7+tUZgSval5CA7tr0pHBwybF7OnEa1dOFqg6BfYH/qiMUnWwWj+Frhlww=="
+ },
+ "unist-util-remove-position": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/unist-util-remove-position/-/unist-util-remove-position-1.1.2.tgz",
+ "integrity": "sha512-XxoNOBvq1WXRKXxgnSYbtCF76TJrRoe5++pD4cCBsssSiWSnPEktyFrFLE8LTk3JW5mt9hB0Sk5zn4x/JeWY7Q==",
+ "requires": {
+ "unist-util-visit": "^1.1.0"
+ }
+ },
+ "unist-util-stringify-position": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/unist-util-stringify-position/-/unist-util-stringify-position-1.1.2.tgz",
+ "integrity": "sha512-pNCVrk64LZv1kElr0N1wPiHEUoXNVFERp+mlTg/s9R5Lwg87f9bM/3sQB99w+N9D/qnM9ar3+AKDBwo/gm/iQQ=="
+ },
+ "unist-util-visit": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/unist-util-visit/-/unist-util-visit-1.3.1.tgz",
+ "integrity": "sha512-0fdB9EQJU0tho5tK0VzOJzAQpPv2LyLZ030b10GxuzAWEfvd54mpY7BMjQ1L69k2YNvL+SvxRzH0yUIehOO8aA==",
+ "requires": {
+ "unist-util-is": "^2.1.1"
+ }
+ },
+ "uuid": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.2.1.tgz",
+ "integrity": "sha512-jZnMwlb9Iku/O3smGWvZhauCf6cvvpKi4BKRiliS3cxnI+Gz9j5MEpTz2UFuXiKPJocb7gnsLHwiS05ige5BEA=="
+ },
+ "verror": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
+ "integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
+ "requires": {
+ "assert-plus": "^1.0.0",
+ "core-util-is": "1.0.2",
+ "extsprintf": "^1.2.0"
+ }
+ },
+ "vfile": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/vfile/-/vfile-3.0.0.tgz",
+ "integrity": "sha512-X2DiPHL9Nxgfyu5DNVgtTkZtD4d4Zzf7rVBVI+uXP2pWWIQG8Ri+xAP9KdH/sB6SS0a1niWp5bRF88n4ciwhoA==",
+ "requires": {
+ "is-buffer": "^2.0.0",
+ "replace-ext": "1.0.0",
+ "unist-util-stringify-position": "^1.0.0",
+ "vfile-message": "^1.0.0"
+ }
+ },
+ "vfile-location": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/vfile-location/-/vfile-location-2.0.3.tgz",
+ "integrity": "sha512-zM5/l4lfw1CBoPx3Jimxoc5RNDAHHpk6AM6LM0pTIkm5SUSsx8ZekZ0PVdf0WEZ7kjlhSt7ZlqbRL6Cd6dBs6A=="
+ },
+ "vfile-message": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/vfile-message/-/vfile-message-1.0.1.tgz",
+ "integrity": "sha512-vSGCkhNvJzO6VcWC6AlJW4NtYOVtS+RgCaqFIYUjoGIlHnFL+i0LbtYvonDWOMcB97uTPT4PRsyYY7REWC9vug==",
+ "requires": {
+ "unist-util-stringify-position": "^1.1.1"
+ }
+ },
+ "w3c-hr-time": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.1.tgz",
+ "integrity": "sha1-gqwr/2PZUOqeMYmlimViX+3xkEU=",
+ "requires": {
+ "browser-process-hrtime": "^0.1.2"
+ }
+ },
+ "web-namespaces": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/web-namespaces/-/web-namespaces-1.1.2.tgz",
+ "integrity": "sha512-II+n2ms4mPxK+RnIxRPOw3zwF2jRscdJIUE9BfkKHm4FYEg9+biIoTMnaZF5MpemE3T+VhMLrhbyD4ilkPCSbg=="
+ },
+ "webidl-conversions": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz",
+ "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg=="
+ },
+ "whatwg-encoding": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-1.0.3.tgz",
+ "integrity": "sha512-jLBwwKUhi8WtBfsMQlL4bUUcT8sMkAtQinscJAe/M4KHCkHuUJAF6vuB0tueNIw4c8ziO6AkRmgY+jL3a0iiPw==",
+ "requires": {
+ "iconv-lite": "0.4.19"
+ }
+ },
+ "whatwg-mimetype": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-2.1.0.tgz",
+ "integrity": "sha512-FKxhYLytBQiUKjkYteN71fAUA3g6KpNXoho1isLiLSB3N1G4F35Q5vUxWfKFhBwi5IWF27VE6WxhrnnC+m0Mew=="
+ },
+ "whatwg-url": {
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-6.5.0.tgz",
+ "integrity": "sha512-rhRZRqx/TLJQWUpQ6bmrt2UV4f0HCQ463yQuONJqC6fO2VoEb1pTYddbe59SkYq87aoM5A3bdhMZiUiVws+fzQ==",
+ "requires": {
+ "lodash.sortby": "^4.7.0",
+ "tr46": "^1.0.1",
+ "webidl-conversions": "^4.0.2"
+ }
+ },
+ "wordwrap": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz",
+ "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus="
+ },
+ "wrappy": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
+ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
+ },
+ "ws": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-4.1.0.tgz",
+ "integrity": "sha512-ZGh/8kF9rrRNffkLFV4AzhvooEclrOH0xaugmqGsIfFgOE/pIz4fMc4Ef+5HSQqTEug2S9JZIWDR47duDSLfaA==",
+ "requires": {
+ "async-limiter": "~1.0.0",
+ "safe-buffer": "~5.1.0"
+ }
+ },
+ "x-is-array": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/x-is-array/-/x-is-array-0.1.0.tgz",
+ "integrity": "sha1-3lIBcdR7P0FvVYfWKbidJrEtwp0="
+ },
+ "x-is-string": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/x-is-string/-/x-is-string-0.1.0.tgz",
+ "integrity": "sha1-R0tQhlrzpJqcRlfwWs0UVFj3fYI="
+ },
+ "xml-name-validator": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-3.0.0.tgz",
+ "integrity": "sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw=="
+ },
+ "xtend": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",
+ "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68="
+ },
+ "zwitch": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/zwitch/-/zwitch-1.0.3.tgz",
+ "integrity": "sha512-aynRpmJDw7JIq6X4NDWJoiK1yVSiG57ArWSg4HLC1SFupX5/bo0Cf4jpX0ifwuzBfxpYBuNSyvMlWNNRuy3cVA=="
}
}
}
diff --git a/tools/doc/package.json b/tools/doc/package.json
index d33943eacd..7a8e60f443 100644
--- a/tools/doc/package.json
+++ b/tools/doc/package.json
@@ -7,7 +7,14 @@
"node": ">=6"
},
"dependencies": {
- "marked": "^0.3.5"
+ "marked": "^0.3.5",
+ "rehype-raw": "^2.0.0",
+ "rehype-stringify": "^3.0.0",
+ "remark-parse": "^5.0.0",
+ "remark-rehype": "^3.0.0",
+ "unified": "^7.0.0",
+ "unist-util-find": "^1.0.1",
+ "unist-util-visit": "^1.3.1"
},
"devDependencies": {
"js-yaml": "^3.5.2"
diff --git a/tools/license-builder.sh b/tools/license-builder.sh
index 672e7c4f4c..e394175090 100755
--- a/tools/license-builder.sh
+++ b/tools/license-builder.sh
@@ -84,7 +84,9 @@ addlicense "gtest" "deps/gtest" "$(cat ${rootdir}/deps/gtest/LICENSE)"
# nghttp2
addlicense "nghttp2" "deps/nghttp2" "$(cat ${rootdir}/deps/nghttp2/COPYING)"
-# remark-cli
+# remark
+addlicense "unified" "deps/unified" "$(cat ${rootdir}/tools/doc/node_modules/unified/LICENSE)"
+addlicense "remark-rehype" "deps/remark-rehype" "$(cat ${rootdir}/tools/doc/node_modules/remark-rehype/LICENSE)"
addlicense "remark-cli" "tools/remark-cli" "$(cat ${rootdir}/tools/remark-cli/LICENSE)"
# node-inspect
diff --git a/vcbuild.bat b/vcbuild.bat
index fa14e321e6..7c88c25ed1 100644
--- a/vcbuild.bat
+++ b/vcbuild.bat
@@ -255,7 +255,7 @@ goto exit
:wix-not-found
echo Build skipped. To generate installer, you need to install Wix.
-goto build-doc
+goto install-doctools
:msbuild-found
@@ -385,7 +385,7 @@ exit /b 1
:msi
@rem Skip msi generation if not requested
-if not defined msi goto build-doc
+if not defined msi goto install-doctools
:msibuild
echo Building node-v%FULLVERSION%-%target_arch%.msi
@@ -400,7 +400,7 @@ if errorlevel 1 echo Failed to sign msi&goto exit
:upload
@rem Skip upload if not requested
-if not defined upload goto build-doc
+if not defined upload goto install-doctools
if not defined SSHCONFIG (
echo SSHCONFIG is not set for upload
@@ -428,6 +428,23 @@ ssh -F %SSHCONFIG% %STAGINGSERVER% "touch nodejs/%DISTTYPEDIR%/v%FULLVERSION%/no
if errorlevel 1 goto exit
+:install-doctools
+REM only install if building doc OR testing doctool
+if not defined doc (
+ echo.%test_args% | findstr doctool 1>nul
+ if errorlevel 1 goto :skip-install-doctools
+)
+if exist "tools\doc\node_modules\unified\package.json" goto skip-install-doctools
+SETLOCAL
+cd tools\doc
+%npm_exe% install
+cd ..\..
+if errorlevel 1 goto exit
+ENDLOCAL
+:skip-install-doctools
+@rem Clear errorlevel from echo.%test_args% | findstr doctool 1>nul
+cd .
+
:build-doc
@rem Build documentation if requested
if not defined doc goto run
@@ -439,14 +456,6 @@ mkdir %config%\doc
robocopy /e doc\api %config%\doc\api
robocopy /e doc\api_assets %config%\doc\api\assets
-if exist "tools\doc\node_modules\js-yaml\package.json" goto doc-skip-js-yaml
-SETLOCAL
-cd tools\doc
-%npm_exe% install
-cd ..\..
-if errorlevel 1 goto exit
-ENDLOCAL
-:doc-skip-js-yaml
for %%F in (%config%\doc\api\*.md) do (
%node_exe% tools\doc\generate.js --format=json %%F > %%~dF%%~pF%%~nF.json
%node_exe% tools\doc\generate.js --node-version=v%FULLVERSION% --format=html --analytics=%DOCS_ANALYTICS% %%F > %%~dF%%~pF%%~nF.html