@rohal12/spindle-lsp 0.15.7 → 0.15.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.js +837 -454
- package/dist/bin.js.map +4 -4
- package/package.json +4 -4
package/dist/bin.js
CHANGED
|
@@ -55,7 +55,7 @@ var VERSION;
|
|
|
55
55
|
var init_version = __esm({
|
|
56
56
|
"src/version.ts"() {
|
|
57
57
|
"use strict";
|
|
58
|
-
VERSION = false ? pkg.version : "0.15.
|
|
58
|
+
VERSION = false ? pkg.version : "0.15.9";
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
|
|
@@ -7011,10 +7011,10 @@ var require_resolve_block_map = __commonJS({
|
|
|
7011
7011
|
let offset2 = bm.offset;
|
|
7012
7012
|
let commentEnd = null;
|
|
7013
7013
|
for (const collItem of bm.items) {
|
|
7014
|
-
const { start, key, sep:
|
|
7014
|
+
const { start, key, sep: sep4, value } = collItem;
|
|
7015
7015
|
const keyProps = resolveProps.resolveProps(start, {
|
|
7016
7016
|
indicator: "explicit-key-ind",
|
|
7017
|
-
next: key ??
|
|
7017
|
+
next: key ?? sep4?.[0],
|
|
7018
7018
|
offset: offset2,
|
|
7019
7019
|
onError,
|
|
7020
7020
|
parentIndent: bm.indent,
|
|
@@ -7028,7 +7028,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
7028
7028
|
else if ("indent" in key && key.indent !== bm.indent)
|
|
7029
7029
|
onError(offset2, "BAD_INDENT", startColMsg);
|
|
7030
7030
|
}
|
|
7031
|
-
if (!keyProps.anchor && !keyProps.tag && !
|
|
7031
|
+
if (!keyProps.anchor && !keyProps.tag && !sep4) {
|
|
7032
7032
|
commentEnd = keyProps.end;
|
|
7033
7033
|
if (keyProps.comment) {
|
|
7034
7034
|
if (map2.comment)
|
|
@@ -7052,7 +7052,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
7052
7052
|
ctx.atKey = false;
|
|
7053
7053
|
if (utilMapIncludes.mapIncludes(ctx, map2.items, keyNode))
|
|
7054
7054
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
7055
|
-
const valueProps = resolveProps.resolveProps(
|
|
7055
|
+
const valueProps = resolveProps.resolveProps(sep4 ?? [], {
|
|
7056
7056
|
indicator: "map-value-ind",
|
|
7057
7057
|
next: value,
|
|
7058
7058
|
offset: keyNode.range[2],
|
|
@@ -7068,7 +7068,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
7068
7068
|
if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
|
|
7069
7069
|
onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
|
|
7070
7070
|
}
|
|
7071
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset2,
|
|
7071
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset2, sep4, null, valueProps, onError);
|
|
7072
7072
|
if (ctx.schema.compat)
|
|
7073
7073
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
7074
7074
|
offset2 = valueNode.range[2];
|
|
@@ -7159,7 +7159,7 @@ var require_resolve_end = __commonJS({
|
|
|
7159
7159
|
let comment = "";
|
|
7160
7160
|
if (end) {
|
|
7161
7161
|
let hasSpace = false;
|
|
7162
|
-
let
|
|
7162
|
+
let sep4 = "";
|
|
7163
7163
|
for (const token of end) {
|
|
7164
7164
|
const { source, type } = token;
|
|
7165
7165
|
switch (type) {
|
|
@@ -7173,13 +7173,13 @@ var require_resolve_end = __commonJS({
|
|
|
7173
7173
|
if (!comment)
|
|
7174
7174
|
comment = cb;
|
|
7175
7175
|
else
|
|
7176
|
-
comment +=
|
|
7177
|
-
|
|
7176
|
+
comment += sep4 + cb;
|
|
7177
|
+
sep4 = "";
|
|
7178
7178
|
break;
|
|
7179
7179
|
}
|
|
7180
7180
|
case "newline":
|
|
7181
7181
|
if (comment)
|
|
7182
|
-
|
|
7182
|
+
sep4 += source;
|
|
7183
7183
|
hasSpace = true;
|
|
7184
7184
|
break;
|
|
7185
7185
|
default:
|
|
@@ -7222,18 +7222,18 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
7222
7222
|
let offset2 = fc.offset + fc.start.source.length;
|
|
7223
7223
|
for (let i2 = 0; i2 < fc.items.length; ++i2) {
|
|
7224
7224
|
const collItem = fc.items[i2];
|
|
7225
|
-
const { start, key, sep:
|
|
7225
|
+
const { start, key, sep: sep4, value } = collItem;
|
|
7226
7226
|
const props = resolveProps.resolveProps(start, {
|
|
7227
7227
|
flow: fcName,
|
|
7228
7228
|
indicator: "explicit-key-ind",
|
|
7229
|
-
next: key ??
|
|
7229
|
+
next: key ?? sep4?.[0],
|
|
7230
7230
|
offset: offset2,
|
|
7231
7231
|
onError,
|
|
7232
7232
|
parentIndent: fc.indent,
|
|
7233
7233
|
startOnNewline: false
|
|
7234
7234
|
});
|
|
7235
7235
|
if (!props.found) {
|
|
7236
|
-
if (!props.anchor && !props.tag && !
|
|
7236
|
+
if (!props.anchor && !props.tag && !sep4 && !value) {
|
|
7237
7237
|
if (i2 === 0 && props.comma)
|
|
7238
7238
|
onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
7239
7239
|
else if (i2 < fc.items.length - 1)
|
|
@@ -7287,8 +7287,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
7287
7287
|
}
|
|
7288
7288
|
}
|
|
7289
7289
|
}
|
|
7290
|
-
if (!isMap2 && !
|
|
7291
|
-
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end,
|
|
7290
|
+
if (!isMap2 && !sep4 && !props.found) {
|
|
7291
|
+
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep4, null, props, onError);
|
|
7292
7292
|
coll.items.push(valueNode);
|
|
7293
7293
|
offset2 = valueNode.range[2];
|
|
7294
7294
|
if (isBlock(value))
|
|
@@ -7300,7 +7300,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
7300
7300
|
if (isBlock(key))
|
|
7301
7301
|
onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
7302
7302
|
ctx.atKey = false;
|
|
7303
|
-
const valueProps = resolveProps.resolveProps(
|
|
7303
|
+
const valueProps = resolveProps.resolveProps(sep4 ?? [], {
|
|
7304
7304
|
flow: fcName,
|
|
7305
7305
|
indicator: "map-value-ind",
|
|
7306
7306
|
next: value,
|
|
@@ -7311,8 +7311,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
7311
7311
|
});
|
|
7312
7312
|
if (valueProps.found) {
|
|
7313
7313
|
if (!isMap2 && !props.found && ctx.options.strict) {
|
|
7314
|
-
if (
|
|
7315
|
-
for (const st2 of
|
|
7314
|
+
if (sep4)
|
|
7315
|
+
for (const st2 of sep4) {
|
|
7316
7316
|
if (st2 === valueProps.found)
|
|
7317
7317
|
break;
|
|
7318
7318
|
if (st2.type === "newline") {
|
|
@@ -7329,7 +7329,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
7329
7329
|
else
|
|
7330
7330
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
7331
7331
|
}
|
|
7332
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end,
|
|
7332
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep4, null, valueProps, onError) : null;
|
|
7333
7333
|
if (valueNode) {
|
|
7334
7334
|
if (isBlock(value))
|
|
7335
7335
|
onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
@@ -7509,7 +7509,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
7509
7509
|
chompStart = i2 + 1;
|
|
7510
7510
|
}
|
|
7511
7511
|
let value = "";
|
|
7512
|
-
let
|
|
7512
|
+
let sep4 = "";
|
|
7513
7513
|
let prevMoreIndented = false;
|
|
7514
7514
|
for (let i2 = 0; i2 < contentStart; ++i2)
|
|
7515
7515
|
value += lines[i2][0].slice(trimIndent) + "\n";
|
|
@@ -7526,24 +7526,24 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
7526
7526
|
indent = "";
|
|
7527
7527
|
}
|
|
7528
7528
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
7529
|
-
value +=
|
|
7530
|
-
|
|
7529
|
+
value += sep4 + indent.slice(trimIndent) + content2;
|
|
7530
|
+
sep4 = "\n";
|
|
7531
7531
|
} else if (indent.length > trimIndent || content2[0] === " ") {
|
|
7532
|
-
if (
|
|
7533
|
-
|
|
7534
|
-
else if (!prevMoreIndented &&
|
|
7535
|
-
|
|
7536
|
-
value +=
|
|
7537
|
-
|
|
7532
|
+
if (sep4 === " ")
|
|
7533
|
+
sep4 = "\n";
|
|
7534
|
+
else if (!prevMoreIndented && sep4 === "\n")
|
|
7535
|
+
sep4 = "\n\n";
|
|
7536
|
+
value += sep4 + indent.slice(trimIndent) + content2;
|
|
7537
|
+
sep4 = "\n";
|
|
7538
7538
|
prevMoreIndented = true;
|
|
7539
7539
|
} else if (content2 === "") {
|
|
7540
|
-
if (
|
|
7540
|
+
if (sep4 === "\n")
|
|
7541
7541
|
value += "\n";
|
|
7542
7542
|
else
|
|
7543
|
-
|
|
7543
|
+
sep4 = "\n";
|
|
7544
7544
|
} else {
|
|
7545
|
-
value +=
|
|
7546
|
-
|
|
7545
|
+
value += sep4 + content2;
|
|
7546
|
+
sep4 = " ";
|
|
7547
7547
|
prevMoreIndented = false;
|
|
7548
7548
|
}
|
|
7549
7549
|
}
|
|
@@ -7726,25 +7726,25 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
7726
7726
|
trimBoth = /^[ \t]+|[ \t]+$/g;
|
|
7727
7727
|
}
|
|
7728
7728
|
let res = match2[1].replace(trimEnd, "");
|
|
7729
|
-
let
|
|
7729
|
+
let sep4 = " ";
|
|
7730
7730
|
let pos = line.lastIndex;
|
|
7731
7731
|
while (match2 = line.exec(source)) {
|
|
7732
7732
|
const lm = match2[1].replace(trimBoth, "");
|
|
7733
7733
|
if (lm === "") {
|
|
7734
|
-
if (
|
|
7735
|
-
res +=
|
|
7734
|
+
if (sep4 === "\n")
|
|
7735
|
+
res += sep4;
|
|
7736
7736
|
else
|
|
7737
|
-
|
|
7737
|
+
sep4 = "\n";
|
|
7738
7738
|
} else {
|
|
7739
|
-
res +=
|
|
7740
|
-
|
|
7739
|
+
res += sep4 + lm;
|
|
7740
|
+
sep4 = " ";
|
|
7741
7741
|
}
|
|
7742
7742
|
pos = line.lastIndex;
|
|
7743
7743
|
}
|
|
7744
7744
|
const last2 = /[ \t]*(.*)/sy;
|
|
7745
7745
|
last2.lastIndex = pos;
|
|
7746
7746
|
match2 = last2.exec(source);
|
|
7747
|
-
return res +
|
|
7747
|
+
return res + sep4 + (match2?.[1] ?? "");
|
|
7748
7748
|
}
|
|
7749
7749
|
function doubleQuotedValue(source, onError) {
|
|
7750
7750
|
let res = "";
|
|
@@ -8554,14 +8554,14 @@ var require_cst_stringify = __commonJS({
|
|
|
8554
8554
|
}
|
|
8555
8555
|
}
|
|
8556
8556
|
}
|
|
8557
|
-
function stringifyItem({ start, key, sep:
|
|
8557
|
+
function stringifyItem({ start, key, sep: sep4, value }) {
|
|
8558
8558
|
let res = "";
|
|
8559
8559
|
for (const st2 of start)
|
|
8560
8560
|
res += st2.source;
|
|
8561
8561
|
if (key)
|
|
8562
8562
|
res += stringifyToken(key);
|
|
8563
|
-
if (
|
|
8564
|
-
for (const st2 of
|
|
8563
|
+
if (sep4)
|
|
8564
|
+
for (const st2 of sep4)
|
|
8565
8565
|
res += st2.source;
|
|
8566
8566
|
if (value)
|
|
8567
8567
|
res += stringifyToken(value);
|
|
@@ -9728,18 +9728,18 @@ var require_parser = __commonJS({
|
|
|
9728
9728
|
if (this.type === "map-value-ind") {
|
|
9729
9729
|
const prev = getPrevProps(this.peek(2));
|
|
9730
9730
|
const start = getFirstKeyStartProps(prev);
|
|
9731
|
-
let
|
|
9731
|
+
let sep4;
|
|
9732
9732
|
if (scalar.end) {
|
|
9733
|
-
|
|
9734
|
-
|
|
9733
|
+
sep4 = scalar.end;
|
|
9734
|
+
sep4.push(this.sourceToken);
|
|
9735
9735
|
delete scalar.end;
|
|
9736
9736
|
} else
|
|
9737
|
-
|
|
9737
|
+
sep4 = [this.sourceToken];
|
|
9738
9738
|
const map2 = {
|
|
9739
9739
|
type: "block-map",
|
|
9740
9740
|
offset: scalar.offset,
|
|
9741
9741
|
indent: scalar.indent,
|
|
9742
|
-
items: [{ start, key: scalar, sep:
|
|
9742
|
+
items: [{ start, key: scalar, sep: sep4 }]
|
|
9743
9743
|
};
|
|
9744
9744
|
this.onKeyLine = true;
|
|
9745
9745
|
this.stack[this.stack.length - 1] = map2;
|
|
@@ -9892,15 +9892,15 @@ var require_parser = __commonJS({
|
|
|
9892
9892
|
} else if (isFlowToken(it2.key) && !includesToken(it2.sep, "newline")) {
|
|
9893
9893
|
const start2 = getFirstKeyStartProps(it2.start);
|
|
9894
9894
|
const key = it2.key;
|
|
9895
|
-
const
|
|
9896
|
-
|
|
9895
|
+
const sep4 = it2.sep;
|
|
9896
|
+
sep4.push(this.sourceToken);
|
|
9897
9897
|
delete it2.key;
|
|
9898
9898
|
delete it2.sep;
|
|
9899
9899
|
this.stack.push({
|
|
9900
9900
|
type: "block-map",
|
|
9901
9901
|
offset: this.offset,
|
|
9902
9902
|
indent: this.indent,
|
|
9903
|
-
items: [{ start: start2, key, sep:
|
|
9903
|
+
items: [{ start: start2, key, sep: sep4 }]
|
|
9904
9904
|
});
|
|
9905
9905
|
} else if (start.length > 0) {
|
|
9906
9906
|
it2.sep = it2.sep.concat(start, this.sourceToken);
|
|
@@ -10094,13 +10094,13 @@ var require_parser = __commonJS({
|
|
|
10094
10094
|
const prev = getPrevProps(parent);
|
|
10095
10095
|
const start = getFirstKeyStartProps(prev);
|
|
10096
10096
|
fixFlowSeqItems(fc);
|
|
10097
|
-
const
|
|
10098
|
-
|
|
10097
|
+
const sep4 = fc.end.splice(1, fc.end.length);
|
|
10098
|
+
sep4.push(this.sourceToken);
|
|
10099
10099
|
const map2 = {
|
|
10100
10100
|
type: "block-map",
|
|
10101
10101
|
offset: fc.offset,
|
|
10102
10102
|
indent: fc.indent,
|
|
10103
|
-
items: [{ start, key: fc, sep:
|
|
10103
|
+
items: [{ start, key: fc, sep: sep4 }]
|
|
10104
10104
|
};
|
|
10105
10105
|
this.onKeyLine = true;
|
|
10106
10106
|
this.stack[this.stack.length - 1] = map2;
|
|
@@ -10489,8 +10489,8 @@ var init_config_loader = __esm({
|
|
|
10489
10489
|
});
|
|
10490
10490
|
|
|
10491
10491
|
// src/core/workspace/macro-sources.ts
|
|
10492
|
-
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
10493
|
-
import { dirname, isAbsolute, join as join2, relative } from "node:path";
|
|
10492
|
+
import { existsSync as existsSync2, lstatSync, readdir, readFileSync as readFileSync2 } from "node:fs";
|
|
10493
|
+
import { dirname, isAbsolute, join as join2, relative, resolve as resolve2, sep } from "node:path";
|
|
10494
10494
|
import { pathToFileURL } from "node:url";
|
|
10495
10495
|
function isExcludedSegment(segment) {
|
|
10496
10496
|
return EXCLUDED_DIRS.includes(segment) || segment.startsWith(".") && segment !== "." && segment !== "..";
|
|
@@ -10501,19 +10501,41 @@ function isMacroSource(uriOrPath) {
|
|
|
10501
10501
|
function isExcludedProjectFile(path2, root) {
|
|
10502
10502
|
return (root ? relative(root, path2) : path2).split(/[\\/]/).some(isExcludedSegment);
|
|
10503
10503
|
}
|
|
10504
|
+
function canDiscoverProjectPath(path2, root) {
|
|
10505
|
+
let current2 = resolve2(root);
|
|
10506
|
+
try {
|
|
10507
|
+
for (const segment of relative(root, path2).split(sep)) {
|
|
10508
|
+
current2 = resolve2(current2, segment);
|
|
10509
|
+
if (lstatSync(current2).isSymbolicLink()) return false;
|
|
10510
|
+
}
|
|
10511
|
+
} catch (error48) {
|
|
10512
|
+
if (["ENOENT", "ENOTDIR", "EACCES", "EPERM"].includes(error48.code ?? "")) return false;
|
|
10513
|
+
throw error48;
|
|
10514
|
+
}
|
|
10515
|
+
return true;
|
|
10516
|
+
}
|
|
10504
10517
|
function findMacroSourceFiles(root) {
|
|
10505
10518
|
return findProjectFiles(root, MACRO_SOURCE_GLOB);
|
|
10506
10519
|
}
|
|
10507
|
-
function findProjectFiles(root, pattern) {
|
|
10508
|
-
const excluded = (p) => isExcludedProjectFile(p.fullpath(), root);
|
|
10509
|
-
|
|
10520
|
+
async function findProjectFiles(root, pattern) {
|
|
10521
|
+
const excluded = (p) => isExcludedProjectFile(p.fullpath(), root) || !canDiscoverProjectPath(p.fullpath(), root);
|
|
10522
|
+
const files = await Ze(pattern, {
|
|
10510
10523
|
cwd: root,
|
|
10511
10524
|
absolute: true,
|
|
10512
10525
|
nodir: true,
|
|
10526
|
+
follow: false,
|
|
10513
10527
|
// Hidden entries are excluded by the predicate, not by glob's default
|
|
10514
10528
|
dot: true,
|
|
10515
|
-
ignore: { ignored: excluded, childrenIgnored: excluded }
|
|
10529
|
+
ignore: { ignored: excluded, childrenIgnored: excluded },
|
|
10530
|
+
// Glob can read a literal prefix before consulting childrenIgnored.
|
|
10531
|
+
fs: {
|
|
10532
|
+
readdir(path2, options, callback) {
|
|
10533
|
+
if (canDiscoverProjectPath(path2, root)) readdir(path2, options, callback);
|
|
10534
|
+
else callback(null, []);
|
|
10535
|
+
}
|
|
10536
|
+
}
|
|
10516
10537
|
});
|
|
10538
|
+
return files.filter((file2) => canDiscoverProjectPath(file2, root));
|
|
10517
10539
|
}
|
|
10518
10540
|
function isWithin(path2, dir) {
|
|
10519
10541
|
const rel = relative(dir, path2);
|
|
@@ -10558,16 +10580,16 @@ var init_macro_sources = __esm({
|
|
|
10558
10580
|
|
|
10559
10581
|
// src/core/workspace/file-inputs.ts
|
|
10560
10582
|
import { readFileSync as readFileSync3, statSync } from "node:fs";
|
|
10561
|
-
import { isAbsolute as isAbsolute2, relative as relative2, resolve as
|
|
10583
|
+
import { isAbsolute as isAbsolute2, relative as relative2, resolve as resolve3, sep as sep2 } from "node:path";
|
|
10562
10584
|
async function resolveFiles(pattern, cwd) {
|
|
10563
10585
|
let input = pattern;
|
|
10564
10586
|
let directory = cwd;
|
|
10565
|
-
const literal3 =
|
|
10587
|
+
const literal3 = resolve3(cwd, pattern);
|
|
10566
10588
|
try {
|
|
10567
10589
|
const stat = statSync(literal3);
|
|
10568
10590
|
if (stat.isFile()) return [literal3];
|
|
10569
10591
|
if (stat.isDirectory()) {
|
|
10570
|
-
if (isExcludedProjectFile(literal3, cwd)) return [];
|
|
10592
|
+
if (isExcludedProjectFile(literal3, cwd) || !canDiscoverProjectPath(literal3, cwd)) return [];
|
|
10571
10593
|
directory = literal3;
|
|
10572
10594
|
input = "**/*.{tw,twee}";
|
|
10573
10595
|
}
|
|
@@ -10586,7 +10608,7 @@ async function resolveInputs(patterns, cwd) {
|
|
|
10586
10608
|
}
|
|
10587
10609
|
function relativeTo(cwd, filePath) {
|
|
10588
10610
|
const rel = relative2(cwd, filePath);
|
|
10589
|
-
return rel === ".." || rel.startsWith(`..${
|
|
10611
|
+
return rel === ".." || rel.startsWith(`..${sep2}`) || isAbsolute2(rel) ? filePath : rel;
|
|
10590
10612
|
}
|
|
10591
10613
|
var init_file_inputs = __esm({
|
|
10592
10614
|
"src/core/workspace/file-inputs.ts"() {
|
|
@@ -10800,10 +10822,11 @@ function peg$parse(input, options) {
|
|
|
10800
10822
|
const peg$c11 = "}";
|
|
10801
10823
|
const peg$c12 = "/";
|
|
10802
10824
|
const peg$c13 = "@";
|
|
10803
|
-
const peg$c14 = "
|
|
10804
|
-
const peg$c15 = "
|
|
10805
|
-
const peg$c16 =
|
|
10806
|
-
const peg$c17 = "'
|
|
10825
|
+
const peg$c14 = ":";
|
|
10826
|
+
const peg$c15 = "</";
|
|
10827
|
+
const peg$c16 = "=";
|
|
10828
|
+
const peg$c17 = '"';
|
|
10829
|
+
const peg$c18 = "'";
|
|
10807
10830
|
const peg$r0 = /^[^\\{[<]/;
|
|
10808
10831
|
const peg$r1 = /^[{}]/;
|
|
10809
10832
|
const peg$r2 = /^[$_@%(!\/a-zA-Z]/;
|
|
@@ -10816,14 +10839,16 @@ function peg$parse(input, options) {
|
|
|
10816
10839
|
const peg$r9 = /^[^ \t\n\r\v\f\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF}]/;
|
|
10817
10840
|
const peg$r10 = /^[a-zA-Z0-9.!#$%&'*+\/=?\^_`|~\-]/;
|
|
10818
10841
|
const peg$r11 = /^[a-zA-Z0-9.\-]/;
|
|
10819
|
-
const peg$r12 = /^[
|
|
10820
|
-
const peg$r13 = /^[
|
|
10821
|
-
const peg$r14 = /^[\t-\r
|
|
10822
|
-
const peg$r15 = /^[
|
|
10823
|
-
const peg$r16 = /^[
|
|
10824
|
-
const peg$r17 = /^["
|
|
10825
|
-
const peg$r18 = /^[^
|
|
10826
|
-
const peg$r19 = /^[
|
|
10842
|
+
const peg$r12 = /^[a-zA-Z0-9+.\-]/;
|
|
10843
|
+
const peg$r13 = /^[^\0- \x7F<>{}]/;
|
|
10844
|
+
const peg$r14 = /^[\t-\r \/>\xA0\u1680\u2000-\u200A\u2028-\u2029\u202F\u205F\u3000\uFEFF]/;
|
|
10845
|
+
const peg$r15 = /^[a-zA-Z0-9\-]/;
|
|
10846
|
+
const peg$r16 = /^[\t-\r "'\/<->{}\xA0\u1680\u2000-\u200A\u2028-\u2029\u202F\u205F\u3000\uFEFF]/;
|
|
10847
|
+
const peg$r17 = /^[^"]/;
|
|
10848
|
+
const peg$r18 = /^[^']/;
|
|
10849
|
+
const peg$r19 = /^["']/;
|
|
10850
|
+
const peg$r20 = /^[^ \t\n\r\v\f\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF>]/;
|
|
10851
|
+
const peg$r21 = /^[ \t\n\r\v\f\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]/;
|
|
10827
10852
|
const peg$e0 = peg$anyExpectation();
|
|
10828
10853
|
const peg$e1 = peg$classExpectation([
|
|
10829
10854
|
"\\",
|
|
@@ -10936,6 +10961,23 @@ function peg$parse(input, options) {
|
|
|
10936
10961
|
"-"
|
|
10937
10962
|
], false, false, false);
|
|
10938
10963
|
const peg$e27 = peg$classExpectation([
|
|
10964
|
+
["a", "z"],
|
|
10965
|
+
["A", "Z"],
|
|
10966
|
+
["0", "9"],
|
|
10967
|
+
"+",
|
|
10968
|
+
".",
|
|
10969
|
+
"-"
|
|
10970
|
+
], false, false, false);
|
|
10971
|
+
const peg$e28 = peg$literalExpectation(":", false);
|
|
10972
|
+
const peg$e29 = peg$classExpectation([
|
|
10973
|
+
["\0", " "],
|
|
10974
|
+
"\x7F",
|
|
10975
|
+
"<",
|
|
10976
|
+
">",
|
|
10977
|
+
"{",
|
|
10978
|
+
"}"
|
|
10979
|
+
], true, false, false);
|
|
10980
|
+
const peg$e30 = peg$classExpectation([
|
|
10939
10981
|
[" ", "\r"],
|
|
10940
10982
|
" ",
|
|
10941
10983
|
"/",
|
|
@@ -10949,14 +10991,14 @@ function peg$parse(input, options) {
|
|
|
10949
10991
|
"\u3000",
|
|
10950
10992
|
"\uFEFF"
|
|
10951
10993
|
], false, false, false);
|
|
10952
|
-
const peg$
|
|
10953
|
-
const peg$
|
|
10994
|
+
const peg$e31 = peg$literalExpectation("</", false);
|
|
10995
|
+
const peg$e32 = peg$classExpectation([
|
|
10954
10996
|
["a", "z"],
|
|
10955
10997
|
["A", "Z"],
|
|
10956
10998
|
["0", "9"],
|
|
10957
10999
|
"-"
|
|
10958
11000
|
], false, false, false);
|
|
10959
|
-
const peg$
|
|
11001
|
+
const peg$e33 = peg$classExpectation([
|
|
10960
11002
|
[" ", "\r"],
|
|
10961
11003
|
" ",
|
|
10962
11004
|
'"',
|
|
@@ -10974,13 +11016,13 @@ function peg$parse(input, options) {
|
|
|
10974
11016
|
"\u3000",
|
|
10975
11017
|
"\uFEFF"
|
|
10976
11018
|
], false, false, false);
|
|
10977
|
-
const peg$
|
|
10978
|
-
const peg$
|
|
10979
|
-
const peg$
|
|
10980
|
-
const peg$
|
|
10981
|
-
const peg$
|
|
10982
|
-
const peg$
|
|
10983
|
-
const peg$
|
|
11019
|
+
const peg$e34 = peg$literalExpectation("=", false);
|
|
11020
|
+
const peg$e35 = peg$literalExpectation('"', false);
|
|
11021
|
+
const peg$e36 = peg$classExpectation(['"'], true, false, false);
|
|
11022
|
+
const peg$e37 = peg$literalExpectation("'", false);
|
|
11023
|
+
const peg$e38 = peg$classExpectation(["'"], true, false, false);
|
|
11024
|
+
const peg$e39 = peg$classExpectation(['"', "'"], false, false, false);
|
|
11025
|
+
const peg$e40 = peg$classExpectation([
|
|
10984
11026
|
" ",
|
|
10985
11027
|
" ",
|
|
10986
11028
|
"\n",
|
|
@@ -10998,7 +11040,7 @@ function peg$parse(input, options) {
|
|
|
10998
11040
|
"\uFEFF",
|
|
10999
11041
|
">"
|
|
11000
11042
|
], true, false, false);
|
|
11001
|
-
const peg$
|
|
11043
|
+
const peg$e41 = peg$classExpectation([
|
|
11002
11044
|
" ",
|
|
11003
11045
|
" ",
|
|
11004
11046
|
"\n",
|
|
@@ -11021,68 +11063,71 @@ function peg$parse(input, options) {
|
|
|
11021
11063
|
function peg$f1() {
|
|
11022
11064
|
return !textMode;
|
|
11023
11065
|
}
|
|
11024
|
-
function peg$f2(
|
|
11066
|
+
function peg$f2() {
|
|
11067
|
+
return !textMode;
|
|
11068
|
+
}
|
|
11069
|
+
function peg$f3(tag) {
|
|
11025
11070
|
return tag;
|
|
11026
11071
|
}
|
|
11027
|
-
function peg$
|
|
11072
|
+
function peg$f4() {
|
|
11028
11073
|
return !textMode;
|
|
11029
11074
|
}
|
|
11030
|
-
function peg$
|
|
11075
|
+
function peg$f5(tag) {
|
|
11031
11076
|
return VOID_TAGS.has(tag.lower) ? null : tag;
|
|
11032
11077
|
}
|
|
11033
|
-
function peg$
|
|
11078
|
+
function peg$f6(tag) {
|
|
11034
11079
|
rawName = tag.lower;
|
|
11035
11080
|
return tag.kind === "open" && hooks.isRaw(rawName);
|
|
11036
11081
|
}
|
|
11037
|
-
function peg$
|
|
11082
|
+
function peg$f7(tag, b) {
|
|
11038
11083
|
return b;
|
|
11039
11084
|
}
|
|
11040
|
-
function peg$
|
|
11085
|
+
function peg$f8(tag, body) {
|
|
11041
11086
|
return body ? [tag, body] : tag;
|
|
11042
11087
|
}
|
|
11043
|
-
function peg$
|
|
11088
|
+
function peg$f9(tag) {
|
|
11044
11089
|
return tag.kind === "close";
|
|
11045
11090
|
}
|
|
11046
|
-
function peg$
|
|
11091
|
+
function peg$f10(tag) {
|
|
11047
11092
|
return tag;
|
|
11048
11093
|
}
|
|
11049
|
-
function peg$
|
|
11094
|
+
function peg$f11() {
|
|
11050
11095
|
return !textMode;
|
|
11051
11096
|
}
|
|
11052
|
-
function peg$
|
|
11097
|
+
function peg$f12(tag) {
|
|
11053
11098
|
return tag;
|
|
11054
11099
|
}
|
|
11055
|
-
function peg$
|
|
11100
|
+
function peg$f13(start) {
|
|
11056
11101
|
return skipTo(hooks.rawBodyEnd(input, start, rawName));
|
|
11057
11102
|
}
|
|
11058
|
-
function peg$
|
|
11103
|
+
function peg$f14(start) {
|
|
11059
11104
|
return skipEnd - offset2();
|
|
11060
11105
|
}
|
|
11061
|
-
function peg$
|
|
11106
|
+
function peg$f15(start, body, end) {
|
|
11062
11107
|
const loc = {
|
|
11063
11108
|
start: { offset: start },
|
|
11064
11109
|
end: { offset: start + body.length }
|
|
11065
11110
|
};
|
|
11066
11111
|
return [body ? lexeme("text", loc, { value: body }) : null, end];
|
|
11067
11112
|
}
|
|
11068
|
-
function peg$
|
|
11113
|
+
function peg$f16() {
|
|
11069
11114
|
return offset2();
|
|
11070
11115
|
}
|
|
11071
|
-
function peg$
|
|
11116
|
+
function peg$f17(value) {
|
|
11072
11117
|
return lexeme("text", location(), { value });
|
|
11073
11118
|
}
|
|
11074
|
-
function peg$
|
|
11119
|
+
function peg$f18(value) {
|
|
11075
11120
|
const node = lexeme("text", location(), { value });
|
|
11076
11121
|
node.comment = true;
|
|
11077
11122
|
return node;
|
|
11078
11123
|
}
|
|
11079
|
-
function peg$
|
|
11124
|
+
function peg$f19(bs2) {
|
|
11080
11125
|
return bs2.length % 2 === 1;
|
|
11081
11126
|
}
|
|
11082
|
-
function peg$
|
|
11127
|
+
function peg$f20(bs2, c) {
|
|
11083
11128
|
return c;
|
|
11084
11129
|
}
|
|
11085
|
-
function peg$
|
|
11130
|
+
function peg$f21(bs2, brace) {
|
|
11086
11131
|
const loc = location();
|
|
11087
11132
|
const next = input.charAt(loc.end.offset);
|
|
11088
11133
|
if (textMode) {
|
|
@@ -11099,48 +11144,48 @@ function peg$parse(input, options) {
|
|
|
11099
11144
|
escaped.escape = true;
|
|
11100
11145
|
return bs2.length > 1 ? [before, escaped] : escaped;
|
|
11101
11146
|
}
|
|
11102
|
-
function peg$
|
|
11147
|
+
function peg$f22() {
|
|
11103
11148
|
return lexeme("text", location(), { value: LB });
|
|
11104
11149
|
}
|
|
11105
|
-
function peg$
|
|
11150
|
+
function peg$f23() {
|
|
11106
11151
|
return !textMode;
|
|
11107
11152
|
}
|
|
11108
|
-
function peg$
|
|
11153
|
+
function peg$f24() {
|
|
11109
11154
|
return lexeme("text", location(), { value: "<" });
|
|
11110
11155
|
}
|
|
11111
|
-
function peg$
|
|
11156
|
+
function peg$f25() {
|
|
11112
11157
|
return lexeme("text", location(), { value: "[" });
|
|
11113
11158
|
}
|
|
11114
|
-
function peg$
|
|
11159
|
+
function peg$f26() {
|
|
11115
11160
|
return !textMode;
|
|
11116
11161
|
}
|
|
11117
|
-
function peg$
|
|
11162
|
+
function peg$f27(ss2, s, at3, inner) {
|
|
11118
11163
|
const link = lexeme("link", location(), parseLink(inner, at3, (separator) => linkSeparatorIndex(inner, at3, separator)));
|
|
11119
11164
|
link.selectorSpan = selectorSpan(s, ss2, at3);
|
|
11120
11165
|
return withSelectors(link, s);
|
|
11121
11166
|
}
|
|
11122
|
-
function peg$
|
|
11167
|
+
function peg$f28() {
|
|
11123
11168
|
return !textMode;
|
|
11124
11169
|
}
|
|
11125
|
-
function peg$
|
|
11170
|
+
function peg$f29() {
|
|
11126
11171
|
fail("Unclosed link: [[ without ]]", location(), "unclosed-link");
|
|
11127
11172
|
}
|
|
11128
|
-
function peg$
|
|
11173
|
+
function peg$f30(parts) {
|
|
11129
11174
|
return selectorsOf(parts);
|
|
11130
11175
|
}
|
|
11131
|
-
function peg$
|
|
11176
|
+
function peg$f31() {
|
|
11132
11177
|
return NO_SELECTORS;
|
|
11133
11178
|
}
|
|
11134
|
-
function peg$
|
|
11179
|
+
function peg$f32(s, end) {
|
|
11135
11180
|
return {
|
|
11136
11181
|
...s,
|
|
11137
11182
|
end
|
|
11138
11183
|
};
|
|
11139
11184
|
}
|
|
11140
|
-
function peg$
|
|
11185
|
+
function peg$f33(prefix, name) {
|
|
11141
11186
|
return [prefix, name];
|
|
11142
11187
|
}
|
|
11143
|
-
function peg$
|
|
11188
|
+
function peg$f34(ss2, s, sigil, nameStart, name) {
|
|
11144
11189
|
const variable = lexeme("variable", location(), {
|
|
11145
11190
|
name,
|
|
11146
11191
|
nameStart,
|
|
@@ -11150,7 +11195,7 @@ function peg$parse(input, options) {
|
|
|
11150
11195
|
variable.selectorSpan = selectorSpan(s, ss2, nameStart - 1);
|
|
11151
11196
|
return withSelectors(variable, s);
|
|
11152
11197
|
}
|
|
11153
|
-
function peg$
|
|
11198
|
+
function peg$f35(ss2, s, after, expression) {
|
|
11154
11199
|
const node = lexeme("expression", location(), {
|
|
11155
11200
|
expression,
|
|
11156
11201
|
expressionStart: after,
|
|
@@ -11159,28 +11204,28 @@ function peg$parse(input, options) {
|
|
|
11159
11204
|
node.selectorSpan = selectorSpan(s, ss2, after);
|
|
11160
11205
|
return withSelectors(node, s);
|
|
11161
11206
|
}
|
|
11162
|
-
function peg$
|
|
11207
|
+
function peg$f36() {
|
|
11163
11208
|
fail("Unclosed {" + input.substr(location().end.offset, 1) + "\u2026: no } ends it", location(), "unclosed-expression");
|
|
11164
11209
|
}
|
|
11165
|
-
function peg$
|
|
11210
|
+
function peg$f37(start) {
|
|
11166
11211
|
return skipTo(hooks.closeBrace(input, start, start));
|
|
11167
11212
|
}
|
|
11168
|
-
function peg$
|
|
11213
|
+
function peg$f38(start) {
|
|
11169
11214
|
return skipEnd - offset2();
|
|
11170
11215
|
}
|
|
11171
|
-
function peg$
|
|
11216
|
+
function peg$f39(start, code) {
|
|
11172
11217
|
return code;
|
|
11173
11218
|
}
|
|
11174
|
-
function peg$
|
|
11219
|
+
function peg$f40(ss2, s, start, close, name, nameEnd) {
|
|
11175
11220
|
return skipTo(hooks.closeBrace(input, nameEnd, start));
|
|
11176
11221
|
}
|
|
11177
|
-
function peg$
|
|
11222
|
+
function peg$f41(ss2, s, start, close, name, nameEnd) {
|
|
11178
11223
|
return skipEnd - offset2();
|
|
11179
11224
|
}
|
|
11180
|
-
function peg$
|
|
11225
|
+
function peg$f42(ss2, s, start, close, name, nameEnd, args2) {
|
|
11181
11226
|
return args2;
|
|
11182
11227
|
}
|
|
11183
|
-
function peg$
|
|
11228
|
+
function peg$f43(ss2, s, start, close, name, nameEnd, tail) {
|
|
11184
11229
|
const loc = location();
|
|
11185
11230
|
const lower = name.toLowerCase();
|
|
11186
11231
|
const tag = lexeme("macro", loc, {
|
|
@@ -11206,16 +11251,19 @@ function peg$parse(input, options) {
|
|
|
11206
11251
|
}
|
|
11207
11252
|
return tag;
|
|
11208
11253
|
}
|
|
11209
|
-
function peg$
|
|
11254
|
+
function peg$f44(s) {
|
|
11210
11255
|
fail("A closing tag starts with a letter after {/", location(), "invalid-closer");
|
|
11211
11256
|
}
|
|
11212
|
-
function peg$
|
|
11257
|
+
function peg$f45(value) {
|
|
11213
11258
|
return EMAIL_AUTOLINK.test(value);
|
|
11214
11259
|
}
|
|
11215
|
-
function peg$
|
|
11260
|
+
function peg$f46(value) {
|
|
11261
|
+
return lexeme("text", location(), { value });
|
|
11262
|
+
}
|
|
11263
|
+
function peg$f47(value) {
|
|
11216
11264
|
return lexeme("text", location(), { value });
|
|
11217
11265
|
}
|
|
11218
|
-
function peg$
|
|
11266
|
+
function peg$f48(tagStart, tag, list3, slash) {
|
|
11219
11267
|
const lower = tag.toLowerCase();
|
|
11220
11268
|
return lexeme("html", location(), {
|
|
11221
11269
|
tag,
|
|
@@ -11228,7 +11276,7 @@ function peg$parse(input, options) {
|
|
|
11228
11276
|
isSelfClose: !!slash || VOID_TAGS.has(lower)
|
|
11229
11277
|
});
|
|
11230
11278
|
}
|
|
11231
|
-
function peg$
|
|
11279
|
+
function peg$f49(tag, bad) {
|
|
11232
11280
|
const c = input.charAt(bad);
|
|
11233
11281
|
if (!c) fail("Unclosed tag <" + tag + ": no > ends it (write < for a < that starts no tag)", location(), "unclosed-tag");
|
|
11234
11282
|
const at3 = {
|
|
@@ -11246,7 +11294,7 @@ function peg$parse(input, options) {
|
|
|
11246
11294
|
};
|
|
11247
11295
|
fail("Unexpected " + JSON.stringify(c) + " in the tag <" + tag + ">: expected an attribute, or > to end the tag", at3, "unexpected-character");
|
|
11248
11296
|
}
|
|
11249
|
-
function peg$
|
|
11297
|
+
function peg$f50(tagStart, tag) {
|
|
11250
11298
|
return lexeme("html", location(), {
|
|
11251
11299
|
tag,
|
|
11252
11300
|
lower: tag.toLowerCase(),
|
|
@@ -11258,14 +11306,14 @@ function peg$parse(input, options) {
|
|
|
11258
11306
|
isSelfClose: false
|
|
11259
11307
|
});
|
|
11260
11308
|
}
|
|
11261
|
-
function peg$
|
|
11309
|
+
function peg$f51(nameStart, name) {
|
|
11262
11310
|
attrCode = hooks.isCodeAttribute(name);
|
|
11263
11311
|
return true;
|
|
11264
11312
|
}
|
|
11265
|
-
function peg$
|
|
11313
|
+
function peg$f52(nameStart, name, v2) {
|
|
11266
11314
|
return v2;
|
|
11267
11315
|
}
|
|
11268
|
-
function peg$
|
|
11316
|
+
function peg$f53(nameStart, name, value) {
|
|
11269
11317
|
const attribute = {
|
|
11270
11318
|
name,
|
|
11271
11319
|
value: value ? value.value : "",
|
|
@@ -11279,7 +11327,7 @@ function peg$parse(input, options) {
|
|
|
11279
11327
|
}
|
|
11280
11328
|
return attribute;
|
|
11281
11329
|
}
|
|
11282
|
-
function peg$
|
|
11330
|
+
function peg$f54(start, value, end) {
|
|
11283
11331
|
return {
|
|
11284
11332
|
value,
|
|
11285
11333
|
start,
|
|
@@ -11287,7 +11335,7 @@ function peg$parse(input, options) {
|
|
|
11287
11335
|
quote: '"'
|
|
11288
11336
|
};
|
|
11289
11337
|
}
|
|
11290
|
-
function peg$
|
|
11338
|
+
function peg$f55(start, value, end) {
|
|
11291
11339
|
return {
|
|
11292
11340
|
value,
|
|
11293
11341
|
start,
|
|
@@ -11295,35 +11343,35 @@ function peg$parse(input, options) {
|
|
|
11295
11343
|
quote: "'"
|
|
11296
11344
|
};
|
|
11297
11345
|
}
|
|
11298
|
-
function peg$
|
|
11346
|
+
function peg$f56(q2) {
|
|
11299
11347
|
fail("Unclosed attribute value: the " + q2 + " here has no closing " + q2, location(), "unclosed-attribute");
|
|
11300
11348
|
}
|
|
11301
|
-
function peg$
|
|
11349
|
+
function peg$f57(start, value, end) {
|
|
11302
11350
|
return {
|
|
11303
11351
|
value,
|
|
11304
11352
|
start,
|
|
11305
11353
|
end
|
|
11306
11354
|
};
|
|
11307
11355
|
}
|
|
11308
|
-
function peg$
|
|
11356
|
+
function peg$f58() {
|
|
11309
11357
|
return !attrCode;
|
|
11310
11358
|
}
|
|
11311
|
-
function peg$
|
|
11359
|
+
function peg$f59(bs2) {
|
|
11312
11360
|
return bs2.length % 2 === 1;
|
|
11313
11361
|
}
|
|
11314
|
-
function peg$
|
|
11362
|
+
function peg$f60() {
|
|
11315
11363
|
return !attrCode;
|
|
11316
11364
|
}
|
|
11317
|
-
function peg$
|
|
11365
|
+
function peg$f61(start, nameEnd) {
|
|
11318
11366
|
return skipTo(hooks.closeBrace(input, nameEnd, start));
|
|
11319
11367
|
}
|
|
11320
|
-
function peg$
|
|
11368
|
+
function peg$f62(start, nameEnd) {
|
|
11321
11369
|
return skipEnd - offset2();
|
|
11322
11370
|
}
|
|
11323
|
-
function peg$
|
|
11371
|
+
function peg$f63() {
|
|
11324
11372
|
return !attrCode;
|
|
11325
11373
|
}
|
|
11326
|
-
function peg$
|
|
11374
|
+
function peg$f64() {
|
|
11327
11375
|
return attrCode;
|
|
11328
11376
|
}
|
|
11329
11377
|
let peg$currPos = options.peg$currPos | 0;
|
|
@@ -11471,10 +11519,10 @@ function peg$parse(input, options) {
|
|
|
11471
11519
|
if (s1) s1 = void 0;
|
|
11472
11520
|
else s1 = peg$FAILED;
|
|
11473
11521
|
if (s1 !== peg$FAILED) {
|
|
11474
|
-
s2 = peg$
|
|
11522
|
+
s2 = peg$parseUriAutolink();
|
|
11475
11523
|
if (s2 !== peg$FAILED) {
|
|
11476
|
-
|
|
11477
|
-
s0 =
|
|
11524
|
+
s1 = [s1, s2];
|
|
11525
|
+
s0 = s1;
|
|
11478
11526
|
} else {
|
|
11479
11527
|
peg$currPos = s0;
|
|
11480
11528
|
s0 = peg$FAILED;
|
|
@@ -11486,14 +11534,14 @@ function peg$parse(input, options) {
|
|
|
11486
11534
|
if (s0 === peg$FAILED) {
|
|
11487
11535
|
s0 = peg$currPos;
|
|
11488
11536
|
peg$savedPos = peg$currPos;
|
|
11489
|
-
s1 = peg$
|
|
11537
|
+
s1 = peg$f2();
|
|
11490
11538
|
if (s1) s1 = void 0;
|
|
11491
11539
|
else s1 = peg$FAILED;
|
|
11492
11540
|
if (s1 !== peg$FAILED) {
|
|
11493
|
-
s2 = peg$
|
|
11541
|
+
s2 = peg$parseHtmlOpen();
|
|
11494
11542
|
if (s2 !== peg$FAILED) {
|
|
11495
11543
|
peg$savedPos = s0;
|
|
11496
|
-
s0 = peg$
|
|
11544
|
+
s0 = peg$f3(s2);
|
|
11497
11545
|
} else {
|
|
11498
11546
|
peg$currPos = s0;
|
|
11499
11547
|
s0 = peg$FAILED;
|
|
@@ -11503,37 +11551,57 @@ function peg$parse(input, options) {
|
|
|
11503
11551
|
s0 = peg$FAILED;
|
|
11504
11552
|
}
|
|
11505
11553
|
if (s0 === peg$FAILED) {
|
|
11506
|
-
s0 = peg$
|
|
11554
|
+
s0 = peg$currPos;
|
|
11555
|
+
peg$savedPos = peg$currPos;
|
|
11556
|
+
s1 = peg$f4();
|
|
11557
|
+
if (s1) s1 = void 0;
|
|
11558
|
+
else s1 = peg$FAILED;
|
|
11559
|
+
if (s1 !== peg$FAILED) {
|
|
11560
|
+
s2 = peg$parseHtmlClose();
|
|
11561
|
+
if (s2 !== peg$FAILED) {
|
|
11562
|
+
peg$savedPos = s0;
|
|
11563
|
+
s0 = peg$f5(s2);
|
|
11564
|
+
} else {
|
|
11565
|
+
peg$currPos = s0;
|
|
11566
|
+
s0 = peg$FAILED;
|
|
11567
|
+
}
|
|
11568
|
+
} else {
|
|
11569
|
+
peg$currPos = s0;
|
|
11570
|
+
s0 = peg$FAILED;
|
|
11571
|
+
}
|
|
11507
11572
|
if (s0 === peg$FAILED) {
|
|
11508
|
-
s0 = peg$
|
|
11509
|
-
|
|
11510
|
-
|
|
11511
|
-
|
|
11512
|
-
|
|
11513
|
-
|
|
11514
|
-
|
|
11515
|
-
|
|
11516
|
-
|
|
11517
|
-
|
|
11518
|
-
if (
|
|
11519
|
-
|
|
11520
|
-
|
|
11573
|
+
s0 = peg$parseValue();
|
|
11574
|
+
if (s0 === peg$FAILED) {
|
|
11575
|
+
s0 = peg$currPos;
|
|
11576
|
+
s1 = peg$parseMacroTag();
|
|
11577
|
+
if (s1 !== peg$FAILED) {
|
|
11578
|
+
s2 = peg$currPos;
|
|
11579
|
+
peg$savedPos = peg$currPos;
|
|
11580
|
+
s3 = peg$f6(s1);
|
|
11581
|
+
if (s3) s3 = void 0;
|
|
11582
|
+
else s3 = peg$FAILED;
|
|
11583
|
+
if (s3 !== peg$FAILED) {
|
|
11584
|
+
s4 = peg$parseRawTokens();
|
|
11585
|
+
if (s4 !== peg$FAILED) {
|
|
11586
|
+
peg$savedPos = s2;
|
|
11587
|
+
s2 = peg$f7(s1, s4);
|
|
11588
|
+
} else {
|
|
11589
|
+
peg$currPos = s2;
|
|
11590
|
+
s2 = peg$FAILED;
|
|
11591
|
+
}
|
|
11521
11592
|
} else {
|
|
11522
11593
|
peg$currPos = s2;
|
|
11523
11594
|
s2 = peg$FAILED;
|
|
11524
11595
|
}
|
|
11596
|
+
if (s2 === peg$FAILED) s2 = null;
|
|
11597
|
+
peg$savedPos = s0;
|
|
11598
|
+
s0 = peg$f8(s1, s2);
|
|
11525
11599
|
} else {
|
|
11526
|
-
peg$currPos =
|
|
11527
|
-
|
|
11600
|
+
peg$currPos = s0;
|
|
11601
|
+
s0 = peg$FAILED;
|
|
11528
11602
|
}
|
|
11529
|
-
if (
|
|
11530
|
-
peg$savedPos = s0;
|
|
11531
|
-
s0 = peg$f7(s1, s2);
|
|
11532
|
-
} else {
|
|
11533
|
-
peg$currPos = s0;
|
|
11534
|
-
s0 = peg$FAILED;
|
|
11603
|
+
if (s0 === peg$FAILED) s0 = peg$parseLiteral();
|
|
11535
11604
|
}
|
|
11536
|
-
if (s0 === peg$FAILED) s0 = peg$parseLiteral();
|
|
11537
11605
|
}
|
|
11538
11606
|
}
|
|
11539
11607
|
}
|
|
@@ -11550,12 +11618,12 @@ function peg$parse(input, options) {
|
|
|
11550
11618
|
s1 = peg$parseMacroTag();
|
|
11551
11619
|
if (s1 !== peg$FAILED) {
|
|
11552
11620
|
peg$savedPos = peg$currPos;
|
|
11553
|
-
s2 = peg$
|
|
11621
|
+
s2 = peg$f9(s1);
|
|
11554
11622
|
if (s2) s2 = void 0;
|
|
11555
11623
|
else s2 = peg$FAILED;
|
|
11556
11624
|
if (s2 !== peg$FAILED) {
|
|
11557
11625
|
peg$savedPos = s0;
|
|
11558
|
-
s0 = peg$
|
|
11626
|
+
s0 = peg$f10(s1);
|
|
11559
11627
|
} else {
|
|
11560
11628
|
peg$currPos = s0;
|
|
11561
11629
|
s0 = peg$FAILED;
|
|
@@ -11567,14 +11635,14 @@ function peg$parse(input, options) {
|
|
|
11567
11635
|
if (s0 === peg$FAILED) {
|
|
11568
11636
|
s0 = peg$currPos;
|
|
11569
11637
|
peg$savedPos = peg$currPos;
|
|
11570
|
-
s1 = peg$
|
|
11638
|
+
s1 = peg$f11();
|
|
11571
11639
|
if (s1) s1 = void 0;
|
|
11572
11640
|
else s1 = peg$FAILED;
|
|
11573
11641
|
if (s1 !== peg$FAILED) {
|
|
11574
11642
|
s2 = peg$parseHtmlClose();
|
|
11575
11643
|
if (s2 !== peg$FAILED) {
|
|
11576
11644
|
peg$savedPos = s0;
|
|
11577
|
-
s0 = peg$
|
|
11645
|
+
s0 = peg$f12(s2);
|
|
11578
11646
|
} else {
|
|
11579
11647
|
peg$currPos = s0;
|
|
11580
11648
|
s0 = peg$FAILED;
|
|
@@ -11591,12 +11659,12 @@ function peg$parse(input, options) {
|
|
|
11591
11659
|
s0 = peg$currPos;
|
|
11592
11660
|
s1 = peg$parseHere();
|
|
11593
11661
|
peg$savedPos = peg$currPos;
|
|
11594
|
-
s2 = peg$
|
|
11662
|
+
s2 = peg$f13(s1);
|
|
11595
11663
|
if (s2) s2 = void 0;
|
|
11596
11664
|
else s2 = peg$FAILED;
|
|
11597
11665
|
if (s2 !== peg$FAILED) {
|
|
11598
11666
|
s3 = peg$currPos;
|
|
11599
|
-
s4 = peg$
|
|
11667
|
+
s4 = peg$f14(s1);
|
|
11600
11668
|
s5 = peg$currPos;
|
|
11601
11669
|
s6 = [];
|
|
11602
11670
|
if (s6.length >= (s4 | 0)) s7 = peg$FAILED;
|
|
@@ -11629,7 +11697,7 @@ function peg$parse(input, options) {
|
|
|
11629
11697
|
s4 = peg$parseCloseTag();
|
|
11630
11698
|
if (s4 !== peg$FAILED) {
|
|
11631
11699
|
peg$savedPos = s0;
|
|
11632
|
-
s0 = peg$
|
|
11700
|
+
s0 = peg$f15(s1, s3, s4);
|
|
11633
11701
|
} else {
|
|
11634
11702
|
peg$currPos = s0;
|
|
11635
11703
|
s0 = peg$FAILED;
|
|
@@ -11649,7 +11717,7 @@ function peg$parse(input, options) {
|
|
|
11649
11717
|
s0 = peg$currPos;
|
|
11650
11718
|
s1 = "";
|
|
11651
11719
|
peg$savedPos = s0;
|
|
11652
|
-
s1 = peg$
|
|
11720
|
+
s1 = peg$f16();
|
|
11653
11721
|
s0 = s1;
|
|
11654
11722
|
return s0;
|
|
11655
11723
|
}
|
|
@@ -11678,7 +11746,7 @@ function peg$parse(input, options) {
|
|
|
11678
11746
|
else s1 = s2;
|
|
11679
11747
|
if (s1 !== peg$FAILED) {
|
|
11680
11748
|
peg$savedPos = s0;
|
|
11681
|
-
s1 = peg$
|
|
11749
|
+
s1 = peg$f17(s1);
|
|
11682
11750
|
}
|
|
11683
11751
|
s0 = s1;
|
|
11684
11752
|
return s0;
|
|
@@ -11818,7 +11886,7 @@ function peg$parse(input, options) {
|
|
|
11818
11886
|
else s1 = s2;
|
|
11819
11887
|
if (s1 !== peg$FAILED) {
|
|
11820
11888
|
peg$savedPos = s0;
|
|
11821
|
-
s1 = peg$
|
|
11889
|
+
s1 = peg$f18(s1);
|
|
11822
11890
|
}
|
|
11823
11891
|
s0 = s1;
|
|
11824
11892
|
return s0;
|
|
@@ -11851,7 +11919,7 @@ function peg$parse(input, options) {
|
|
|
11851
11919
|
if (s1 !== peg$FAILED) {
|
|
11852
11920
|
s2 = peg$currPos;
|
|
11853
11921
|
peg$savedPos = peg$currPos;
|
|
11854
|
-
s3 = peg$
|
|
11922
|
+
s3 = peg$f19(s1);
|
|
11855
11923
|
if (s3) s3 = void 0;
|
|
11856
11924
|
else s3 = peg$FAILED;
|
|
11857
11925
|
if (s3 !== peg$FAILED) {
|
|
@@ -11863,7 +11931,7 @@ function peg$parse(input, options) {
|
|
|
11863
11931
|
}
|
|
11864
11932
|
if (s4 !== peg$FAILED) {
|
|
11865
11933
|
peg$savedPos = s2;
|
|
11866
|
-
s2 = peg$
|
|
11934
|
+
s2 = peg$f20(s1, s4);
|
|
11867
11935
|
} else {
|
|
11868
11936
|
peg$currPos = s2;
|
|
11869
11937
|
s2 = peg$FAILED;
|
|
@@ -11874,7 +11942,7 @@ function peg$parse(input, options) {
|
|
|
11874
11942
|
}
|
|
11875
11943
|
if (s2 === peg$FAILED) s2 = null;
|
|
11876
11944
|
peg$savedPos = s0;
|
|
11877
|
-
s0 = peg$
|
|
11945
|
+
s0 = peg$f21(s1, s2);
|
|
11878
11946
|
} else {
|
|
11879
11947
|
peg$currPos = s0;
|
|
11880
11948
|
s0 = peg$FAILED;
|
|
@@ -11922,7 +11990,7 @@ function peg$parse(input, options) {
|
|
|
11922
11990
|
}
|
|
11923
11991
|
if (s2 !== peg$FAILED) {
|
|
11924
11992
|
peg$savedPos = s0;
|
|
11925
|
-
s0 = peg$
|
|
11993
|
+
s0 = peg$f22();
|
|
11926
11994
|
} else {
|
|
11927
11995
|
peg$currPos = s0;
|
|
11928
11996
|
s0 = peg$FAILED;
|
|
@@ -11937,7 +12005,7 @@ function peg$parse(input, options) {
|
|
|
11937
12005
|
peg$silentFails++;
|
|
11938
12006
|
s2 = peg$currPos;
|
|
11939
12007
|
peg$savedPos = peg$currPos;
|
|
11940
|
-
s3 = peg$
|
|
12008
|
+
s3 = peg$f23();
|
|
11941
12009
|
if (s3) s3 = void 0;
|
|
11942
12010
|
else s3 = peg$FAILED;
|
|
11943
12011
|
if (s3 !== peg$FAILED) {
|
|
@@ -11969,7 +12037,7 @@ function peg$parse(input, options) {
|
|
|
11969
12037
|
}
|
|
11970
12038
|
if (s2 !== peg$FAILED) {
|
|
11971
12039
|
peg$savedPos = s0;
|
|
11972
|
-
s0 = peg$
|
|
12040
|
+
s0 = peg$f24();
|
|
11973
12041
|
} else {
|
|
11974
12042
|
peg$currPos = s0;
|
|
11975
12043
|
s0 = peg$FAILED;
|
|
@@ -11989,7 +12057,7 @@ function peg$parse(input, options) {
|
|
|
11989
12057
|
}
|
|
11990
12058
|
if (s1 !== peg$FAILED) {
|
|
11991
12059
|
peg$savedPos = s0;
|
|
11992
|
-
s1 = peg$
|
|
12060
|
+
s1 = peg$f25();
|
|
11993
12061
|
}
|
|
11994
12062
|
s0 = s1;
|
|
11995
12063
|
}
|
|
@@ -12000,7 +12068,7 @@ function peg$parse(input, options) {
|
|
|
12000
12068
|
let s0, s1, s2, s3, s4, s5, s6, s7;
|
|
12001
12069
|
s0 = peg$currPos;
|
|
12002
12070
|
peg$savedPos = peg$currPos;
|
|
12003
|
-
s1 = peg$
|
|
12071
|
+
s1 = peg$f26();
|
|
12004
12072
|
if (s1) s1 = void 0;
|
|
12005
12073
|
else s1 = peg$FAILED;
|
|
12006
12074
|
if (s1 !== peg$FAILED) {
|
|
@@ -12028,7 +12096,7 @@ function peg$parse(input, options) {
|
|
|
12028
12096
|
}
|
|
12029
12097
|
if (s7 !== peg$FAILED) {
|
|
12030
12098
|
peg$savedPos = s0;
|
|
12031
|
-
s0 = peg$
|
|
12099
|
+
s0 = peg$f27(s3, s4, s5, s6);
|
|
12032
12100
|
} else {
|
|
12033
12101
|
peg$currPos = s0;
|
|
12034
12102
|
s0 = peg$FAILED;
|
|
@@ -12048,7 +12116,7 @@ function peg$parse(input, options) {
|
|
|
12048
12116
|
if (s0 === peg$FAILED) {
|
|
12049
12117
|
s0 = peg$currPos;
|
|
12050
12118
|
peg$savedPos = peg$currPos;
|
|
12051
|
-
s1 = peg$
|
|
12119
|
+
s1 = peg$f28();
|
|
12052
12120
|
if (s1) s1 = void 0;
|
|
12053
12121
|
else s1 = peg$FAILED;
|
|
12054
12122
|
if (s1 !== peg$FAILED) {
|
|
@@ -12061,7 +12129,7 @@ function peg$parse(input, options) {
|
|
|
12061
12129
|
}
|
|
12062
12130
|
if (s2 !== peg$FAILED) {
|
|
12063
12131
|
peg$savedPos = s0;
|
|
12064
|
-
s0 = peg$
|
|
12132
|
+
s0 = peg$f29();
|
|
12065
12133
|
} else {
|
|
12066
12134
|
peg$currPos = s0;
|
|
12067
12135
|
s0 = peg$FAILED;
|
|
@@ -12189,7 +12257,7 @@ function peg$parse(input, options) {
|
|
|
12189
12257
|
}
|
|
12190
12258
|
if (s2 === peg$FAILED) s2 = null;
|
|
12191
12259
|
peg$savedPos = s0;
|
|
12192
|
-
s0 = peg$
|
|
12260
|
+
s0 = peg$f30(s1);
|
|
12193
12261
|
} else {
|
|
12194
12262
|
peg$currPos = s0;
|
|
12195
12263
|
s0 = peg$FAILED;
|
|
@@ -12198,7 +12266,7 @@ function peg$parse(input, options) {
|
|
|
12198
12266
|
s0 = peg$currPos;
|
|
12199
12267
|
s1 = "";
|
|
12200
12268
|
peg$savedPos = s0;
|
|
12201
|
-
s1 = peg$
|
|
12269
|
+
s1 = peg$f31();
|
|
12202
12270
|
s0 = s1;
|
|
12203
12271
|
}
|
|
12204
12272
|
return s0;
|
|
@@ -12228,7 +12296,7 @@ function peg$parse(input, options) {
|
|
|
12228
12296
|
}
|
|
12229
12297
|
}
|
|
12230
12298
|
peg$savedPos = s0;
|
|
12231
|
-
s0 = peg$
|
|
12299
|
+
s0 = peg$f32(s1, s2);
|
|
12232
12300
|
} else {
|
|
12233
12301
|
peg$currPos = s0;
|
|
12234
12302
|
s0 = peg$FAILED;
|
|
@@ -12254,7 +12322,7 @@ function peg$parse(input, options) {
|
|
|
12254
12322
|
}
|
|
12255
12323
|
s2 = input.substring(s2, peg$currPos);
|
|
12256
12324
|
peg$savedPos = s0;
|
|
12257
|
-
s0 = peg$
|
|
12325
|
+
s0 = peg$f33(s1, s2);
|
|
12258
12326
|
} else {
|
|
12259
12327
|
peg$currPos = s0;
|
|
12260
12328
|
s0 = peg$FAILED;
|
|
@@ -12381,7 +12449,7 @@ function peg$parse(input, options) {
|
|
|
12381
12449
|
}
|
|
12382
12450
|
if (s7 !== peg$FAILED) {
|
|
12383
12451
|
peg$savedPos = s0;
|
|
12384
|
-
s0 = peg$
|
|
12452
|
+
s0 = peg$f34(s2, s3, s4, s5, s6);
|
|
12385
12453
|
} else {
|
|
12386
12454
|
peg$currPos = s0;
|
|
12387
12455
|
s0 = peg$FAILED;
|
|
@@ -12437,7 +12505,7 @@ function peg$parse(input, options) {
|
|
|
12437
12505
|
}
|
|
12438
12506
|
if (s7 !== peg$FAILED) {
|
|
12439
12507
|
peg$savedPos = s0;
|
|
12440
|
-
s0 = peg$
|
|
12508
|
+
s0 = peg$f35(s2, s3, s4, s6);
|
|
12441
12509
|
} else {
|
|
12442
12510
|
peg$currPos = s0;
|
|
12443
12511
|
s0 = peg$FAILED;
|
|
@@ -12485,7 +12553,7 @@ function peg$parse(input, options) {
|
|
|
12485
12553
|
} else s3 = peg$FAILED;
|
|
12486
12554
|
if (s3 !== peg$FAILED) {
|
|
12487
12555
|
peg$savedPos = s0;
|
|
12488
|
-
s0 = peg$
|
|
12556
|
+
s0 = peg$f36();
|
|
12489
12557
|
} else {
|
|
12490
12558
|
peg$currPos = s0;
|
|
12491
12559
|
s0 = peg$FAILED;
|
|
@@ -12507,12 +12575,12 @@ function peg$parse(input, options) {
|
|
|
12507
12575
|
s0 = peg$currPos;
|
|
12508
12576
|
s1 = peg$parseHere();
|
|
12509
12577
|
peg$savedPos = peg$currPos;
|
|
12510
|
-
s2 = peg$
|
|
12578
|
+
s2 = peg$f37(s1);
|
|
12511
12579
|
if (s2) s2 = void 0;
|
|
12512
12580
|
else s2 = peg$FAILED;
|
|
12513
12581
|
if (s2 !== peg$FAILED) {
|
|
12514
12582
|
s3 = peg$currPos;
|
|
12515
|
-
s4 = peg$
|
|
12583
|
+
s4 = peg$f38(s1);
|
|
12516
12584
|
s5 = peg$currPos;
|
|
12517
12585
|
s6 = [];
|
|
12518
12586
|
if (s6.length >= (s4 | 0)) s7 = peg$FAILED;
|
|
@@ -12543,7 +12611,7 @@ function peg$parse(input, options) {
|
|
|
12543
12611
|
else s3 = s4;
|
|
12544
12612
|
if (s3 !== peg$FAILED) {
|
|
12545
12613
|
peg$savedPos = s0;
|
|
12546
|
-
s0 = peg$
|
|
12614
|
+
s0 = peg$f39(s1, s3);
|
|
12547
12615
|
} else {
|
|
12548
12616
|
peg$currPos = s0;
|
|
12549
12617
|
s0 = peg$FAILED;
|
|
@@ -12582,12 +12650,12 @@ function peg$parse(input, options) {
|
|
|
12582
12650
|
s7 = peg$parseHere();
|
|
12583
12651
|
s8 = peg$currPos;
|
|
12584
12652
|
peg$savedPos = peg$currPos;
|
|
12585
|
-
s9 = peg$
|
|
12653
|
+
s9 = peg$f40(s2, s3, s4, s5, s6, s7);
|
|
12586
12654
|
if (s9) s9 = void 0;
|
|
12587
12655
|
else s9 = peg$FAILED;
|
|
12588
12656
|
if (s9 !== peg$FAILED) {
|
|
12589
12657
|
s10 = peg$currPos;
|
|
12590
|
-
s11 = peg$
|
|
12658
|
+
s11 = peg$f41(s2, s3, s4, s5, s6, s7);
|
|
12591
12659
|
s12 = peg$currPos;
|
|
12592
12660
|
s13 = [];
|
|
12593
12661
|
if (s13.length >= (s11 | 0)) s14 = peg$FAILED;
|
|
@@ -12626,7 +12694,7 @@ function peg$parse(input, options) {
|
|
|
12626
12694
|
}
|
|
12627
12695
|
if (s11 !== peg$FAILED) {
|
|
12628
12696
|
peg$savedPos = s8;
|
|
12629
|
-
s8 = peg$
|
|
12697
|
+
s8 = peg$f42(s2, s3, s4, s5, s6, s7, s10);
|
|
12630
12698
|
} else {
|
|
12631
12699
|
peg$currPos = s8;
|
|
12632
12700
|
s8 = peg$FAILED;
|
|
@@ -12641,7 +12709,7 @@ function peg$parse(input, options) {
|
|
|
12641
12709
|
}
|
|
12642
12710
|
if (s8 === peg$FAILED) s8 = null;
|
|
12643
12711
|
peg$savedPos = s0;
|
|
12644
|
-
s0 = peg$
|
|
12712
|
+
s0 = peg$f43(s2, s3, s4, s5, s6, s7, s8);
|
|
12645
12713
|
} else {
|
|
12646
12714
|
peg$currPos = s0;
|
|
12647
12715
|
s0 = peg$FAILED;
|
|
@@ -12675,7 +12743,7 @@ function peg$parse(input, options) {
|
|
|
12675
12743
|
}
|
|
12676
12744
|
if (s3 !== peg$FAILED) {
|
|
12677
12745
|
peg$savedPos = s0;
|
|
12678
|
-
s0 = peg$
|
|
12746
|
+
s0 = peg$f44(s2);
|
|
12679
12747
|
} else {
|
|
12680
12748
|
peg$currPos = s0;
|
|
12681
12749
|
s0 = peg$FAILED;
|
|
@@ -12825,12 +12893,12 @@ function peg$parse(input, options) {
|
|
|
12825
12893
|
else s1 = s2;
|
|
12826
12894
|
if (s1 !== peg$FAILED) {
|
|
12827
12895
|
peg$savedPos = peg$currPos;
|
|
12828
|
-
s2 = peg$
|
|
12896
|
+
s2 = peg$f45(s1);
|
|
12829
12897
|
if (s2) s2 = void 0;
|
|
12830
12898
|
else s2 = peg$FAILED;
|
|
12831
12899
|
if (s2 !== peg$FAILED) {
|
|
12832
12900
|
peg$savedPos = s0;
|
|
12833
|
-
s0 = peg$
|
|
12901
|
+
s0 = peg$f46(s1);
|
|
12834
12902
|
} else {
|
|
12835
12903
|
peg$currPos = s0;
|
|
12836
12904
|
s0 = peg$FAILED;
|
|
@@ -12841,6 +12909,177 @@ function peg$parse(input, options) {
|
|
|
12841
12909
|
}
|
|
12842
12910
|
return s0;
|
|
12843
12911
|
}
|
|
12912
|
+
function peg$parseUriAutolink() {
|
|
12913
|
+
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10;
|
|
12914
|
+
s0 = peg$currPos;
|
|
12915
|
+
s1 = peg$currPos;
|
|
12916
|
+
s2 = peg$currPos;
|
|
12917
|
+
if (input.charCodeAt(peg$currPos) === 60) {
|
|
12918
|
+
s3 = peg$c6;
|
|
12919
|
+
peg$currPos++;
|
|
12920
|
+
} else {
|
|
12921
|
+
s3 = peg$FAILED;
|
|
12922
|
+
if (peg$silentFails === 0) peg$fail(peg$e10);
|
|
12923
|
+
}
|
|
12924
|
+
if (s3 !== peg$FAILED) {
|
|
12925
|
+
s4 = input.charAt(peg$currPos);
|
|
12926
|
+
if (peg$r8.test(s4)) peg$currPos++;
|
|
12927
|
+
else {
|
|
12928
|
+
s4 = peg$FAILED;
|
|
12929
|
+
if (peg$silentFails === 0) peg$fail(peg$e22);
|
|
12930
|
+
}
|
|
12931
|
+
if (s4 !== peg$FAILED) {
|
|
12932
|
+
s5 = peg$currPos;
|
|
12933
|
+
s6 = [];
|
|
12934
|
+
s7 = input.charAt(peg$currPos);
|
|
12935
|
+
if (peg$r12.test(s7)) peg$currPos++;
|
|
12936
|
+
else {
|
|
12937
|
+
s7 = peg$FAILED;
|
|
12938
|
+
if (peg$silentFails === 0) peg$fail(peg$e27);
|
|
12939
|
+
}
|
|
12940
|
+
while (s7 !== peg$FAILED) {
|
|
12941
|
+
s6.push(s7);
|
|
12942
|
+
if (s6.length >= 31) s7 = peg$FAILED;
|
|
12943
|
+
else {
|
|
12944
|
+
s7 = input.charAt(peg$currPos);
|
|
12945
|
+
if (peg$r12.test(s7)) peg$currPos++;
|
|
12946
|
+
else {
|
|
12947
|
+
s7 = peg$FAILED;
|
|
12948
|
+
if (peg$silentFails === 0) peg$fail(peg$e27);
|
|
12949
|
+
}
|
|
12950
|
+
}
|
|
12951
|
+
}
|
|
12952
|
+
if (s6.length < 1) {
|
|
12953
|
+
peg$currPos = s5;
|
|
12954
|
+
s5 = peg$FAILED;
|
|
12955
|
+
} else s5 = s6;
|
|
12956
|
+
if (s5 !== peg$FAILED) {
|
|
12957
|
+
if (input.charCodeAt(peg$currPos) === 58) {
|
|
12958
|
+
s6 = peg$c14;
|
|
12959
|
+
peg$currPos++;
|
|
12960
|
+
} else {
|
|
12961
|
+
s6 = peg$FAILED;
|
|
12962
|
+
if (peg$silentFails === 0) peg$fail(peg$e28);
|
|
12963
|
+
}
|
|
12964
|
+
if (s6 !== peg$FAILED) {
|
|
12965
|
+
s7 = [];
|
|
12966
|
+
s8 = peg$currPos;
|
|
12967
|
+
s9 = peg$currPos;
|
|
12968
|
+
peg$silentFails++;
|
|
12969
|
+
if (input.substr(peg$currPos, 2) === peg$c8) {
|
|
12970
|
+
s10 = peg$c8;
|
|
12971
|
+
peg$currPos += 2;
|
|
12972
|
+
} else {
|
|
12973
|
+
s10 = peg$FAILED;
|
|
12974
|
+
if (peg$silentFails === 0) peg$fail(peg$e12);
|
|
12975
|
+
}
|
|
12976
|
+
peg$silentFails--;
|
|
12977
|
+
if (s10 === peg$FAILED) s9 = void 0;
|
|
12978
|
+
else {
|
|
12979
|
+
peg$currPos = s9;
|
|
12980
|
+
s9 = peg$FAILED;
|
|
12981
|
+
}
|
|
12982
|
+
if (s9 !== peg$FAILED) {
|
|
12983
|
+
s10 = input.charAt(peg$currPos);
|
|
12984
|
+
if (peg$r13.test(s10)) peg$currPos++;
|
|
12985
|
+
else {
|
|
12986
|
+
s10 = peg$FAILED;
|
|
12987
|
+
if (peg$silentFails === 0) peg$fail(peg$e29);
|
|
12988
|
+
}
|
|
12989
|
+
if (s10 !== peg$FAILED) {
|
|
12990
|
+
s9 = [s9, s10];
|
|
12991
|
+
s8 = s9;
|
|
12992
|
+
} else {
|
|
12993
|
+
peg$currPos = s8;
|
|
12994
|
+
s8 = peg$FAILED;
|
|
12995
|
+
}
|
|
12996
|
+
} else {
|
|
12997
|
+
peg$currPos = s8;
|
|
12998
|
+
s8 = peg$FAILED;
|
|
12999
|
+
}
|
|
13000
|
+
while (s8 !== peg$FAILED) {
|
|
13001
|
+
s7.push(s8);
|
|
13002
|
+
s8 = peg$currPos;
|
|
13003
|
+
s9 = peg$currPos;
|
|
13004
|
+
peg$silentFails++;
|
|
13005
|
+
if (input.substr(peg$currPos, 2) === peg$c8) {
|
|
13006
|
+
s10 = peg$c8;
|
|
13007
|
+
peg$currPos += 2;
|
|
13008
|
+
} else {
|
|
13009
|
+
s10 = peg$FAILED;
|
|
13010
|
+
if (peg$silentFails === 0) peg$fail(peg$e12);
|
|
13011
|
+
}
|
|
13012
|
+
peg$silentFails--;
|
|
13013
|
+
if (s10 === peg$FAILED) s9 = void 0;
|
|
13014
|
+
else {
|
|
13015
|
+
peg$currPos = s9;
|
|
13016
|
+
s9 = peg$FAILED;
|
|
13017
|
+
}
|
|
13018
|
+
if (s9 !== peg$FAILED) {
|
|
13019
|
+
s10 = input.charAt(peg$currPos);
|
|
13020
|
+
if (peg$r13.test(s10)) peg$currPos++;
|
|
13021
|
+
else {
|
|
13022
|
+
s10 = peg$FAILED;
|
|
13023
|
+
if (peg$silentFails === 0) peg$fail(peg$e29);
|
|
13024
|
+
}
|
|
13025
|
+
if (s10 !== peg$FAILED) {
|
|
13026
|
+
s9 = [s9, s10];
|
|
13027
|
+
s8 = s9;
|
|
13028
|
+
} else {
|
|
13029
|
+
peg$currPos = s8;
|
|
13030
|
+
s8 = peg$FAILED;
|
|
13031
|
+
}
|
|
13032
|
+
} else {
|
|
13033
|
+
peg$currPos = s8;
|
|
13034
|
+
s8 = peg$FAILED;
|
|
13035
|
+
}
|
|
13036
|
+
}
|
|
13037
|
+
if (input.charCodeAt(peg$currPos) === 62) {
|
|
13038
|
+
s8 = peg$c1;
|
|
13039
|
+
peg$currPos++;
|
|
13040
|
+
} else {
|
|
13041
|
+
s8 = peg$FAILED;
|
|
13042
|
+
if (peg$silentFails === 0) peg$fail(peg$e3);
|
|
13043
|
+
}
|
|
13044
|
+
if (s8 !== peg$FAILED) {
|
|
13045
|
+
s3 = [
|
|
13046
|
+
s3,
|
|
13047
|
+
s4,
|
|
13048
|
+
s5,
|
|
13049
|
+
s6,
|
|
13050
|
+
s7,
|
|
13051
|
+
s8
|
|
13052
|
+
];
|
|
13053
|
+
s2 = s3;
|
|
13054
|
+
} else {
|
|
13055
|
+
peg$currPos = s2;
|
|
13056
|
+
s2 = peg$FAILED;
|
|
13057
|
+
}
|
|
13058
|
+
} else {
|
|
13059
|
+
peg$currPos = s2;
|
|
13060
|
+
s2 = peg$FAILED;
|
|
13061
|
+
}
|
|
13062
|
+
} else {
|
|
13063
|
+
peg$currPos = s2;
|
|
13064
|
+
s2 = peg$FAILED;
|
|
13065
|
+
}
|
|
13066
|
+
} else {
|
|
13067
|
+
peg$currPos = s2;
|
|
13068
|
+
s2 = peg$FAILED;
|
|
13069
|
+
}
|
|
13070
|
+
} else {
|
|
13071
|
+
peg$currPos = s2;
|
|
13072
|
+
s2 = peg$FAILED;
|
|
13073
|
+
}
|
|
13074
|
+
if (s2 !== peg$FAILED) s1 = input.substring(s1, peg$currPos);
|
|
13075
|
+
else s1 = s2;
|
|
13076
|
+
if (s1 !== peg$FAILED) {
|
|
13077
|
+
peg$savedPos = s0;
|
|
13078
|
+
s1 = peg$f47(s1);
|
|
13079
|
+
}
|
|
13080
|
+
s0 = s1;
|
|
13081
|
+
return s0;
|
|
13082
|
+
}
|
|
12844
13083
|
function peg$parseHtmlOpen() {
|
|
12845
13084
|
let s0, s1, s2, s3, s4, s5, s6, s7;
|
|
12846
13085
|
s0 = peg$currPos;
|
|
@@ -12879,7 +13118,7 @@ function peg$parse(input, options) {
|
|
|
12879
13118
|
}
|
|
12880
13119
|
if (s7 !== peg$FAILED) {
|
|
12881
13120
|
peg$savedPos = s0;
|
|
12882
|
-
s0 = peg$
|
|
13121
|
+
s0 = peg$f48(s2, s3, s4, s6);
|
|
12883
13122
|
} else {
|
|
12884
13123
|
peg$currPos = s0;
|
|
12885
13124
|
s0 = peg$FAILED;
|
|
@@ -12907,10 +13146,10 @@ function peg$parse(input, options) {
|
|
|
12907
13146
|
s3 = peg$currPos;
|
|
12908
13147
|
peg$silentFails++;
|
|
12909
13148
|
s4 = input.charAt(peg$currPos);
|
|
12910
|
-
if (peg$
|
|
13149
|
+
if (peg$r14.test(s4)) peg$currPos++;
|
|
12911
13150
|
else {
|
|
12912
13151
|
s4 = peg$FAILED;
|
|
12913
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13152
|
+
if (peg$silentFails === 0) peg$fail(peg$e30);
|
|
12914
13153
|
}
|
|
12915
13154
|
if (s4 === peg$FAILED) {
|
|
12916
13155
|
s4 = peg$currPos;
|
|
@@ -12944,7 +13183,7 @@ function peg$parse(input, options) {
|
|
|
12944
13183
|
s5 = peg$parse_();
|
|
12945
13184
|
s6 = peg$parseHere();
|
|
12946
13185
|
peg$savedPos = s0;
|
|
12947
|
-
s0 = peg$
|
|
13186
|
+
s0 = peg$f49(s2, s6);
|
|
12948
13187
|
} else {
|
|
12949
13188
|
peg$currPos = s0;
|
|
12950
13189
|
s0 = peg$FAILED;
|
|
@@ -12963,12 +13202,12 @@ function peg$parse(input, options) {
|
|
|
12963
13202
|
function peg$parseHtmlClose() {
|
|
12964
13203
|
let s0, s1, s2, s3, s5;
|
|
12965
13204
|
s0 = peg$currPos;
|
|
12966
|
-
if (input.substr(peg$currPos, 2) === peg$
|
|
12967
|
-
s1 = peg$
|
|
13205
|
+
if (input.substr(peg$currPos, 2) === peg$c15) {
|
|
13206
|
+
s1 = peg$c15;
|
|
12968
13207
|
peg$currPos += 2;
|
|
12969
13208
|
} else {
|
|
12970
13209
|
s1 = peg$FAILED;
|
|
12971
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13210
|
+
if (peg$silentFails === 0) peg$fail(peg$e31);
|
|
12972
13211
|
}
|
|
12973
13212
|
if (s1 !== peg$FAILED) {
|
|
12974
13213
|
s2 = peg$parseHere();
|
|
@@ -12984,7 +13223,7 @@ function peg$parse(input, options) {
|
|
|
12984
13223
|
}
|
|
12985
13224
|
if (s5 !== peg$FAILED) {
|
|
12986
13225
|
peg$savedPos = s0;
|
|
12987
|
-
s0 = peg$
|
|
13226
|
+
s0 = peg$f50(s2, s3);
|
|
12988
13227
|
} else {
|
|
12989
13228
|
peg$currPos = s0;
|
|
12990
13229
|
s0 = peg$FAILED;
|
|
@@ -13012,18 +13251,18 @@ function peg$parse(input, options) {
|
|
|
13012
13251
|
if (s2 !== peg$FAILED) {
|
|
13013
13252
|
s3 = [];
|
|
13014
13253
|
s4 = input.charAt(peg$currPos);
|
|
13015
|
-
if (peg$
|
|
13254
|
+
if (peg$r15.test(s4)) peg$currPos++;
|
|
13016
13255
|
else {
|
|
13017
13256
|
s4 = peg$FAILED;
|
|
13018
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13257
|
+
if (peg$silentFails === 0) peg$fail(peg$e32);
|
|
13019
13258
|
}
|
|
13020
13259
|
while (s4 !== peg$FAILED) {
|
|
13021
13260
|
s3.push(s4);
|
|
13022
13261
|
s4 = input.charAt(peg$currPos);
|
|
13023
|
-
if (peg$
|
|
13262
|
+
if (peg$r15.test(s4)) peg$currPos++;
|
|
13024
13263
|
else {
|
|
13025
13264
|
s4 = peg$FAILED;
|
|
13026
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13265
|
+
if (peg$silentFails === 0) peg$fail(peg$e32);
|
|
13027
13266
|
}
|
|
13028
13267
|
}
|
|
13029
13268
|
s2 = [s2, s3];
|
|
@@ -13047,10 +13286,10 @@ function peg$parse(input, options) {
|
|
|
13047
13286
|
s6 = peg$currPos;
|
|
13048
13287
|
peg$silentFails++;
|
|
13049
13288
|
s7 = input.charAt(peg$currPos);
|
|
13050
|
-
if (peg$
|
|
13289
|
+
if (peg$r16.test(s7)) peg$currPos++;
|
|
13051
13290
|
else {
|
|
13052
13291
|
s7 = peg$FAILED;
|
|
13053
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13292
|
+
if (peg$silentFails === 0) peg$fail(peg$e33);
|
|
13054
13293
|
}
|
|
13055
13294
|
peg$silentFails--;
|
|
13056
13295
|
if (s7 === peg$FAILED) s6 = void 0;
|
|
@@ -13083,10 +13322,10 @@ function peg$parse(input, options) {
|
|
|
13083
13322
|
s6 = peg$currPos;
|
|
13084
13323
|
peg$silentFails++;
|
|
13085
13324
|
s7 = input.charAt(peg$currPos);
|
|
13086
|
-
if (peg$
|
|
13325
|
+
if (peg$r16.test(s7)) peg$currPos++;
|
|
13087
13326
|
else {
|
|
13088
13327
|
s7 = peg$FAILED;
|
|
13089
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13328
|
+
if (peg$silentFails === 0) peg$fail(peg$e33);
|
|
13090
13329
|
}
|
|
13091
13330
|
peg$silentFails--;
|
|
13092
13331
|
if (s7 === peg$FAILED) s6 = void 0;
|
|
@@ -13119,25 +13358,25 @@ function peg$parse(input, options) {
|
|
|
13119
13358
|
else s3 = s4;
|
|
13120
13359
|
if (s3 !== peg$FAILED) {
|
|
13121
13360
|
peg$savedPos = peg$currPos;
|
|
13122
|
-
s4 = peg$
|
|
13361
|
+
s4 = peg$f51(s2, s3);
|
|
13123
13362
|
if (s4) s4 = void 0;
|
|
13124
13363
|
else s4 = peg$FAILED;
|
|
13125
13364
|
if (s4 !== peg$FAILED) {
|
|
13126
13365
|
s5 = peg$currPos;
|
|
13127
13366
|
s6 = peg$parse_();
|
|
13128
13367
|
if (input.charCodeAt(peg$currPos) === 61) {
|
|
13129
|
-
s7 = peg$
|
|
13368
|
+
s7 = peg$c16;
|
|
13130
13369
|
peg$currPos++;
|
|
13131
13370
|
} else {
|
|
13132
13371
|
s7 = peg$FAILED;
|
|
13133
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13372
|
+
if (peg$silentFails === 0) peg$fail(peg$e34);
|
|
13134
13373
|
}
|
|
13135
13374
|
if (s7 !== peg$FAILED) {
|
|
13136
13375
|
peg$parse_();
|
|
13137
13376
|
s9 = peg$parseAttrValue();
|
|
13138
13377
|
if (s9 !== peg$FAILED) {
|
|
13139
13378
|
peg$savedPos = s5;
|
|
13140
|
-
s5 = peg$
|
|
13379
|
+
s5 = peg$f52(s2, s3, s9);
|
|
13141
13380
|
} else {
|
|
13142
13381
|
peg$currPos = s5;
|
|
13143
13382
|
s5 = peg$FAILED;
|
|
@@ -13148,7 +13387,7 @@ function peg$parse(input, options) {
|
|
|
13148
13387
|
}
|
|
13149
13388
|
if (s5 === peg$FAILED) s5 = null;
|
|
13150
13389
|
peg$savedPos = s0;
|
|
13151
|
-
s0 = peg$
|
|
13390
|
+
s0 = peg$f53(s2, s3, s5);
|
|
13152
13391
|
} else {
|
|
13153
13392
|
peg$currPos = s0;
|
|
13154
13393
|
s0 = peg$FAILED;
|
|
@@ -13163,11 +13402,11 @@ function peg$parse(input, options) {
|
|
|
13163
13402
|
let s0, s1, s2, s3, s4, s5;
|
|
13164
13403
|
s0 = peg$currPos;
|
|
13165
13404
|
if (input.charCodeAt(peg$currPos) === 34) {
|
|
13166
|
-
s1 = peg$
|
|
13405
|
+
s1 = peg$c17;
|
|
13167
13406
|
peg$currPos++;
|
|
13168
13407
|
} else {
|
|
13169
13408
|
s1 = peg$FAILED;
|
|
13170
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13409
|
+
if (peg$silentFails === 0) peg$fail(peg$e35);
|
|
13171
13410
|
}
|
|
13172
13411
|
if (s1 !== peg$FAILED) {
|
|
13173
13412
|
s2 = peg$parseHere();
|
|
@@ -13176,10 +13415,10 @@ function peg$parse(input, options) {
|
|
|
13176
13415
|
s5 = peg$parseValuePart();
|
|
13177
13416
|
if (s5 === peg$FAILED) {
|
|
13178
13417
|
s5 = input.charAt(peg$currPos);
|
|
13179
|
-
if (peg$
|
|
13418
|
+
if (peg$r17.test(s5)) peg$currPos++;
|
|
13180
13419
|
else {
|
|
13181
13420
|
s5 = peg$FAILED;
|
|
13182
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13421
|
+
if (peg$silentFails === 0) peg$fail(peg$e36);
|
|
13183
13422
|
}
|
|
13184
13423
|
}
|
|
13185
13424
|
while (s5 !== peg$FAILED) {
|
|
@@ -13187,25 +13426,25 @@ function peg$parse(input, options) {
|
|
|
13187
13426
|
s5 = peg$parseValuePart();
|
|
13188
13427
|
if (s5 === peg$FAILED) {
|
|
13189
13428
|
s5 = input.charAt(peg$currPos);
|
|
13190
|
-
if (peg$
|
|
13429
|
+
if (peg$r17.test(s5)) peg$currPos++;
|
|
13191
13430
|
else {
|
|
13192
13431
|
s5 = peg$FAILED;
|
|
13193
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13432
|
+
if (peg$silentFails === 0) peg$fail(peg$e36);
|
|
13194
13433
|
}
|
|
13195
13434
|
}
|
|
13196
13435
|
}
|
|
13197
13436
|
s3 = input.substring(s3, peg$currPos);
|
|
13198
13437
|
s4 = peg$parseHere();
|
|
13199
13438
|
if (input.charCodeAt(peg$currPos) === 34) {
|
|
13200
|
-
s5 = peg$
|
|
13439
|
+
s5 = peg$c17;
|
|
13201
13440
|
peg$currPos++;
|
|
13202
13441
|
} else {
|
|
13203
13442
|
s5 = peg$FAILED;
|
|
13204
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13443
|
+
if (peg$silentFails === 0) peg$fail(peg$e35);
|
|
13205
13444
|
}
|
|
13206
13445
|
if (s5 !== peg$FAILED) {
|
|
13207
13446
|
peg$savedPos = s0;
|
|
13208
|
-
s0 = peg$
|
|
13447
|
+
s0 = peg$f54(s2, s3, s4);
|
|
13209
13448
|
} else {
|
|
13210
13449
|
peg$currPos = s0;
|
|
13211
13450
|
s0 = peg$FAILED;
|
|
@@ -13217,11 +13456,11 @@ function peg$parse(input, options) {
|
|
|
13217
13456
|
if (s0 === peg$FAILED) {
|
|
13218
13457
|
s0 = peg$currPos;
|
|
13219
13458
|
if (input.charCodeAt(peg$currPos) === 39) {
|
|
13220
|
-
s1 = peg$
|
|
13459
|
+
s1 = peg$c18;
|
|
13221
13460
|
peg$currPos++;
|
|
13222
13461
|
} else {
|
|
13223
13462
|
s1 = peg$FAILED;
|
|
13224
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13463
|
+
if (peg$silentFails === 0) peg$fail(peg$e37);
|
|
13225
13464
|
}
|
|
13226
13465
|
if (s1 !== peg$FAILED) {
|
|
13227
13466
|
s2 = peg$parseHere();
|
|
@@ -13230,10 +13469,10 @@ function peg$parse(input, options) {
|
|
|
13230
13469
|
s5 = peg$parseValuePart();
|
|
13231
13470
|
if (s5 === peg$FAILED) {
|
|
13232
13471
|
s5 = input.charAt(peg$currPos);
|
|
13233
|
-
if (peg$
|
|
13472
|
+
if (peg$r18.test(s5)) peg$currPos++;
|
|
13234
13473
|
else {
|
|
13235
13474
|
s5 = peg$FAILED;
|
|
13236
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13475
|
+
if (peg$silentFails === 0) peg$fail(peg$e38);
|
|
13237
13476
|
}
|
|
13238
13477
|
}
|
|
13239
13478
|
while (s5 !== peg$FAILED) {
|
|
@@ -13241,25 +13480,25 @@ function peg$parse(input, options) {
|
|
|
13241
13480
|
s5 = peg$parseValuePart();
|
|
13242
13481
|
if (s5 === peg$FAILED) {
|
|
13243
13482
|
s5 = input.charAt(peg$currPos);
|
|
13244
|
-
if (peg$
|
|
13483
|
+
if (peg$r18.test(s5)) peg$currPos++;
|
|
13245
13484
|
else {
|
|
13246
13485
|
s5 = peg$FAILED;
|
|
13247
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13486
|
+
if (peg$silentFails === 0) peg$fail(peg$e38);
|
|
13248
13487
|
}
|
|
13249
13488
|
}
|
|
13250
13489
|
}
|
|
13251
13490
|
s3 = input.substring(s3, peg$currPos);
|
|
13252
13491
|
s4 = peg$parseHere();
|
|
13253
13492
|
if (input.charCodeAt(peg$currPos) === 39) {
|
|
13254
|
-
s5 = peg$
|
|
13493
|
+
s5 = peg$c18;
|
|
13255
13494
|
peg$currPos++;
|
|
13256
13495
|
} else {
|
|
13257
13496
|
s5 = peg$FAILED;
|
|
13258
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13497
|
+
if (peg$silentFails === 0) peg$fail(peg$e37);
|
|
13259
13498
|
}
|
|
13260
13499
|
if (s5 !== peg$FAILED) {
|
|
13261
13500
|
peg$savedPos = s0;
|
|
13262
|
-
s0 = peg$
|
|
13501
|
+
s0 = peg$f55(s2, s3, s4);
|
|
13263
13502
|
} else {
|
|
13264
13503
|
peg$currPos = s0;
|
|
13265
13504
|
s0 = peg$FAILED;
|
|
@@ -13271,14 +13510,14 @@ function peg$parse(input, options) {
|
|
|
13271
13510
|
if (s0 === peg$FAILED) {
|
|
13272
13511
|
s0 = peg$currPos;
|
|
13273
13512
|
s1 = input.charAt(peg$currPos);
|
|
13274
|
-
if (peg$
|
|
13513
|
+
if (peg$r19.test(s1)) peg$currPos++;
|
|
13275
13514
|
else {
|
|
13276
13515
|
s1 = peg$FAILED;
|
|
13277
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13516
|
+
if (peg$silentFails === 0) peg$fail(peg$e39);
|
|
13278
13517
|
}
|
|
13279
13518
|
if (s1 !== peg$FAILED) {
|
|
13280
13519
|
peg$savedPos = s0;
|
|
13281
|
-
s1 = peg$
|
|
13520
|
+
s1 = peg$f56(s1);
|
|
13282
13521
|
}
|
|
13283
13522
|
s0 = s1;
|
|
13284
13523
|
if (s0 === peg$FAILED) {
|
|
@@ -13287,24 +13526,24 @@ function peg$parse(input, options) {
|
|
|
13287
13526
|
s2 = peg$currPos;
|
|
13288
13527
|
s3 = [];
|
|
13289
13528
|
s4 = input.charAt(peg$currPos);
|
|
13290
|
-
if (peg$
|
|
13529
|
+
if (peg$r20.test(s4)) peg$currPos++;
|
|
13291
13530
|
else {
|
|
13292
13531
|
s4 = peg$FAILED;
|
|
13293
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13532
|
+
if (peg$silentFails === 0) peg$fail(peg$e40);
|
|
13294
13533
|
}
|
|
13295
13534
|
while (s4 !== peg$FAILED) {
|
|
13296
13535
|
s3.push(s4);
|
|
13297
13536
|
s4 = input.charAt(peg$currPos);
|
|
13298
|
-
if (peg$
|
|
13537
|
+
if (peg$r20.test(s4)) peg$currPos++;
|
|
13299
13538
|
else {
|
|
13300
13539
|
s4 = peg$FAILED;
|
|
13301
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13540
|
+
if (peg$silentFails === 0) peg$fail(peg$e40);
|
|
13302
13541
|
}
|
|
13303
13542
|
}
|
|
13304
13543
|
s2 = input.substring(s2, peg$currPos);
|
|
13305
13544
|
s3 = peg$parseHere();
|
|
13306
13545
|
peg$savedPos = s0;
|
|
13307
|
-
s0 = peg$
|
|
13546
|
+
s0 = peg$f57(s1, s2, s3);
|
|
13308
13547
|
}
|
|
13309
13548
|
}
|
|
13310
13549
|
}
|
|
@@ -13314,7 +13553,7 @@ function peg$parse(input, options) {
|
|
|
13314
13553
|
let s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13;
|
|
13315
13554
|
s0 = peg$currPos;
|
|
13316
13555
|
peg$savedPos = peg$currPos;
|
|
13317
|
-
s1 = peg$
|
|
13556
|
+
s1 = peg$f58();
|
|
13318
13557
|
if (s1) s1 = void 0;
|
|
13319
13558
|
else s1 = peg$FAILED;
|
|
13320
13559
|
if (s1 !== peg$FAILED) {
|
|
@@ -13343,7 +13582,7 @@ function peg$parse(input, options) {
|
|
|
13343
13582
|
if (s2 !== peg$FAILED) {
|
|
13344
13583
|
s3 = peg$currPos;
|
|
13345
13584
|
peg$savedPos = peg$currPos;
|
|
13346
|
-
s4 = peg$
|
|
13585
|
+
s4 = peg$f59(s2);
|
|
13347
13586
|
if (s4) s4 = void 0;
|
|
13348
13587
|
else s4 = peg$FAILED;
|
|
13349
13588
|
if (s4 !== peg$FAILED) {
|
|
@@ -13382,7 +13621,7 @@ function peg$parse(input, options) {
|
|
|
13382
13621
|
if (s0 === peg$FAILED) {
|
|
13383
13622
|
s0 = peg$currPos;
|
|
13384
13623
|
peg$savedPos = peg$currPos;
|
|
13385
|
-
s1 = peg$
|
|
13624
|
+
s1 = peg$f60();
|
|
13386
13625
|
if (s1) s1 = void 0;
|
|
13387
13626
|
else s1 = peg$FAILED;
|
|
13388
13627
|
if (s1 !== peg$FAILED) {
|
|
@@ -13409,12 +13648,12 @@ function peg$parse(input, options) {
|
|
|
13409
13648
|
if (s6 !== peg$FAILED) {
|
|
13410
13649
|
s7 = peg$parseHere();
|
|
13411
13650
|
peg$savedPos = peg$currPos;
|
|
13412
|
-
s8 = peg$
|
|
13651
|
+
s8 = peg$f61(s4, s7);
|
|
13413
13652
|
if (s8) s8 = void 0;
|
|
13414
13653
|
else s8 = peg$FAILED;
|
|
13415
13654
|
if (s8 !== peg$FAILED) {
|
|
13416
13655
|
s9 = peg$currPos;
|
|
13417
|
-
s10 = peg$
|
|
13656
|
+
s10 = peg$f62(s4, s7);
|
|
13418
13657
|
s11 = peg$currPos;
|
|
13419
13658
|
s12 = [];
|
|
13420
13659
|
if (s12.length >= (s10 | 0)) s13 = peg$FAILED;
|
|
@@ -13496,7 +13735,7 @@ function peg$parse(input, options) {
|
|
|
13496
13735
|
if (s0 === peg$FAILED) {
|
|
13497
13736
|
s0 = peg$currPos;
|
|
13498
13737
|
peg$savedPos = peg$currPos;
|
|
13499
|
-
s1 = peg$
|
|
13738
|
+
s1 = peg$f63();
|
|
13500
13739
|
if (s1) s1 = void 0;
|
|
13501
13740
|
else s1 = peg$FAILED;
|
|
13502
13741
|
if (s1 !== peg$FAILED) {
|
|
@@ -13587,7 +13826,7 @@ function peg$parse(input, options) {
|
|
|
13587
13826
|
if (s0 === peg$FAILED) {
|
|
13588
13827
|
s0 = peg$currPos;
|
|
13589
13828
|
peg$savedPos = peg$currPos;
|
|
13590
|
-
s1 = peg$
|
|
13829
|
+
s1 = peg$f64();
|
|
13591
13830
|
if (s1) s1 = void 0;
|
|
13592
13831
|
else s1 = peg$FAILED;
|
|
13593
13832
|
if (s1 !== peg$FAILED) {
|
|
@@ -13669,10 +13908,10 @@ function peg$parse(input, options) {
|
|
|
13669
13908
|
function peg$parse_c() {
|
|
13670
13909
|
let s0;
|
|
13671
13910
|
s0 = input.charAt(peg$currPos);
|
|
13672
|
-
if (peg$
|
|
13911
|
+
if (peg$r21.test(s0)) peg$currPos++;
|
|
13673
13912
|
else {
|
|
13674
13913
|
s0 = peg$FAILED;
|
|
13675
|
-
if (peg$silentFails === 0) peg$fail(peg$
|
|
13914
|
+
if (peg$silentFails === 0) peg$fail(peg$e41);
|
|
13676
13915
|
}
|
|
13677
13916
|
return s0;
|
|
13678
13917
|
}
|
|
@@ -14336,13 +14575,13 @@ function propertyName(node, src) {
|
|
|
14336
14575
|
const c = src.charAt(node.start);
|
|
14337
14576
|
if (c === "@" || c === "%") throw new CodeSyntaxError(`"${node.name}" can't be a property name`, src, node.start);
|
|
14338
14577
|
}
|
|
14339
|
-
function walk(node, src, out, binding, shorthand) {
|
|
14578
|
+
function walk(node, src, out, binding, shorthand, access = "read") {
|
|
14340
14579
|
if (Array.isArray(node)) {
|
|
14341
|
-
for (const n7 of node) walk(n7, src, out, binding, false);
|
|
14580
|
+
for (const n7 of node) walk(n7, src, out, binding, false, access);
|
|
14342
14581
|
return;
|
|
14343
14582
|
}
|
|
14344
14583
|
if (!isNode(node)) return;
|
|
14345
|
-
const sub = (child, bind = false, short = false) => walk(child, src, out, bind, short);
|
|
14584
|
+
const sub = (child, bind = false, short = false, role = "read") => walk(child, src, out, bind, short, role);
|
|
14346
14585
|
switch (node.type) {
|
|
14347
14586
|
case "Identifier": {
|
|
14348
14587
|
const sigil = sigilOf(node, src);
|
|
@@ -14353,7 +14592,9 @@ function walk(node, src, out, binding, shorthand) {
|
|
|
14353
14592
|
name: sigil[1],
|
|
14354
14593
|
start: node.start,
|
|
14355
14594
|
end: node.end,
|
|
14356
|
-
shorthand
|
|
14595
|
+
shorthand,
|
|
14596
|
+
read: access !== "write",
|
|
14597
|
+
write: access !== "read"
|
|
14357
14598
|
});
|
|
14358
14599
|
return;
|
|
14359
14600
|
}
|
|
@@ -14374,10 +14615,10 @@ function walk(node, src, out, binding, shorthand) {
|
|
|
14374
14615
|
if (node.shorthand) {
|
|
14375
14616
|
const value = node.value;
|
|
14376
14617
|
if (value.type === "AssignmentPattern") {
|
|
14377
|
-
sub(value.left, binding, true);
|
|
14618
|
+
sub(value.left, binding, true, access);
|
|
14378
14619
|
sub(value.right);
|
|
14379
|
-
} else sub(value, binding, true);
|
|
14380
|
-
} else sub(node.value, binding);
|
|
14620
|
+
} else sub(value, binding, true, access);
|
|
14621
|
+
} else sub(node.value, binding, false, access);
|
|
14381
14622
|
return;
|
|
14382
14623
|
case "MethodDefinition":
|
|
14383
14624
|
case "PropertyDefinition":
|
|
@@ -14414,8 +14655,24 @@ function walk(node, src, out, binding, shorthand) {
|
|
|
14414
14655
|
sub(node.param, true);
|
|
14415
14656
|
sub(node.body);
|
|
14416
14657
|
return;
|
|
14658
|
+
case "AssignmentExpression":
|
|
14659
|
+
sub(node.left, false, false, node.operator === "=" ? "write" : "readwrite");
|
|
14660
|
+
sub(node.right);
|
|
14661
|
+
return;
|
|
14662
|
+
case "UnaryExpression":
|
|
14663
|
+
sub(node.argument, false, false, node.operator === "delete" ? "write" : "read");
|
|
14664
|
+
return;
|
|
14665
|
+
case "UpdateExpression":
|
|
14666
|
+
sub(node.argument, false, false, "readwrite");
|
|
14667
|
+
return;
|
|
14668
|
+
case "ForInStatement":
|
|
14669
|
+
case "ForOfStatement":
|
|
14670
|
+
sub(node.left, false, false, "write");
|
|
14671
|
+
sub(node.right);
|
|
14672
|
+
sub(node.body);
|
|
14673
|
+
return;
|
|
14417
14674
|
case "AssignmentPattern":
|
|
14418
|
-
sub(node.left, binding);
|
|
14675
|
+
sub(node.left, binding, false, access);
|
|
14419
14676
|
sub(node.right);
|
|
14420
14677
|
return;
|
|
14421
14678
|
case "ObjectPattern":
|
|
@@ -14425,7 +14682,7 @@ function walk(node, src, out, binding, shorthand) {
|
|
|
14425
14682
|
"properties",
|
|
14426
14683
|
"elements",
|
|
14427
14684
|
"argument"
|
|
14428
|
-
]) sub(node[key], binding);
|
|
14685
|
+
]) sub(node[key], binding, false, access);
|
|
14429
14686
|
return;
|
|
14430
14687
|
default:
|
|
14431
14688
|
for (const key in node) {
|
|
@@ -15023,13 +15280,13 @@ function isCloser(ch) {
|
|
|
15023
15280
|
function unescapeQuoted(body) {
|
|
15024
15281
|
return body.replace(/\\(["'\\])/g, "$1");
|
|
15025
15282
|
}
|
|
15026
|
-
function readQuoted(src, start) {
|
|
15283
|
+
function readQuoted(src, start, tolerant = false) {
|
|
15027
15284
|
const quote = src[start];
|
|
15028
15285
|
if (quote !== '"' && quote !== "'") return null;
|
|
15029
15286
|
const { end, closed } = scanStringLiteral(src, start);
|
|
15030
|
-
if (!closed) return null;
|
|
15287
|
+
if (!closed && !tolerant) return null;
|
|
15031
15288
|
return {
|
|
15032
|
-
value: unescapeQuoted(src.slice(start + 1, end - 1)),
|
|
15289
|
+
value: unescapeQuoted(src.slice(start + 1, closed ? end - 1 : end)),
|
|
15033
15290
|
end
|
|
15034
15291
|
};
|
|
15035
15292
|
}
|
|
@@ -15087,8 +15344,7 @@ function startsLikeValue(token) {
|
|
|
15087
15344
|
const first = token[0];
|
|
15088
15345
|
if (first === '"' || first === "'" || first === "`") return true;
|
|
15089
15346
|
if (/^[$_@]\w|^%[A-Za-z_]/.test(token)) return true;
|
|
15090
|
-
if (
|
|
15091
|
-
if ((first === "-" || first === "+") && token.length > 1 && /\d/.test(token[1])) return true;
|
|
15347
|
+
if (/^[+-]?(?:\d|\.\d)/.test(token)) return true;
|
|
15092
15348
|
if (first === "(" || first === "[" || first === "{") return true;
|
|
15093
15349
|
if (/^(?:true|false|null|undefined)(?![\w$])/.test(token)) return true;
|
|
15094
15350
|
if (first === "!" && token.length > 1 && token[1] !== "=") return true;
|
|
@@ -15133,11 +15389,16 @@ function readText(src) {
|
|
|
15133
15389
|
return readWholeQuoted(src) ?? stripLooseQuotes(src);
|
|
15134
15390
|
}
|
|
15135
15391
|
function readValue(param, src, place) {
|
|
15136
|
-
|
|
15392
|
+
const span = [place.at, place.at + src.length];
|
|
15393
|
+
place.spans?.set(param, span);
|
|
15394
|
+
place.toolingSpans?.set(param, span);
|
|
15137
15395
|
switch (param.type) {
|
|
15138
15396
|
case "string": {
|
|
15139
15397
|
const value = readWholeQuoted(src);
|
|
15140
|
-
if (value === null)
|
|
15398
|
+
if (value === null) {
|
|
15399
|
+
if (place.toolingSpans && (src[0] === '"' || src[0] === "'")) return readText(src);
|
|
15400
|
+
throw new MacroArgumentError(param, src);
|
|
15401
|
+
}
|
|
15141
15402
|
return value;
|
|
15142
15403
|
}
|
|
15143
15404
|
case "text":
|
|
@@ -15162,20 +15423,21 @@ function matchAt(re2, src, pos) {
|
|
|
15162
15423
|
re2.lastIndex = pos;
|
|
15163
15424
|
return re2.exec(src)?.[0] ?? null;
|
|
15164
15425
|
}
|
|
15165
|
-
function readOptions(params, src, { at: at3, spans }) {
|
|
15426
|
+
function readOptions(params, src, { at: at3, spans, toolingSpans }) {
|
|
15166
15427
|
const options = {};
|
|
15167
15428
|
let i2 = 0;
|
|
15168
15429
|
while (i2 < src.length) {
|
|
15169
15430
|
const key = matchAt(WORD_RE$1, src, i2);
|
|
15170
15431
|
if (!key) {
|
|
15171
|
-
i2 = readQuoted(src, i2)?.end ?? i2 + 1;
|
|
15432
|
+
i2 = readQuoted(src, i2, !!toolingSpans)?.end ?? i2 + 1;
|
|
15172
15433
|
continue;
|
|
15173
15434
|
}
|
|
15435
|
+
const keyAt = i2;
|
|
15174
15436
|
i2 += key.length;
|
|
15175
15437
|
let val;
|
|
15176
15438
|
let j2 = i2;
|
|
15177
15439
|
while (j2 < src.length && isWhitespace(src[j2])) j2++;
|
|
15178
|
-
const quoted = readQuoted(src, j2);
|
|
15440
|
+
const quoted = readQuoted(src, j2, !!toolingSpans);
|
|
15179
15441
|
const digits = quoted || j2 === i2 ? null : matchAt(NUMBER_RE$1, src, j2);
|
|
15180
15442
|
if (quoted) {
|
|
15181
15443
|
val = quoted.value;
|
|
@@ -15186,7 +15448,8 @@ function readOptions(params, src, { at: at3, spans }) {
|
|
|
15186
15448
|
}
|
|
15187
15449
|
const param = params.find((p) => p.name === key);
|
|
15188
15450
|
if (param && param.type !== "flag" && val !== void 0) spans?.set(param, [at3 + j2, at3 + i2]);
|
|
15189
|
-
if (param
|
|
15451
|
+
if (param) toolingSpans?.set(param, [at3 + keyAt, at3 + i2]);
|
|
15452
|
+
if (param?.type === "string" && !quoted && !toolingSpans) throw new MacroArgumentError(param, matchAt(WORD_OR_PUNCT_RE, src, j2) ?? "");
|
|
15190
15453
|
if (param?.type === "flag") options[key] = true;
|
|
15191
15454
|
else if (param?.type === "number") options[key] = Number(val ?? 0);
|
|
15192
15455
|
else if (param) options[key] = val;
|
|
@@ -15207,7 +15470,7 @@ function takeFlag(src, word, alone) {
|
|
|
15207
15470
|
}
|
|
15208
15471
|
return null;
|
|
15209
15472
|
}
|
|
15210
|
-
function findSeparator(src, word) {
|
|
15473
|
+
function findSeparator(src, word, tolerant = false) {
|
|
15211
15474
|
if (word === "=") {
|
|
15212
15475
|
const indices = topLevelIndices(src, (ch) => ch === "=");
|
|
15213
15476
|
for (let k2 = 0; k2 < indices.length; k2++) {
|
|
@@ -15221,29 +15484,42 @@ function findSeparator(src, word) {
|
|
|
15221
15484
|
return null;
|
|
15222
15485
|
}
|
|
15223
15486
|
const spans = terms(src);
|
|
15224
|
-
for (let k2 = 1; k2 < spans.length - 1; k2++) if (slice(src, spans[k2]) === word) return [spans[k2 - 1][1], spans[k2 + 1][0]];
|
|
15487
|
+
for (let k2 = 1; k2 < spans.length - (tolerant ? 0 : 1); k2++) if (slice(src, spans[k2]) === word) return [spans[k2 - 1][1], spans[k2 + 1]?.[0] ?? src.length];
|
|
15225
15488
|
return null;
|
|
15226
15489
|
}
|
|
15227
15490
|
function trimmed(src, at3) {
|
|
15228
15491
|
const text3 = src.trim();
|
|
15229
15492
|
return [text3, text3 ? at3 + src.indexOf(text3) : at3];
|
|
15230
15493
|
}
|
|
15231
|
-
function readGroup(params, src, args2, { at: srcAt, spans }) {
|
|
15494
|
+
function readGroup(params, src, args2, { at: srcAt, spans, toolingSpans }) {
|
|
15232
15495
|
let [text3, at3] = trimmed(src ?? "", srcAt);
|
|
15233
15496
|
const alone = !params.some((p) => p.type !== "flag" && p.required);
|
|
15234
15497
|
for (const flag of params.filter((p) => p.type === "flag")) {
|
|
15235
15498
|
const rest2 = src === null ? null : takeFlag(text3, flag.name, alone);
|
|
15236
15499
|
args2[flag.name] = rest2 !== null;
|
|
15237
|
-
if (rest2)
|
|
15500
|
+
if (rest2) {
|
|
15501
|
+
const flagSpan = rest2[0] > 0 ? [0, text3.indexOf(flag.name) + flag.name.length] : [text3.lastIndexOf(flag.name), text3.length];
|
|
15502
|
+
toolingSpans?.set(flag, [at3 + flagSpan[0], at3 + flagSpan[1]]);
|
|
15503
|
+
[text3, at3] = trimmed(slice(text3, rest2), at3 + rest2[0]);
|
|
15504
|
+
}
|
|
15238
15505
|
}
|
|
15239
15506
|
const positional = params.filter((p) => p.type !== "flag");
|
|
15240
15507
|
if (positional.length === 0) return;
|
|
15241
15508
|
const lastText = positional.findIndex((p, i2) => takesRest(p) && !positional.slice(i2 + 1).some(takesRest));
|
|
15242
15509
|
const restIndex = lastText < 0 ? positional.length - 1 : lastText;
|
|
15243
|
-
const read = (param, [start, end]
|
|
15244
|
-
|
|
15245
|
-
|
|
15246
|
-
|
|
15510
|
+
const read = (param, [start, end], tolerant = true) => {
|
|
15511
|
+
if (start === end) return unset(param);
|
|
15512
|
+
try {
|
|
15513
|
+
return readValue(param, text3.slice(start, end), {
|
|
15514
|
+
at: at3 + start,
|
|
15515
|
+
spans,
|
|
15516
|
+
toolingSpans
|
|
15517
|
+
});
|
|
15518
|
+
} catch (error48) {
|
|
15519
|
+
if (toolingSpans && tolerant && error48 instanceof MacroArgumentError) return;
|
|
15520
|
+
throw error48;
|
|
15521
|
+
}
|
|
15522
|
+
};
|
|
15247
15523
|
if (positional.length === 1) {
|
|
15248
15524
|
args2[positional[0].name] = read(positional[0], [0, text3.length]);
|
|
15249
15525
|
return;
|
|
@@ -15254,7 +15530,7 @@ function readGroup(params, src, args2, { at: srcAt, spans }) {
|
|
|
15254
15530
|
for (const param of positional.slice(0, restIndex)) args2[param.name] = from < to ? read(param, parts[from++]) : unset(param);
|
|
15255
15531
|
const readTrailing = (param, span) => {
|
|
15256
15532
|
try {
|
|
15257
|
-
return read(param, span);
|
|
15533
|
+
return read(param, span, false);
|
|
15258
15534
|
} catch (error48) {
|
|
15259
15535
|
if (error48 instanceof MacroArgumentError) return void 0;
|
|
15260
15536
|
throw error48;
|
|
@@ -15264,23 +15540,31 @@ function readGroup(params, src, args2, { at: srcAt, spans }) {
|
|
|
15264
15540
|
const value = from < to && !endsWithOperator(text3.slice(0, parts[to - 1][0])) ? readTrailing(param, parts[to - 1]) : void 0;
|
|
15265
15541
|
args2[param.name] = value ?? unset(param);
|
|
15266
15542
|
if (value !== void 0) to--;
|
|
15267
|
-
else
|
|
15543
|
+
else {
|
|
15544
|
+
spans?.delete(param);
|
|
15545
|
+
toolingSpans?.delete(param);
|
|
15546
|
+
}
|
|
15268
15547
|
}
|
|
15269
15548
|
const rest = positional[restIndex];
|
|
15270
15549
|
args2[rest.name] = from < to ? read(rest, [parts[from][0], parts[to - 1][1]]) : unset(rest);
|
|
15271
15550
|
}
|
|
15272
|
-
function parseMacroArgs(rawArgs, parameters, spans) {
|
|
15551
|
+
function parseMacroArgs(rawArgs, parameters, spans, toolingSpans) {
|
|
15273
15552
|
const args2 = {};
|
|
15274
15553
|
let [rest, restAt] = trimmed(rawArgs, 0);
|
|
15275
15554
|
let groupStart = 0;
|
|
15276
15555
|
parameters.forEach((separator, i2) => {
|
|
15277
15556
|
if (separator.type !== "separator") return;
|
|
15278
|
-
const at3 = rest === null ? null : findSeparator(rest, separator.name);
|
|
15557
|
+
const at3 = rest === null ? null : findSeparator(rest, separator.name, !!toolingSpans);
|
|
15279
15558
|
args2[separator.name] = at3 !== null;
|
|
15559
|
+
if (at3 && toolingSpans) {
|
|
15560
|
+
const start = restAt + at3[0] + rest.slice(at3[0], at3[1]).indexOf(separator.name);
|
|
15561
|
+
toolingSpans.set(separator, [start, start + separator.name.length]);
|
|
15562
|
+
}
|
|
15280
15563
|
const before = at3 ? rest.slice(0, at3[0]) : rest;
|
|
15281
15564
|
readGroup(parameters.slice(groupStart, i2), before, args2, {
|
|
15282
15565
|
at: restAt,
|
|
15283
|
-
spans
|
|
15566
|
+
spans,
|
|
15567
|
+
toolingSpans
|
|
15284
15568
|
});
|
|
15285
15569
|
rest = at3 ? rest.slice(at3[1]) : null;
|
|
15286
15570
|
if (at3) restAt += at3[1];
|
|
@@ -15288,7 +15572,8 @@ function parseMacroArgs(rawArgs, parameters, spans) {
|
|
|
15288
15572
|
});
|
|
15289
15573
|
readGroup(parameters.slice(groupStart), rest, args2, {
|
|
15290
15574
|
at: restAt,
|
|
15291
|
-
spans
|
|
15575
|
+
spans,
|
|
15576
|
+
toolingSpans
|
|
15292
15577
|
});
|
|
15293
15578
|
return args2;
|
|
15294
15579
|
}
|
|
@@ -15395,7 +15680,14 @@ function stringHolds(param) {
|
|
|
15395
15680
|
return param.holds ?? "markup";
|
|
15396
15681
|
}
|
|
15397
15682
|
function* codeAndText(src, tokens2, parametersOf2) {
|
|
15398
|
-
const
|
|
15683
|
+
const closeOfTextBody = (t, name) => {
|
|
15684
|
+
for (let k2 = t + 1; k2 < tokens2.length; k2++) {
|
|
15685
|
+
const c = tokens2[k2];
|
|
15686
|
+
if (c.type === "text") continue;
|
|
15687
|
+
return c.type === "macro" && c.isClose && c.name.toLowerCase() === name ? k2 : -1;
|
|
15688
|
+
}
|
|
15689
|
+
return -1;
|
|
15690
|
+
};
|
|
15399
15691
|
for (let t = 0; t < tokens2.length; t++) {
|
|
15400
15692
|
const token = tokens2[t];
|
|
15401
15693
|
if (token.type === "link") {
|
|
@@ -15431,7 +15723,7 @@ function* codeAndText(src, tokens2, parametersOf2) {
|
|
|
15431
15723
|
else if (token.type === "macro" && !token.isClose) {
|
|
15432
15724
|
const name = token.name.toLowerCase();
|
|
15433
15725
|
if (name === "do") {
|
|
15434
|
-
const close =
|
|
15726
|
+
const close = closeOfTextBody(t, name);
|
|
15435
15727
|
if (close < 0) continue;
|
|
15436
15728
|
yield {
|
|
15437
15729
|
kind: "code",
|
|
@@ -15445,9 +15737,8 @@ function* codeAndText(src, tokens2, parametersOf2) {
|
|
|
15445
15737
|
}
|
|
15446
15738
|
const args2 = token.rawArgs;
|
|
15447
15739
|
if (PASSAGE_BODIES.has(name)) {
|
|
15448
|
-
const close =
|
|
15449
|
-
|
|
15450
|
-
if (close > t + 1 && body.every((b) => b.type === "text")) {
|
|
15740
|
+
const close = closeOfTextBody(t, name);
|
|
15741
|
+
if (close > t + 1) {
|
|
15451
15742
|
const text3 = src.slice(token.end, tokens2[close].start);
|
|
15452
15743
|
const written2 = text3.trim();
|
|
15453
15744
|
yield {
|
|
@@ -16837,10 +17128,10 @@ function resolveAll(constructs2, events, context) {
|
|
|
16837
17128
|
const called = [];
|
|
16838
17129
|
let index = -1;
|
|
16839
17130
|
while (++index < constructs2.length) {
|
|
16840
|
-
const
|
|
16841
|
-
if (
|
|
16842
|
-
events =
|
|
16843
|
-
called.push(
|
|
17131
|
+
const resolve8 = constructs2[index].resolveAll;
|
|
17132
|
+
if (resolve8 && !called.includes(resolve8)) {
|
|
17133
|
+
events = resolve8(events, context);
|
|
17134
|
+
called.push(resolve8);
|
|
16844
17135
|
}
|
|
16845
17136
|
}
|
|
16846
17137
|
return events;
|
|
@@ -20304,10 +20595,25 @@ function markdownOptions(options) {
|
|
|
20304
20595
|
htmlExtensions: [gfmTableHtml(), gfmStrikethroughHtml()]
|
|
20305
20596
|
};
|
|
20306
20597
|
}
|
|
20307
|
-
function
|
|
20598
|
+
function sourceLines(source) {
|
|
20599
|
+
const starts = [0];
|
|
20600
|
+
for (let i2 = 0; i2 < source.length; i2++) if (source[i2] === "\n") starts.push(i2 + 1);
|
|
20601
|
+
return (offset2) => {
|
|
20602
|
+
let low = 0;
|
|
20603
|
+
let high = starts.length;
|
|
20604
|
+
while (low < high) {
|
|
20605
|
+
const middle = low + high >>> 1;
|
|
20606
|
+
if (starts[middle] <= offset2) low = middle + 1;
|
|
20607
|
+
else high = middle;
|
|
20608
|
+
}
|
|
20609
|
+
return Math.max(0, low - 1);
|
|
20610
|
+
};
|
|
20611
|
+
}
|
|
20612
|
+
function markdownLines(source, isBlock, types3) {
|
|
20308
20613
|
const found = /* @__PURE__ */ new Set();
|
|
20309
|
-
if (!/`{3}|~{3}/.test(source)) return found;
|
|
20614
|
+
if (types3.size === 1 && types3.has("codeFenced") && !/`{3}|~{3}/.test(source)) return found;
|
|
20310
20615
|
const { nodes } = analyzeMarkup(source, { hooks: { isBlock } });
|
|
20616
|
+
const lineAt = sourceLines(source);
|
|
20311
20617
|
function visit(nodes2) {
|
|
20312
20618
|
let markdown = "";
|
|
20313
20619
|
const spans = [];
|
|
@@ -20319,23 +20625,32 @@ function fencedCodeLines(source, isBlock) {
|
|
|
20319
20625
|
end: markdown.length,
|
|
20320
20626
|
node
|
|
20321
20627
|
});
|
|
20322
|
-
if (node.body && !(node.token.type === "macro" && node.token.name === "do")) {
|
|
20628
|
+
if (node.body && !(node.token.type === "macro" && node.token.name.toLowerCase() === "do")) {
|
|
20323
20629
|
visit(node.body.children);
|
|
20324
20630
|
for (const branch of node.body.branches) visit(branch.children);
|
|
20325
20631
|
}
|
|
20326
20632
|
}
|
|
20327
20633
|
const events = postprocess(parse3(markdownOptions()).document().write(preprocess()(markdown, void 0, true)));
|
|
20328
20634
|
for (const [event, token] of events) {
|
|
20329
|
-
if (event !== "enter" || token.type
|
|
20330
|
-
|
|
20635
|
+
if (event !== "enter" || !types3.has(token.type)) continue;
|
|
20636
|
+
let low = 0;
|
|
20637
|
+
let high = spans.length;
|
|
20638
|
+
while (low < high) {
|
|
20639
|
+
const middle = low + high >>> 1;
|
|
20640
|
+
if (spans[middle].end <= token.start.offset) low = middle + 1;
|
|
20641
|
+
else high = middle;
|
|
20642
|
+
}
|
|
20643
|
+
for (let i2 = low; i2 < spans.length; i2++) {
|
|
20644
|
+
const span = spans[i2];
|
|
20645
|
+
if (span.start >= token.end.offset) break;
|
|
20331
20646
|
const start = Math.max(token.start.offset, span.start);
|
|
20332
20647
|
const end = Math.min(token.end.offset, span.end);
|
|
20333
20648
|
if (start >= end) continue;
|
|
20334
20649
|
const text3 = span.node.token.type === "text";
|
|
20335
20650
|
const a = text3 ? span.node.start + start - span.start : span.node.start;
|
|
20336
20651
|
const b = text3 ? span.node.start + end - span.start : span.node.end;
|
|
20337
|
-
const first =
|
|
20338
|
-
const last2 =
|
|
20652
|
+
const first = lineAt(a);
|
|
20653
|
+
const last2 = lineAt(Math.max(a, b - 1));
|
|
20339
20654
|
for (let line = first; line <= last2; line++) found.add(line);
|
|
20340
20655
|
}
|
|
20341
20656
|
}
|
|
@@ -20395,7 +20710,7 @@ function scanSpindleMarkup(text3) {
|
|
|
20395
20710
|
}, true);
|
|
20396
20711
|
}
|
|
20397
20712
|
} else if (t.type !== "text") {
|
|
20398
|
-
if (t.type === "macro" && t.name === "do") {
|
|
20713
|
+
if (t.type === "macro" && t.name.toLowerCase() === "do") {
|
|
20399
20714
|
if (!t.isClose) open = t;
|
|
20400
20715
|
else if (open) {
|
|
20401
20716
|
doBlocks.push({
|
|
@@ -20428,9 +20743,6 @@ function multilineJsLiterals(code) {
|
|
|
20428
20743
|
} }, "statements");
|
|
20429
20744
|
return spans;
|
|
20430
20745
|
}
|
|
20431
|
-
function lineHasTag(tags, start, end) {
|
|
20432
|
-
return tags.some((tag) => tag.start < end && tag.end > start);
|
|
20433
|
-
}
|
|
20434
20746
|
function replaceSvgBlocks(html) {
|
|
20435
20747
|
const tokens2 = [];
|
|
20436
20748
|
return {
|
|
@@ -20443,7 +20755,17 @@ function replaceSvgBlocks(html) {
|
|
|
20443
20755
|
};
|
|
20444
20756
|
}
|
|
20445
20757
|
function placeholdersIntact(text3, tokens2, placeholdersOf) {
|
|
20446
|
-
|
|
20758
|
+
if (tokens2.length === 0) return true;
|
|
20759
|
+
const indices = /* @__PURE__ */ new Map();
|
|
20760
|
+
const counts = new Array(tokens2.length).fill(0);
|
|
20761
|
+
tokens2.forEach((_2, index) => {
|
|
20762
|
+
for (const marker of placeholdersOf(index)) indices.set(marker, index);
|
|
20763
|
+
});
|
|
20764
|
+
for (const [marker] of text3.matchAll(PLACEHOLDER_PATTERN)) {
|
|
20765
|
+
const index = indices.get(marker);
|
|
20766
|
+
if (index !== void 0 && ++counts[index] > 1) return false;
|
|
20767
|
+
}
|
|
20768
|
+
return counts.every((count) => count === 1);
|
|
20447
20769
|
}
|
|
20448
20770
|
function sameSpindleTokens(before, after) {
|
|
20449
20771
|
const tokensOf2 = (text3) => scanSpindleMarkup(text3).tokens.map((m) => m.token);
|
|
@@ -20451,15 +20773,19 @@ function sameSpindleTokens(before, after) {
|
|
|
20451
20773
|
const found = tokensOf2(after);
|
|
20452
20774
|
return expected.length === found.length && expected.every((t, i2) => t === found[i2]);
|
|
20453
20775
|
}
|
|
20454
|
-
function restorePlaceholders(text3,
|
|
20455
|
-
|
|
20456
|
-
tokens2.forEach((token, index) => {
|
|
20457
|
-
for (const
|
|
20776
|
+
function restorePlaceholders(text3, groups) {
|
|
20777
|
+
const replacements = /* @__PURE__ */ new Map();
|
|
20778
|
+
for (const [tokens2, placeholdersOf] of groups) tokens2.forEach((token, index) => {
|
|
20779
|
+
for (const marker of placeholdersOf(index)) replacements.set(marker, token);
|
|
20780
|
+
});
|
|
20781
|
+
return text3.replace(PLACEHOLDER_PATTERN, (marker) => {
|
|
20782
|
+
const token = replacements.get(marker);
|
|
20783
|
+
replacements.delete(marker);
|
|
20784
|
+
return token ?? marker;
|
|
20458
20785
|
});
|
|
20459
|
-
return result2;
|
|
20460
20786
|
}
|
|
20461
|
-
function
|
|
20462
|
-
return restorePlaceholders(text3,
|
|
20787
|
+
function restoreHtmlTokens(text3, spindle, svg) {
|
|
20788
|
+
return restorePlaceholders(text3, [[spindle, SPINDLE_PLACEHOLDERS], [svg, SVG_PLACEHOLDERS]]);
|
|
20463
20789
|
}
|
|
20464
20790
|
function replaceSpindleTokens(html) {
|
|
20465
20791
|
const { tokens: found, tags, doBlocks } = scanSpindleMarkup(html);
|
|
@@ -20484,6 +20810,7 @@ function replaceSpindleTokens(html) {
|
|
|
20484
20810
|
const tokens2 = [];
|
|
20485
20811
|
const resultLines = [];
|
|
20486
20812
|
let unit = 0;
|
|
20813
|
+
let tag = 0;
|
|
20487
20814
|
let lineStart = 0;
|
|
20488
20815
|
while (lineStart <= html.length) {
|
|
20489
20816
|
let lineEnd = lineStart;
|
|
@@ -20503,8 +20830,10 @@ function replaceSpindleTokens(html) {
|
|
|
20503
20830
|
}
|
|
20504
20831
|
const line = html.slice(lineStart, lineEnd);
|
|
20505
20832
|
const indent = line.match(/^(\s*)/)?.[1] ?? "";
|
|
20833
|
+
while (tag < tags.length && tags[tag].end <= lineStart) tag++;
|
|
20834
|
+
const hasTag = tag < tags.length && tags[tag].start < lineEnd;
|
|
20506
20835
|
if (lineUnits.length === 0) resultLines.push(line);
|
|
20507
|
-
else if (!
|
|
20836
|
+
else if (!hasTag) {
|
|
20508
20837
|
const idx = tokens2.length;
|
|
20509
20838
|
tokens2.push(line.trim());
|
|
20510
20839
|
resultLines.push(`${indent}<!--SP:${idx}-->`);
|
|
@@ -20526,9 +20855,6 @@ function replaceSpindleTokens(html) {
|
|
|
20526
20855
|
tokens: tokens2
|
|
20527
20856
|
};
|
|
20528
20857
|
}
|
|
20529
|
-
function restoreSpindleTokens(text3, tokens2) {
|
|
20530
|
-
return restorePlaceholders(text3, tokens2, SPINDLE_PLACEHOLDERS);
|
|
20531
|
-
}
|
|
20532
20858
|
function closedMacroNames(text3) {
|
|
20533
20859
|
const found = /* @__PURE__ */ new Set();
|
|
20534
20860
|
for (const t of tokenizeMarkupTolerant(text3).tokens) if (t.type === "macro" && t.isClose) found.add(t.name.toLowerCase());
|
|
@@ -20594,7 +20920,7 @@ async function formatLf(text3, options) {
|
|
|
20594
20920
|
const literalSentinel = newlineSentinel(body + sentinel);
|
|
20595
20921
|
const literalLines = /* @__PURE__ */ new Map();
|
|
20596
20922
|
const literalMarkers = /* @__PURE__ */ new Set();
|
|
20597
|
-
const fenced =
|
|
20923
|
+
const fenced = markdownLines(body, isBlock, /* @__PURE__ */ new Set(["codeFenced"]));
|
|
20598
20924
|
const literalHtml = whitespaceSensitiveLines(body, isBlock);
|
|
20599
20925
|
body = body.split("\n").map((line, index) => {
|
|
20600
20926
|
if (!fenced.has(index) && !literalHtml.has(index)) return line;
|
|
@@ -20637,18 +20963,22 @@ async function formatLf(text3, options) {
|
|
|
20637
20963
|
continue;
|
|
20638
20964
|
}
|
|
20639
20965
|
const { text: svgPlaceholdered, tokens: svgTokens } = replaceSvgBlocks(htmlText2);
|
|
20966
|
+
if (!placeholdersIntact(svgPlaceholdered, svgTokens, SVG_PLACEHOLDERS)) {
|
|
20967
|
+
lines.push(...region.lines);
|
|
20968
|
+
continue;
|
|
20969
|
+
}
|
|
20640
20970
|
const { text: placeholdered, tokens: tokens2 } = replaceSpindleTokens(svgPlaceholdered);
|
|
20641
20971
|
const formatted = await formatHTML(placeholdered, prettier2, prettierOptions);
|
|
20642
20972
|
if (formatted === void 0 || !placeholdersIntact(formatted, tokens2, SPINDLE_PLACEHOLDERS) || !placeholdersIntact(formatted, svgTokens, SVG_PLACEHOLDERS)) {
|
|
20643
20973
|
lines.push(...region.lines);
|
|
20644
20974
|
continue;
|
|
20645
20975
|
}
|
|
20646
|
-
const restored =
|
|
20976
|
+
const restored = restoreHtmlTokens(formatted.trim(), tokens2.map((t) => replaceAll(t, "\n", sentinel)), svgTokens);
|
|
20647
20977
|
for (const fLine of restored.split("\n")) lines.push(fLine);
|
|
20648
20978
|
continue;
|
|
20649
20979
|
}
|
|
20650
20980
|
let indented = indentMacros(region.lines, isBlock, isDedenting, literalMarkers);
|
|
20651
|
-
if (options.maxLineLength) indented = wrapLines(indented, options.maxLineLength, literalLines);
|
|
20981
|
+
if (options.maxLineLength) indented = wrapLines(indented, options.maxLineLength, literalLines, isBlock);
|
|
20652
20982
|
for (const line of indented) {
|
|
20653
20983
|
if (line.endsWith(" ")) hardBreakLines.add(lines.length);
|
|
20654
20984
|
lines.push(line);
|
|
@@ -20661,13 +20991,14 @@ async function formatLf(text3, options) {
|
|
|
20661
20991
|
function whitespaceSensitiveLines(source, isBlock) {
|
|
20662
20992
|
const lines = /* @__PURE__ */ new Set();
|
|
20663
20993
|
if (!WHITESPACE_AS_WRITTEN.test(source)) return lines;
|
|
20994
|
+
const lineAt = sourceLines(source);
|
|
20664
20995
|
const { nodes } = analyzeMarkup(source, { hooks: { isBlock } });
|
|
20665
20996
|
function visit(nodes2) {
|
|
20666
20997
|
for (const node of nodes2) {
|
|
20667
20998
|
const { token, body } = node;
|
|
20668
20999
|
if (token.type === "html" && (["pre", "textarea"].includes(token.tag.toLowerCase()) || Object.entries(token.attributes).some(([name, value]) => name.toLowerCase() === "style" && /white-space\s*:/i.test(value)))) {
|
|
20669
|
-
const first =
|
|
20670
|
-
const last2 =
|
|
21000
|
+
const first = lineAt(node.start);
|
|
21001
|
+
const last2 = lineAt(node.end - 1);
|
|
20671
21002
|
for (let line = first; line <= last2; line++) lines.add(line);
|
|
20672
21003
|
} else if (body) {
|
|
20673
21004
|
visit(body.children);
|
|
@@ -20794,11 +21125,12 @@ function indentColumn(line) {
|
|
|
20794
21125
|
else break;
|
|
20795
21126
|
return col;
|
|
20796
21127
|
}
|
|
20797
|
-
function wrapLines(lines, maxLen, literalLines) {
|
|
21128
|
+
function wrapLines(lines, maxLen, literalLines, isBlock) {
|
|
20798
21129
|
const result2 = [];
|
|
20799
|
-
const
|
|
21130
|
+
const verbatim = verbatimLines(lines);
|
|
21131
|
+
const structured = markdownLines(lines.join("\n"), isBlock, NO_WRAP);
|
|
20800
21132
|
for (const [index, line] of lines.entries()) {
|
|
20801
|
-
if (line.length <= maxLen ||
|
|
21133
|
+
if (line.length <= maxLen || verbatim.has(index) || structured.has(index) || literalLines.has(line.trim())) {
|
|
20802
21134
|
result2.push(line);
|
|
20803
21135
|
continue;
|
|
20804
21136
|
}
|
|
@@ -20808,17 +21140,29 @@ function wrapLines(lines, maxLen, literalLines) {
|
|
|
20808
21140
|
continue;
|
|
20809
21141
|
}
|
|
20810
21142
|
const wrapped = wordWrap(trimmed2, maxLen, line.match(/^(\s*)/)?.[1] ?? "");
|
|
21143
|
+
if (wrapped.length > 1 && markdownLines(wrapped.join("\n"), isBlock, NO_WRAP).size) {
|
|
21144
|
+
result2.push(line);
|
|
21145
|
+
continue;
|
|
21146
|
+
}
|
|
20811
21147
|
if (line.endsWith(" ")) wrapped[wrapped.length - 1] += " ";
|
|
20812
21148
|
result2.push(...wrapped);
|
|
20813
21149
|
}
|
|
20814
21150
|
return result2;
|
|
20815
21151
|
}
|
|
20816
|
-
function
|
|
21152
|
+
function verbatimLines(lines) {
|
|
20817
21153
|
const found = /* @__PURE__ */ new Set();
|
|
20818
21154
|
const text3 = lines.join("\n");
|
|
20819
|
-
|
|
20820
|
-
|
|
20821
|
-
|
|
21155
|
+
const lineAt = sourceLines(text3);
|
|
21156
|
+
const { doBlocks, tags } = scanSpindleMarkup(text3);
|
|
21157
|
+
for (const block of doBlocks) {
|
|
21158
|
+
const first = lineAt(block.bodyStart);
|
|
21159
|
+
const last2 = lineAt(block.bodyEnd);
|
|
21160
|
+
for (let i2 = first; i2 <= last2; i2++) found.add(i2);
|
|
21161
|
+
}
|
|
21162
|
+
for (const tag of tags) {
|
|
21163
|
+
const first = lineAt(tag.start);
|
|
21164
|
+
const last2 = lineAt(tag.end - 1);
|
|
21165
|
+
if (first === last2) continue;
|
|
20822
21166
|
for (let i2 = first; i2 <= last2; i2++) found.add(i2);
|
|
20823
21167
|
}
|
|
20824
21168
|
return found;
|
|
@@ -20827,7 +21171,7 @@ function wordWrap(text3, maxLen, indent) {
|
|
|
20827
21171
|
const lines = [];
|
|
20828
21172
|
const inToken = new Array(text3.length).fill(false);
|
|
20829
21173
|
for (const token of tokenizeMarkupTolerant(text3).tokens) {
|
|
20830
|
-
if (token.type === "text"
|
|
21174
|
+
if (token.type === "text") continue;
|
|
20831
21175
|
inToken.fill(true, token.start, token.end);
|
|
20832
21176
|
}
|
|
20833
21177
|
const room = maxLen - indentColumn(indent);
|
|
@@ -20859,8 +21203,8 @@ function validateStoryMarkup(passages, macros, options = {}) {
|
|
|
20859
21203
|
const list3 = [...passages];
|
|
20860
21204
|
const all = [...macros];
|
|
20861
21205
|
const known = /* @__PURE__ */ new Set();
|
|
20862
|
-
const widgets = widgetDefinitions$1(list3, parameterLookup(all));
|
|
20863
|
-
const blocks = new Set(
|
|
21206
|
+
const widgets = effectiveWidgetDefinitions(widgetDefinitions$1(list3, parameterLookup(all)));
|
|
21207
|
+
const blocks = new Set(widgets.filter((def) => def.block).map((def) => def.name.toLowerCase()));
|
|
20864
21208
|
const parametersOf2 = parameterLookup([...all, ...definedWidgetMacros(widgets)]);
|
|
20865
21209
|
for (const macro of all) {
|
|
20866
21210
|
const name = macro.name.toLowerCase();
|
|
@@ -20900,7 +21244,7 @@ function widgetDefinitions(passages, macros = []) {
|
|
|
20900
21244
|
}
|
|
20901
21245
|
function referenceOptions(macros, all = false, passages = []) {
|
|
20902
21246
|
const list3 = [...macros];
|
|
20903
|
-
const widgets = widgetDefinitions$1(passages, parameterLookup(list3));
|
|
21247
|
+
const widgets = effectiveWidgetDefinitions(widgetDefinitions$1(passages, parameterLookup(list3)));
|
|
20904
21248
|
return {
|
|
20905
21249
|
all,
|
|
20906
21250
|
storeVarMacros: new Set(list3.filter((m) => m.storeVar).map((m) => m.name.toLowerCase())),
|
|
@@ -20915,7 +21259,7 @@ function validateVariableReferences(passages, declarations, macros = []) {
|
|
|
20915
21259
|
const list3 = [...passages];
|
|
20916
21260
|
return checkVariableReferences(list3.filter((p) => !p.tags?.some((t) => NOT_MARKUP_TAGS.includes(t))), declarations, referenceOptions(macros, false, list3));
|
|
20917
21261
|
}
|
|
20918
|
-
var __defProp2, __exportAll, NameMap, NameSet, PARAMETER_TYPES, STRING_HOLDS, metadataRegistry, companionParents, SIGIL_SCOPES, SIGIL_CHARS, grammar_shared_default, LB, RB, SIGIL_SCOPES$1, withSelectors, VOID_TAGS, BRANCH_PARENT$1, LINK_SEPARATORS, NO_SELECTORS, EMAIL_AUTOLINK, peg$SyntaxError, BLOCK_MACROS, BLOCK_WIDGETS, DEFINED_BLOCK_MACROS, RAW_BODY_MACROS, BRANCHING, quoteArg, last$1, BRANCH_PARENT, lowerName, nameOf, closerOf, closes, astralIdentifierCodes, astralIdentifierStartCodes, nonASCIIidentifierChars, nonASCIIidentifierStartChars, reservedWords, ecma5AndLessKeywords, keywords$1, keywordRelationalOperator, nonASCIIidentifierStart, nonASCIIidentifier, TokenType, beforeExpr, startsExpr, keywords, types$1, lineBreak, lineBreakG, nonASCIIwhitespace, skipWhiteSpace, ref, hasOwnProperty$1, toString, hasOwn$1, isArray, regexpCache, loneSurrogate, Position, SourceLocation, defaultOptions, warnedAboutEcmaVersion, SCOPE_TOP, SCOPE_FUNCTION, SCOPE_ASYNC, SCOPE_GENERATOR, SCOPE_ARROW, SCOPE_SIMPLE_CATCH, SCOPE_SUPER, SCOPE_DIRECT_SUPER, SCOPE_CLASS_STATIC_BLOCK, SCOPE_CLASS_FIELD_INIT, SCOPE_SWITCH, SCOPE_VAR, BIND_NONE, BIND_VAR, BIND_LEXICAL, BIND_FUNCTION, BIND_SIMPLE_CATCH, BIND_OUTSIDE, Parser, prototypeAccessors, pp$9, literal, DestructuringErrors, pp$8, loopLabel, switchLabel, empty$1, FUNC_STATEMENT, FUNC_HANGING_STATEMENT, FUNC_NULLABLE_ID, pp$7, TokContext, types, pp$6, pp$5, empty, pp$4, pp$3, Scope, Node, pp$2, scriptValuesAddedInUnicode, ecma9BinaryProperties, ecma10BinaryProperties, ecma11BinaryProperties, ecma12BinaryProperties, ecma13BinaryProperties, unicodeBinaryProperties, unicodeBinaryPropertiesOfStrings, unicodeGeneralCategoryValues, ecma9ScriptValues, ecma10ScriptValues, ecma11ScriptValues, ecma12ScriptValues, ecma13ScriptValues, unicodeScriptValues, data, ecmaVersion, i, list$2, pp$1, BranchID, RegExpValidationState, CharSetNone, CharSetOk, CharSetString, Token, pp, INVALID_TEMPLATE_ESCAPE_ERROR, OPTIONS, AT_NAME_RE, TRANS_NAME_RE, SIGIL_IDENT_RE, LINE_BREAK_RE, NOT_A_BODY_RE, OPERAND_ENDS, SigilParser, OPENERS, CLOSERS$1, CodeSyntaxError, last, CLOSER, isNode, NAMESPACE_NAME, WORD_RE$2, FLAGS_RE, WORDS_BEFORE_STRING, NON_STRING_QUOTE_PREFIX, memoInput, memo, defaultCodeEnd, defaultHooks, MarkupError, OFFSET_FIELD, listeners, TRAILING_OPERATOR_RE, slice, MacroArgumentError, WORD_RE$1, NUMBER_RE$1, WORD_OR_PUNCT_RE, LEADING_OPERATOR_RE, takesRest, SUB_MACRO_PARAMETERS, RESERVED_NAME, isArrayIndex, hasOwn, createNamespace, parses, CONDITION_MACROS, PASSAGE_BODIES, holdsByDefault, JS_ESCAPE_RE, textPiece, registeredParameters, WIDGET_PARAMETERS, NOT_MARKUP, NOT_MARKUP_TAGS$1, BRANCH_MACROS, didYouMean, PASSAGE_ARGUMENT_HINT, BARE_WORD_RE, NUMBER_RE, IDENT_RE, KEY_RE, ARROW_RE, LINE_END_RE, ARRAY_INDEX_RE, UNSUPPORTED_UNDEFINED, Reader, VAR_PATH_RE, QUOTED_VAR_ARG_RE, VALID_VAR_TYPES, PRIMITIVE_SAMPLES, UNSUPPORTED_TYPE, NO_STORE_VAR_MACROS, FIELD_PATH_RE, CLOSERS, BLOCK_WORDS, NOT_PARAMETERS, DECLARATIONS, WRITE_RE, MUTATORS, MUTATING_CALL_RE, BEFORE_BINDING, isWordChar, Bindings, CALL_RE, IDENTIFIER_ARGUMENT_RE, WORD_RE, MODIFIER_RE, KEY_START_RE, CONFIG_KEYS, ConfigReader, stringOf, booleanOf, textOf, stringsOf, VOID_ELEMENTS, characterEntities, own, hasOwnProperty, asciiAlpha, asciiAlphanumeric, asciiAtext, asciiDigit, asciiHexDigit, asciiPunctuation, unicodePunctuation, unicodeWhitespace, content$1, EditMap$1, document$1, containerConstruct, attention, autolink, blankLine, blockQuote, characterEscape, characterReference, nonLazyContinuation, codeFenced, codeIndented, furtherStart, codeText, SpliceBuffer, content, continuationConstruct, definition, titleBefore, hardBreakEscape, headingAtx, htmlBlockNames, htmlRawNames, htmlFlow, blankLineBefore, nonLazyContinuationStart, htmlText, labelEnd, resourceConstruct, referenceFullConstruct, referenceCollapsedConstruct, labelStartImage, labelStartLink, lineEnding, thematicBreak, list, listItemPrefixWhitespaceConstruct, indentConstruct, setextUnderline, flow$1, resolver, string$1, text$1, constructs_exports, document, contentInitial, flowInitial, flow, string, text, insideSpan, attentionMarkers, disable, search, alignment, EditMap, DEFAULT_PRETTIER_OPTIONS, SVG_PLACEHOLDERS, SPINDLE_PLACEHOLDERS, DEFAULT_DEDENTING, WHITESPACE_AS_WRITTEN, LIST_ITEM_REGEX, CODE_FENCE_REGEX, NOT_MARKUP_TAGS;
|
|
21262
|
+
var __defProp2, __exportAll, NameMap, NameSet, PARAMETER_TYPES, STRING_HOLDS, metadataRegistry, companionParents, SIGIL_SCOPES, SIGIL_CHARS, grammar_shared_default, LB, RB, SIGIL_SCOPES$1, withSelectors, VOID_TAGS, BRANCH_PARENT$1, LINK_SEPARATORS, NO_SELECTORS, EMAIL_AUTOLINK, peg$SyntaxError, BLOCK_MACROS, BLOCK_WIDGETS, DEFINED_BLOCK_MACROS, RAW_BODY_MACROS, BRANCHING, quoteArg, last$1, BRANCH_PARENT, lowerName, nameOf, closerOf, closes, astralIdentifierCodes, astralIdentifierStartCodes, nonASCIIidentifierChars, nonASCIIidentifierStartChars, reservedWords, ecma5AndLessKeywords, keywords$1, keywordRelationalOperator, nonASCIIidentifierStart, nonASCIIidentifier, TokenType, beforeExpr, startsExpr, keywords, types$1, lineBreak, lineBreakG, nonASCIIwhitespace, skipWhiteSpace, ref, hasOwnProperty$1, toString, hasOwn$1, isArray, regexpCache, loneSurrogate, Position, SourceLocation, defaultOptions, warnedAboutEcmaVersion, SCOPE_TOP, SCOPE_FUNCTION, SCOPE_ASYNC, SCOPE_GENERATOR, SCOPE_ARROW, SCOPE_SIMPLE_CATCH, SCOPE_SUPER, SCOPE_DIRECT_SUPER, SCOPE_CLASS_STATIC_BLOCK, SCOPE_CLASS_FIELD_INIT, SCOPE_SWITCH, SCOPE_VAR, BIND_NONE, BIND_VAR, BIND_LEXICAL, BIND_FUNCTION, BIND_SIMPLE_CATCH, BIND_OUTSIDE, Parser, prototypeAccessors, pp$9, literal, DestructuringErrors, pp$8, loopLabel, switchLabel, empty$1, FUNC_STATEMENT, FUNC_HANGING_STATEMENT, FUNC_NULLABLE_ID, pp$7, TokContext, types, pp$6, pp$5, empty, pp$4, pp$3, Scope, Node, pp$2, scriptValuesAddedInUnicode, ecma9BinaryProperties, ecma10BinaryProperties, ecma11BinaryProperties, ecma12BinaryProperties, ecma13BinaryProperties, unicodeBinaryProperties, unicodeBinaryPropertiesOfStrings, unicodeGeneralCategoryValues, ecma9ScriptValues, ecma10ScriptValues, ecma11ScriptValues, ecma12ScriptValues, ecma13ScriptValues, unicodeScriptValues, data, ecmaVersion, i, list$2, pp$1, BranchID, RegExpValidationState, CharSetNone, CharSetOk, CharSetString, Token, pp, INVALID_TEMPLATE_ESCAPE_ERROR, OPTIONS, AT_NAME_RE, TRANS_NAME_RE, SIGIL_IDENT_RE, LINE_BREAK_RE, NOT_A_BODY_RE, OPERAND_ENDS, SigilParser, OPENERS, CLOSERS$1, CodeSyntaxError, last, CLOSER, isNode, NAMESPACE_NAME, WORD_RE$2, FLAGS_RE, WORDS_BEFORE_STRING, NON_STRING_QUOTE_PREFIX, memoInput, memo, defaultCodeEnd, defaultHooks, MarkupError, OFFSET_FIELD, listeners, TRAILING_OPERATOR_RE, slice, MacroArgumentError, WORD_RE$1, NUMBER_RE$1, WORD_OR_PUNCT_RE, LEADING_OPERATOR_RE, takesRest, SUB_MACRO_PARAMETERS, RESERVED_NAME, isArrayIndex, hasOwn, createNamespace, parses, CONDITION_MACROS, PASSAGE_BODIES, holdsByDefault, JS_ESCAPE_RE, textPiece, registeredParameters, WIDGET_PARAMETERS, NOT_MARKUP, NOT_MARKUP_TAGS$1, BRANCH_MACROS, didYouMean, PASSAGE_ARGUMENT_HINT, BARE_WORD_RE, NUMBER_RE, IDENT_RE, KEY_RE, ARROW_RE, LINE_END_RE, ARRAY_INDEX_RE, UNSUPPORTED_UNDEFINED, Reader, VAR_PATH_RE, QUOTED_VAR_ARG_RE, VALID_VAR_TYPES, PRIMITIVE_SAMPLES, UNSUPPORTED_TYPE, NO_STORE_VAR_MACROS, FIELD_PATH_RE, CLOSERS, BLOCK_WORDS, NOT_PARAMETERS, DECLARATIONS, WRITE_RE, MUTATORS, MUTATING_CALL_RE, BEFORE_BINDING, isWordChar, Bindings, CALL_RE, IDENTIFIER_ARGUMENT_RE, WORD_RE, MODIFIER_RE, KEY_START_RE, CONFIG_KEYS, ConfigReader, stringOf, booleanOf, textOf, stringsOf, VOID_ELEMENTS, characterEntities, own, hasOwnProperty, asciiAlpha, asciiAlphanumeric, asciiAtext, asciiDigit, asciiHexDigit, asciiPunctuation, unicodePunctuation, unicodeWhitespace, content$1, EditMap$1, document$1, containerConstruct, attention, autolink, blankLine, blockQuote, characterEscape, characterReference, nonLazyContinuation, codeFenced, codeIndented, furtherStart, codeText, SpliceBuffer, content, continuationConstruct, definition, titleBefore, hardBreakEscape, headingAtx, htmlBlockNames, htmlRawNames, htmlFlow, blankLineBefore, nonLazyContinuationStart, htmlText, labelEnd, resourceConstruct, referenceFullConstruct, referenceCollapsedConstruct, labelStartImage, labelStartLink, lineEnding, thematicBreak, list, listItemPrefixWhitespaceConstruct, indentConstruct, setextUnderline, flow$1, resolver, string$1, text$1, constructs_exports, document, contentInitial, flowInitial, flow, string, text, insideSpan, attentionMarkers, disable, search, alignment, EditMap, DEFAULT_PRETTIER_OPTIONS, SVG_PLACEHOLDERS, SPINDLE_PLACEHOLDERS, PLACEHOLDER_PATTERN, DEFAULT_DEDENTING, WHITESPACE_AS_WRITTEN, LIST_ITEM_REGEX, CODE_FENCE_REGEX, NO_WRAP, NOT_MARKUP_TAGS;
|
|
20919
21263
|
var init_story_variables = __esm({
|
|
20920
21264
|
"node_modules/@rohal12/spindle/dist/pkg/story-variables.js"() {
|
|
20921
21265
|
__defProp2 = Object.defineProperty;
|
|
@@ -26268,6 +26612,7 @@ var init_story_variables = __esm({
|
|
|
26268
26612
|
braceIsBlock(prevType) {
|
|
26269
26613
|
if (prevType === types$1.colon && this.colonEndsTernary) return false;
|
|
26270
26614
|
if (prevType === types$1.braceR && this.closedBlock) return true;
|
|
26615
|
+
if (prevType === types$1._do) return true;
|
|
26271
26616
|
if (prevType === types$1.name && this.prevValue === "static") return true;
|
|
26272
26617
|
if (this.breakHere && OPERAND_ENDS.has(prevType)) {
|
|
26273
26618
|
const { context } = this;
|
|
@@ -26369,7 +26714,7 @@ var init_story_variables = __esm({
|
|
|
26369
26714
|
WORD_RE$1 = /\w+/y;
|
|
26370
26715
|
NUMBER_RE$1 = /[-+]?(?:\d+\.?\d*|\.\d+)/y;
|
|
26371
26716
|
WORD_OR_PUNCT_RE = /\S+/y;
|
|
26372
|
-
LEADING_OPERATOR_RE = /^(?:[
|
|
26717
|
+
LEADING_OPERATOR_RE = /^(?:[-+*/&|^=<>?:,]|\.(?!\d)|%(?![A-Za-z_]))/;
|
|
26373
26718
|
takesRest = (param) => param.type === "expression" || param.type === "statements" || param.type === "passage" || param.type === "text";
|
|
26374
26719
|
SUB_MACRO_PARAMETERS = /* @__PURE__ */ new Map([["option", [{
|
|
26375
26720
|
name: "value",
|
|
@@ -30156,6 +30501,7 @@ var init_story_variables = __esm({
|
|
|
30156
30501
|
DEFAULT_PRETTIER_OPTIONS = { tabWidth: 2 };
|
|
30157
30502
|
SVG_PLACEHOLDERS = (i2) => [`<!--SVG:${i2}-->`];
|
|
30158
30503
|
SPINDLE_PLACEHOLDERS = (i2) => [`<!--SP:${i2}-->`, `__SP${i2}__`];
|
|
30504
|
+
PLACEHOLDER_PATTERN = /<!--(?:SP|SVG):\d+-->|__SP\d+__/g;
|
|
30159
30505
|
DEFAULT_DEDENTING = /* @__PURE__ */ new Set([
|
|
30160
30506
|
"else",
|
|
30161
30507
|
"elseif",
|
|
@@ -30166,6 +30512,21 @@ var init_story_variables = __esm({
|
|
|
30166
30512
|
WHITESPACE_AS_WRITTEN = /<(?:pre|textarea)[\s>]|white-space\s*:/i;
|
|
30167
30513
|
LIST_ITEM_REGEX = /^(?:[-+*]|\d{1,9}[.)])(?:[ \t]|$)/;
|
|
30168
30514
|
CODE_FENCE_REGEX = /^(?:`{3,}|~{3,})/;
|
|
30515
|
+
NO_WRAP = /* @__PURE__ */ new Set([
|
|
30516
|
+
"atxHeading",
|
|
30517
|
+
"setextHeading",
|
|
30518
|
+
"table",
|
|
30519
|
+
"listOrdered",
|
|
30520
|
+
"listUnordered",
|
|
30521
|
+
"blockQuote",
|
|
30522
|
+
"definition",
|
|
30523
|
+
"thematicBreak",
|
|
30524
|
+
"htmlFlow",
|
|
30525
|
+
"codeText",
|
|
30526
|
+
"codeFenced",
|
|
30527
|
+
"link",
|
|
30528
|
+
"image"
|
|
30529
|
+
]);
|
|
30169
30530
|
NOT_MARKUP_TAGS = ["script", "stylesheet"];
|
|
30170
30531
|
}
|
|
30171
30532
|
});
|
|
@@ -31284,6 +31645,10 @@ var init_macro_registry2 = __esm({
|
|
|
31284
31645
|
getMacro(name) {
|
|
31285
31646
|
return this.resolve(name.toLowerCase());
|
|
31286
31647
|
}
|
|
31648
|
+
/** A project's explicit schema takes precedence over runtime signature metadata. */
|
|
31649
|
+
hasConfiguredParameters(name) {
|
|
31650
|
+
return this.configEntries.get(name.toLowerCase())?.parameters !== void 0;
|
|
31651
|
+
}
|
|
31287
31652
|
/** Check if a macro is a block (container) macro. */
|
|
31288
31653
|
isBlock(name) {
|
|
31289
31654
|
return this.getMacro(name)?.block ?? false;
|
|
@@ -31568,7 +31933,7 @@ function usagesOf(byUri, name) {
|
|
|
31568
31933
|
}
|
|
31569
31934
|
return results;
|
|
31570
31935
|
}
|
|
31571
|
-
var
|
|
31936
|
+
var BUILTIN_CONTEXT, ARRAY_MEMBERS, DeclarationSet, VariableTracker;
|
|
31572
31937
|
var init_variable_tracker = __esm({
|
|
31573
31938
|
"src/core/workspace/variable-tracker.ts"() {
|
|
31574
31939
|
"use strict";
|
|
@@ -31578,7 +31943,6 @@ var init_variable_tracker = __esm({
|
|
|
31578
31943
|
init_text();
|
|
31579
31944
|
init_passage_index();
|
|
31580
31945
|
init_declaration_check();
|
|
31581
|
-
STORY_SCRIPT_PASSAGE = "StoryScript";
|
|
31582
31946
|
BUILTIN_CONTEXT = { macros: builtinMacros, isBlock: isBlockMacro };
|
|
31583
31947
|
ARRAY_MEMBERS = /* @__PURE__ */ new Set([
|
|
31584
31948
|
...Object.getOwnPropertyNames(Array.prototype),
|
|
@@ -31682,7 +32046,6 @@ var init_variable_tracker = __esm({
|
|
|
31682
32046
|
const usages = [];
|
|
31683
32047
|
const transientUsages = [];
|
|
31684
32048
|
for (const passage of markup.passages) {
|
|
31685
|
-
if (passage.passage.name === STORY_SCRIPT_PASSAGE) continue;
|
|
31686
32049
|
for (const ref2 of collectVariableReferences2(passage)) {
|
|
31687
32050
|
const usage = {
|
|
31688
32051
|
uri,
|
|
@@ -31816,6 +32179,25 @@ var init_tokens = __esm({
|
|
|
31816
32179
|
}
|
|
31817
32180
|
});
|
|
31818
32181
|
|
|
32182
|
+
// src/core/markup/widgets.ts
|
|
32183
|
+
function widgetSources(passages, macros) {
|
|
32184
|
+
const sources = /* @__PURE__ */ new Map();
|
|
32185
|
+
for (const passage of passages) {
|
|
32186
|
+
if (!passage.isMarkup) continue;
|
|
32187
|
+
const { name, tags } = passage.passage;
|
|
32188
|
+
for (const definition2 of widgetDefinitions([{ name, tags, content: passage.content }], macros)) {
|
|
32189
|
+
sources.set(definition2, passage);
|
|
32190
|
+
}
|
|
32191
|
+
}
|
|
32192
|
+
return sources;
|
|
32193
|
+
}
|
|
32194
|
+
var init_widgets = __esm({
|
|
32195
|
+
"src/core/markup/widgets.ts"() {
|
|
32196
|
+
"use strict";
|
|
32197
|
+
init_tooling();
|
|
32198
|
+
}
|
|
32199
|
+
});
|
|
32200
|
+
|
|
31819
32201
|
// src/core/workspace/widget-registry.ts
|
|
31820
32202
|
var WidgetRegistry;
|
|
31821
32203
|
var init_widget_registry = __esm({
|
|
@@ -31823,40 +32205,45 @@ var init_widget_registry = __esm({
|
|
|
31823
32205
|
"use strict";
|
|
31824
32206
|
init_tooling();
|
|
31825
32207
|
init_tokens();
|
|
32208
|
+
init_widgets();
|
|
31826
32209
|
WidgetRegistry = class {
|
|
31827
32210
|
/** Widgets keyed by lower-cased name; Spindle resolves widgets case-insensitively. */
|
|
31828
32211
|
widgets = /* @__PURE__ */ new Map();
|
|
32212
|
+
/** Half-typed declarations remain discoverable in the editor, without replacing effective widgets. */
|
|
32213
|
+
incomplete = /* @__PURE__ */ new Map();
|
|
31829
32214
|
/** Per-URI set of lower-cased macro names opened in that document. */
|
|
31830
32215
|
invokedByUri = /* @__PURE__ */ new Map();
|
|
31831
32216
|
/**
|
|
31832
32217
|
* Read the widget definitions of `passages` (all of them, in workspace
|
|
31833
|
-
* order
|
|
31834
|
-
*
|
|
32218
|
+
* order). Public tooling selects the closed definitions in runtime phase
|
|
32219
|
+
* order, preserving their identities so the original source is retained.
|
|
31835
32220
|
*/
|
|
31836
32221
|
scan(passages, macros) {
|
|
31837
32222
|
this.widgets.clear();
|
|
31838
|
-
|
|
31839
|
-
|
|
31840
|
-
|
|
31841
|
-
|
|
31842
|
-
|
|
31843
|
-
|
|
31844
|
-
|
|
31845
|
-
|
|
31846
|
-
|
|
31847
|
-
|
|
31848
|
-
|
|
31849
|
-
|
|
31850
|
-
|
|
31851
|
-
|
|
31852
|
-
|
|
32223
|
+
this.incomplete.clear();
|
|
32224
|
+
const sources = widgetSources(passages, [...macros]);
|
|
32225
|
+
const effective = new Set(effectiveWidgetDefinitions([...sources.keys()]));
|
|
32226
|
+
for (const [definition2, markup] of sources) {
|
|
32227
|
+
const widget = {
|
|
32228
|
+
tooling: definition2,
|
|
32229
|
+
name: definition2.name,
|
|
32230
|
+
params: definition2.params,
|
|
32231
|
+
uri: markup.passage.uri,
|
|
32232
|
+
range: markup.range(definition2.start, definition2.end),
|
|
32233
|
+
nameRange: markup.range(definition2.nameStart, definition2.nameEnd),
|
|
32234
|
+
block: definition2.block
|
|
32235
|
+
};
|
|
32236
|
+
const key = definition2.name.toLowerCase();
|
|
32237
|
+
if (effective.has(definition2)) this.widgets.set(key, widget);
|
|
32238
|
+
else if (definition2.closeStart === void 0) this.incomplete.set(key, widget);
|
|
31853
32239
|
}
|
|
31854
32240
|
}
|
|
31855
|
-
/**
|
|
32241
|
+
/** The effective definition, or an incomplete declaration while its first definition is being typed. */
|
|
31856
32242
|
getWidget(name) {
|
|
31857
|
-
|
|
32243
|
+
const key = name.toLowerCase();
|
|
32244
|
+
return this.widgets.get(key) ?? this.incomplete.get(key);
|
|
31858
32245
|
}
|
|
31859
|
-
/** Get
|
|
32246
|
+
/** Get the effective registered definitions, excluding incomplete editor declarations. */
|
|
31860
32247
|
getAllWidgets() {
|
|
31861
32248
|
return Array.from(this.widgets.values());
|
|
31862
32249
|
}
|
|
@@ -31937,7 +32324,7 @@ var init_markup_index = __esm({
|
|
|
31937
32324
|
|
|
31938
32325
|
// src/core/workspace/spindle-version.ts
|
|
31939
32326
|
import { existsSync as existsSync3, readFileSync as readFileSync5 } from "node:fs";
|
|
31940
|
-
import { dirname as dirname2, join as join3, resolve as
|
|
32327
|
+
import { dirname as dirname2, join as join3, resolve as resolve4 } from "node:path";
|
|
31941
32328
|
import { fileURLToPath } from "node:url";
|
|
31942
32329
|
function parseSpindleVersion(text3) {
|
|
31943
32330
|
const m = /^\s*v?(\d+)\.(\d+)\.(\d+)(?:[-+].*)?\s*$/.exec(text3);
|
|
@@ -31993,7 +32380,7 @@ function readSpindlePackageVersion(file2) {
|
|
|
31993
32380
|
});
|
|
31994
32381
|
}
|
|
31995
32382
|
function findUp(startDir, visit) {
|
|
31996
|
-
let dir =
|
|
32383
|
+
let dir = resolve4(startDir);
|
|
31997
32384
|
for (; ; ) {
|
|
31998
32385
|
const found = visit(dir);
|
|
31999
32386
|
if (found) return found.version;
|
|
@@ -32270,11 +32657,7 @@ var init_macro_supplements = __esm({
|
|
|
32270
32657
|
},
|
|
32271
32658
|
computed: {
|
|
32272
32659
|
name: "computed",
|
|
32273
|
-
description: "
|
|
32274
|
-
parameters: ["...text"],
|
|
32275
|
-
parameterDocs: [
|
|
32276
|
-
{ name: "expression", documentation: "Expression whose result is output." }
|
|
32277
|
-
]
|
|
32660
|
+
description: "Assigns an expression's value to a variable and recomputes it when its dependencies change. The target must be a story ($), temporary (_) or local (@) variable. This macro produces no output; display the variable to show its value.\n\nUsage: `{computed _total = 1 + 2}Value: {_total}`"
|
|
32278
32661
|
},
|
|
32279
32662
|
print: {
|
|
32280
32663
|
name: "print",
|
|
@@ -32287,7 +32670,7 @@ var init_macro_supplements = __esm({
|
|
|
32287
32670
|
do: {
|
|
32288
32671
|
name: "do",
|
|
32289
32672
|
container: true,
|
|
32290
|
-
description: "
|
|
32673
|
+
description: "Executes JavaScript statements in its body. The body is code and produces no markup output.\n\nUsage:\n\n```\n{do}\n _total = 1 + 2;\n{/do}\nValue: {_total}\n```",
|
|
32291
32674
|
parameters: []
|
|
32292
32675
|
},
|
|
32293
32676
|
link: {
|
|
@@ -32427,7 +32810,7 @@ var init_macro_supplements = __esm({
|
|
|
32427
32810
|
},
|
|
32428
32811
|
passage: {
|
|
32429
32812
|
name: "passage",
|
|
32430
|
-
description: "
|
|
32813
|
+
description: "Renders the current passage's contents in a layout. Put this slot in StoryInterface; placing it in the current passage itself recursively renders that passage. To display the passage's name, use `{print currentPassage().name}`.\n\nUsage in StoryInterface: `<main>{passage}</main>`",
|
|
32431
32814
|
parameters: []
|
|
32432
32815
|
},
|
|
32433
32816
|
textbox: {
|
|
@@ -33891,16 +34274,15 @@ function buildReport(documents, workspace) {
|
|
|
33891
34274
|
if (list3) list3.push(diagnostic);
|
|
33892
34275
|
else markup.set(passage, [diagnostic]);
|
|
33893
34276
|
}
|
|
33894
|
-
const
|
|
33895
|
-
const widgetList = [];
|
|
34277
|
+
const sources = widgetSources(passages, macros);
|
|
34278
|
+
const widgetList = [...sources].map(([definition2, passage]) => ({ definition: definition2, passage }));
|
|
34279
|
+
const widgets = new Map(effectiveWidgetDefinitions([...sources.keys()]).map((definition2) => [
|
|
34280
|
+
definition2.name.toLowerCase(),
|
|
34281
|
+
{ definition: definition2, passage: sources.get(definition2) }
|
|
34282
|
+
]));
|
|
33896
34283
|
const invoked = /* @__PURE__ */ new Set();
|
|
33897
34284
|
for (const passage of passages) {
|
|
33898
34285
|
if (!passage.isMarkup) continue;
|
|
33899
|
-
for (const definition2 of widgetDefinitions([{ name: passage.passage.name, content: passage.content, tags: passage.passage.tags }], macros)) {
|
|
33900
|
-
const widget = { definition: definition2, passage };
|
|
33901
|
-
widgets.set(definition2.name.toLowerCase(), widget);
|
|
33902
|
-
widgetList.push(widget);
|
|
33903
|
-
}
|
|
33904
34286
|
for (const token of macroTokens(passage)) {
|
|
33905
34287
|
if (!token.isClose) invoked.add(token.name.toLowerCase());
|
|
33906
34288
|
}
|
|
@@ -34075,6 +34457,7 @@ function parentDiagnostics(passage, token, ancestors, workspace) {
|
|
|
34075
34457
|
const name = token.name.toLowerCase();
|
|
34076
34458
|
const parents = workspace.macros.getMacro(name)?.parents;
|
|
34077
34459
|
if (!parents || parents.length === 0 || BRANCH_MACROS2.has(name)) return [];
|
|
34460
|
+
if (workspace.macros.getAllMacros().some((macro) => macro.source === "user" && macro.name.toLowerCase() !== "listbox" && macro.subMacros.some((sub) => sub.toLowerCase() === name))) return [];
|
|
34078
34461
|
const allowed = new Set(parents.map((parent) => parent.toLowerCase()));
|
|
34079
34462
|
const parentList = parents.join(", ");
|
|
34080
34463
|
const range2 = passage.range(token.start, token.end);
|
|
@@ -34213,14 +34596,12 @@ function isReadInBody(passage, bodyStart, bodyEnd, name, macroStart, macroEnd) {
|
|
|
34213
34596
|
}
|
|
34214
34597
|
for (const piece of passage.pieces) {
|
|
34215
34598
|
if (piece.kind !== "code") continue;
|
|
34216
|
-
|
|
34217
|
-
|
|
34218
|
-
|
|
34219
|
-
|
|
34220
|
-
|
|
34221
|
-
|
|
34222
|
-
}, piece.goal);
|
|
34223
|
-
if (read) return true;
|
|
34599
|
+
try {
|
|
34600
|
+
if (parseCode(piece.code, piece.goal).refs.some(
|
|
34601
|
+
(ref2) => ref2.sigil === "_" && ref2.name === name && ref2.read && eligible(pieceOffset(piece, ref2.start))
|
|
34602
|
+
)) return true;
|
|
34603
|
+
} catch {
|
|
34604
|
+
}
|
|
34224
34605
|
}
|
|
34225
34606
|
return false;
|
|
34226
34607
|
}
|
|
@@ -34390,6 +34771,7 @@ var init_diagnostics = __esm({
|
|
|
34390
34771
|
init_diagnostic_codes();
|
|
34391
34772
|
init_tokens();
|
|
34392
34773
|
init_source_view();
|
|
34774
|
+
init_widgets();
|
|
34393
34775
|
init_argument_lexer();
|
|
34394
34776
|
init_parameter_validator();
|
|
34395
34777
|
init_link_parser();
|
|
@@ -34631,7 +35013,7 @@ var check_exports = {};
|
|
|
34631
35013
|
__export(check_exports, {
|
|
34632
35014
|
runCheck: () => runCheck
|
|
34633
35015
|
});
|
|
34634
|
-
import { resolve as
|
|
35016
|
+
import { resolve as resolve5 } from "node:path";
|
|
34635
35017
|
import { pathToFileURL as pathToFileURL3 } from "node:url";
|
|
34636
35018
|
function parseArgs(args2) {
|
|
34637
35019
|
const options = {
|
|
@@ -34707,7 +35089,7 @@ async function runCheck(args2) {
|
|
|
34707
35089
|
let explicitConfig = null;
|
|
34708
35090
|
if (options.configPath) {
|
|
34709
35091
|
try {
|
|
34710
|
-
explicitConfig = loadConfigFile(
|
|
35092
|
+
explicitConfig = loadConfigFile(resolve5(cwd, options.configPath));
|
|
34711
35093
|
} catch (err) {
|
|
34712
35094
|
console.error(`spindle-lsp check: ${err instanceof Error ? err.message : String(err)}`);
|
|
34713
35095
|
return 2;
|
|
@@ -35964,7 +36346,7 @@ var init_escape = __esm({
|
|
|
35964
36346
|
});
|
|
35965
36347
|
|
|
35966
36348
|
// node_modules/minimatch/dist/esm/index.js
|
|
35967
|
-
var minimatch, starDotExtRE, starDotExtTest, starDotExtTestDot, starDotExtTestNocase, starDotExtTestNocaseDot, starDotStarRE, starDotStarTest, starDotStarTestDot, dotStarRE, dotStarTest, starRE, starTest, starTestDot, qmarksRE, qmarksTestNocase, qmarksTestNocaseDot, qmarksTestDot, qmarksTest, qmarksTestNoExt, qmarksTestNoExtDot, defaultPlatform, path,
|
|
36349
|
+
var minimatch, starDotExtRE, starDotExtTest, starDotExtTestDot, starDotExtTestNocase, starDotExtTestNocaseDot, starDotStarRE, starDotStarTest, starDotStarTestDot, dotStarRE, dotStarTest, starRE, starTest, starTestDot, qmarksRE, qmarksTestNocase, qmarksTestNocaseDot, qmarksTestDot, qmarksTest, qmarksTestNoExt, qmarksTestNoExtDot, defaultPlatform, path, sep3, GLOBSTAR, qmark2, star2, twoStarDot, twoStarNoDot, filter, ext, defaults, braceExpand, makeRe, match, globMagic, regExpEscape2, Minimatch;
|
|
35968
36350
|
var init_esm3 = __esm({
|
|
35969
36351
|
"node_modules/minimatch/dist/esm/index.js"() {
|
|
35970
36352
|
init_esm2();
|
|
@@ -36037,8 +36419,8 @@ var init_esm3 = __esm({
|
|
|
36037
36419
|
win32: { sep: "\\" },
|
|
36038
36420
|
posix: { sep: "/" }
|
|
36039
36421
|
};
|
|
36040
|
-
|
|
36041
|
-
minimatch.sep =
|
|
36422
|
+
sep3 = defaultPlatform === "win32" ? path.win32.sep : path.posix.sep;
|
|
36423
|
+
minimatch.sep = sep3;
|
|
36042
36424
|
GLOBSTAR = /* @__PURE__ */ Symbol("globstar **");
|
|
36043
36425
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
36044
36426
|
qmark2 = "[^/]";
|
|
@@ -36787,7 +37169,7 @@ var init_esm3 = __esm({
|
|
|
36787
37169
|
|
|
36788
37170
|
// src/plugins/format/prettier-bridge.ts
|
|
36789
37171
|
import { readFile } from "node:fs/promises";
|
|
36790
|
-
import { basename, dirname as dirname3, extname, relative as relative3, resolve as
|
|
37172
|
+
import { basename, dirname as dirname3, extname, relative as relative3, resolve as resolve6 } from "node:path";
|
|
36791
37173
|
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
36792
37174
|
async function loadPrettier(filePath) {
|
|
36793
37175
|
prettier ??= import("prettier").catch(() => null);
|
|
@@ -36796,7 +37178,7 @@ async function loadPrettier(filePath) {
|
|
|
36796
37178
|
let resolved = null;
|
|
36797
37179
|
try {
|
|
36798
37180
|
const path2 = filePath?.startsWith("file:") ? fileURLToPath3(filePath) : filePath;
|
|
36799
|
-
const target = path2 ??
|
|
37181
|
+
const target = path2 ?? resolve6(process.cwd(), "story.tw");
|
|
36800
37182
|
resolved = process.env.SPINDLE_LSP_TRUSTED_FORMAT === "1" ? await p.resolveConfig(target, { useCache: false }) : await loadDataConfig(p, target);
|
|
36801
37183
|
} catch {
|
|
36802
37184
|
}
|
|
@@ -36811,7 +37193,7 @@ async function loadDataConfig(p, target) {
|
|
|
36811
37193
|
if (!config2 || typeof config2 !== "object" || Array.isArray(config2)) return null;
|
|
36812
37194
|
const { overrides, ...base } = config2;
|
|
36813
37195
|
let options = base;
|
|
36814
|
-
const file2 = relative3(dirname3(configFile),
|
|
37196
|
+
const file2 = relative3(dirname3(configFile), resolve6(target)).replaceAll("\\", "/");
|
|
36815
37197
|
for (const override of Array.isArray(overrides) ? overrides : []) {
|
|
36816
37198
|
if (matchesPatterns(file2, override.files, override.excludeFiles)) {
|
|
36817
37199
|
options = { ...options, ...override.options };
|
|
@@ -59325,7 +59707,7 @@ var init_protocol = __esm({
|
|
|
59325
59707
|
return;
|
|
59326
59708
|
}
|
|
59327
59709
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
59328
|
-
await new Promise((
|
|
59710
|
+
await new Promise((resolve8) => setTimeout(resolve8, pollInterval));
|
|
59329
59711
|
options?.signal?.throwIfAborted();
|
|
59330
59712
|
}
|
|
59331
59713
|
} catch (error48) {
|
|
@@ -59342,7 +59724,7 @@ var init_protocol = __esm({
|
|
|
59342
59724
|
*/
|
|
59343
59725
|
request(request, resultSchema, options) {
|
|
59344
59726
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
59345
|
-
return new Promise((
|
|
59727
|
+
return new Promise((resolve8, reject) => {
|
|
59346
59728
|
const earlyReject = (error48) => {
|
|
59347
59729
|
reject(error48);
|
|
59348
59730
|
};
|
|
@@ -59420,7 +59802,7 @@ var init_protocol = __esm({
|
|
|
59420
59802
|
if (!parseResult.success) {
|
|
59421
59803
|
reject(parseResult.error);
|
|
59422
59804
|
} else {
|
|
59423
|
-
|
|
59805
|
+
resolve8(parseResult.data);
|
|
59424
59806
|
}
|
|
59425
59807
|
} catch (error48) {
|
|
59426
59808
|
reject(error48);
|
|
@@ -59682,12 +60064,12 @@ var init_protocol = __esm({
|
|
|
59682
60064
|
}
|
|
59683
60065
|
} catch {
|
|
59684
60066
|
}
|
|
59685
|
-
return new Promise((
|
|
60067
|
+
return new Promise((resolve8, reject) => {
|
|
59686
60068
|
if (signal.aborted) {
|
|
59687
60069
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
59688
60070
|
return;
|
|
59689
60071
|
}
|
|
59690
|
-
const timeoutId = setTimeout(
|
|
60072
|
+
const timeoutId = setTimeout(resolve8, interval);
|
|
59691
60073
|
signal.addEventListener("abort", () => {
|
|
59692
60074
|
clearTimeout(timeoutId);
|
|
59693
60075
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -62714,7 +63096,7 @@ var require_compile = __commonJS({
|
|
|
62714
63096
|
const schOrFunc = root.refs[ref2];
|
|
62715
63097
|
if (schOrFunc)
|
|
62716
63098
|
return schOrFunc;
|
|
62717
|
-
let _sch =
|
|
63099
|
+
let _sch = resolve8.call(this, root, ref2);
|
|
62718
63100
|
if (_sch === void 0) {
|
|
62719
63101
|
const schema = (_a3 = root.localRefs) === null || _a3 === void 0 ? void 0 : _a3[ref2];
|
|
62720
63102
|
const { schemaId } = this.opts;
|
|
@@ -62741,7 +63123,7 @@ var require_compile = __commonJS({
|
|
|
62741
63123
|
function sameSchemaEnv(s1, s2) {
|
|
62742
63124
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
62743
63125
|
}
|
|
62744
|
-
function
|
|
63126
|
+
function resolve8(root, ref2) {
|
|
62745
63127
|
let sch;
|
|
62746
63128
|
while (typeof (sch = this.refs[ref2]) == "string")
|
|
62747
63129
|
ref2 = sch;
|
|
@@ -63316,7 +63698,7 @@ var require_fast_uri = __commonJS({
|
|
|
63316
63698
|
}
|
|
63317
63699
|
return uri;
|
|
63318
63700
|
}
|
|
63319
|
-
function
|
|
63701
|
+
function resolve8(baseURI, relativeURI, options) {
|
|
63320
63702
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
63321
63703
|
const resolved = resolveComponent(parse6(baseURI, schemelessOptions), parse6(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
63322
63704
|
schemelessOptions.skipEscape = true;
|
|
@@ -63543,7 +63925,7 @@ var require_fast_uri = __commonJS({
|
|
|
63543
63925
|
var fastUri = {
|
|
63544
63926
|
SCHEMES,
|
|
63545
63927
|
normalize,
|
|
63546
|
-
resolve:
|
|
63928
|
+
resolve: resolve8,
|
|
63547
63929
|
resolveComponent,
|
|
63548
63930
|
equal,
|
|
63549
63931
|
serialize,
|
|
@@ -67701,7 +68083,7 @@ var init_mcp = __esm({
|
|
|
67701
68083
|
let task = createTaskResult.task;
|
|
67702
68084
|
const pollInterval = task.pollInterval ?? 5e3;
|
|
67703
68085
|
while (task.status !== "completed" && task.status !== "failed" && task.status !== "cancelled") {
|
|
67704
|
-
await new Promise((
|
|
68086
|
+
await new Promise((resolve8) => setTimeout(resolve8, pollInterval));
|
|
67705
68087
|
const updatedTask = await extra.taskStore.getTask(taskId);
|
|
67706
68088
|
if (!updatedTask) {
|
|
67707
68089
|
throw new McpError(ErrorCode.InternalError, `Task ${taskId} not found during polling`);
|
|
@@ -68310,12 +68692,12 @@ var init_stdio2 = __esm({
|
|
|
68310
68692
|
this.onclose?.();
|
|
68311
68693
|
}
|
|
68312
68694
|
send(message) {
|
|
68313
|
-
return new Promise((
|
|
68695
|
+
return new Promise((resolve8) => {
|
|
68314
68696
|
const json2 = serializeMessage(message);
|
|
68315
68697
|
if (this._stdout.write(json2)) {
|
|
68316
|
-
|
|
68698
|
+
resolve8();
|
|
68317
68699
|
} else {
|
|
68318
|
-
this._stdout.once("drain",
|
|
68700
|
+
this._stdout.once("drain", resolve8);
|
|
68319
68701
|
}
|
|
68320
68702
|
});
|
|
68321
68703
|
}
|
|
@@ -68326,7 +68708,7 @@ var init_stdio2 = __esm({
|
|
|
68326
68708
|
// src/mcp/play/sessions.ts
|
|
68327
68709
|
import { randomBytes } from "node:crypto";
|
|
68328
68710
|
import { statSync as statSync2 } from "node:fs";
|
|
68329
|
-
import { dirname as dirname4, resolve as
|
|
68711
|
+
import { dirname as dirname4, resolve as resolve7 } from "node:path";
|
|
68330
68712
|
function missingPlayMessage() {
|
|
68331
68713
|
return `spindle_play needs @rohal12/spindle ${PLAY_SPINDLE_VERSION} or later`;
|
|
68332
68714
|
}
|
|
@@ -68416,7 +68798,7 @@ var init_sessions = __esm({
|
|
|
68416
68798
|
this.starting++;
|
|
68417
68799
|
try {
|
|
68418
68800
|
const play = await this.load();
|
|
68419
|
-
const path2 =
|
|
68801
|
+
const path2 = resolve7(process.cwd(), storyPath);
|
|
68420
68802
|
const { html, notes: storyNotes } = await play.resolveStoryHtml({ path: path2 });
|
|
68421
68803
|
const notes = [...storyNotes, ...runtimeNote(path2, play.version)];
|
|
68422
68804
|
const sessionOptions = { html, trusted: this.trustedHostCode };
|
|
@@ -70156,8 +70538,8 @@ var require_semaphore = __commonJS({
|
|
|
70156
70538
|
this._waiting = [];
|
|
70157
70539
|
}
|
|
70158
70540
|
lock(thunk) {
|
|
70159
|
-
return new Promise((
|
|
70160
|
-
this._waiting.push({ thunk, resolve:
|
|
70541
|
+
return new Promise((resolve8, reject) => {
|
|
70542
|
+
this._waiting.push({ thunk, resolve: resolve8, reject });
|
|
70161
70543
|
this.runNext();
|
|
70162
70544
|
});
|
|
70163
70545
|
}
|
|
@@ -71783,9 +72165,9 @@ ${JSON.stringify(message, null, 4)}`);
|
|
|
71783
72165
|
if (typeof cancellationStrategy.sender.enableCancellation === "function") {
|
|
71784
72166
|
cancellationStrategy.sender.enableCancellation(requestMessage);
|
|
71785
72167
|
}
|
|
71786
|
-
return new Promise(async (
|
|
72168
|
+
return new Promise(async (resolve8, reject) => {
|
|
71787
72169
|
const resolveWithCleanup = (r) => {
|
|
71788
|
-
|
|
72170
|
+
resolve8(r);
|
|
71789
72171
|
cancellationStrategy.sender.cleanup(id);
|
|
71790
72172
|
disposable?.dispose();
|
|
71791
72173
|
};
|
|
@@ -77427,8 +77809,8 @@ var require_server = __commonJS({
|
|
|
77427
77809
|
if (value instanceof Promise) {
|
|
77428
77810
|
return value;
|
|
77429
77811
|
} else if (Is3.thenable(value)) {
|
|
77430
|
-
return new Promise((
|
|
77431
|
-
value.then((resolved) =>
|
|
77812
|
+
return new Promise((resolve8, reject) => {
|
|
77813
|
+
value.then((resolved) => resolve8(resolved), (error48) => reject(error48));
|
|
77432
77814
|
});
|
|
77433
77815
|
} else {
|
|
77434
77816
|
return Promise.resolve(value);
|
|
@@ -77712,7 +78094,7 @@ var require_files = __commonJS({
|
|
|
77712
78094
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
77713
78095
|
exports.FileSystem = void 0;
|
|
77714
78096
|
exports.uriToFilePath = uriToFilePath;
|
|
77715
|
-
exports.resolve =
|
|
78097
|
+
exports.resolve = resolve8;
|
|
77716
78098
|
exports.resolveGlobalNodePath = resolveGlobalNodePath;
|
|
77717
78099
|
exports.resolveGlobalYarnPath = resolveGlobalYarnPath;
|
|
77718
78100
|
exports.resolveModulePath = resolveModulePath;
|
|
@@ -77741,7 +78123,7 @@ var require_files = __commonJS({
|
|
|
77741
78123
|
function isWindows() {
|
|
77742
78124
|
return process.platform === "win32";
|
|
77743
78125
|
}
|
|
77744
|
-
function
|
|
78126
|
+
function resolve8(moduleName, nodePath, cwd, tracer) {
|
|
77745
78127
|
const nodePathKey = "NODE_PATH";
|
|
77746
78128
|
const app = [
|
|
77747
78129
|
"var p = process;",
|
|
@@ -77760,7 +78142,7 @@ var require_files = __commonJS({
|
|
|
77760
78142
|
"}",
|
|
77761
78143
|
"});"
|
|
77762
78144
|
].join("");
|
|
77763
|
-
return new Promise((
|
|
78145
|
+
return new Promise((resolve9, reject) => {
|
|
77764
78146
|
const env = process.env;
|
|
77765
78147
|
const newEnv = /* @__PURE__ */ Object.create(null);
|
|
77766
78148
|
Object.keys(env).forEach((key) => newEnv[key] = env[key]);
|
|
@@ -77792,7 +78174,7 @@ var require_files = __commonJS({
|
|
|
77792
78174
|
if (message2.c === "r") {
|
|
77793
78175
|
cp.send({ c: "e" });
|
|
77794
78176
|
if (message2.s) {
|
|
77795
|
-
|
|
78177
|
+
resolve9(message2.r);
|
|
77796
78178
|
} else {
|
|
77797
78179
|
reject(new Error(`Failed to resolve module: ${moduleName}`));
|
|
77798
78180
|
}
|
|
@@ -77920,17 +78302,17 @@ var require_files = __commonJS({
|
|
|
77920
78302
|
if (!path2.isAbsolute(nodePath)) {
|
|
77921
78303
|
nodePath = path2.join(workspaceRoot, nodePath);
|
|
77922
78304
|
}
|
|
77923
|
-
return
|
|
78305
|
+
return resolve8(moduleName, nodePath, nodePath, tracer).then((value) => {
|
|
77924
78306
|
if (FileSystem.isParent(nodePath, value)) {
|
|
77925
78307
|
return value;
|
|
77926
78308
|
} else {
|
|
77927
78309
|
return Promise.reject(new Error(`Failed to load ${moduleName} from node path location.`));
|
|
77928
78310
|
}
|
|
77929
78311
|
}).then(void 0, (_error) => {
|
|
77930
|
-
return
|
|
78312
|
+
return resolve8(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer);
|
|
77931
78313
|
});
|
|
77932
78314
|
} else {
|
|
77933
|
-
return
|
|
78315
|
+
return resolve8(moduleName, resolveGlobalNodePath(tracer), workspaceRoot, tracer);
|
|
77934
78316
|
}
|
|
77935
78317
|
}
|
|
77936
78318
|
}
|
|
@@ -78012,10 +78394,10 @@ var require_ril = __commonJS({
|
|
|
78012
78394
|
return api_1.Disposable.create(() => this.stream.off("end", listener));
|
|
78013
78395
|
}
|
|
78014
78396
|
write(data2, encoding) {
|
|
78015
|
-
return new Promise((
|
|
78397
|
+
return new Promise((resolve8, reject) => {
|
|
78016
78398
|
const callback = (error48) => {
|
|
78017
78399
|
if (error48 === void 0 || error48 === null) {
|
|
78018
|
-
|
|
78400
|
+
resolve8();
|
|
78019
78401
|
} else {
|
|
78020
78402
|
reject(error48);
|
|
78021
78403
|
}
|
|
@@ -78307,10 +78689,10 @@ var require_main = __commonJS({
|
|
|
78307
78689
|
}
|
|
78308
78690
|
function createClientPipeTransport(pipeName, encoding = "utf-8") {
|
|
78309
78691
|
let connectResolve;
|
|
78310
|
-
const connected = new Promise((
|
|
78311
|
-
connectResolve =
|
|
78692
|
+
const connected = new Promise((resolve8, _reject) => {
|
|
78693
|
+
connectResolve = resolve8;
|
|
78312
78694
|
});
|
|
78313
|
-
return new Promise((
|
|
78695
|
+
return new Promise((resolve8, reject) => {
|
|
78314
78696
|
const server = (0, net_1.createServer)((socket) => {
|
|
78315
78697
|
server.close();
|
|
78316
78698
|
connectResolve([
|
|
@@ -78321,7 +78703,7 @@ var require_main = __commonJS({
|
|
|
78321
78703
|
server.on("error", reject);
|
|
78322
78704
|
server.listen(pipeName, () => {
|
|
78323
78705
|
server.removeListener("error", reject);
|
|
78324
|
-
|
|
78706
|
+
resolve8({
|
|
78325
78707
|
onConnected: () => {
|
|
78326
78708
|
return connected;
|
|
78327
78709
|
}
|
|
@@ -78338,10 +78720,10 @@ var require_main = __commonJS({
|
|
|
78338
78720
|
}
|
|
78339
78721
|
function createClientSocketTransport(port, encoding = "utf-8") {
|
|
78340
78722
|
let connectResolve;
|
|
78341
|
-
const connected = new Promise((
|
|
78342
|
-
connectResolve =
|
|
78723
|
+
const connected = new Promise((resolve8, _reject) => {
|
|
78724
|
+
connectResolve = resolve8;
|
|
78343
78725
|
});
|
|
78344
|
-
return new Promise((
|
|
78726
|
+
return new Promise((resolve8, reject) => {
|
|
78345
78727
|
const server = (0, net_1.createServer)((socket) => {
|
|
78346
78728
|
server.close();
|
|
78347
78729
|
connectResolve([
|
|
@@ -78358,7 +78740,7 @@ var require_main = __commonJS({
|
|
|
78358
78740
|
return;
|
|
78359
78741
|
}
|
|
78360
78742
|
const boundPort = address.port;
|
|
78361
|
-
|
|
78743
|
+
resolve8({
|
|
78362
78744
|
port: () => boundPort,
|
|
78363
78745
|
onConnected: () => {
|
|
78364
78746
|
return connected;
|
|
@@ -79434,9 +79816,8 @@ function getDocumentVariableCompletions(sigil, cursor, workspace) {
|
|
|
79434
79816
|
for (const passage of doc.passages) {
|
|
79435
79817
|
for (const use of variableUses(passage)) if (use.sigil === sigil) names.add(use.name);
|
|
79436
79818
|
}
|
|
79437
|
-
for (const
|
|
79438
|
-
|
|
79439
|
-
for (const param of widget.params) if (param[0] === sigil) names.add(param.slice(1));
|
|
79819
|
+
for (const definition2 of widgetSources(doc.passages, doc.context.macros).keys()) {
|
|
79820
|
+
for (const param of definition2.params) if (param[0] === sigil) names.add(param.slice(1));
|
|
79440
79821
|
}
|
|
79441
79822
|
return [...names].map((name) => ({
|
|
79442
79823
|
label: `${sigil}${name}`,
|
|
@@ -79475,6 +79856,7 @@ var init_completions = __esm({
|
|
|
79475
79856
|
"src/plugins/completions.ts"() {
|
|
79476
79857
|
"use strict";
|
|
79477
79858
|
init_tooling();
|
|
79859
|
+
init_widgets();
|
|
79478
79860
|
init_passage_refs();
|
|
79479
79861
|
init_link_runtime();
|
|
79480
79862
|
init_markup_cursor();
|
|
@@ -79665,10 +80047,11 @@ function getSignatureHelp(uri, position, workspace) {
|
|
|
79665
80047
|
const typing = argumentsBeingTyped(argsBefore);
|
|
79666
80048
|
const argument = typing.length - 1;
|
|
79667
80049
|
const macroInfo = workspace.macros.getMacro(macroName);
|
|
79668
|
-
|
|
80050
|
+
const schema = macroInfo?.parameterDefs?.length && !workspace.macros.hasConfiguredParameters(macroName) ? void 0 : macroInfo?.parameters;
|
|
80051
|
+
if (macroInfo && schema && schema.length > 0) {
|
|
79669
80052
|
const described = describeSignatures(
|
|
79670
80053
|
macroName,
|
|
79671
|
-
|
|
80054
|
+
schema,
|
|
79672
80055
|
macroInfo.description ?? void 0,
|
|
79673
80056
|
macroInfo.parameterDocs
|
|
79674
80057
|
);
|
|
@@ -79683,10 +80066,10 @@ function getSignatureHelp(uri, position, workspace) {
|
|
|
79683
80066
|
}
|
|
79684
80067
|
}
|
|
79685
80068
|
if (macroInfo) {
|
|
79686
|
-
const definitions =
|
|
80069
|
+
const definitions = schema === void 0 ? macroInfo.parameterDefs : void 0;
|
|
79687
80070
|
if (!definitions?.length) return null;
|
|
79688
80071
|
const parameters = definitions.map((parameter) => ({
|
|
79689
|
-
label: parameter.required ? parameter.name : `[${parameter.name}]`,
|
|
80072
|
+
label: parameter.required || parameter.type === "separator" ? parameter.name : `[${parameter.name}]`,
|
|
79690
80073
|
documentation: [parameter.description, `Type: ${parameter.type}`].filter(Boolean).join("\n\n")
|
|
79691
80074
|
}));
|
|
79692
80075
|
const positional = definitions.every((p) => p.type === "string" || p.type === "number") && argument < parameters.length;
|