@rohal12/spindle 0.64.10 → 0.64.12
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/pkg/format.js +1 -1
- package/dist/pkg/headless.js +291 -443
- package/dist/pkg/play.js +2 -1
- package/dist/pkg/story-variables.js +400 -520
- package/dist/pkg/tooling.js +2 -0
- package/package.json +4 -4
- package/src/completion-context.ts +111 -23
- package/src/format/segment.ts +34 -36
- package/src/js-lexer.ts +187 -64
- package/src/markup/html-integration.tsx +101 -0
- package/src/markup/render.tsx +67 -30
- package/src/play/session.ts +9 -1
- package/src/tooling.ts +63 -19
- package/src/twine-editor/highlight.ts +10 -11
- package/types/tooling.d.ts +42 -0
package/dist/pkg/headless.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment, createContext, h, render } from "preact";
|
|
1
|
+
import { Fragment, createContext, createPortal, h, render } from "preact";
|
|
2
2
|
import { useCallback, useContext, useEffect, useErrorBoundary, useId, useLayoutEffect, useMemo, useRef, useState } from "preact/hooks";
|
|
3
3
|
import { useSyncExternalStore } from "preact/compat";
|
|
4
4
|
import { createStore } from "zustand/vanilla";
|
|
@@ -5546,9 +5546,7 @@ var SigilParser = class extends Parser {
|
|
|
5546
5546
|
if (name) {
|
|
5547
5547
|
const end = at + 1 + name.length;
|
|
5548
5548
|
const afterPrefix = self.type === types$1.incDec && (this.operandBeforeLast || this.breakBeforeLast);
|
|
5549
|
-
|
|
5550
|
-
if (code === 64 || (forced ?? (self.exprAllowed || afterPrefix || this.lookahead && transientAssignment(self, end)))) {
|
|
5551
|
-
if (code === 37) this.transientsRead?.add(at);
|
|
5549
|
+
if (code === 64 || self.exprAllowed || afterPrefix || this.lookahead && transientAssignment(self, end)) {
|
|
5552
5550
|
self.pos = end;
|
|
5553
5551
|
self.finishToken(types$1.name, self.input.charAt(at) + name);
|
|
5554
5552
|
return;
|
|
@@ -5571,16 +5569,31 @@ var SigilParser = class extends Parser {
|
|
|
5571
5569
|
}
|
|
5572
5570
|
const self = this;
|
|
5573
5571
|
const prevType = self.type;
|
|
5572
|
+
const beforePreviousValue = this.prevValue;
|
|
5574
5573
|
this.prevValue = isMemberDot(this.typeBeforeLast) ? void 0 : self.value;
|
|
5575
5574
|
const property = type.keyword !== void 0 && isMemberDot(prevType) || (type === types$1._function || type === types$1._class) && notABody(self.input, self.pos);
|
|
5576
5575
|
if (!property && (type === types$1._function || type === types$1._class)) {
|
|
5577
|
-
const
|
|
5578
|
-
|
|
5576
|
+
const afterAsync = type === types$1._function && prevType === types$1.name && this.prevValue === "async" && !this.breakHere;
|
|
5577
|
+
const before = afterAsync ? this.typeBeforeLast : prevType;
|
|
5578
|
+
const contextualOperand = before === types$1.name && (afterAsync ? this.operandBeforeLast : self.exprAllowed) && ((afterAsync ? beforePreviousValue : this.prevValue) !== "yield" || !(afterAsync ? this.breakBeforeLast : this.breakHere));
|
|
5579
|
+
self.type = before === types$1.colon && this.colonEndsTernary || contextualOperand ? types$1.parenL : before;
|
|
5579
5580
|
}
|
|
5580
5581
|
this.typeBeforeLast = prevType;
|
|
5581
5582
|
super.finishToken(property ? types$1.name : type, value);
|
|
5582
5583
|
if (type === types$1.name && (isMemberDot(prevType) || value === "of" && (prevType === types$1._const || prevType === types$1._var || this.prevValue === "let"))) self.exprAllowed = false;
|
|
5583
5584
|
}
|
|
5585
|
+
parseIdent(liberal) {
|
|
5586
|
+
this.exprAllowed = false;
|
|
5587
|
+
return super.parseIdent(liberal);
|
|
5588
|
+
}
|
|
5589
|
+
parseForIn(node, init) {
|
|
5590
|
+
this.exprAllowed = true;
|
|
5591
|
+
return super.parseForIn(node, init);
|
|
5592
|
+
}
|
|
5593
|
+
parseAwait(forInit) {
|
|
5594
|
+
this.exprAllowed = true;
|
|
5595
|
+
return super.parseAwait(forInit);
|
|
5596
|
+
}
|
|
5584
5597
|
braceIsBlock(prevType) {
|
|
5585
5598
|
if (prevType === types$1.colon && this.colonEndsTernary) return false;
|
|
5586
5599
|
if (prevType === types$1.braceR && this.closedBlock) return true;
|
|
@@ -5644,10 +5657,14 @@ var CLOSERS = /* @__PURE__ */ new Set([
|
|
|
5644
5657
|
* After an operand, a `/` divides.
|
|
5645
5658
|
*/
|
|
5646
5659
|
function tokenizerAt(src, start, goal, { onComment, afterOperand = false } = {}) {
|
|
5647
|
-
const p = new SigilParser(
|
|
5660
|
+
const p = new SigilParser({
|
|
5648
5661
|
...OPTIONS,
|
|
5662
|
+
startLocation: {
|
|
5663
|
+
line: 1,
|
|
5664
|
+
column: 0
|
|
5665
|
+
},
|
|
5649
5666
|
onComment
|
|
5650
|
-
}
|
|
5667
|
+
}, src, start);
|
|
5651
5668
|
if (goal === "expression") p.type = types$1.parenL;
|
|
5652
5669
|
if (afterOperand) p.exprAllowed = false;
|
|
5653
5670
|
return p;
|
|
@@ -5765,29 +5782,17 @@ function parseCode(src, goal = "expression") {
|
|
|
5765
5782
|
}
|
|
5766
5783
|
/** What parseCode finds in `src`, and the syntax tree it is in. */
|
|
5767
5784
|
function parseWithAst(src, goal) {
|
|
5768
|
-
const
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
return {
|
|
5780
|
-
out,
|
|
5781
|
-
ast
|
|
5782
|
-
};
|
|
5783
|
-
} catch (error) {
|
|
5784
|
-
const pos = error.pos ?? -1;
|
|
5785
|
-
if (!(error instanceof SyntaxError) || percentAt.has(pos)) throw error;
|
|
5786
|
-
TRANS_NAME_RE.lastIndex = pos + 1;
|
|
5787
|
-
if (src.charAt(pos) !== "%" || !TRANS_NAME_RE.test(src)) throw error;
|
|
5788
|
-
percentAt.set(pos, !transientsRead.has(pos));
|
|
5789
|
-
}
|
|
5790
|
-
}
|
|
5785
|
+
const ast = parseAst(src, goal);
|
|
5786
|
+
const out = {
|
|
5787
|
+
refs: [],
|
|
5788
|
+
strings: []
|
|
5789
|
+
};
|
|
5790
|
+
walk(ast, src, out, false, false);
|
|
5791
|
+
out.refs.sort((a, b) => a.start - b.start);
|
|
5792
|
+
return {
|
|
5793
|
+
out,
|
|
5794
|
+
ast
|
|
5795
|
+
};
|
|
5791
5796
|
}
|
|
5792
5797
|
/**
|
|
5793
5798
|
* Read `src` as a reference path: a variable with any number of `.name` and
|
|
@@ -5845,15 +5850,10 @@ function readMemberPath(src, end) {
|
|
|
5845
5850
|
end
|
|
5846
5851
|
};
|
|
5847
5852
|
}
|
|
5848
|
-
/**
|
|
5849
|
-
|
|
5850
|
-
* noting where it read a transient in `transientsRead`.
|
|
5851
|
-
*/
|
|
5852
|
-
function parseAst(src, goal, percentAt, transientsRead) {
|
|
5853
|
+
/** Parse `src` as `goal`, using the parser's context for `%name`. */
|
|
5854
|
+
function parseAst(src, goal) {
|
|
5853
5855
|
try {
|
|
5854
5856
|
const p = tokenizerAt(src, 0, goal);
|
|
5855
|
-
p.percentAt = percentAt;
|
|
5856
|
-
p.transientsRead = transientsRead;
|
|
5857
5857
|
if (goal === "statements") return p.parse();
|
|
5858
5858
|
p.nextToken();
|
|
5859
5859
|
const ast = p.parseExpression();
|
|
@@ -6066,33 +6066,54 @@ var WORDS_BEFORE_STRING = /* @__PURE__ */ new Set([
|
|
|
6066
6066
|
* what in it is no JavaScript.
|
|
6067
6067
|
*/
|
|
6068
6068
|
function findCodeEnd(src, start, { goal = "expression", stop, onRunOut } = {}) {
|
|
6069
|
-
|
|
6070
|
-
|
|
6069
|
+
let verifyStop = false;
|
|
6070
|
+
const end = scanCodeEnd(src, start, goal, stop, onRunOut, () => {
|
|
6071
|
+
verifyStop = true;
|
|
6072
|
+
});
|
|
6073
|
+
if (end < 0 || verifyStop) {
|
|
6074
|
+
const parsed = parsedCodeEnd(src, start, goal, stop);
|
|
6075
|
+
if (parsed >= 0) return parsed;
|
|
6076
|
+
}
|
|
6077
|
+
return end;
|
|
6071
6078
|
}
|
|
6072
6079
|
/**
|
|
6073
6080
|
* Where the code from `start` ends, as the parser finds it: the `}` it
|
|
6074
|
-
* stops at, or -1. The token scan of
|
|
6075
|
-
* opens a regex from the tokens before
|
|
6076
|
-
*
|
|
6077
|
-
*
|
|
6081
|
+
* stops at (or the `{` matching `stop`), or -1. The token scan of
|
|
6082
|
+
* `findCodeEnd` guesses whether a `/` opens a regex from the tokens before
|
|
6083
|
+
* it, and class fields inside template literals can mislead it. The parser
|
|
6084
|
+
* knows the context. Asked when the scan finds no end or a stop that might
|
|
6085
|
+
* still be template text.
|
|
6078
6086
|
*/
|
|
6079
|
-
function parsedCodeEnd(src, start, goal) {
|
|
6087
|
+
function parsedCodeEnd(src, start, goal, stop) {
|
|
6080
6088
|
const p = tokenizerAt(src, start, goal);
|
|
6089
|
+
const stopped = {};
|
|
6090
|
+
let stoppedAt = -1;
|
|
6091
|
+
if (stop) {
|
|
6092
|
+
const nextToken = p.nextToken;
|
|
6093
|
+
p.nextToken = () => {
|
|
6094
|
+
nextToken.call(p);
|
|
6095
|
+
if (p.type === types$1.braceL && stop(p.start)) {
|
|
6096
|
+
stoppedAt = p.start;
|
|
6097
|
+
throw stopped;
|
|
6098
|
+
}
|
|
6099
|
+
};
|
|
6100
|
+
}
|
|
6081
6101
|
try {
|
|
6082
6102
|
if (goal === "statements") p.parse();
|
|
6083
6103
|
else {
|
|
6084
6104
|
p.nextToken();
|
|
6085
6105
|
p.parseExpression();
|
|
6086
|
-
if (p.type === types$1.braceR) return p.start;
|
|
6106
|
+
if (!stop && p.type === types$1.braceR) return p.start;
|
|
6087
6107
|
}
|
|
6088
6108
|
} catch (error) {
|
|
6109
|
+
if (error === stopped) return stoppedAt;
|
|
6089
6110
|
const pos = error.pos ?? -1;
|
|
6090
|
-
if (src.charAt(pos) === "}") return pos;
|
|
6111
|
+
if (!stop && src.charAt(pos) === "}") return pos;
|
|
6091
6112
|
}
|
|
6092
6113
|
return -1;
|
|
6093
6114
|
}
|
|
6094
6115
|
/** `findCodeEnd` by the tokens: see there. */
|
|
6095
|
-
function scanCodeEnd(src, start, goal, stop, onRunOut) {
|
|
6116
|
+
function scanCodeEnd(src, start, goal, stop, onRunOut, onTemplateStop) {
|
|
6096
6117
|
/** No end: the code runs to the end of `src`. */
|
|
6097
6118
|
const ranOut = () => {
|
|
6098
6119
|
onRunOut?.();
|
|
@@ -6104,6 +6125,7 @@ function scanCodeEnd(src, start, goal, stop, onRunOut) {
|
|
|
6104
6125
|
let from = start;
|
|
6105
6126
|
let afterOperand = false;
|
|
6106
6127
|
let templateSlip = false;
|
|
6128
|
+
let interpolated = false;
|
|
6107
6129
|
for (;;) {
|
|
6108
6130
|
let resumeAt = -1;
|
|
6109
6131
|
for (const tok of tokens(src, from, goal, { afterOperand })) {
|
|
@@ -6132,10 +6154,15 @@ function scanCodeEnd(src, start, goal, stop, onRunOut) {
|
|
|
6132
6154
|
prevWord = t === types$1.name && !WORDS_BEFORE_STRING.has(tok.value) || t === types$1.num;
|
|
6133
6155
|
prevEnd = tok.end;
|
|
6134
6156
|
if (t === types$1.braceL) {
|
|
6135
|
-
if (stop?.(tok.start))
|
|
6157
|
+
if (stop?.(tok.start)) {
|
|
6158
|
+
if (interpolated) onTemplateStop();
|
|
6159
|
+
return tok.start;
|
|
6160
|
+
}
|
|
6136
6161
|
stack.push("{");
|
|
6137
|
-
} else if (t === types$1.dollarBraceL)
|
|
6138
|
-
|
|
6162
|
+
} else if (t === types$1.dollarBraceL) {
|
|
6163
|
+
interpolated = true;
|
|
6164
|
+
stack.push("${");
|
|
6165
|
+
} else if (t === types$1.parenL) stack.push("(");
|
|
6139
6166
|
else if (t === types$1.bracketL) stack.push("[");
|
|
6140
6167
|
else if (t === types$1.parenR || t === types$1.bracketR) {
|
|
6141
6168
|
if (last$1(stack) === (t === types$1.parenR ? "(" : "[")) stack.pop();
|
|
@@ -6213,7 +6240,8 @@ function* tokens(src, start, goal, options = {}) {
|
|
|
6213
6240
|
type: p.type,
|
|
6214
6241
|
start: p.start,
|
|
6215
6242
|
end: p.end,
|
|
6216
|
-
value: p.value
|
|
6243
|
+
value: p.value,
|
|
6244
|
+
operand: p.operandHere
|
|
6217
6245
|
};
|
|
6218
6246
|
if (p.type === types$1.eof) return;
|
|
6219
6247
|
}
|
|
@@ -9851,11 +9879,14 @@ var peg$SyntaxError = class extends SyntaxError {
|
|
|
9851
9879
|
if (nonPrintable) return s.replace(nonPrintable, (ch) => "\\u{" + hex(ch) + "}");
|
|
9852
9880
|
return s;
|
|
9853
9881
|
}
|
|
9882
|
+
function escape(s, special) {
|
|
9883
|
+
return unicodeEscape(s.replace(special, "\\$&").replace(/\0/g, "\\0").replace(/\t/g, "\\t").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/[\x00-\x0F]/g, (ch) => "\\x0" + hex(ch)).replace(/[\x10-\x1F\x7F-\x9F]/g, (ch) => "\\x" + hex(ch)));
|
|
9884
|
+
}
|
|
9854
9885
|
function literalEscape(s) {
|
|
9855
|
-
return
|
|
9886
|
+
return escape(s, /[\\"]/g);
|
|
9856
9887
|
}
|
|
9857
9888
|
function classEscape(s) {
|
|
9858
|
-
return
|
|
9889
|
+
return escape(s, /[\\\]^-]/g);
|
|
9859
9890
|
}
|
|
9860
9891
|
const DESCRIBE_EXPECTATION_FNS = {
|
|
9861
9892
|
literal(expectation) {
|
|
@@ -9929,28 +9960,6 @@ function peg$parse(input, options) {
|
|
|
9929
9960
|
const peg$c16 = "=";
|
|
9930
9961
|
const peg$c17 = "\"";
|
|
9931
9962
|
const peg$c18 = "'";
|
|
9932
|
-
const peg$r0 = /^[^\\{[<]/;
|
|
9933
|
-
const peg$r1 = /^[{}]/;
|
|
9934
|
-
const peg$r2 = /^[$_@%(!\/a-zA-Z]/;
|
|
9935
|
-
const peg$r3 = /^[.#]/;
|
|
9936
|
-
const peg$r4 = /^[a-zA-Z0-9_\-]/;
|
|
9937
|
-
const peg$r5 = /^[$_@%]/;
|
|
9938
|
-
const peg$r6 = /^[a-zA-Z0-9_.]/;
|
|
9939
|
-
const peg$r7 = /^[$_@%(!]/;
|
|
9940
|
-
const peg$r8 = /^[a-zA-Z]/;
|
|
9941
|
-
const peg$r9 = /^[^ \t\n\r\v\f\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF}]/;
|
|
9942
|
-
const peg$r10 = /^[a-zA-Z0-9.!#$%&'*+\/=?\^_`|~\-]/;
|
|
9943
|
-
const peg$r11 = /^[a-zA-Z0-9.\-]/;
|
|
9944
|
-
const peg$r12 = /^[a-zA-Z0-9+.\-]/;
|
|
9945
|
-
const peg$r13 = /^[^\0- \x7F<>{}]/;
|
|
9946
|
-
const peg$r14 = /^[\t-\r \/>\xA0\u1680\u2000-\u200A\u2028-\u2029\u202F\u205F\u3000\uFEFF]/;
|
|
9947
|
-
const peg$r15 = /^[a-zA-Z0-9\-]/;
|
|
9948
|
-
const peg$r16 = /^[\t-\r "'\/<->{}\xA0\u1680\u2000-\u200A\u2028-\u2029\u202F\u205F\u3000\uFEFF]/;
|
|
9949
|
-
const peg$r17 = /^[^"]/;
|
|
9950
|
-
const peg$r18 = /^[^']/;
|
|
9951
|
-
const peg$r19 = /^["']/;
|
|
9952
|
-
const peg$r20 = /^[^ \t\n\r\v\f\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF>]/;
|
|
9953
|
-
const peg$r21 = /^[ \t\n\r\v\f\xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]/;
|
|
9954
9963
|
const peg$e0 = peg$anyExpectation();
|
|
9955
9964
|
const peg$e1 = peg$classExpectation([
|
|
9956
9965
|
"\\",
|
|
@@ -10515,6 +10524,7 @@ function peg$parse(input, options) {
|
|
|
10515
10524
|
let peg$maxFailExpected = options.peg$maxFailExpected || [];
|
|
10516
10525
|
let peg$silentFails = options.peg$silentFails | 0;
|
|
10517
10526
|
let peg$result;
|
|
10527
|
+
let peg$charCode;
|
|
10518
10528
|
if (options.startRule) {
|
|
10519
10529
|
if (!(options.startRule in peg$startRuleFunctions)) throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
|
|
10520
10530
|
peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
|
|
@@ -10622,10 +10632,10 @@ function peg$parse(input, options) {
|
|
|
10622
10632
|
let s0, s1, s2;
|
|
10623
10633
|
s0 = peg$currPos;
|
|
10624
10634
|
s1 = [];
|
|
10625
|
-
|
|
10626
|
-
while (s2 !== peg$FAILED) {
|
|
10627
|
-
s1.push(s2);
|
|
10635
|
+
for (;;) {
|
|
10628
10636
|
s2 = peg$parseTokenItem();
|
|
10637
|
+
if (s2 === peg$FAILED) break;
|
|
10638
|
+
s1.push(s2);
|
|
10629
10639
|
}
|
|
10630
10640
|
peg$savedPos = s0;
|
|
10631
10641
|
s1 = peg$f0(s1);
|
|
@@ -10910,15 +10920,7 @@ function peg$parse(input, options) {
|
|
|
10910
10920
|
if (s1 !== peg$FAILED) {
|
|
10911
10921
|
s2 = peg$currPos;
|
|
10912
10922
|
s3 = [];
|
|
10913
|
-
|
|
10914
|
-
s4 = input.charAt(peg$currPos);
|
|
10915
|
-
peg$currPos++;
|
|
10916
|
-
} else {
|
|
10917
|
-
s4 = peg$FAILED;
|
|
10918
|
-
if (peg$silentFails === 0) peg$fail(peg$e0);
|
|
10919
|
-
}
|
|
10920
|
-
while (s4 !== peg$FAILED) {
|
|
10921
|
-
s3.push(s4);
|
|
10923
|
+
for (;;) {
|
|
10922
10924
|
if (input.length > peg$currPos) {
|
|
10923
10925
|
s4 = input.charAt(peg$currPos);
|
|
10924
10926
|
peg$currPos++;
|
|
@@ -10926,6 +10928,8 @@ function peg$parse(input, options) {
|
|
|
10926
10928
|
s4 = peg$FAILED;
|
|
10927
10929
|
if (peg$silentFails === 0) peg$fail(peg$e0);
|
|
10928
10930
|
}
|
|
10931
|
+
if (s4 === peg$FAILED) break;
|
|
10932
|
+
s3.push(s4);
|
|
10929
10933
|
}
|
|
10930
10934
|
s2 = input.substring(s2, peg$currPos);
|
|
10931
10935
|
peg$savedPos = s0;
|
|
@@ -10951,22 +10955,17 @@ function peg$parse(input, options) {
|
|
|
10951
10955
|
s0 = peg$currPos;
|
|
10952
10956
|
s1 = peg$currPos;
|
|
10953
10957
|
s2 = [];
|
|
10954
|
-
|
|
10955
|
-
if (peg$r0.test(s3)) peg$currPos++;
|
|
10956
|
-
else {
|
|
10957
|
-
s3 = peg$FAILED;
|
|
10958
|
-
if (peg$silentFails === 0) peg$fail(peg$e1);
|
|
10959
|
-
}
|
|
10960
|
-
if (s3 !== peg$FAILED) while (s3 !== peg$FAILED) {
|
|
10961
|
-
s2.push(s3);
|
|
10958
|
+
for (;;) {
|
|
10962
10959
|
s3 = input.charAt(peg$currPos);
|
|
10963
|
-
if (peg$
|
|
10960
|
+
if (s3 !== "" && !(peg$charCode = s3.charCodeAt(0), peg$charCode === 92 || peg$charCode === 123 || peg$charCode === 91 || peg$charCode === 60)) peg$currPos++;
|
|
10964
10961
|
else {
|
|
10965
10962
|
s3 = peg$FAILED;
|
|
10966
10963
|
if (peg$silentFails === 0) peg$fail(peg$e1);
|
|
10967
10964
|
}
|
|
10965
|
+
if (s3 === peg$FAILED) break;
|
|
10966
|
+
s2.push(s3);
|
|
10968
10967
|
}
|
|
10969
|
-
|
|
10968
|
+
if (s2.length < 1) s2 = peg$FAILED;
|
|
10970
10969
|
if (s2 !== peg$FAILED) s1 = input.substring(s1, peg$currPos);
|
|
10971
10970
|
else s1 = s2;
|
|
10972
10971
|
if (s1 !== peg$FAILED) {
|
|
@@ -11012,43 +11011,7 @@ function peg$parse(input, options) {
|
|
|
11012
11011
|
else s5 = peg$FAILED;
|
|
11013
11012
|
if (s5 !== peg$FAILED) {
|
|
11014
11013
|
s6 = [];
|
|
11015
|
-
|
|
11016
|
-
s8 = peg$currPos;
|
|
11017
|
-
peg$silentFails++;
|
|
11018
|
-
if (input.substr(peg$currPos, 3) === peg$c3) {
|
|
11019
|
-
s9 = peg$c3;
|
|
11020
|
-
peg$currPos += 3;
|
|
11021
|
-
} else {
|
|
11022
|
-
s9 = peg$FAILED;
|
|
11023
|
-
if (peg$silentFails === 0) peg$fail(peg$e5);
|
|
11024
|
-
}
|
|
11025
|
-
peg$silentFails--;
|
|
11026
|
-
if (s9 === peg$FAILED) s8 = void 0;
|
|
11027
|
-
else {
|
|
11028
|
-
peg$currPos = s8;
|
|
11029
|
-
s8 = peg$FAILED;
|
|
11030
|
-
}
|
|
11031
|
-
if (s8 !== peg$FAILED) {
|
|
11032
|
-
if (input.length > peg$currPos) {
|
|
11033
|
-
s9 = input.charAt(peg$currPos);
|
|
11034
|
-
peg$currPos++;
|
|
11035
|
-
} else {
|
|
11036
|
-
s9 = peg$FAILED;
|
|
11037
|
-
if (peg$silentFails === 0) peg$fail(peg$e0);
|
|
11038
|
-
}
|
|
11039
|
-
if (s9 !== peg$FAILED) {
|
|
11040
|
-
s8 = [s8, s9];
|
|
11041
|
-
s7 = s8;
|
|
11042
|
-
} else {
|
|
11043
|
-
peg$currPos = s7;
|
|
11044
|
-
s7 = peg$FAILED;
|
|
11045
|
-
}
|
|
11046
|
-
} else {
|
|
11047
|
-
peg$currPos = s7;
|
|
11048
|
-
s7 = peg$FAILED;
|
|
11049
|
-
}
|
|
11050
|
-
while (s7 !== peg$FAILED) {
|
|
11051
|
-
s6.push(s7);
|
|
11014
|
+
for (;;) {
|
|
11052
11015
|
s7 = peg$currPos;
|
|
11053
11016
|
s8 = peg$currPos;
|
|
11054
11017
|
peg$silentFails++;
|
|
@@ -11084,6 +11047,8 @@ function peg$parse(input, options) {
|
|
|
11084
11047
|
peg$currPos = s7;
|
|
11085
11048
|
s7 = peg$FAILED;
|
|
11086
11049
|
}
|
|
11050
|
+
if (s7 === peg$FAILED) break;
|
|
11051
|
+
s6.push(s7);
|
|
11087
11052
|
}
|
|
11088
11053
|
if (input.substr(peg$currPos, 3) === peg$c3) {
|
|
11089
11054
|
s7 = peg$c3;
|
|
@@ -11135,15 +11100,7 @@ function peg$parse(input, options) {
|
|
|
11135
11100
|
s0 = peg$currPos;
|
|
11136
11101
|
s1 = peg$currPos;
|
|
11137
11102
|
s2 = [];
|
|
11138
|
-
|
|
11139
|
-
s3 = peg$c4;
|
|
11140
|
-
peg$currPos++;
|
|
11141
|
-
} else {
|
|
11142
|
-
s3 = peg$FAILED;
|
|
11143
|
-
if (peg$silentFails === 0) peg$fail(peg$e6);
|
|
11144
|
-
}
|
|
11145
|
-
if (s3 !== peg$FAILED) while (s3 !== peg$FAILED) {
|
|
11146
|
-
s2.push(s3);
|
|
11103
|
+
for (;;) {
|
|
11147
11104
|
if (input.charCodeAt(peg$currPos) === 92) {
|
|
11148
11105
|
s3 = peg$c4;
|
|
11149
11106
|
peg$currPos++;
|
|
@@ -11151,8 +11108,10 @@ function peg$parse(input, options) {
|
|
|
11151
11108
|
s3 = peg$FAILED;
|
|
11152
11109
|
if (peg$silentFails === 0) peg$fail(peg$e6);
|
|
11153
11110
|
}
|
|
11111
|
+
if (s3 === peg$FAILED) break;
|
|
11112
|
+
s2.push(s3);
|
|
11154
11113
|
}
|
|
11155
|
-
|
|
11114
|
+
if (s2.length < 1) s2 = peg$FAILED;
|
|
11156
11115
|
if (s2 !== peg$FAILED) s1 = input.substring(s1, peg$currPos);
|
|
11157
11116
|
else s1 = s2;
|
|
11158
11117
|
if (s1 !== peg$FAILED) {
|
|
@@ -11163,7 +11122,7 @@ function peg$parse(input, options) {
|
|
|
11163
11122
|
else s3 = peg$FAILED;
|
|
11164
11123
|
if (s3 !== peg$FAILED) {
|
|
11165
11124
|
s4 = input.charAt(peg$currPos);
|
|
11166
|
-
if (peg$
|
|
11125
|
+
if (peg$charCode = s4.charCodeAt(0), peg$charCode === 123 || peg$charCode === 125) peg$currPos++;
|
|
11167
11126
|
else {
|
|
11168
11127
|
s4 = peg$FAILED;
|
|
11169
11128
|
if (peg$silentFails === 0) peg$fail(peg$e7);
|
|
@@ -11205,7 +11164,7 @@ function peg$parse(input, options) {
|
|
|
11205
11164
|
s4 = peg$parseSelectors();
|
|
11206
11165
|
if (s4 !== peg$FAILED) {
|
|
11207
11166
|
s5 = input.charAt(peg$currPos);
|
|
11208
|
-
if (peg$
|
|
11167
|
+
if (peg$charCode = s5.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37 || peg$charCode === 40 || peg$charCode === 33 || peg$charCode === 47 || peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90) peg$currPos++;
|
|
11209
11168
|
else {
|
|
11210
11169
|
s5 = peg$FAILED;
|
|
11211
11170
|
if (peg$silentFails === 0) peg$fail(peg$e9);
|
|
@@ -11384,52 +11343,7 @@ function peg$parse(input, options) {
|
|
|
11384
11343
|
function peg$parseLinkText() {
|
|
11385
11344
|
let s0, s1, s2, s3;
|
|
11386
11345
|
s0 = [];
|
|
11387
|
-
|
|
11388
|
-
s2 = peg$currPos;
|
|
11389
|
-
peg$silentFails++;
|
|
11390
|
-
if (input.substr(peg$currPos, 2) === peg$c9) {
|
|
11391
|
-
s3 = peg$c9;
|
|
11392
|
-
peg$currPos += 2;
|
|
11393
|
-
} else {
|
|
11394
|
-
s3 = peg$FAILED;
|
|
11395
|
-
if (peg$silentFails === 0) peg$fail(peg$e13);
|
|
11396
|
-
}
|
|
11397
|
-
if (s3 === peg$FAILED) {
|
|
11398
|
-
if (input.substr(peg$currPos, 2) === peg$c8) {
|
|
11399
|
-
s3 = peg$c8;
|
|
11400
|
-
peg$currPos += 2;
|
|
11401
|
-
} else {
|
|
11402
|
-
s3 = peg$FAILED;
|
|
11403
|
-
if (peg$silentFails === 0) peg$fail(peg$e12);
|
|
11404
|
-
}
|
|
11405
|
-
}
|
|
11406
|
-
peg$silentFails--;
|
|
11407
|
-
if (s3 === peg$FAILED) s2 = void 0;
|
|
11408
|
-
else {
|
|
11409
|
-
peg$currPos = s2;
|
|
11410
|
-
s2 = peg$FAILED;
|
|
11411
|
-
}
|
|
11412
|
-
if (s2 !== peg$FAILED) {
|
|
11413
|
-
if (input.length > peg$currPos) {
|
|
11414
|
-
s3 = input.charAt(peg$currPos);
|
|
11415
|
-
peg$currPos++;
|
|
11416
|
-
} else {
|
|
11417
|
-
s3 = peg$FAILED;
|
|
11418
|
-
if (peg$silentFails === 0) peg$fail(peg$e0);
|
|
11419
|
-
}
|
|
11420
|
-
if (s3 !== peg$FAILED) {
|
|
11421
|
-
s2 = [s2, s3];
|
|
11422
|
-
s1 = s2;
|
|
11423
|
-
} else {
|
|
11424
|
-
peg$currPos = s1;
|
|
11425
|
-
s1 = peg$FAILED;
|
|
11426
|
-
}
|
|
11427
|
-
} else {
|
|
11428
|
-
peg$currPos = s1;
|
|
11429
|
-
s1 = peg$FAILED;
|
|
11430
|
-
}
|
|
11431
|
-
while (s1 !== peg$FAILED) {
|
|
11432
|
-
s0.push(s1);
|
|
11346
|
+
for (;;) {
|
|
11433
11347
|
s1 = peg$currPos;
|
|
11434
11348
|
s2 = peg$currPos;
|
|
11435
11349
|
peg$silentFails++;
|
|
@@ -11474,6 +11388,8 @@ function peg$parse(input, options) {
|
|
|
11474
11388
|
peg$currPos = s1;
|
|
11475
11389
|
s1 = peg$FAILED;
|
|
11476
11390
|
}
|
|
11391
|
+
if (s1 === peg$FAILED) break;
|
|
11392
|
+
s0.push(s1);
|
|
11477
11393
|
}
|
|
11478
11394
|
return s0;
|
|
11479
11395
|
}
|
|
@@ -11481,12 +11397,12 @@ function peg$parse(input, options) {
|
|
|
11481
11397
|
let s0, s1, s2;
|
|
11482
11398
|
s0 = peg$currPos;
|
|
11483
11399
|
s1 = [];
|
|
11484
|
-
|
|
11485
|
-
if (s2 !== peg$FAILED) while (s2 !== peg$FAILED) {
|
|
11486
|
-
s1.push(s2);
|
|
11400
|
+
for (;;) {
|
|
11487
11401
|
s2 = peg$parseSelectorPart();
|
|
11402
|
+
if (s2 === peg$FAILED) break;
|
|
11403
|
+
s1.push(s2);
|
|
11488
11404
|
}
|
|
11489
|
-
|
|
11405
|
+
if (s1.length < 1) s1 = peg$FAILED;
|
|
11490
11406
|
if (s1 !== peg$FAILED) {
|
|
11491
11407
|
if (input.charCodeAt(peg$currPos) === 32) {
|
|
11492
11408
|
s2 = peg$c10;
|
|
@@ -11518,15 +11434,7 @@ function peg$parse(input, options) {
|
|
|
11518
11434
|
if (s1 !== peg$FAILED) {
|
|
11519
11435
|
s2 = peg$parseHere();
|
|
11520
11436
|
s3 = [];
|
|
11521
|
-
|
|
11522
|
-
s4 = input.charAt(peg$currPos);
|
|
11523
|
-
peg$currPos++;
|
|
11524
|
-
} else {
|
|
11525
|
-
s4 = peg$FAILED;
|
|
11526
|
-
if (peg$silentFails === 0) peg$fail(peg$e0);
|
|
11527
|
-
}
|
|
11528
|
-
while (s4 !== peg$FAILED) {
|
|
11529
|
-
s3.push(s4);
|
|
11437
|
+
for (;;) {
|
|
11530
11438
|
if (input.length > peg$currPos) {
|
|
11531
11439
|
s4 = input.charAt(peg$currPos);
|
|
11532
11440
|
peg$currPos++;
|
|
@@ -11534,6 +11442,8 @@ function peg$parse(input, options) {
|
|
|
11534
11442
|
s4 = peg$FAILED;
|
|
11535
11443
|
if (peg$silentFails === 0) peg$fail(peg$e0);
|
|
11536
11444
|
}
|
|
11445
|
+
if (s4 === peg$FAILED) break;
|
|
11446
|
+
s3.push(s4);
|
|
11537
11447
|
}
|
|
11538
11448
|
peg$savedPos = s0;
|
|
11539
11449
|
s0 = peg$f39(s1, s2);
|
|
@@ -11547,7 +11457,7 @@ function peg$parse(input, options) {
|
|
|
11547
11457
|
let s0, s1, s2, s3, s4;
|
|
11548
11458
|
s0 = peg$currPos;
|
|
11549
11459
|
s1 = input.charAt(peg$currPos);
|
|
11550
|
-
if (peg$
|
|
11460
|
+
if (peg$charCode = s1.charCodeAt(0), peg$charCode === 46 || peg$charCode === 35) peg$currPos++;
|
|
11551
11461
|
else {
|
|
11552
11462
|
s1 = peg$FAILED;
|
|
11553
11463
|
if (peg$silentFails === 0) peg$fail(peg$e15);
|
|
@@ -11555,10 +11465,10 @@ function peg$parse(input, options) {
|
|
|
11555
11465
|
if (s1 !== peg$FAILED) {
|
|
11556
11466
|
s2 = peg$currPos;
|
|
11557
11467
|
s3 = [];
|
|
11558
|
-
|
|
11559
|
-
while (s4 !== peg$FAILED) {
|
|
11560
|
-
s3.push(s4);
|
|
11468
|
+
for (;;) {
|
|
11561
11469
|
s4 = peg$parseSelectorChar();
|
|
11470
|
+
if (s4 === peg$FAILED) break;
|
|
11471
|
+
s3.push(s4);
|
|
11562
11472
|
}
|
|
11563
11473
|
s2 = input.substring(s2, peg$currPos);
|
|
11564
11474
|
peg$savedPos = s0;
|
|
@@ -11572,7 +11482,7 @@ function peg$parse(input, options) {
|
|
|
11572
11482
|
function peg$parseSelectorChar() {
|
|
11573
11483
|
let s0, s1, s2, s3, s4;
|
|
11574
11484
|
s0 = input.charAt(peg$currPos);
|
|
11575
|
-
if (peg$
|
|
11485
|
+
if (peg$charCode = s0.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 95 || peg$charCode === 45) peg$currPos++;
|
|
11576
11486
|
else {
|
|
11577
11487
|
s0 = peg$FAILED;
|
|
11578
11488
|
if (peg$silentFails === 0) peg$fail(peg$e16);
|
|
@@ -11588,27 +11498,22 @@ function peg$parse(input, options) {
|
|
|
11588
11498
|
}
|
|
11589
11499
|
if (s1 !== peg$FAILED) {
|
|
11590
11500
|
s2 = input.charAt(peg$currPos);
|
|
11591
|
-
if (peg$
|
|
11501
|
+
if (peg$charCode = s2.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37) peg$currPos++;
|
|
11592
11502
|
else {
|
|
11593
11503
|
s2 = peg$FAILED;
|
|
11594
11504
|
if (peg$silentFails === 0) peg$fail(peg$e17);
|
|
11595
11505
|
}
|
|
11596
11506
|
if (s2 !== peg$FAILED) {
|
|
11597
11507
|
s3 = [];
|
|
11598
|
-
|
|
11599
|
-
if (peg$r6.test(s4)) peg$currPos++;
|
|
11600
|
-
else {
|
|
11601
|
-
s4 = peg$FAILED;
|
|
11602
|
-
if (peg$silentFails === 0) peg$fail(peg$e18);
|
|
11603
|
-
}
|
|
11604
|
-
while (s4 !== peg$FAILED) {
|
|
11605
|
-
s3.push(s4);
|
|
11508
|
+
for (;;) {
|
|
11606
11509
|
s4 = input.charAt(peg$currPos);
|
|
11607
|
-
if (peg$
|
|
11510
|
+
if (peg$charCode = s4.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 95 || peg$charCode === 46) peg$currPos++;
|
|
11608
11511
|
else {
|
|
11609
11512
|
s4 = peg$FAILED;
|
|
11610
11513
|
if (peg$silentFails === 0) peg$fail(peg$e18);
|
|
11611
11514
|
}
|
|
11515
|
+
if (s4 === peg$FAILED) break;
|
|
11516
|
+
s3.push(s4);
|
|
11612
11517
|
}
|
|
11613
11518
|
if (input.charCodeAt(peg$currPos) === 125) {
|
|
11614
11519
|
s4 = peg$c11;
|
|
@@ -11655,7 +11560,7 @@ function peg$parse(input, options) {
|
|
|
11655
11560
|
s3 = peg$parseSelectors();
|
|
11656
11561
|
if (s3 !== peg$FAILED) {
|
|
11657
11562
|
s4 = input.charAt(peg$currPos);
|
|
11658
|
-
if (peg$
|
|
11563
|
+
if (peg$charCode = s4.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37) peg$currPos++;
|
|
11659
11564
|
else {
|
|
11660
11565
|
s4 = peg$FAILED;
|
|
11661
11566
|
if (peg$silentFails === 0) peg$fail(peg$e17);
|
|
@@ -11664,20 +11569,15 @@ function peg$parse(input, options) {
|
|
|
11664
11569
|
s5 = peg$parseHere();
|
|
11665
11570
|
s6 = peg$currPos;
|
|
11666
11571
|
s7 = [];
|
|
11667
|
-
|
|
11668
|
-
if (peg$r6.test(s8)) peg$currPos++;
|
|
11669
|
-
else {
|
|
11670
|
-
s8 = peg$FAILED;
|
|
11671
|
-
if (peg$silentFails === 0) peg$fail(peg$e18);
|
|
11672
|
-
}
|
|
11673
|
-
while (s8 !== peg$FAILED) {
|
|
11674
|
-
s7.push(s8);
|
|
11572
|
+
for (;;) {
|
|
11675
11573
|
s8 = input.charAt(peg$currPos);
|
|
11676
|
-
if (peg$
|
|
11574
|
+
if (peg$charCode = s8.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 95 || peg$charCode === 46) peg$currPos++;
|
|
11677
11575
|
else {
|
|
11678
11576
|
s8 = peg$FAILED;
|
|
11679
11577
|
if (peg$silentFails === 0) peg$fail(peg$e18);
|
|
11680
11578
|
}
|
|
11579
|
+
if (s8 === peg$FAILED) break;
|
|
11580
|
+
s7.push(s8);
|
|
11681
11581
|
}
|
|
11682
11582
|
s6 = input.substring(s6, peg$currPos);
|
|
11683
11583
|
s7 = peg$parseBraceEnd();
|
|
@@ -11717,7 +11617,7 @@ function peg$parse(input, options) {
|
|
|
11717
11617
|
s5 = peg$currPos;
|
|
11718
11618
|
peg$silentFails++;
|
|
11719
11619
|
s6 = input.charAt(peg$currPos);
|
|
11720
|
-
if (peg$
|
|
11620
|
+
if (peg$charCode = s6.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37 || peg$charCode === 40 || peg$charCode === 33) peg$currPos++;
|
|
11721
11621
|
else {
|
|
11722
11622
|
s6 = peg$FAILED;
|
|
11723
11623
|
if (peg$silentFails === 0) peg$fail(peg$e20);
|
|
@@ -11769,7 +11669,7 @@ function peg$parse(input, options) {
|
|
|
11769
11669
|
s3 = peg$currPos;
|
|
11770
11670
|
peg$silentFails++;
|
|
11771
11671
|
s4 = input.charAt(peg$currPos);
|
|
11772
|
-
if (peg$
|
|
11672
|
+
if (peg$charCode = s4.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37 || peg$charCode === 40 || peg$charCode === 33) peg$currPos++;
|
|
11773
11673
|
else {
|
|
11774
11674
|
s4 = peg$FAILED;
|
|
11775
11675
|
if (peg$silentFails === 0) peg$fail(peg$e20);
|
|
@@ -12034,27 +11934,22 @@ function peg$parse(input, options) {
|
|
|
12034
11934
|
s0 = peg$currPos;
|
|
12035
11935
|
s1 = peg$currPos;
|
|
12036
11936
|
s2 = input.charAt(peg$currPos);
|
|
12037
|
-
if (peg$
|
|
11937
|
+
if (peg$charCode = s2.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90) peg$currPos++;
|
|
12038
11938
|
else {
|
|
12039
11939
|
s2 = peg$FAILED;
|
|
12040
11940
|
if (peg$silentFails === 0) peg$fail(peg$e22);
|
|
12041
11941
|
}
|
|
12042
11942
|
if (s2 !== peg$FAILED) {
|
|
12043
11943
|
s3 = [];
|
|
12044
|
-
|
|
12045
|
-
if (peg$r9.test(s4)) peg$currPos++;
|
|
12046
|
-
else {
|
|
12047
|
-
s4 = peg$FAILED;
|
|
12048
|
-
if (peg$silentFails === 0) peg$fail(peg$e23);
|
|
12049
|
-
}
|
|
12050
|
-
while (s4 !== peg$FAILED) {
|
|
12051
|
-
s3.push(s4);
|
|
11944
|
+
for (;;) {
|
|
12052
11945
|
s4 = input.charAt(peg$currPos);
|
|
12053
|
-
if (peg$
|
|
11946
|
+
if (s4 !== "" && !(peg$charCode = s4.charCodeAt(0), peg$charCode === 32 || peg$charCode === 9 || peg$charCode === 10 || peg$charCode === 13 || peg$charCode === 11 || peg$charCode === 12 || peg$charCode === 160 || peg$charCode === 5760 || peg$charCode >= 8192 && peg$charCode <= 8202 || peg$charCode === 8232 || peg$charCode === 8233 || peg$charCode === 8239 || peg$charCode === 8287 || peg$charCode === 12288 || peg$charCode === 65279 || peg$charCode === 125)) peg$currPos++;
|
|
12054
11947
|
else {
|
|
12055
11948
|
s4 = peg$FAILED;
|
|
12056
11949
|
if (peg$silentFails === 0) peg$fail(peg$e23);
|
|
12057
11950
|
}
|
|
11951
|
+
if (s4 === peg$FAILED) break;
|
|
11952
|
+
s3.push(s4);
|
|
12058
11953
|
}
|
|
12059
11954
|
s2 = [s2, s3];
|
|
12060
11955
|
s1 = s2;
|
|
@@ -12080,22 +11975,17 @@ function peg$parse(input, options) {
|
|
|
12080
11975
|
}
|
|
12081
11976
|
if (s3 !== peg$FAILED) {
|
|
12082
11977
|
s4 = [];
|
|
12083
|
-
|
|
12084
|
-
if (peg$r10.test(s5)) peg$currPos++;
|
|
12085
|
-
else {
|
|
12086
|
-
s5 = peg$FAILED;
|
|
12087
|
-
if (peg$silentFails === 0) peg$fail(peg$e24);
|
|
12088
|
-
}
|
|
12089
|
-
if (s5 !== peg$FAILED) while (s5 !== peg$FAILED) {
|
|
12090
|
-
s4.push(s5);
|
|
11978
|
+
for (;;) {
|
|
12091
11979
|
s5 = input.charAt(peg$currPos);
|
|
12092
|
-
if (peg$
|
|
11980
|
+
if (peg$charCode = s5.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 46 || peg$charCode === 33 || peg$charCode === 35 || peg$charCode === 36 || peg$charCode === 37 || peg$charCode === 38 || peg$charCode === 39 || peg$charCode === 42 || peg$charCode === 43 || peg$charCode === 47 || peg$charCode === 61 || peg$charCode === 63 || peg$charCode === 94 || peg$charCode === 95 || peg$charCode === 96 || peg$charCode === 124 || peg$charCode === 126 || peg$charCode === 45) peg$currPos++;
|
|
12093
11981
|
else {
|
|
12094
11982
|
s5 = peg$FAILED;
|
|
12095
11983
|
if (peg$silentFails === 0) peg$fail(peg$e24);
|
|
12096
11984
|
}
|
|
11985
|
+
if (s5 === peg$FAILED) break;
|
|
11986
|
+
s4.push(s5);
|
|
12097
11987
|
}
|
|
12098
|
-
|
|
11988
|
+
if (s4.length < 1) s4 = peg$FAILED;
|
|
12099
11989
|
if (s4 !== peg$FAILED) {
|
|
12100
11990
|
if (input.charCodeAt(peg$currPos) === 64) {
|
|
12101
11991
|
s5 = peg$c13;
|
|
@@ -12106,22 +11996,17 @@ function peg$parse(input, options) {
|
|
|
12106
11996
|
}
|
|
12107
11997
|
if (s5 !== peg$FAILED) {
|
|
12108
11998
|
s6 = [];
|
|
12109
|
-
|
|
12110
|
-
if (peg$r11.test(s7)) peg$currPos++;
|
|
12111
|
-
else {
|
|
12112
|
-
s7 = peg$FAILED;
|
|
12113
|
-
if (peg$silentFails === 0) peg$fail(peg$e26);
|
|
12114
|
-
}
|
|
12115
|
-
if (s7 !== peg$FAILED) while (s7 !== peg$FAILED) {
|
|
12116
|
-
s6.push(s7);
|
|
11999
|
+
for (;;) {
|
|
12117
12000
|
s7 = input.charAt(peg$currPos);
|
|
12118
|
-
if (peg$
|
|
12001
|
+
if (peg$charCode = s7.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 46 || peg$charCode === 45) peg$currPos++;
|
|
12119
12002
|
else {
|
|
12120
12003
|
s7 = peg$FAILED;
|
|
12121
12004
|
if (peg$silentFails === 0) peg$fail(peg$e26);
|
|
12122
12005
|
}
|
|
12006
|
+
if (s7 === peg$FAILED) break;
|
|
12007
|
+
s6.push(s7);
|
|
12123
12008
|
}
|
|
12124
|
-
|
|
12009
|
+
if (s6.length < 1) s6 = peg$FAILED;
|
|
12125
12010
|
if (s6 !== peg$FAILED) {
|
|
12126
12011
|
if (input.charCodeAt(peg$currPos) === 62) {
|
|
12127
12012
|
s7 = peg$c1;
|
|
@@ -12193,7 +12078,7 @@ function peg$parse(input, options) {
|
|
|
12193
12078
|
}
|
|
12194
12079
|
if (s3 !== peg$FAILED) {
|
|
12195
12080
|
s4 = input.charAt(peg$currPos);
|
|
12196
|
-
if (peg$
|
|
12081
|
+
if (peg$charCode = s4.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90) peg$currPos++;
|
|
12197
12082
|
else {
|
|
12198
12083
|
s4 = peg$FAILED;
|
|
12199
12084
|
if (peg$silentFails === 0) peg$fail(peg$e22);
|
|
@@ -12202,7 +12087,7 @@ function peg$parse(input, options) {
|
|
|
12202
12087
|
s5 = peg$currPos;
|
|
12203
12088
|
s6 = [];
|
|
12204
12089
|
s7 = input.charAt(peg$currPos);
|
|
12205
|
-
if (peg$
|
|
12090
|
+
if (peg$charCode = s7.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 43 || peg$charCode === 46 || peg$charCode === 45) peg$currPos++;
|
|
12206
12091
|
else {
|
|
12207
12092
|
s7 = peg$FAILED;
|
|
12208
12093
|
if (peg$silentFails === 0) peg$fail(peg$e27);
|
|
@@ -12212,7 +12097,7 @@ function peg$parse(input, options) {
|
|
|
12212
12097
|
if (s6.length >= 31) s7 = peg$FAILED;
|
|
12213
12098
|
else {
|
|
12214
12099
|
s7 = input.charAt(peg$currPos);
|
|
12215
|
-
if (peg$
|
|
12100
|
+
if (peg$charCode = s7.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 43 || peg$charCode === 46 || peg$charCode === 45) peg$currPos++;
|
|
12216
12101
|
else {
|
|
12217
12102
|
s7 = peg$FAILED;
|
|
12218
12103
|
if (peg$silentFails === 0) peg$fail(peg$e27);
|
|
@@ -12233,42 +12118,7 @@ function peg$parse(input, options) {
|
|
|
12233
12118
|
}
|
|
12234
12119
|
if (s6 !== peg$FAILED) {
|
|
12235
12120
|
s7 = [];
|
|
12236
|
-
|
|
12237
|
-
s9 = peg$currPos;
|
|
12238
|
-
peg$silentFails++;
|
|
12239
|
-
if (input.substr(peg$currPos, 2) === peg$c8) {
|
|
12240
|
-
s10 = peg$c8;
|
|
12241
|
-
peg$currPos += 2;
|
|
12242
|
-
} else {
|
|
12243
|
-
s10 = peg$FAILED;
|
|
12244
|
-
if (peg$silentFails === 0) peg$fail(peg$e12);
|
|
12245
|
-
}
|
|
12246
|
-
peg$silentFails--;
|
|
12247
|
-
if (s10 === peg$FAILED) s9 = void 0;
|
|
12248
|
-
else {
|
|
12249
|
-
peg$currPos = s9;
|
|
12250
|
-
s9 = peg$FAILED;
|
|
12251
|
-
}
|
|
12252
|
-
if (s9 !== peg$FAILED) {
|
|
12253
|
-
s10 = input.charAt(peg$currPos);
|
|
12254
|
-
if (peg$r13.test(s10)) peg$currPos++;
|
|
12255
|
-
else {
|
|
12256
|
-
s10 = peg$FAILED;
|
|
12257
|
-
if (peg$silentFails === 0) peg$fail(peg$e29);
|
|
12258
|
-
}
|
|
12259
|
-
if (s10 !== peg$FAILED) {
|
|
12260
|
-
s9 = [s9, s10];
|
|
12261
|
-
s8 = s9;
|
|
12262
|
-
} else {
|
|
12263
|
-
peg$currPos = s8;
|
|
12264
|
-
s8 = peg$FAILED;
|
|
12265
|
-
}
|
|
12266
|
-
} else {
|
|
12267
|
-
peg$currPos = s8;
|
|
12268
|
-
s8 = peg$FAILED;
|
|
12269
|
-
}
|
|
12270
|
-
while (s8 !== peg$FAILED) {
|
|
12271
|
-
s7.push(s8);
|
|
12121
|
+
for (;;) {
|
|
12272
12122
|
s8 = peg$currPos;
|
|
12273
12123
|
s9 = peg$currPos;
|
|
12274
12124
|
peg$silentFails++;
|
|
@@ -12287,7 +12137,7 @@ function peg$parse(input, options) {
|
|
|
12287
12137
|
}
|
|
12288
12138
|
if (s9 !== peg$FAILED) {
|
|
12289
12139
|
s10 = input.charAt(peg$currPos);
|
|
12290
|
-
if (peg$
|
|
12140
|
+
if (s10 !== "" && !(peg$charCode = s10.charCodeAt(0), peg$charCode >= 0 && peg$charCode <= 32 || peg$charCode === 127 || peg$charCode === 60 || peg$charCode === 62 || peg$charCode === 123 || peg$charCode === 125)) peg$currPos++;
|
|
12291
12141
|
else {
|
|
12292
12142
|
s10 = peg$FAILED;
|
|
12293
12143
|
if (peg$silentFails === 0) peg$fail(peg$e29);
|
|
@@ -12303,6 +12153,8 @@ function peg$parse(input, options) {
|
|
|
12303
12153
|
peg$currPos = s8;
|
|
12304
12154
|
s8 = peg$FAILED;
|
|
12305
12155
|
}
|
|
12156
|
+
if (s8 === peg$FAILED) break;
|
|
12157
|
+
s7.push(s8);
|
|
12306
12158
|
}
|
|
12307
12159
|
if (input.charCodeAt(peg$currPos) === 62) {
|
|
12308
12160
|
s8 = peg$c1;
|
|
@@ -12365,10 +12217,10 @@ function peg$parse(input, options) {
|
|
|
12365
12217
|
s3 = peg$parseTagName();
|
|
12366
12218
|
if (s3 !== peg$FAILED) {
|
|
12367
12219
|
s4 = [];
|
|
12368
|
-
|
|
12369
|
-
while (s5 !== peg$FAILED) {
|
|
12370
|
-
s4.push(s5);
|
|
12220
|
+
for (;;) {
|
|
12371
12221
|
s5 = peg$parseAttribute();
|
|
12222
|
+
if (s5 === peg$FAILED) break;
|
|
12223
|
+
s4.push(s5);
|
|
12372
12224
|
}
|
|
12373
12225
|
s5 = peg$parse_();
|
|
12374
12226
|
if (input.charCodeAt(peg$currPos) === 47) {
|
|
@@ -12417,7 +12269,7 @@ function peg$parse(input, options) {
|
|
|
12417
12269
|
s3 = peg$currPos;
|
|
12418
12270
|
peg$silentFails++;
|
|
12419
12271
|
s4 = input.charAt(peg$currPos);
|
|
12420
|
-
if (peg$
|
|
12272
|
+
if (peg$charCode = s4.charCodeAt(0), peg$charCode >= 9 && peg$charCode <= 13 || peg$charCode === 32 || peg$charCode === 47 || peg$charCode === 62 || peg$charCode === 160 || peg$charCode === 5760 || peg$charCode >= 8192 && peg$charCode <= 8202 || peg$charCode >= 8232 && peg$charCode <= 8233 || peg$charCode === 8239 || peg$charCode === 8287 || peg$charCode === 12288 || peg$charCode === 65279) peg$currPos++;
|
|
12421
12273
|
else {
|
|
12422
12274
|
s4 = peg$FAILED;
|
|
12423
12275
|
if (peg$silentFails === 0) peg$fail(peg$e30);
|
|
@@ -12446,10 +12298,10 @@ function peg$parse(input, options) {
|
|
|
12446
12298
|
} else s3 = peg$FAILED;
|
|
12447
12299
|
if (s3 !== peg$FAILED) {
|
|
12448
12300
|
s4 = [];
|
|
12449
|
-
|
|
12450
|
-
while (s5 !== peg$FAILED) {
|
|
12451
|
-
s4.push(s5);
|
|
12301
|
+
for (;;) {
|
|
12452
12302
|
s5 = peg$parseAttribute();
|
|
12303
|
+
if (s5 === peg$FAILED) break;
|
|
12304
|
+
s4.push(s5);
|
|
12453
12305
|
}
|
|
12454
12306
|
s5 = peg$parse_();
|
|
12455
12307
|
s6 = peg$parseHere();
|
|
@@ -12514,27 +12366,22 @@ function peg$parse(input, options) {
|
|
|
12514
12366
|
s0 = peg$currPos;
|
|
12515
12367
|
s1 = peg$currPos;
|
|
12516
12368
|
s2 = input.charAt(peg$currPos);
|
|
12517
|
-
if (peg$
|
|
12369
|
+
if (peg$charCode = s2.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90) peg$currPos++;
|
|
12518
12370
|
else {
|
|
12519
12371
|
s2 = peg$FAILED;
|
|
12520
12372
|
if (peg$silentFails === 0) peg$fail(peg$e22);
|
|
12521
12373
|
}
|
|
12522
12374
|
if (s2 !== peg$FAILED) {
|
|
12523
12375
|
s3 = [];
|
|
12524
|
-
|
|
12525
|
-
if (peg$r15.test(s4)) peg$currPos++;
|
|
12526
|
-
else {
|
|
12527
|
-
s4 = peg$FAILED;
|
|
12528
|
-
if (peg$silentFails === 0) peg$fail(peg$e32);
|
|
12529
|
-
}
|
|
12530
|
-
while (s4 !== peg$FAILED) {
|
|
12531
|
-
s3.push(s4);
|
|
12376
|
+
for (;;) {
|
|
12532
12377
|
s4 = input.charAt(peg$currPos);
|
|
12533
|
-
if (peg$
|
|
12378
|
+
if (peg$charCode = s4.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90 || peg$charCode >= 48 && peg$charCode <= 57 || peg$charCode === 45) peg$currPos++;
|
|
12534
12379
|
else {
|
|
12535
12380
|
s4 = peg$FAILED;
|
|
12536
12381
|
if (peg$silentFails === 0) peg$fail(peg$e32);
|
|
12537
12382
|
}
|
|
12383
|
+
if (s4 === peg$FAILED) break;
|
|
12384
|
+
s3.push(s4);
|
|
12538
12385
|
}
|
|
12539
12386
|
s2 = [s2, s3];
|
|
12540
12387
|
s1 = s2;
|
|
@@ -12553,47 +12400,12 @@ function peg$parse(input, options) {
|
|
|
12553
12400
|
s2 = peg$parseHere();
|
|
12554
12401
|
s3 = peg$currPos;
|
|
12555
12402
|
s4 = [];
|
|
12556
|
-
|
|
12557
|
-
s6 = peg$currPos;
|
|
12558
|
-
peg$silentFails++;
|
|
12559
|
-
s7 = input.charAt(peg$currPos);
|
|
12560
|
-
if (peg$r16.test(s7)) peg$currPos++;
|
|
12561
|
-
else {
|
|
12562
|
-
s7 = peg$FAILED;
|
|
12563
|
-
if (peg$silentFails === 0) peg$fail(peg$e33);
|
|
12564
|
-
}
|
|
12565
|
-
peg$silentFails--;
|
|
12566
|
-
if (s7 === peg$FAILED) s6 = void 0;
|
|
12567
|
-
else {
|
|
12568
|
-
peg$currPos = s6;
|
|
12569
|
-
s6 = peg$FAILED;
|
|
12570
|
-
}
|
|
12571
|
-
if (s6 !== peg$FAILED) {
|
|
12572
|
-
if (input.length > peg$currPos) {
|
|
12573
|
-
s7 = input.charAt(peg$currPos);
|
|
12574
|
-
peg$currPos++;
|
|
12575
|
-
} else {
|
|
12576
|
-
s7 = peg$FAILED;
|
|
12577
|
-
if (peg$silentFails === 0) peg$fail(peg$e0);
|
|
12578
|
-
}
|
|
12579
|
-
if (s7 !== peg$FAILED) {
|
|
12580
|
-
s6 = [s6, s7];
|
|
12581
|
-
s5 = s6;
|
|
12582
|
-
} else {
|
|
12583
|
-
peg$currPos = s5;
|
|
12584
|
-
s5 = peg$FAILED;
|
|
12585
|
-
}
|
|
12586
|
-
} else {
|
|
12587
|
-
peg$currPos = s5;
|
|
12588
|
-
s5 = peg$FAILED;
|
|
12589
|
-
}
|
|
12590
|
-
if (s5 !== peg$FAILED) while (s5 !== peg$FAILED) {
|
|
12591
|
-
s4.push(s5);
|
|
12403
|
+
for (;;) {
|
|
12592
12404
|
s5 = peg$currPos;
|
|
12593
12405
|
s6 = peg$currPos;
|
|
12594
12406
|
peg$silentFails++;
|
|
12595
12407
|
s7 = input.charAt(peg$currPos);
|
|
12596
|
-
if (peg$
|
|
12408
|
+
if (peg$charCode = s7.charCodeAt(0), peg$charCode >= 9 && peg$charCode <= 13 || peg$charCode === 32 || peg$charCode === 34 || peg$charCode === 39 || peg$charCode === 47 || peg$charCode >= 60 && peg$charCode <= 62 || peg$charCode === 123 || peg$charCode === 125 || peg$charCode === 160 || peg$charCode === 5760 || peg$charCode >= 8192 && peg$charCode <= 8202 || peg$charCode >= 8232 && peg$charCode <= 8233 || peg$charCode === 8239 || peg$charCode === 8287 || peg$charCode === 12288 || peg$charCode === 65279) peg$currPos++;
|
|
12597
12409
|
else {
|
|
12598
12410
|
s7 = peg$FAILED;
|
|
12599
12411
|
if (peg$silentFails === 0) peg$fail(peg$e33);
|
|
@@ -12623,8 +12435,10 @@ function peg$parse(input, options) {
|
|
|
12623
12435
|
peg$currPos = s5;
|
|
12624
12436
|
s5 = peg$FAILED;
|
|
12625
12437
|
}
|
|
12438
|
+
if (s5 === peg$FAILED) break;
|
|
12439
|
+
s4.push(s5);
|
|
12626
12440
|
}
|
|
12627
|
-
|
|
12441
|
+
if (s4.length < 1) s4 = peg$FAILED;
|
|
12628
12442
|
if (s4 !== peg$FAILED) s3 = input.substring(s3, peg$currPos);
|
|
12629
12443
|
else s3 = s4;
|
|
12630
12444
|
if (s3 !== peg$FAILED) {
|
|
@@ -12683,26 +12497,18 @@ function peg$parse(input, options) {
|
|
|
12683
12497
|
s2 = peg$parseHere();
|
|
12684
12498
|
s3 = peg$currPos;
|
|
12685
12499
|
s4 = [];
|
|
12686
|
-
|
|
12687
|
-
if (s5 === peg$FAILED) {
|
|
12688
|
-
s5 = input.charAt(peg$currPos);
|
|
12689
|
-
if (peg$r17.test(s5)) peg$currPos++;
|
|
12690
|
-
else {
|
|
12691
|
-
s5 = peg$FAILED;
|
|
12692
|
-
if (peg$silentFails === 0) peg$fail(peg$e36);
|
|
12693
|
-
}
|
|
12694
|
-
}
|
|
12695
|
-
while (s5 !== peg$FAILED) {
|
|
12696
|
-
s4.push(s5);
|
|
12500
|
+
for (;;) {
|
|
12697
12501
|
s5 = peg$parseValuePart();
|
|
12698
12502
|
if (s5 === peg$FAILED) {
|
|
12699
12503
|
s5 = input.charAt(peg$currPos);
|
|
12700
|
-
if (peg$
|
|
12504
|
+
if (s5 !== "" && !(peg$charCode = s5.charCodeAt(0), peg$charCode === 34)) peg$currPos++;
|
|
12701
12505
|
else {
|
|
12702
12506
|
s5 = peg$FAILED;
|
|
12703
12507
|
if (peg$silentFails === 0) peg$fail(peg$e36);
|
|
12704
12508
|
}
|
|
12705
12509
|
}
|
|
12510
|
+
if (s5 === peg$FAILED) break;
|
|
12511
|
+
s4.push(s5);
|
|
12706
12512
|
}
|
|
12707
12513
|
s3 = input.substring(s3, peg$currPos);
|
|
12708
12514
|
s4 = peg$parseHere();
|
|
@@ -12738,26 +12544,18 @@ function peg$parse(input, options) {
|
|
|
12738
12544
|
s2 = peg$parseHere();
|
|
12739
12545
|
s3 = peg$currPos;
|
|
12740
12546
|
s4 = [];
|
|
12741
|
-
|
|
12742
|
-
if (s5 === peg$FAILED) {
|
|
12743
|
-
s5 = input.charAt(peg$currPos);
|
|
12744
|
-
if (peg$r18.test(s5)) peg$currPos++;
|
|
12745
|
-
else {
|
|
12746
|
-
s5 = peg$FAILED;
|
|
12747
|
-
if (peg$silentFails === 0) peg$fail(peg$e38);
|
|
12748
|
-
}
|
|
12749
|
-
}
|
|
12750
|
-
while (s5 !== peg$FAILED) {
|
|
12751
|
-
s4.push(s5);
|
|
12547
|
+
for (;;) {
|
|
12752
12548
|
s5 = peg$parseValuePart();
|
|
12753
12549
|
if (s5 === peg$FAILED) {
|
|
12754
12550
|
s5 = input.charAt(peg$currPos);
|
|
12755
|
-
if (peg$
|
|
12551
|
+
if (s5 !== "" && !(peg$charCode = s5.charCodeAt(0), peg$charCode === 39)) peg$currPos++;
|
|
12756
12552
|
else {
|
|
12757
12553
|
s5 = peg$FAILED;
|
|
12758
12554
|
if (peg$silentFails === 0) peg$fail(peg$e38);
|
|
12759
12555
|
}
|
|
12760
12556
|
}
|
|
12557
|
+
if (s5 === peg$FAILED) break;
|
|
12558
|
+
s4.push(s5);
|
|
12761
12559
|
}
|
|
12762
12560
|
s3 = input.substring(s3, peg$currPos);
|
|
12763
12561
|
s4 = peg$parseHere();
|
|
@@ -12783,7 +12581,7 @@ function peg$parse(input, options) {
|
|
|
12783
12581
|
if (s0 === peg$FAILED) {
|
|
12784
12582
|
s0 = peg$currPos;
|
|
12785
12583
|
s1 = input.charAt(peg$currPos);
|
|
12786
|
-
if (peg$
|
|
12584
|
+
if (peg$charCode = s1.charCodeAt(0), peg$charCode === 34 || peg$charCode === 39) peg$currPos++;
|
|
12787
12585
|
else {
|
|
12788
12586
|
s1 = peg$FAILED;
|
|
12789
12587
|
if (peg$silentFails === 0) peg$fail(peg$e39);
|
|
@@ -12798,20 +12596,15 @@ function peg$parse(input, options) {
|
|
|
12798
12596
|
s1 = peg$parseHere();
|
|
12799
12597
|
s2 = peg$currPos;
|
|
12800
12598
|
s3 = [];
|
|
12801
|
-
|
|
12802
|
-
if (peg$r20.test(s4)) peg$currPos++;
|
|
12803
|
-
else {
|
|
12804
|
-
s4 = peg$FAILED;
|
|
12805
|
-
if (peg$silentFails === 0) peg$fail(peg$e40);
|
|
12806
|
-
}
|
|
12807
|
-
while (s4 !== peg$FAILED) {
|
|
12808
|
-
s3.push(s4);
|
|
12599
|
+
for (;;) {
|
|
12809
12600
|
s4 = input.charAt(peg$currPos);
|
|
12810
|
-
if (peg$
|
|
12601
|
+
if (s4 !== "" && !(peg$charCode = s4.charCodeAt(0), peg$charCode === 32 || peg$charCode === 9 || peg$charCode === 10 || peg$charCode === 13 || peg$charCode === 11 || peg$charCode === 12 || peg$charCode === 160 || peg$charCode === 5760 || peg$charCode >= 8192 && peg$charCode <= 8202 || peg$charCode === 8232 || peg$charCode === 8233 || peg$charCode === 8239 || peg$charCode === 8287 || peg$charCode === 12288 || peg$charCode === 65279 || peg$charCode === 62)) peg$currPos++;
|
|
12811
12602
|
else {
|
|
12812
12603
|
s4 = peg$FAILED;
|
|
12813
12604
|
if (peg$silentFails === 0) peg$fail(peg$e40);
|
|
12814
12605
|
}
|
|
12606
|
+
if (s4 === peg$FAILED) break;
|
|
12607
|
+
s3.push(s4);
|
|
12815
12608
|
}
|
|
12816
12609
|
s2 = input.substring(s2, peg$currPos);
|
|
12817
12610
|
s3 = peg$parseHere();
|
|
@@ -12832,15 +12625,7 @@ function peg$parse(input, options) {
|
|
|
12832
12625
|
if (s1 !== peg$FAILED) {
|
|
12833
12626
|
s2 = peg$currPos;
|
|
12834
12627
|
s3 = [];
|
|
12835
|
-
|
|
12836
|
-
s4 = peg$c4;
|
|
12837
|
-
peg$currPos++;
|
|
12838
|
-
} else {
|
|
12839
|
-
s4 = peg$FAILED;
|
|
12840
|
-
if (peg$silentFails === 0) peg$fail(peg$e6);
|
|
12841
|
-
}
|
|
12842
|
-
if (s4 !== peg$FAILED) while (s4 !== peg$FAILED) {
|
|
12843
|
-
s3.push(s4);
|
|
12628
|
+
for (;;) {
|
|
12844
12629
|
if (input.charCodeAt(peg$currPos) === 92) {
|
|
12845
12630
|
s4 = peg$c4;
|
|
12846
12631
|
peg$currPos++;
|
|
@@ -12848,8 +12633,10 @@ function peg$parse(input, options) {
|
|
|
12848
12633
|
s4 = peg$FAILED;
|
|
12849
12634
|
if (peg$silentFails === 0) peg$fail(peg$e6);
|
|
12850
12635
|
}
|
|
12636
|
+
if (s4 === peg$FAILED) break;
|
|
12637
|
+
s3.push(s4);
|
|
12851
12638
|
}
|
|
12852
|
-
|
|
12639
|
+
if (s3.length < 1) s3 = peg$FAILED;
|
|
12853
12640
|
if (s3 !== peg$FAILED) s2 = input.substring(s2, peg$currPos);
|
|
12854
12641
|
else s2 = s3;
|
|
12855
12642
|
if (s2 !== peg$FAILED) {
|
|
@@ -12860,7 +12647,7 @@ function peg$parse(input, options) {
|
|
|
12860
12647
|
else s4 = peg$FAILED;
|
|
12861
12648
|
if (s4 !== peg$FAILED) {
|
|
12862
12649
|
s5 = input.charAt(peg$currPos);
|
|
12863
|
-
if (peg$
|
|
12650
|
+
if (peg$charCode = s5.charCodeAt(0), peg$charCode === 123 || peg$charCode === 125) peg$currPos++;
|
|
12864
12651
|
else {
|
|
12865
12652
|
s5 = peg$FAILED;
|
|
12866
12653
|
if (peg$silentFails === 0) peg$fail(peg$e7);
|
|
@@ -13028,7 +12815,7 @@ function peg$parse(input, options) {
|
|
|
13028
12815
|
}
|
|
13029
12816
|
if (s6 === peg$FAILED) s6 = null;
|
|
13030
12817
|
s7 = input.charAt(peg$currPos);
|
|
13031
|
-
if (peg$
|
|
12818
|
+
if (peg$charCode = s7.charCodeAt(0), peg$charCode >= 97 && peg$charCode <= 122 || peg$charCode >= 65 && peg$charCode <= 90) peg$currPos++;
|
|
13032
12819
|
else {
|
|
13033
12820
|
s7 = peg$FAILED;
|
|
13034
12821
|
if (peg$silentFails === 0) peg$fail(peg$e22);
|
|
@@ -13102,7 +12889,7 @@ function peg$parse(input, options) {
|
|
|
13102
12889
|
s3 = peg$currPos;
|
|
13103
12890
|
peg$silentFails++;
|
|
13104
12891
|
s4 = input.charAt(peg$currPos);
|
|
13105
|
-
if (peg$
|
|
12892
|
+
if (peg$charCode = s4.charCodeAt(0), peg$charCode === 36 || peg$charCode === 95 || peg$charCode === 64 || peg$charCode === 37) peg$currPos++;
|
|
13106
12893
|
else {
|
|
13107
12894
|
s4 = peg$FAILED;
|
|
13108
12895
|
if (peg$silentFails === 0) peg$fail(peg$e17);
|
|
@@ -13153,17 +12940,17 @@ function peg$parse(input, options) {
|
|
|
13153
12940
|
function peg$parse_() {
|
|
13154
12941
|
let s0, s1;
|
|
13155
12942
|
s0 = [];
|
|
13156
|
-
|
|
13157
|
-
while (s1 !== peg$FAILED) {
|
|
13158
|
-
s0.push(s1);
|
|
12943
|
+
for (;;) {
|
|
13159
12944
|
s1 = peg$parse_c();
|
|
12945
|
+
if (s1 === peg$FAILED) break;
|
|
12946
|
+
s0.push(s1);
|
|
13160
12947
|
}
|
|
13161
12948
|
return s0;
|
|
13162
12949
|
}
|
|
13163
12950
|
function peg$parse_c() {
|
|
13164
12951
|
let s0;
|
|
13165
12952
|
s0 = input.charAt(peg$currPos);
|
|
13166
|
-
if (peg$
|
|
12953
|
+
if (peg$charCode = s0.charCodeAt(0), peg$charCode === 32 || peg$charCode === 9 || peg$charCode === 10 || peg$charCode === 13 || peg$charCode === 11 || peg$charCode === 12 || peg$charCode === 160 || peg$charCode === 5760 || peg$charCode >= 8192 && peg$charCode <= 8202 || peg$charCode === 8232 || peg$charCode === 8233 || peg$charCode === 8239 || peg$charCode === 8287 || peg$charCode === 12288 || peg$charCode === 65279) peg$currPos++;
|
|
13167
12954
|
else {
|
|
13168
12955
|
s0 = peg$FAILED;
|
|
13169
12956
|
if (peg$silentFails === 0) peg$fail(peg$e41);
|
|
@@ -16688,6 +16475,53 @@ function unclosedHtml(text) {
|
|
|
16688
16475
|
}
|
|
16689
16476
|
} } };
|
|
16690
16477
|
}
|
|
16478
|
+
// src/markup/html-integration.tsx
|
|
16479
|
+
function isHtmlEncoding(value) {
|
|
16480
|
+
return typeof value === "string" && /^(?:text\/html|application\/xhtml\+xml)$/i.test(value);
|
|
16481
|
+
}
|
|
16482
|
+
function authorElement(tag, attributes, children, math) {
|
|
16483
|
+
return math && tag === "annotation-xml" ? /* @__PURE__ */ jsx(HtmlAnnotation, {
|
|
16484
|
+
attributes,
|
|
16485
|
+
children
|
|
16486
|
+
}, attributes.key) : h(tag, attributes, children);
|
|
16487
|
+
}
|
|
16488
|
+
/**
|
|
16489
|
+
* Preact handles MathML text integration points, but does not yet switch the
|
|
16490
|
+
* namespace for HTML-encoded annotation-xml. A portal's container can supply
|
|
16491
|
+
* that namespace without adding a wrapper or changing the MathML element.
|
|
16492
|
+
*/
|
|
16493
|
+
function HtmlAnnotation({ attributes, children }) {
|
|
16494
|
+
const elementRef = useRef(null);
|
|
16495
|
+
const [container, setContainer] = useState(null);
|
|
16496
|
+
useLayoutEffect(() => {
|
|
16497
|
+
const element = elementRef.current;
|
|
16498
|
+
setContainer({
|
|
16499
|
+
nodeType: 1,
|
|
16500
|
+
namespaceURI: "http://www.w3.org/1999/xhtml",
|
|
16501
|
+
ownerDocument: element.ownerDocument,
|
|
16502
|
+
get parentNode() {
|
|
16503
|
+
return element.parentNode;
|
|
16504
|
+
},
|
|
16505
|
+
get firstChild() {
|
|
16506
|
+
return element.firstChild;
|
|
16507
|
+
},
|
|
16508
|
+
get childNodes() {
|
|
16509
|
+
return element.childNodes;
|
|
16510
|
+
},
|
|
16511
|
+
insertBefore: element.insertBefore.bind(element),
|
|
16512
|
+
appendChild: element.appendChild.bind(element),
|
|
16513
|
+
removeChild: element.removeChild.bind(element)
|
|
16514
|
+
});
|
|
16515
|
+
}, []);
|
|
16516
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [h("annotation-xml", {
|
|
16517
|
+
...attributes,
|
|
16518
|
+
ref: (element) => {
|
|
16519
|
+
elementRef.current = element;
|
|
16520
|
+
const forwarded = attributes.ref;
|
|
16521
|
+
if (forwarded) forwarded.current = element;
|
|
16522
|
+
}
|
|
16523
|
+
}, isHtmlEncoding(attributes.encoding) ? void 0 : children), container && isHtmlEncoding(attributes.encoding) && createPortal(children, container)] });
|
|
16524
|
+
}
|
|
16691
16525
|
// src/markup/render.tsx
|
|
16692
16526
|
var defaultUpdater = {
|
|
16693
16527
|
update: (key) => {
|
|
@@ -16714,7 +16548,7 @@ var InlineContext = createContext(false);
|
|
|
16714
16548
|
*/
|
|
16715
16549
|
var StructuralContext = createContext(false);
|
|
16716
16550
|
/**
|
|
16717
|
-
* True while rendering inside an element whose content is not markdown: SVG
|
|
16551
|
+
* True while rendering inside an element whose content is not markdown: SVG/MathML
|
|
16718
16552
|
* (whose namespace `<p>` wrappers would break) and the preformatted `<pre>`
|
|
16719
16553
|
* `<textarea>`, `<style>` and `<script>`, whose text is literal.
|
|
16720
16554
|
* Macro and widget bodies read it so their content stays literal too.
|
|
@@ -16734,11 +16568,19 @@ function useViewScope() {
|
|
|
16734
16568
|
return useState(() => `v${++viewScopes}`)[0];
|
|
16735
16569
|
}
|
|
16736
16570
|
/**
|
|
16737
|
-
*
|
|
16738
|
-
*
|
|
16571
|
+
* The foreign namespace containing author elements. SVG and MathML attributes
|
|
16572
|
+
* are case-sensitive and have no live HTML form properties.
|
|
16739
16573
|
*/
|
|
16740
|
-
var
|
|
16574
|
+
var ForeignContext = createContext(void 0);
|
|
16741
16575
|
var SVG_NAMESPACE = "http://www.w3.org/2000/svg";
|
|
16576
|
+
var MATH_NAMESPACE = "http://www.w3.org/1998/Math/MathML";
|
|
16577
|
+
var MATH_TEXT_ELEMENTS = /* @__PURE__ */ new Set([
|
|
16578
|
+
"mi",
|
|
16579
|
+
"mo",
|
|
16580
|
+
"mn",
|
|
16581
|
+
"ms",
|
|
16582
|
+
"mtext"
|
|
16583
|
+
]);
|
|
16742
16584
|
/**
|
|
16743
16585
|
* Elements whose children must be elements of particular types: markdown
|
|
16744
16586
|
* paragraphs between them would pull the children out of the structure (#423).
|
|
@@ -16808,7 +16650,7 @@ function expandPlaceholderText(text, ph) {
|
|
|
16808
16650
|
* evaluated as text against the store and locals, so it follows its
|
|
16809
16651
|
* variables as the component would.
|
|
16810
16652
|
*/
|
|
16811
|
-
function PlaceholderAttributes({ tag, attributes, placeholders,
|
|
16653
|
+
function PlaceholderAttributes({ tag, attributes, placeholders, foreign, math, children }) {
|
|
16812
16654
|
const scope = useTextScope();
|
|
16813
16655
|
const errors = [];
|
|
16814
16656
|
const { props, direct } = splitAttributes(attributes.map(([name, value, written]) => {
|
|
@@ -16827,20 +16669,20 @@ function PlaceholderAttributes({ tag, attributes, placeholders, svg, children })
|
|
|
16827
16669
|
written,
|
|
16828
16670
|
true
|
|
16829
16671
|
];
|
|
16830
|
-
}),
|
|
16672
|
+
}), foreign, tag);
|
|
16831
16673
|
const ref = useDirectAttributes(direct);
|
|
16832
|
-
return withAttributeErrors(errors,
|
|
16674
|
+
return withAttributeErrors(errors, authorElement(tag, ref ? {
|
|
16833
16675
|
...props,
|
|
16834
16676
|
ref
|
|
16835
|
-
} : props, children));
|
|
16677
|
+
} : props, children, math));
|
|
16836
16678
|
}
|
|
16837
16679
|
/** An element of markdown output with attributes to set directly. */
|
|
16838
|
-
function DirectAttributes({ tag, props, direct, children }) {
|
|
16680
|
+
function DirectAttributes({ tag, props, direct, math, children }) {
|
|
16839
16681
|
const ref = useDirectAttributes(direct);
|
|
16840
|
-
return
|
|
16682
|
+
return authorElement(tag, {
|
|
16841
16683
|
...props,
|
|
16842
16684
|
ref
|
|
16843
|
-
}, children);
|
|
16685
|
+
}, children, math);
|
|
16844
16686
|
}
|
|
16845
16687
|
/**
|
|
16846
16688
|
* Show the errors met in an element's attributes in front of it, the way a
|
|
@@ -16898,7 +16740,7 @@ function convertDomNode(node, key, ph) {
|
|
|
16898
16740
|
const tag = el.localName;
|
|
16899
16741
|
const idx = placeholderIndex(el, ph);
|
|
16900
16742
|
if (idx !== -1) return ph.components[idx];
|
|
16901
|
-
const
|
|
16743
|
+
const foreign = el.namespaceURI === SVG_NAMESPACE || el.namespaceURI === MATH_NAMESPACE;
|
|
16902
16744
|
const attributes = [];
|
|
16903
16745
|
let placeholders;
|
|
16904
16746
|
for (const { name, value } of Array.from(el.attributes)) {
|
|
@@ -16921,20 +16763,22 @@ function convertDomNode(node, key, ph) {
|
|
|
16921
16763
|
tag,
|
|
16922
16764
|
attributes,
|
|
16923
16765
|
placeholders,
|
|
16924
|
-
|
|
16766
|
+
foreign,
|
|
16767
|
+
math: el.namespaceURI === MATH_NAMESPACE,
|
|
16925
16768
|
children
|
|
16926
16769
|
}, key);
|
|
16927
|
-
const { props, direct } = splitAttributes(attributes,
|
|
16770
|
+
const { props, direct } = splitAttributes(attributes, foreign, tag);
|
|
16928
16771
|
if (direct.length > 0) return /* @__PURE__ */ jsx(DirectAttributes, {
|
|
16929
16772
|
tag,
|
|
16930
16773
|
props,
|
|
16931
16774
|
direct,
|
|
16775
|
+
math: el.namespaceURI === MATH_NAMESPACE,
|
|
16932
16776
|
children
|
|
16933
16777
|
}, key);
|
|
16934
|
-
return
|
|
16778
|
+
return authorElement(tag, {
|
|
16935
16779
|
...props,
|
|
16936
16780
|
key
|
|
16937
|
-
}, children);
|
|
16781
|
+
}, children, el.namespaceURI === MATH_NAMESPACE);
|
|
16938
16782
|
}
|
|
16939
16783
|
return null;
|
|
16940
16784
|
}
|
|
@@ -17043,7 +16887,7 @@ var BOOLEAN_ATTRIBUTES = /* @__PURE__ */ new Set([
|
|
|
17043
16887
|
"selected"
|
|
17044
16888
|
]);
|
|
17045
16889
|
/** Names set directly on SVG elements (see splitAttributes). */
|
|
17046
|
-
var
|
|
16890
|
+
var FOREIGN_DIRECT = /* @__PURE__ */ new Set([
|
|
17047
16891
|
.../* @__PURE__ */ new Set([
|
|
17048
16892
|
"key",
|
|
17049
16893
|
"ref",
|
|
@@ -17096,18 +16940,18 @@ function isNativeDefault(tag, name) {
|
|
|
17096
16940
|
* and `className` compat rewrites (dropping an empty `class`, turning
|
|
17097
16941
|
* `className` into `class`) are set directly instead.
|
|
17098
16942
|
*/
|
|
17099
|
-
function splitAttributes(attributes,
|
|
16943
|
+
function splitAttributes(attributes, foreign, tag) {
|
|
17100
16944
|
const props = {};
|
|
17101
16945
|
const direct = [];
|
|
17102
16946
|
const defaults = [];
|
|
17103
16947
|
for (const [name, value, written, bound] of attributes) {
|
|
17104
16948
|
const lower = name.toLowerCase();
|
|
17105
16949
|
if (BOOLEAN_ATTRIBUTES.has(lower) && written !== "" && value === "") continue;
|
|
17106
|
-
else if (!
|
|
16950
|
+
else if (!foreign && LIVE_PROPERTIES.has(lower)) {
|
|
17107
16951
|
if (!bound && isNativeDefault(tag, lower)) defaults.push([name.toUpperCase(), lower === "value" ? value : ""]);
|
|
17108
16952
|
else props[lower] = lower !== "value" && written === "" ? true : value;
|
|
17109
|
-
} else if (!SETTABLE_NAME.test(name) || lower.startsWith("on") || lower === "translate" ||
|
|
17110
|
-
else props[
|
|
16953
|
+
} else if (!SETTABLE_NAME.test(name) || lower.startsWith("on") || lower === "translate" || foreign && (FOREIGN_DIRECT.has(name) || name === "__proto__")) direct.push([name, value]);
|
|
16954
|
+
else props[foreign ? name : name.toUpperCase()] = value;
|
|
17111
16955
|
}
|
|
17112
16956
|
for (const [name, value] of defaults) props[name] = value;
|
|
17113
16957
|
return {
|
|
@@ -17234,19 +17078,23 @@ function leadingPartIndex(tag, nodes) {
|
|
|
17234
17078
|
function HtmlNodeRenderer({ node }) {
|
|
17235
17079
|
const scope = useTextScope();
|
|
17236
17080
|
const { nobr, locals, raw: inRaw, inline: parentInline, structural: parentStructural } = useRenderOptions();
|
|
17237
|
-
const
|
|
17081
|
+
const parentNamespace = useContext(ForeignContext);
|
|
17238
17082
|
const tag = node.tag.toLowerCase();
|
|
17239
|
-
const
|
|
17240
|
-
const isHtmlRoot = inSvg && tag === "foreignobject";
|
|
17241
|
-
const rawContent = inRaw && !isHtmlRoot;
|
|
17242
|
-
const isRawRoot = !inRaw && (isSvgRoot || PREFORMATTED_ELEMENTS.has(tag));
|
|
17083
|
+
const namespace = tag === "svg" || tag === "math" ? tag : parentNamespace;
|
|
17243
17084
|
const errors = [];
|
|
17244
|
-
const
|
|
17085
|
+
const resolved = Object.entries(node.attributes).map(([k, v]) => [
|
|
17245
17086
|
k,
|
|
17246
17087
|
resolveAttributeValue(k, v, scope, errors),
|
|
17247
17088
|
v,
|
|
17248
17089
|
hasInterpolation(v)
|
|
17249
|
-
])
|
|
17090
|
+
]);
|
|
17091
|
+
const htmlAnnotation = namespace === "math" && tag === "annotation-xml" && isHtmlEncoding(resolved.find(([name]) => name === "encoding")?.[1]);
|
|
17092
|
+
const mathText = namespace === "math" && MATH_TEXT_ELEMENTS.has(tag);
|
|
17093
|
+
const isHtmlRoot = namespace === "svg" && tag === "foreignobject" || htmlAnnotation;
|
|
17094
|
+
const childNamespace = isHtmlRoot || mathText ? void 0 : namespace;
|
|
17095
|
+
const rawContent = inRaw && !isHtmlRoot;
|
|
17096
|
+
const isRawRoot = !inRaw && (namespace !== void 0 || PREFORMATTED_ELEMENTS.has(tag));
|
|
17097
|
+
const { props, direct } = splitAttributes(resolved, namespace !== void 0, tag);
|
|
17250
17098
|
const ref = useDirectAttributes(direct);
|
|
17251
17099
|
if (ref) props.ref = ref;
|
|
17252
17100
|
const isInline = INLINE_ELEMENTS.has(tag);
|
|
@@ -17278,18 +17126,18 @@ function HtmlNodeRenderer({ node }) {
|
|
|
17278
17126
|
});
|
|
17279
17127
|
}
|
|
17280
17128
|
}
|
|
17281
|
-
if (isHtmlRoot && children) children = /* @__PURE__ */ jsx(
|
|
17282
|
-
value:
|
|
17129
|
+
if (isHtmlRoot && children) children = /* @__PURE__ */ jsx(ForeignContext.Provider, {
|
|
17130
|
+
value: void 0,
|
|
17283
17131
|
children: /* @__PURE__ */ jsx(RawTextContext.Provider, {
|
|
17284
17132
|
value: false,
|
|
17285
17133
|
children
|
|
17286
17134
|
})
|
|
17287
17135
|
});
|
|
17288
|
-
|
|
17289
|
-
|
|
17290
|
-
|
|
17291
|
-
children: element
|
|
17136
|
+
if (childNamespace !== parentNamespace) children = /* @__PURE__ */ jsx(ForeignContext.Provider, {
|
|
17137
|
+
value: childNamespace,
|
|
17138
|
+
children
|
|
17292
17139
|
});
|
|
17140
|
+
const element = authorElement(node.tag, props, children, namespace === "math");
|
|
17293
17141
|
return withAttributeErrors(errors, isRawRoot ? /* @__PURE__ */ jsx(RawTextContext.Provider, {
|
|
17294
17142
|
value: true,
|
|
17295
17143
|
children: element
|