@rhost/testkit 1.5.1 → 1.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. package/dist/cli/init.d.ts.map +1 -1
  2. package/dist/cli/init.js +4 -1
  3. package/dist/cli/init.js.map +1 -1
  4. package/node_modules/@ursamu/mushcode/.github/workflows/publish.yml +36 -0
  5. package/node_modules/@ursamu/mushcode/LICENSE +21 -0
  6. package/node_modules/@ursamu/mushcode/README.md +110 -0
  7. package/node_modules/@ursamu/mushcode/_dist/mod.d.ts +36 -0
  8. package/node_modules/@ursamu/mushcode/_dist/mod.d.ts.map +1 -0
  9. package/node_modules/@ursamu/mushcode/_dist/parser/mod.d.ts +41 -0
  10. package/node_modules/@ursamu/mushcode/_dist/parser/mod.d.ts.map +1 -0
  11. package/node_modules/@ursamu/mushcode/_dist/src/analyze/commands.d.ts +15 -0
  12. package/node_modules/@ursamu/mushcode/_dist/src/analyze/commands.d.ts.map +1 -0
  13. package/node_modules/@ursamu/mushcode/_dist/src/analyze/deps.d.ts +18 -0
  14. package/node_modules/@ursamu/mushcode/_dist/src/analyze/deps.d.ts.map +1 -0
  15. package/node_modules/@ursamu/mushcode/_dist/src/analyze/mod.d.ts +20 -0
  16. package/node_modules/@ursamu/mushcode/_dist/src/analyze/mod.d.ts.map +1 -0
  17. package/node_modules/@ursamu/mushcode/_dist/src/analyze/tags.d.ts +6 -0
  18. package/node_modules/@ursamu/mushcode/_dist/src/analyze/tags.d.ts.map +1 -0
  19. package/node_modules/@ursamu/mushcode/_dist/src/eval/context.d.ts +85 -0
  20. package/node_modules/@ursamu/mushcode/_dist/src/eval/context.d.ts.map +1 -0
  21. package/node_modules/@ursamu/mushcode/_dist/src/eval/engine.d.ts +48 -0
  22. package/node_modules/@ursamu/mushcode/_dist/src/eval/engine.d.ts.map +1 -0
  23. package/node_modules/@ursamu/mushcode/_dist/src/eval/mod.d.ts +26 -0
  24. package/node_modules/@ursamu/mushcode/_dist/src/eval/mod.d.ts.map +1 -0
  25. package/node_modules/@ursamu/mushcode/_dist/src/eval/stdlib/mod.d.ts +3 -0
  26. package/node_modules/@ursamu/mushcode/_dist/src/eval/stdlib/mod.d.ts.map +1 -0
  27. package/node_modules/@ursamu/mushcode/_dist/src/lint/mod.d.ts +38 -0
  28. package/node_modules/@ursamu/mushcode/_dist/src/lint/mod.d.ts.map +1 -0
  29. package/node_modules/@ursamu/mushcode/_dist/src/print/mod.d.ts +18 -0
  30. package/node_modules/@ursamu/mushcode/_dist/src/print/mod.d.ts.map +1 -0
  31. package/node_modules/@ursamu/mushcode/_dist/src/print/printer.d.ts +15 -0
  32. package/node_modules/@ursamu/mushcode/_dist/src/print/printer.d.ts.map +1 -0
  33. package/node_modules/@ursamu/mushcode/_dist/src/traverse/mod.d.ts +19 -0
  34. package/node_modules/@ursamu/mushcode/_dist/src/traverse/mod.d.ts.map +1 -0
  35. package/node_modules/@ursamu/mushcode/_dist/src/traverse/transform.d.ts +27 -0
  36. package/node_modules/@ursamu/mushcode/_dist/src/traverse/transform.d.ts.map +1 -0
  37. package/node_modules/@ursamu/mushcode/_dist/src/traverse/walk.d.ts +27 -0
  38. package/node_modules/@ursamu/mushcode/_dist/src/traverse/walk.d.ts.map +1 -0
  39. package/node_modules/@ursamu/mushcode/deno.json +26 -0
  40. package/node_modules/@ursamu/mushcode/deno.lock +42 -0
  41. package/node_modules/@ursamu/mushcode/docs/analyze.md +145 -0
  42. package/node_modules/@ursamu/mushcode/docs/eval.md +312 -0
  43. package/node_modules/@ursamu/mushcode/docs/lint.md +152 -0
  44. package/node_modules/@ursamu/mushcode/docs/parser.md +196 -0
  45. package/node_modules/@ursamu/mushcode/docs/print.md +84 -0
  46. package/node_modules/@ursamu/mushcode/docs/stdlib.md +418 -0
  47. package/node_modules/@ursamu/mushcode/docs/traverse.md +167 -0
  48. package/node_modules/@ursamu/mushcode/grammar/mux-softcode.pegjs +781 -0
  49. package/node_modules/@ursamu/mushcode/mod.js +44 -0
  50. package/node_modules/@ursamu/mushcode/mod.js.map +1 -0
  51. package/node_modules/@ursamu/mushcode/mod.ts +63 -0
  52. package/node_modules/@ursamu/mushcode/package.json +38 -0
  53. package/node_modules/@ursamu/mushcode/parser/mod.js +47 -0
  54. package/node_modules/@ursamu/mushcode/parser/mod.js.map +1 -0
  55. package/node_modules/@ursamu/mushcode/parser/mod.ts +99 -0
  56. package/node_modules/@ursamu/mushcode/parser/mux-softcode.js +3833 -0
  57. package/node_modules/@ursamu/mushcode/parser/mux-softcode.mjs +3837 -0
  58. package/node_modules/@ursamu/mushcode/src/analyze/commands.js +29 -0
  59. package/node_modules/@ursamu/mushcode/src/analyze/commands.js.map +1 -0
  60. package/node_modules/@ursamu/mushcode/src/analyze/commands.ts +46 -0
  61. package/node_modules/@ursamu/mushcode/src/analyze/deps.js +45 -0
  62. package/node_modules/@ursamu/mushcode/src/analyze/deps.js.map +1 -0
  63. package/node_modules/@ursamu/mushcode/src/analyze/deps.ts +51 -0
  64. package/node_modules/@ursamu/mushcode/src/analyze/mod.js +18 -0
  65. package/node_modules/@ursamu/mushcode/src/analyze/mod.js.map +1 -0
  66. package/node_modules/@ursamu/mushcode/src/analyze/mod.ts +20 -0
  67. package/node_modules/@ursamu/mushcode/src/analyze/tags.js +11 -0
  68. package/node_modules/@ursamu/mushcode/src/analyze/tags.js.map +1 -0
  69. package/node_modules/@ursamu/mushcode/src/analyze/tags.ts +11 -0
  70. package/node_modules/@ursamu/mushcode/src/eval/context.js +22 -0
  71. package/node_modules/@ursamu/mushcode/src/eval/context.js.map +1 -0
  72. package/node_modules/@ursamu/mushcode/src/eval/context.ts +177 -0
  73. package/node_modules/@ursamu/mushcode/src/eval/engine.js +238 -0
  74. package/node_modules/@ursamu/mushcode/src/eval/engine.js.map +1 -0
  75. package/node_modules/@ursamu/mushcode/src/eval/engine.ts +276 -0
  76. package/node_modules/@ursamu/mushcode/src/eval/mod.js +25 -0
  77. package/node_modules/@ursamu/mushcode/src/eval/mod.js.map +1 -0
  78. package/node_modules/@ursamu/mushcode/src/eval/mod.ts +31 -0
  79. package/node_modules/@ursamu/mushcode/src/eval/stdlib/compare.js +56 -0
  80. package/node_modules/@ursamu/mushcode/src/eval/stdlib/compare.js.map +1 -0
  81. package/node_modules/@ursamu/mushcode/src/eval/stdlib/compare.ts +16 -0
  82. package/node_modules/@ursamu/mushcode/src/eval/stdlib/db.js +91 -0
  83. package/node_modules/@ursamu/mushcode/src/eval/stdlib/db.js.map +1 -0
  84. package/node_modules/@ursamu/mushcode/src/eval/stdlib/db.ts +104 -0
  85. package/node_modules/@ursamu/mushcode/src/eval/stdlib/iter.js +91 -0
  86. package/node_modules/@ursamu/mushcode/src/eval/stdlib/iter.js.map +1 -0
  87. package/node_modules/@ursamu/mushcode/src/eval/stdlib/iter.ts +98 -0
  88. package/node_modules/@ursamu/mushcode/src/eval/stdlib/logic.js +79 -0
  89. package/node_modules/@ursamu/mushcode/src/eval/stdlib/logic.js.map +1 -0
  90. package/node_modules/@ursamu/mushcode/src/eval/stdlib/logic.ts +84 -0
  91. package/node_modules/@ursamu/mushcode/src/eval/stdlib/math.js +120 -0
  92. package/node_modules/@ursamu/mushcode/src/eval/stdlib/math.js.map +1 -0
  93. package/node_modules/@ursamu/mushcode/src/eval/stdlib/math.ts +115 -0
  94. package/node_modules/@ursamu/mushcode/src/eval/stdlib/mod.js +17 -0
  95. package/node_modules/@ursamu/mushcode/src/eval/stdlib/mod.js.map +1 -0
  96. package/node_modules/@ursamu/mushcode/src/eval/stdlib/mod.ts +19 -0
  97. package/node_modules/@ursamu/mushcode/src/eval/stdlib/register.js +28 -0
  98. package/node_modules/@ursamu/mushcode/src/eval/stdlib/register.js.map +1 -0
  99. package/node_modules/@ursamu/mushcode/src/eval/stdlib/register.ts +31 -0
  100. package/node_modules/@ursamu/mushcode/src/eval/stdlib/string.js +153 -0
  101. package/node_modules/@ursamu/mushcode/src/eval/stdlib/string.js.map +1 -0
  102. package/node_modules/@ursamu/mushcode/src/eval/stdlib/string.ts +154 -0
  103. package/node_modules/@ursamu/mushcode/src/lint/builtin_arities.js +212 -0
  104. package/node_modules/@ursamu/mushcode/src/lint/builtin_arities.js.map +1 -0
  105. package/node_modules/@ursamu/mushcode/src/lint/builtin_arities.ts +68 -0
  106. package/node_modules/@ursamu/mushcode/src/lint/mod.js +60 -0
  107. package/node_modules/@ursamu/mushcode/src/lint/mod.js.map +1 -0
  108. package/node_modules/@ursamu/mushcode/src/lint/mod.ts +96 -0
  109. package/node_modules/@ursamu/mushcode/src/lint/rules/arg_count.js +37 -0
  110. package/node_modules/@ursamu/mushcode/src/lint/rules/arg_count.js.map +1 -0
  111. package/node_modules/@ursamu/mushcode/src/lint/rules/arg_count.ts +44 -0
  112. package/node_modules/@ursamu/mushcode/src/lint/rules/iter_var_outside_iter.js +55 -0
  113. package/node_modules/@ursamu/mushcode/src/lint/rules/iter_var_outside_iter.js.map +1 -0
  114. package/node_modules/@ursamu/mushcode/src/lint/rules/iter_var_outside_iter.ts +60 -0
  115. package/node_modules/@ursamu/mushcode/src/lint/rules/missing_wildcard.js +31 -0
  116. package/node_modules/@ursamu/mushcode/src/lint/rules/missing_wildcard.js.map +1 -0
  117. package/node_modules/@ursamu/mushcode/src/lint/rules/missing_wildcard.ts +40 -0
  118. package/node_modules/@ursamu/mushcode/src/lint/rules/register_before_set.js +59 -0
  119. package/node_modules/@ursamu/mushcode/src/lint/rules/register_before_set.js.map +1 -0
  120. package/node_modules/@ursamu/mushcode/src/lint/rules/register_before_set.ts +64 -0
  121. package/node_modules/@ursamu/mushcode/src/print/lock_printer.js +43 -0
  122. package/node_modules/@ursamu/mushcode/src/print/lock_printer.js.map +1 -0
  123. package/node_modules/@ursamu/mushcode/src/print/lock_printer.ts +41 -0
  124. package/node_modules/@ursamu/mushcode/src/print/mod.js +17 -0
  125. package/node_modules/@ursamu/mushcode/src/print/mod.js.map +1 -0
  126. package/node_modules/@ursamu/mushcode/src/print/mod.ts +18 -0
  127. package/node_modules/@ursamu/mushcode/src/print/printer.js +91 -0
  128. package/node_modules/@ursamu/mushcode/src/print/printer.js.map +1 -0
  129. package/node_modules/@ursamu/mushcode/src/print/printer.ts +132 -0
  130. package/node_modules/@ursamu/mushcode/src/traverse/child_slots.js +129 -0
  131. package/node_modules/@ursamu/mushcode/src/traverse/child_slots.js.map +1 -0
  132. package/node_modules/@ursamu/mushcode/src/traverse/child_slots.ts +51 -0
  133. package/node_modules/@ursamu/mushcode/src/traverse/mod.js +17 -0
  134. package/node_modules/@ursamu/mushcode/src/traverse/mod.js.map +1 -0
  135. package/node_modules/@ursamu/mushcode/src/traverse/mod.ts +19 -0
  136. package/node_modules/@ursamu/mushcode/src/traverse/transform.js +70 -0
  137. package/node_modules/@ursamu/mushcode/src/traverse/transform.js.map +1 -0
  138. package/node_modules/@ursamu/mushcode/src/traverse/transform.ts +84 -0
  139. package/node_modules/@ursamu/mushcode/src/traverse/walk.js +55 -0
  140. package/node_modules/@ursamu/mushcode/src/traverse/walk.js.map +1 -0
  141. package/node_modules/@ursamu/mushcode/src/traverse/walk.ts +82 -0
  142. package/node_modules/@ursamu/mushcode/tests/01-literals.test.ts +105 -0
  143. package/node_modules/@ursamu/mushcode/tests/02-substitutions.test.ts +145 -0
  144. package/node_modules/@ursamu/mushcode/tests/03-function-calls.test.ts +184 -0
  145. package/node_modules/@ursamu/mushcode/tests/04-eval-blocks.test.ts +110 -0
  146. package/node_modules/@ursamu/mushcode/tests/05-braced-strings.test.ts +119 -0
  147. package/node_modules/@ursamu/mushcode/tests/06-commands.test.ts +222 -0
  148. package/node_modules/@ursamu/mushcode/tests/07-dollar-patterns.test.ts +156 -0
  149. package/node_modules/@ursamu/mushcode/tests/08-lock-expressions.test.ts +159 -0
  150. package/node_modules/@ursamu/mushcode/tests/09-edge-cases.test.ts +162 -0
  151. package/node_modules/@ursamu/mushcode/tests/10-regression.test.ts +211 -0
  152. package/node_modules/@ursamu/mushcode/tests/11-tags.test.ts +357 -0
  153. package/node_modules/@ursamu/mushcode/tests/12-locations.test.ts +162 -0
  154. package/node_modules/@ursamu/mushcode/tests/13-eval.test.ts +389 -0
  155. package/node_modules/@ursamu/mushcode/tests/analyze.test.ts +194 -0
  156. package/node_modules/@ursamu/mushcode/tests/helpers.ts +69 -0
  157. package/node_modules/@ursamu/mushcode/tests/lint.test.ts +232 -0
  158. package/node_modules/@ursamu/mushcode/tests/print.test.ts +204 -0
  159. package/node_modules/@ursamu/mushcode/tests/traverse.test.ts +211 -0
  160. package/package.json +10 -1
@@ -0,0 +1,3833 @@
1
+ // @generated by Peggy 5.1.0.
2
+ //
3
+ // https://peggyjs.org/
4
+
5
+ "use strict";
6
+
7
+
8
+ // ── Module-level helpers (shared across all parses) ──────────────────────
9
+
10
+ // Holds the `location` function injected by the per-parse initializer below.
11
+ // Safe because Peggy parsers are synchronous — no interleaving between parses.
12
+ let _loc = null;
13
+
14
+ /**
15
+ * Construct a typed AST node, attaching the current source location.
16
+ * `loc` is always present when called from a grammar action; it is absent
17
+ * only on nodes constructed manually in tests or by transform().
18
+ */
19
+ function node(type, props) {
20
+ const n = Object.assign({ type }, props);
21
+ if (_loc) n.loc = _loc();
22
+ return n;
23
+ }
24
+
25
+ /**
26
+ * Merge adjacent Literal nodes to reduce AST noise.
27
+ * e.g. [Literal("foo"), Literal("bar")] → [Literal("foobar")]
28
+ * When merging, loc.end is extended to cover the full span.
29
+ */
30
+ function coalesce(parts) {
31
+ if (!parts || parts.length === 0) return parts;
32
+ const out = [];
33
+ for (const p of parts) {
34
+ if (
35
+ p.type === "Literal" &&
36
+ out.length > 0 &&
37
+ out[out.length - 1].type === "Literal"
38
+ ) {
39
+ const last = out[out.length - 1];
40
+ last.value += p.value;
41
+ // Extend the span to cover the merged token
42
+ if (last.loc && p.loc) {
43
+ last.loc = { start: last.loc.start, end: p.loc.end };
44
+ }
45
+ } else {
46
+ out.push(p);
47
+ }
48
+ }
49
+ return out;
50
+ }
51
+
52
+ class peg$SyntaxError extends SyntaxError {
53
+ constructor(message, expected, found, location) {
54
+ super(message);
55
+ this.expected = expected;
56
+ this.found = found;
57
+ this.location = location;
58
+ this.name = "SyntaxError";
59
+ }
60
+
61
+ format(sources) {
62
+ let str = "Error: " + this.message;
63
+ if (this.location) {
64
+ let src = null;
65
+ const st = sources.find(s => s.source === this.location.source);
66
+ if (st) {
67
+ src = st.text.split(/\r\n|\n|\r/g);
68
+ }
69
+ const s = this.location.start;
70
+ const offset_s = (this.location.source && (typeof this.location.source.offset === "function"))
71
+ ? this.location.source.offset(s)
72
+ : s;
73
+ const loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column;
74
+ if (src) {
75
+ const e = this.location.end;
76
+ const filler = "".padEnd(offset_s.line.toString().length, " ");
77
+ const line = src[s.line - 1];
78
+ const last = s.line === e.line ? e.column : line.length + 1;
79
+ const hatLen = (last - s.column) || 1;
80
+ str += "\n --> " + loc + "\n"
81
+ + filler + " |\n"
82
+ + offset_s.line + " | " + line + "\n"
83
+ + filler + " | " + "".padEnd(s.column - 1, " ")
84
+ + "".padEnd(hatLen, "^");
85
+ } else {
86
+ str += "\n at " + loc;
87
+ }
88
+ }
89
+ return str;
90
+ }
91
+
92
+ static buildMessage(expected, found) {
93
+ function hex(ch) {
94
+ return ch.codePointAt(0).toString(16).toUpperCase();
95
+ }
96
+
97
+ const nonPrintable = Object.prototype.hasOwnProperty.call(RegExp.prototype, "unicode")
98
+ ? new RegExp("[\\p{C}\\p{Mn}\\p{Mc}]", "gu")
99
+ : null;
100
+ function unicodeEscape(s) {
101
+ if (nonPrintable) {
102
+ return s.replace(nonPrintable, ch => "\\u{" + hex(ch) + "}");
103
+ }
104
+ return s;
105
+ }
106
+
107
+ function literalEscape(s) {
108
+ return unicodeEscape(s
109
+ .replace(/\\/g, "\\\\")
110
+ .replace(/"/g, "\\\"")
111
+ .replace(/\0/g, "\\0")
112
+ .replace(/\t/g, "\\t")
113
+ .replace(/\n/g, "\\n")
114
+ .replace(/\r/g, "\\r")
115
+ .replace(/[\x00-\x0F]/g, ch => "\\x0" + hex(ch))
116
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, ch => "\\x" + hex(ch)));
117
+ }
118
+
119
+ function classEscape(s) {
120
+ return unicodeEscape(s
121
+ .replace(/\\/g, "\\\\")
122
+ .replace(/\]/g, "\\]")
123
+ .replace(/\^/g, "\\^")
124
+ .replace(/-/g, "\\-")
125
+ .replace(/\0/g, "\\0")
126
+ .replace(/\t/g, "\\t")
127
+ .replace(/\n/g, "\\n")
128
+ .replace(/\r/g, "\\r")
129
+ .replace(/[\x00-\x0F]/g, ch => "\\x0" + hex(ch))
130
+ .replace(/[\x10-\x1F\x7F-\x9F]/g, ch => "\\x" + hex(ch)));
131
+ }
132
+
133
+ const DESCRIBE_EXPECTATION_FNS = {
134
+ literal(expectation) {
135
+ return "\"" + literalEscape(expectation.text) + "\"";
136
+ },
137
+
138
+ class(expectation) {
139
+ const escapedParts = expectation.parts.map(
140
+ part => (Array.isArray(part)
141
+ ? classEscape(part[0]) + "-" + classEscape(part[1])
142
+ : classEscape(part))
143
+ );
144
+
145
+ return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]" + (expectation.unicode ? "u" : "");
146
+ },
147
+
148
+ any() {
149
+ return "any character";
150
+ },
151
+
152
+ end() {
153
+ return "end of input";
154
+ },
155
+
156
+ other(expectation) {
157
+ return expectation.description;
158
+ },
159
+ };
160
+
161
+ function describeExpectation(expectation) {
162
+ return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
163
+ }
164
+
165
+ function describeExpected(expected) {
166
+ const descriptions = expected.map(describeExpectation);
167
+ descriptions.sort();
168
+
169
+ if (descriptions.length > 0) {
170
+ let j = 1;
171
+ for (let i = 1; i < descriptions.length; i++) {
172
+ if (descriptions[i - 1] !== descriptions[i]) {
173
+ descriptions[j] = descriptions[i];
174
+ j++;
175
+ }
176
+ }
177
+ descriptions.length = j;
178
+ }
179
+
180
+ switch (descriptions.length) {
181
+ case 1:
182
+ return descriptions[0];
183
+
184
+ case 2:
185
+ return descriptions[0] + " or " + descriptions[1];
186
+
187
+ default:
188
+ return descriptions.slice(0, -1).join(", ")
189
+ + ", or "
190
+ + descriptions[descriptions.length - 1];
191
+ }
192
+ }
193
+
194
+ function describeFound(found) {
195
+ return found ? "\"" + literalEscape(found) + "\"" : "end of input";
196
+ }
197
+
198
+ return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
199
+ }
200
+ }
201
+
202
+ function peg$parse(input, options) {
203
+ options = options !== undefined ? options : {};
204
+
205
+ const peg$FAILED = {};
206
+ const peg$source = options.grammarSource;
207
+
208
+ const peg$startRuleFunctions = {
209
+ Start: peg$parseStart,
210
+ LockExpr: peg$parseLockExpr,
211
+ };
212
+ let peg$startRuleFunction = peg$parseStart;
213
+
214
+ const peg$c0 = "$";
215
+ const peg$c1 = ":";
216
+ const peg$c2 = "^";
217
+ const peg$c3 = ";";
218
+ const peg$c4 = "*";
219
+ const peg$c5 = "?";
220
+ const peg$c6 = "\\";
221
+ const peg$c7 = "@";
222
+ const peg$c8 = "/";
223
+ const peg$c9 = "=";
224
+ const peg$c10 = "&";
225
+ const peg$c11 = "#";
226
+ const peg$c12 = "{";
227
+ const peg$c13 = "}";
228
+ const peg$c14 = "[";
229
+ const peg$c15 = "]";
230
+ const peg$c16 = "()";
231
+ const peg$c17 = "(";
232
+ const peg$c18 = ")";
233
+ const peg$c19 = ",";
234
+ const peg$c20 = "%";
235
+ const peg$c21 = "q";
236
+ const peg$c22 = "i";
237
+ const peg$c23 = "V";
238
+ const peg$c24 = "v";
239
+ const peg$c25 = "x";
240
+ const peg$c26 = "<";
241
+ const peg$c27 = ">";
242
+ const peg$c28 = "X";
243
+ const peg$c29 = "c";
244
+ const peg$c30 = "C";
245
+ const peg$c31 = "##";
246
+ const peg$c32 = "#@";
247
+ const peg$c33 = "#$";
248
+ const peg$c34 = "|";
249
+ const peg$c35 = "!";
250
+ const peg$c36 = "me";
251
+ const peg$c37 = "-";
252
+ const peg$c38 = "flag^";
253
+ const peg$c39 = "type^";
254
+ const peg$c40 = "attr^";
255
+
256
+ const peg$r0 = /^[^;:*?\\]/;
257
+ const peg$r1 = /^[a-zA-Z]/;
258
+ const peg$r2 = /^[a-zA-Z0-9_\-]/;
259
+ const peg$r3 = /^[a-zA-Z_]/;
260
+ const peg$r4 = /^[^=;[{%\\#]/;
261
+ const peg$r5 = /^[#-$@]/;
262
+ const peg$r6 = /^[^;[{%\\#]/;
263
+ const peg$r7 = /^[^{}[%\\#]/;
264
+ const peg$r8 = /^[^[\]{}%\\#]/;
265
+ const peg$r9 = /^[a-zA-Z0-9_]/;
266
+ const peg$r10 = /^[^[\](){}%\\#]/;
267
+ const peg$r11 = /^[^,[\](){}%\\#]/;
268
+ const peg$r12 = /^[0-9a-zA-Z_]/;
269
+ const peg$r13 = /^[0-9]/;
270
+ const peg$r14 = /^[A-Za-z]/;
271
+ const peg$r15 = /^[^>]/;
272
+ const peg$r16 = /^[a-zA-Z0-9]/;
273
+ const peg$r17 = /^[#NnSOPAsopaL!0-9RBTMrtblw@+|%kK:]/;
274
+ const peg$r18 = /^[^|&!()[\]{}\r\n]/;
275
+ const peg$r19 = /^[ \t\r\n]/;
276
+
277
+ const peg$e0 = peg$literalExpectation("$", false);
278
+ const peg$e1 = peg$literalExpectation(":", false);
279
+ const peg$e2 = peg$literalExpectation("^", false);
280
+ const peg$e3 = peg$literalExpectation(";", false);
281
+ const peg$e4 = peg$literalExpectation("*", false);
282
+ const peg$e5 = peg$literalExpectation("?", false);
283
+ const peg$e6 = peg$literalExpectation("\\", false);
284
+ const peg$e7 = peg$anyExpectation();
285
+ const peg$e8 = peg$classExpectation([";", ":", "*", "?", "\\"], true, false, false);
286
+ const peg$e9 = peg$literalExpectation("@", false);
287
+ const peg$e10 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false, false);
288
+ const peg$e11 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", "-"], false, false, false);
289
+ const peg$e12 = peg$literalExpectation("/", false);
290
+ const peg$e13 = peg$literalExpectation("=", false);
291
+ const peg$e14 = peg$literalExpectation("&", false);
292
+ const peg$e15 = peg$classExpectation([["a", "z"], ["A", "Z"], "_"], false, false, false);
293
+ const peg$e16 = peg$classExpectation(["=", ";", "[", "{", "%", "\\", "#"], true, false, false);
294
+ const peg$e17 = peg$literalExpectation("#", false);
295
+ const peg$e18 = peg$classExpectation([["#", "$"], "@"], false, false, false);
296
+ const peg$e19 = peg$classExpectation([";", "[", "{", "%", "\\", "#"], true, false, false);
297
+ const peg$e20 = peg$literalExpectation("{", false);
298
+ const peg$e21 = peg$literalExpectation("}", false);
299
+ const peg$e22 = peg$classExpectation(["{", "}", "[", "%", "\\", "#"], true, false, false);
300
+ const peg$e23 = peg$literalExpectation("[", false);
301
+ const peg$e24 = peg$literalExpectation("]", false);
302
+ const peg$e25 = peg$classExpectation(["[", "]", "{", "}", "%", "\\", "#"], true, false, false);
303
+ const peg$e26 = peg$literalExpectation("()", false);
304
+ const peg$e27 = peg$literalExpectation("(", false);
305
+ const peg$e28 = peg$literalExpectation(")", false);
306
+ const peg$e29 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_"], false, false, false);
307
+ const peg$e30 = peg$literalExpectation(",", false);
308
+ const peg$e31 = peg$classExpectation(["[", "]", "(", ")", "{", "}", "%", "\\", "#"], true, false, false);
309
+ const peg$e32 = peg$classExpectation([",", "[", "]", "(", ")", "{", "}", "%", "\\", "#"], true, false, false);
310
+ const peg$e33 = peg$literalExpectation("%", false);
311
+ const peg$e34 = peg$literalExpectation("q", false);
312
+ const peg$e35 = peg$classExpectation([["0", "9"], ["a", "z"], ["A", "Z"], "_"], false, false, false);
313
+ const peg$e36 = peg$literalExpectation("i", false);
314
+ const peg$e37 = peg$classExpectation([["0", "9"]], false, false, false);
315
+ const peg$e38 = peg$literalExpectation("V", false);
316
+ const peg$e39 = peg$classExpectation([["A", "Z"], ["a", "z"]], false, false, false);
317
+ const peg$e40 = peg$literalExpectation("v", false);
318
+ const peg$e41 = peg$literalExpectation("x", false);
319
+ const peg$e42 = peg$literalExpectation("<", false);
320
+ const peg$e43 = peg$classExpectation([">"], true, false, false);
321
+ const peg$e44 = peg$literalExpectation(">", false);
322
+ const peg$e45 = peg$literalExpectation("X", false);
323
+ const peg$e46 = peg$literalExpectation("c", false);
324
+ const peg$e47 = peg$literalExpectation("C", false);
325
+ const peg$e48 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"]], false, false, false);
326
+ const peg$e49 = peg$classExpectation(["#", "N", "n", "S", "O", "P", "A", "s", "o", "p", "a", "L", "!", ["0", "9"], "R", "B", "T", "M", "r", "t", "b", "l", "w", "@", "+", "|", "%", "k", "K", ":"], false, false, false);
327
+ const peg$e50 = peg$literalExpectation("##", false);
328
+ const peg$e51 = peg$literalExpectation("#@", false);
329
+ const peg$e52 = peg$literalExpectation("#$", false);
330
+ const peg$e53 = peg$literalExpectation("|", false);
331
+ const peg$e54 = peg$literalExpectation("!", false);
332
+ const peg$e55 = peg$literalExpectation("me", false);
333
+ const peg$e56 = peg$literalExpectation("-", false);
334
+ const peg$e57 = peg$literalExpectation("flag^", false);
335
+ const peg$e58 = peg$literalExpectation("type^", false);
336
+ const peg$e59 = peg$literalExpectation("attr^", false);
337
+ const peg$e60 = peg$classExpectation(["|", "&", "!", "(", ")", "[", "]", "{", "}", "\r", "\n"], true, false, false);
338
+ const peg$e61 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false, false);
339
+
340
+ function peg$f0(av) { return av; }
341
+ function peg$f1(parts) {
342
+ return node("UserCommand", { parts: coalesce(parts) });
343
+ }
344
+ function peg$f2(pattern, action) {
345
+ return node("DollarPattern", { pattern, action });
346
+ }
347
+ function peg$f3(pattern, action) {
348
+ return node("ListenPattern", { pattern, action });
349
+ }
350
+ function peg$f4(head, tail) {
351
+ const patterns = [head, ...tail.map(t => t[1])];
352
+ return patterns.length === 1
353
+ ? patterns[0]
354
+ : node("PatternAlts", { patterns });
355
+ }
356
+ function peg$f5(parts) {
357
+ return node("Pattern", { parts: coalesce(parts) });
358
+ }
359
+ function peg$f6() { return node("Wildcard", { wildcard: "*" }); }
360
+ function peg$f7() { return node("Wildcard", { wildcard: "?" }); }
361
+ function peg$f8(char) { return node("Escape", { char }); }
362
+ function peg$f9(chars) { return node("Literal", { value: chars }); }
363
+ function peg$f10(head, tail) {
364
+ const commands = [head, ...tail.map(t => t[1])];
365
+ return commands.length === 1
366
+ ? commands[0]
367
+ : node("CommandList", { commands });
368
+ }
369
+ function peg$f11(name, switches, body) {
370
+ return node("AtCommand", {
371
+ name,
372
+ switches,
373
+ object: body ? body.object : null,
374
+ value: body ? body.value : null,
375
+ });
376
+ }
377
+ function peg$f12(n) { return n; }
378
+ function peg$f13(obj, val) {
379
+ return { object: obj, value: val };
380
+ }
381
+ function peg$f14(obj) {
382
+ return { object: obj, value: null };
383
+ }
384
+ function peg$f15(attr, obj, val) {
385
+ return node("AttributeSet", { attribute: attr, object: obj, value: val, hidden: attr.startsWith("_") });
386
+ }
387
+ function peg$f16(attr, obj) {
388
+ return node("AttributeSet", { attribute: attr, object: obj, value: null, hidden: attr.startsWith("_") });
389
+ }
390
+ function peg$f17(parts) {
391
+ return node("UserCommand", { parts: coalesce(parts) });
392
+ }
393
+ function peg$f18(parts) {
394
+ return node("Text", { parts: coalesce(parts) });
395
+ }
396
+ function peg$f19(chars) { return node("Literal", { value: chars }); }
397
+ function peg$f20() { return node("Literal", { value: "#" }); }
398
+ function peg$f21(chars) { return node("Literal", { value: chars }); }
399
+ function peg$f22() { return node("Literal", { value: "#" }); }
400
+ function peg$f23(parts) {
401
+ return node("BracedString", { parts: coalesce(parts) });
402
+ }
403
+ function peg$f24(chars) { return node("Literal", { value: chars }); }
404
+ function peg$f25() { return node("Literal", { value: "#" }); }
405
+ function peg$f26(parts) {
406
+ return node("EvalBlock", { parts: coalesce(parts) });
407
+ }
408
+ function peg$f27(chars) { return node("Literal", { value: chars }); }
409
+ function peg$f28() { return node("Literal", { value: "#" }); }
410
+ function peg$f29(name) {
411
+ return node("FunctionCall", { name, args: [] });
412
+ }
413
+ function peg$f30(name, args) {
414
+ return node("FunctionCall", { name, args });
415
+ }
416
+ function peg$f31(head, tail) {
417
+ return [head, ...tail.map(t => t[1])];
418
+ }
419
+ function peg$f32(parts) {
420
+ return node("Arg", { parts: coalesce(parts) });
421
+ }
422
+ function peg$f33(parts) {
423
+ const inner = coalesce(parts);
424
+ return node("Literal", {
425
+ value: "(" + inner.map(p => p.type === "Literal" ? p.value : "").join("") + ")"
426
+ });
427
+ }
428
+ function peg$f34(chars) { return node("Literal", { value: chars }); }
429
+ function peg$f35() { return node("Literal", { value: "#" }); }
430
+ function peg$f36(chars) { return node("Literal", { value: chars }); }
431
+ function peg$f37() { return node("Literal", { value: "#" }); }
432
+ function peg$f38(code) {
433
+ return node("Substitution", { code });
434
+ }
435
+ function peg$f39(name) { return "q" + name; }
436
+ function peg$f40(n) { return "i" + n; }
437
+ function peg$f41(n) { return "V" + n; }
438
+ function peg$f42(n) { return "v" + n; }
439
+ function peg$f43(s) { return "x<" + s + ">"; }
440
+ function peg$f44(s) { return "X<" + s + ">"; }
441
+ function peg$f45(s) { return "c<" + s + ">"; }
442
+ function peg$f46(s) { return "C<" + s + ">"; }
443
+ function peg$f47(n) { return "x" + n; }
444
+ function peg$f48(n) { return "X" + n; }
445
+ function peg$f49(n) { return "c" + n; }
446
+ function peg$f50(n) { return "C" + n; }
447
+ function peg$f51() { return "\\"; }
448
+ function peg$f52(name) { return "=" + name; }
449
+ function peg$f53(c) { return c; }
450
+ function peg$f54() { return "["; }
451
+ function peg$f55() { return "]"; }
452
+ function peg$f56() { return ","; }
453
+ function peg$f57() { return ";"; }
454
+ function peg$f58() { return node("SpecialVar", { code: "##" }); }
455
+ function peg$f59() { return node("SpecialVar", { code: "#@" }); }
456
+ function peg$f60() { return node("SpecialVar", { code: "#$" }); }
457
+ function peg$f61(name) {
458
+ return node("TagRef", { name });
459
+ }
460
+ function peg$f62(char) {
461
+ return node("Escape", { char });
462
+ }
463
+ function peg$f63(head, tail) {
464
+ if (tail.length === 0) return head;
465
+ return node("LockOr", { operands: [head, ...tail.map(t => t[1])] });
466
+ }
467
+ function peg$f64(head, tail) {
468
+ if (tail.length === 0) return head;
469
+ return node("LockAnd", { operands: [head, ...tail.map(t => t[1])] });
470
+ }
471
+ function peg$f65(operand) { return node("LockNot", { operand }); }
472
+ function peg$f66(expr) { return expr; }
473
+ function peg$f67() { return node("LockMe", {}); }
474
+ function peg$f68(n) {
475
+ return node("LockDbref", { dbref: "#" + n });
476
+ }
477
+ function peg$f69(name) {
478
+ return node("LockFlagCheck", { flag: name });
479
+ }
480
+ function peg$f70(name) {
481
+ return node("LockTypeCheck", { typeName: name });
482
+ }
483
+ function peg$f71(name) {
484
+ return node("LockAttrCheck", { attribute: name });
485
+ }
486
+ function peg$f72(name) {
487
+ return node("LockPlayerName", { name: name.trim() });
488
+ }
489
+ let peg$currPos = options.peg$currPos | 0;
490
+ let peg$savedPos = peg$currPos;
491
+ const peg$posDetailsCache = [{ line: 1, column: 1 }];
492
+ let peg$maxFailPos = peg$currPos;
493
+ let peg$maxFailExpected = options.peg$maxFailExpected || [];
494
+ let peg$silentFails = options.peg$silentFails | 0;
495
+
496
+ let peg$result;
497
+
498
+ if (options.startRule) {
499
+ if (!(options.startRule in peg$startRuleFunctions)) {
500
+ throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
501
+ }
502
+
503
+ peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
504
+ }
505
+
506
+ function text() {
507
+ return input.substring(peg$savedPos, peg$currPos);
508
+ }
509
+
510
+ function offset() {
511
+ return peg$savedPos;
512
+ }
513
+
514
+ function range() {
515
+ return {
516
+ source: peg$source,
517
+ start: peg$savedPos,
518
+ end: peg$currPos,
519
+ };
520
+ }
521
+
522
+ function location() {
523
+ return peg$computeLocation(peg$savedPos, peg$currPos);
524
+ }
525
+
526
+ function expected(description, location) {
527
+ location = location !== undefined
528
+ ? location
529
+ : peg$computeLocation(peg$savedPos, peg$currPos);
530
+
531
+ throw peg$buildStructuredError(
532
+ [peg$otherExpectation(description)],
533
+ input.substring(peg$savedPos, peg$currPos),
534
+ location
535
+ );
536
+ }
537
+
538
+ function error(message, location) {
539
+ location = location !== undefined
540
+ ? location
541
+ : peg$computeLocation(peg$savedPos, peg$currPos);
542
+
543
+ throw peg$buildSimpleError(message, location);
544
+ }
545
+
546
+ function peg$getUnicode(pos = peg$currPos) {
547
+ const cp = input.codePointAt(pos);
548
+ if (cp === undefined) {
549
+ return "";
550
+ }
551
+ return String.fromCodePoint(cp);
552
+ }
553
+
554
+ function peg$literalExpectation(text, ignoreCase) {
555
+ return { type: "literal", text, ignoreCase };
556
+ }
557
+
558
+ function peg$classExpectation(parts, inverted, ignoreCase, unicode) {
559
+ return { type: "class", parts, inverted, ignoreCase, unicode };
560
+ }
561
+
562
+ function peg$anyExpectation() {
563
+ return { type: "any" };
564
+ }
565
+
566
+ function peg$endExpectation() {
567
+ return { type: "end" };
568
+ }
569
+
570
+ function peg$otherExpectation(description) {
571
+ return { type: "other", description };
572
+ }
573
+
574
+ function peg$computePosDetails(pos) {
575
+ let details = peg$posDetailsCache[pos];
576
+ let p;
577
+
578
+ if (details) {
579
+ return details;
580
+ } else {
581
+ if (pos >= peg$posDetailsCache.length) {
582
+ p = peg$posDetailsCache.length - 1;
583
+ } else {
584
+ p = pos;
585
+ while (!peg$posDetailsCache[--p]) {}
586
+ }
587
+
588
+ details = peg$posDetailsCache[p];
589
+ details = {
590
+ line: details.line,
591
+ column: details.column,
592
+ };
593
+
594
+ while (p < pos) {
595
+ if (input.charCodeAt(p) === 10) {
596
+ details.line++;
597
+ details.column = 1;
598
+ } else {
599
+ details.column++;
600
+ }
601
+
602
+ p++;
603
+ }
604
+
605
+ peg$posDetailsCache[pos] = details;
606
+
607
+ return details;
608
+ }
609
+ }
610
+
611
+ function peg$computeLocation(startPos, endPos, offset) {
612
+ const startPosDetails = peg$computePosDetails(startPos);
613
+ const endPosDetails = peg$computePosDetails(endPos);
614
+
615
+ const res = {
616
+ source: peg$source,
617
+ start: {
618
+ offset: startPos,
619
+ line: startPosDetails.line,
620
+ column: startPosDetails.column,
621
+ },
622
+ end: {
623
+ offset: endPos,
624
+ line: endPosDetails.line,
625
+ column: endPosDetails.column,
626
+ },
627
+ };
628
+ if (offset && peg$source && (typeof peg$source.offset === "function")) {
629
+ res.start = peg$source.offset(res.start);
630
+ res.end = peg$source.offset(res.end);
631
+ }
632
+ return res;
633
+ }
634
+
635
+ function peg$fail(expected) {
636
+ if (peg$currPos < peg$maxFailPos) { return; }
637
+
638
+ if (peg$currPos > peg$maxFailPos) {
639
+ peg$maxFailPos = peg$currPos;
640
+ peg$maxFailExpected = [];
641
+ }
642
+
643
+ peg$maxFailExpected.push(expected);
644
+ }
645
+
646
+ function peg$buildSimpleError(message, location) {
647
+ return new peg$SyntaxError(message, null, null, location);
648
+ }
649
+
650
+ function peg$buildStructuredError(expected, found, location) {
651
+ return new peg$SyntaxError(
652
+ peg$SyntaxError.buildMessage(expected, found),
653
+ expected,
654
+ found,
655
+ location
656
+ );
657
+ }
658
+
659
+ function peg$parseStart() {
660
+ let s0, s1, s2, s3;
661
+
662
+ s0 = peg$currPos;
663
+ s1 = peg$parse_();
664
+ s2 = peg$parseAttributeValue();
665
+ if (s2 !== peg$FAILED) {
666
+ s3 = peg$parse_();
667
+ peg$savedPos = s0;
668
+ s0 = peg$f0(s2);
669
+ } else {
670
+ peg$currPos = s0;
671
+ s0 = peg$FAILED;
672
+ }
673
+
674
+ return s0;
675
+ }
676
+
677
+ function peg$parseAttributeValue() {
678
+ let s0;
679
+
680
+ s0 = peg$parseDollarPattern();
681
+ if (s0 === peg$FAILED) {
682
+ s0 = peg$parseListenPattern();
683
+ if (s0 === peg$FAILED) {
684
+ s0 = peg$parseCommandList();
685
+ }
686
+ }
687
+
688
+ return s0;
689
+ }
690
+
691
+ function peg$parseAtCmdValue() {
692
+ let s0, s1, s2;
693
+
694
+ s0 = peg$parseDollarPattern();
695
+ if (s0 === peg$FAILED) {
696
+ s0 = peg$parseListenPattern();
697
+ if (s0 === peg$FAILED) {
698
+ s0 = peg$currPos;
699
+ s1 = [];
700
+ s2 = peg$parseCmdToken();
701
+ while (s2 !== peg$FAILED) {
702
+ s1.push(s2);
703
+ s2 = peg$parseCmdToken();
704
+ }
705
+ peg$savedPos = s0;
706
+ s1 = peg$f1(s1);
707
+ s0 = s1;
708
+ }
709
+ }
710
+
711
+ return s0;
712
+ }
713
+
714
+ function peg$parseDollarPattern() {
715
+ let s0, s1, s2, s3, s4;
716
+
717
+ s0 = peg$currPos;
718
+ if (input.charCodeAt(peg$currPos) === 36) {
719
+ s1 = peg$c0;
720
+ peg$currPos++;
721
+ } else {
722
+ s1 = peg$FAILED;
723
+ if (peg$silentFails === 0) { peg$fail(peg$e0); }
724
+ }
725
+ if (s1 !== peg$FAILED) {
726
+ s2 = peg$parsePatternSpec();
727
+ if (s2 !== peg$FAILED) {
728
+ if (input.charCodeAt(peg$currPos) === 58) {
729
+ s3 = peg$c1;
730
+ peg$currPos++;
731
+ } else {
732
+ s3 = peg$FAILED;
733
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
734
+ }
735
+ if (s3 !== peg$FAILED) {
736
+ s4 = peg$parseCommandList();
737
+ if (s4 !== peg$FAILED) {
738
+ peg$savedPos = s0;
739
+ s0 = peg$f2(s2, s4);
740
+ } else {
741
+ peg$currPos = s0;
742
+ s0 = peg$FAILED;
743
+ }
744
+ } else {
745
+ peg$currPos = s0;
746
+ s0 = peg$FAILED;
747
+ }
748
+ } else {
749
+ peg$currPos = s0;
750
+ s0 = peg$FAILED;
751
+ }
752
+ } else {
753
+ peg$currPos = s0;
754
+ s0 = peg$FAILED;
755
+ }
756
+
757
+ return s0;
758
+ }
759
+
760
+ function peg$parseListenPattern() {
761
+ let s0, s1, s2, s3, s4;
762
+
763
+ s0 = peg$currPos;
764
+ if (input.charCodeAt(peg$currPos) === 94) {
765
+ s1 = peg$c2;
766
+ peg$currPos++;
767
+ } else {
768
+ s1 = peg$FAILED;
769
+ if (peg$silentFails === 0) { peg$fail(peg$e2); }
770
+ }
771
+ if (s1 !== peg$FAILED) {
772
+ s2 = peg$parsePatternSpec();
773
+ if (s2 !== peg$FAILED) {
774
+ if (input.charCodeAt(peg$currPos) === 58) {
775
+ s3 = peg$c1;
776
+ peg$currPos++;
777
+ } else {
778
+ s3 = peg$FAILED;
779
+ if (peg$silentFails === 0) { peg$fail(peg$e1); }
780
+ }
781
+ if (s3 !== peg$FAILED) {
782
+ s4 = peg$parseCommandList();
783
+ if (s4 !== peg$FAILED) {
784
+ peg$savedPos = s0;
785
+ s0 = peg$f3(s2, s4);
786
+ } else {
787
+ peg$currPos = s0;
788
+ s0 = peg$FAILED;
789
+ }
790
+ } else {
791
+ peg$currPos = s0;
792
+ s0 = peg$FAILED;
793
+ }
794
+ } else {
795
+ peg$currPos = s0;
796
+ s0 = peg$FAILED;
797
+ }
798
+ } else {
799
+ peg$currPos = s0;
800
+ s0 = peg$FAILED;
801
+ }
802
+
803
+ return s0;
804
+ }
805
+
806
+ function peg$parsePatternSpec() {
807
+ let s0, s1, s2, s3, s4, s5;
808
+
809
+ s0 = peg$currPos;
810
+ s1 = peg$parseSinglePattern();
811
+ if (s1 !== peg$FAILED) {
812
+ s2 = [];
813
+ s3 = peg$currPos;
814
+ if (input.charCodeAt(peg$currPos) === 59) {
815
+ s4 = peg$c3;
816
+ peg$currPos++;
817
+ } else {
818
+ s4 = peg$FAILED;
819
+ if (peg$silentFails === 0) { peg$fail(peg$e3); }
820
+ }
821
+ if (s4 !== peg$FAILED) {
822
+ s5 = peg$parseSinglePattern();
823
+ if (s5 !== peg$FAILED) {
824
+ s4 = [s4, s5];
825
+ s3 = s4;
826
+ } else {
827
+ peg$currPos = s3;
828
+ s3 = peg$FAILED;
829
+ }
830
+ } else {
831
+ peg$currPos = s3;
832
+ s3 = peg$FAILED;
833
+ }
834
+ while (s3 !== peg$FAILED) {
835
+ s2.push(s3);
836
+ s3 = peg$currPos;
837
+ if (input.charCodeAt(peg$currPos) === 59) {
838
+ s4 = peg$c3;
839
+ peg$currPos++;
840
+ } else {
841
+ s4 = peg$FAILED;
842
+ if (peg$silentFails === 0) { peg$fail(peg$e3); }
843
+ }
844
+ if (s4 !== peg$FAILED) {
845
+ s5 = peg$parseSinglePattern();
846
+ if (s5 !== peg$FAILED) {
847
+ s4 = [s4, s5];
848
+ s3 = s4;
849
+ } else {
850
+ peg$currPos = s3;
851
+ s3 = peg$FAILED;
852
+ }
853
+ } else {
854
+ peg$currPos = s3;
855
+ s3 = peg$FAILED;
856
+ }
857
+ }
858
+ peg$savedPos = s0;
859
+ s0 = peg$f4(s1, s2);
860
+ } else {
861
+ peg$currPos = s0;
862
+ s0 = peg$FAILED;
863
+ }
864
+
865
+ return s0;
866
+ }
867
+
868
+ function peg$parseSinglePattern() {
869
+ let s0, s1, s2;
870
+
871
+ s0 = peg$currPos;
872
+ s1 = [];
873
+ s2 = peg$parsePatternPiece();
874
+ if (s2 !== peg$FAILED) {
875
+ while (s2 !== peg$FAILED) {
876
+ s1.push(s2);
877
+ s2 = peg$parsePatternPiece();
878
+ }
879
+ } else {
880
+ s1 = peg$FAILED;
881
+ }
882
+ if (s1 !== peg$FAILED) {
883
+ peg$savedPos = s0;
884
+ s1 = peg$f5(s1);
885
+ }
886
+ s0 = s1;
887
+
888
+ return s0;
889
+ }
890
+
891
+ function peg$parsePatternPiece() {
892
+ let s0, s1, s2, s3;
893
+
894
+ s0 = peg$currPos;
895
+ if (input.charCodeAt(peg$currPos) === 42) {
896
+ s1 = peg$c4;
897
+ peg$currPos++;
898
+ } else {
899
+ s1 = peg$FAILED;
900
+ if (peg$silentFails === 0) { peg$fail(peg$e4); }
901
+ }
902
+ if (s1 !== peg$FAILED) {
903
+ peg$savedPos = s0;
904
+ s1 = peg$f6();
905
+ }
906
+ s0 = s1;
907
+ if (s0 === peg$FAILED) {
908
+ s0 = peg$currPos;
909
+ if (input.charCodeAt(peg$currPos) === 63) {
910
+ s1 = peg$c5;
911
+ peg$currPos++;
912
+ } else {
913
+ s1 = peg$FAILED;
914
+ if (peg$silentFails === 0) { peg$fail(peg$e5); }
915
+ }
916
+ if (s1 !== peg$FAILED) {
917
+ peg$savedPos = s0;
918
+ s1 = peg$f7();
919
+ }
920
+ s0 = s1;
921
+ if (s0 === peg$FAILED) {
922
+ s0 = peg$currPos;
923
+ if (input.charCodeAt(peg$currPos) === 92) {
924
+ s1 = peg$c6;
925
+ peg$currPos++;
926
+ } else {
927
+ s1 = peg$FAILED;
928
+ if (peg$silentFails === 0) { peg$fail(peg$e6); }
929
+ }
930
+ if (s1 !== peg$FAILED) {
931
+ if (input.length > peg$currPos) {
932
+ s2 = input.charAt(peg$currPos);
933
+ peg$currPos++;
934
+ } else {
935
+ s2 = peg$FAILED;
936
+ if (peg$silentFails === 0) { peg$fail(peg$e7); }
937
+ }
938
+ if (s2 !== peg$FAILED) {
939
+ peg$savedPos = s0;
940
+ s0 = peg$f8(s2);
941
+ } else {
942
+ peg$currPos = s0;
943
+ s0 = peg$FAILED;
944
+ }
945
+ } else {
946
+ peg$currPos = s0;
947
+ s0 = peg$FAILED;
948
+ }
949
+ if (s0 === peg$FAILED) {
950
+ s0 = peg$currPos;
951
+ s1 = peg$currPos;
952
+ s2 = [];
953
+ s3 = input.charAt(peg$currPos);
954
+ if (peg$r0.test(s3)) {
955
+ peg$currPos++;
956
+ } else {
957
+ s3 = peg$FAILED;
958
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
959
+ }
960
+ if (s3 !== peg$FAILED) {
961
+ while (s3 !== peg$FAILED) {
962
+ s2.push(s3);
963
+ s3 = input.charAt(peg$currPos);
964
+ if (peg$r0.test(s3)) {
965
+ peg$currPos++;
966
+ } else {
967
+ s3 = peg$FAILED;
968
+ if (peg$silentFails === 0) { peg$fail(peg$e8); }
969
+ }
970
+ }
971
+ } else {
972
+ s2 = peg$FAILED;
973
+ }
974
+ if (s2 !== peg$FAILED) {
975
+ s1 = input.substring(s1, peg$currPos);
976
+ } else {
977
+ s1 = s2;
978
+ }
979
+ if (s1 !== peg$FAILED) {
980
+ peg$savedPos = s0;
981
+ s1 = peg$f9(s1);
982
+ }
983
+ s0 = s1;
984
+ }
985
+ }
986
+ }
987
+
988
+ return s0;
989
+ }
990
+
991
+ function peg$parseCommandList() {
992
+ let s0, s1, s2, s3, s4, s5;
993
+
994
+ s0 = peg$currPos;
995
+ s1 = peg$parseCommand();
996
+ if (s1 !== peg$FAILED) {
997
+ s2 = [];
998
+ s3 = peg$currPos;
999
+ if (input.charCodeAt(peg$currPos) === 59) {
1000
+ s4 = peg$c3;
1001
+ peg$currPos++;
1002
+ } else {
1003
+ s4 = peg$FAILED;
1004
+ if (peg$silentFails === 0) { peg$fail(peg$e3); }
1005
+ }
1006
+ if (s4 !== peg$FAILED) {
1007
+ s5 = peg$parseCommand();
1008
+ if (s5 !== peg$FAILED) {
1009
+ s4 = [s4, s5];
1010
+ s3 = s4;
1011
+ } else {
1012
+ peg$currPos = s3;
1013
+ s3 = peg$FAILED;
1014
+ }
1015
+ } else {
1016
+ peg$currPos = s3;
1017
+ s3 = peg$FAILED;
1018
+ }
1019
+ while (s3 !== peg$FAILED) {
1020
+ s2.push(s3);
1021
+ s3 = peg$currPos;
1022
+ if (input.charCodeAt(peg$currPos) === 59) {
1023
+ s4 = peg$c3;
1024
+ peg$currPos++;
1025
+ } else {
1026
+ s4 = peg$FAILED;
1027
+ if (peg$silentFails === 0) { peg$fail(peg$e3); }
1028
+ }
1029
+ if (s4 !== peg$FAILED) {
1030
+ s5 = peg$parseCommand();
1031
+ if (s5 !== peg$FAILED) {
1032
+ s4 = [s4, s5];
1033
+ s3 = s4;
1034
+ } else {
1035
+ peg$currPos = s3;
1036
+ s3 = peg$FAILED;
1037
+ }
1038
+ } else {
1039
+ peg$currPos = s3;
1040
+ s3 = peg$FAILED;
1041
+ }
1042
+ }
1043
+ peg$savedPos = s0;
1044
+ s0 = peg$f10(s1, s2);
1045
+ } else {
1046
+ peg$currPos = s0;
1047
+ s0 = peg$FAILED;
1048
+ }
1049
+
1050
+ return s0;
1051
+ }
1052
+
1053
+ function peg$parseCommand() {
1054
+ let s0;
1055
+
1056
+ s0 = peg$parseAtCommand();
1057
+ if (s0 === peg$FAILED) {
1058
+ s0 = peg$parseAttributeSet();
1059
+ if (s0 === peg$FAILED) {
1060
+ s0 = peg$parseUserCommand();
1061
+ }
1062
+ }
1063
+
1064
+ return s0;
1065
+ }
1066
+
1067
+ function peg$parseAtCommand() {
1068
+ let s0, s1, s2, s3, s4;
1069
+
1070
+ s0 = peg$currPos;
1071
+ if (input.charCodeAt(peg$currPos) === 64) {
1072
+ s1 = peg$c7;
1073
+ peg$currPos++;
1074
+ } else {
1075
+ s1 = peg$FAILED;
1076
+ if (peg$silentFails === 0) { peg$fail(peg$e9); }
1077
+ }
1078
+ if (s1 !== peg$FAILED) {
1079
+ s2 = peg$parseAtCmdName();
1080
+ if (s2 !== peg$FAILED) {
1081
+ s3 = [];
1082
+ s4 = peg$parseAtSwitch();
1083
+ while (s4 !== peg$FAILED) {
1084
+ s3.push(s4);
1085
+ s4 = peg$parseAtSwitch();
1086
+ }
1087
+ s4 = peg$parseAtCmdBody();
1088
+ if (s4 === peg$FAILED) {
1089
+ s4 = null;
1090
+ }
1091
+ peg$savedPos = s0;
1092
+ s0 = peg$f11(s2, s3, s4);
1093
+ } else {
1094
+ peg$currPos = s0;
1095
+ s0 = peg$FAILED;
1096
+ }
1097
+ } else {
1098
+ peg$currPos = s0;
1099
+ s0 = peg$FAILED;
1100
+ }
1101
+
1102
+ return s0;
1103
+ }
1104
+
1105
+ function peg$parseAtCmdName() {
1106
+ let s0, s1, s2, s3, s4;
1107
+
1108
+ s0 = peg$currPos;
1109
+ s1 = peg$currPos;
1110
+ s2 = input.charAt(peg$currPos);
1111
+ if (peg$r1.test(s2)) {
1112
+ peg$currPos++;
1113
+ } else {
1114
+ s2 = peg$FAILED;
1115
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
1116
+ }
1117
+ if (s2 !== peg$FAILED) {
1118
+ s3 = [];
1119
+ s4 = input.charAt(peg$currPos);
1120
+ if (peg$r2.test(s4)) {
1121
+ peg$currPos++;
1122
+ } else {
1123
+ s4 = peg$FAILED;
1124
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
1125
+ }
1126
+ while (s4 !== peg$FAILED) {
1127
+ s3.push(s4);
1128
+ s4 = input.charAt(peg$currPos);
1129
+ if (peg$r2.test(s4)) {
1130
+ peg$currPos++;
1131
+ } else {
1132
+ s4 = peg$FAILED;
1133
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
1134
+ }
1135
+ }
1136
+ s2 = [s2, s3];
1137
+ s1 = s2;
1138
+ } else {
1139
+ peg$currPos = s1;
1140
+ s1 = peg$FAILED;
1141
+ }
1142
+ if (s1 !== peg$FAILED) {
1143
+ s0 = input.substring(s0, peg$currPos);
1144
+ } else {
1145
+ s0 = s1;
1146
+ }
1147
+
1148
+ return s0;
1149
+ }
1150
+
1151
+ function peg$parseAtSwitch() {
1152
+ let s0, s1, s2, s3, s4, s5, s6;
1153
+
1154
+ s0 = peg$currPos;
1155
+ if (input.charCodeAt(peg$currPos) === 47) {
1156
+ s1 = peg$c8;
1157
+ peg$currPos++;
1158
+ } else {
1159
+ s1 = peg$FAILED;
1160
+ if (peg$silentFails === 0) { peg$fail(peg$e12); }
1161
+ }
1162
+ if (s1 !== peg$FAILED) {
1163
+ s2 = peg$currPos;
1164
+ s3 = peg$currPos;
1165
+ s4 = input.charAt(peg$currPos);
1166
+ if (peg$r1.test(s4)) {
1167
+ peg$currPos++;
1168
+ } else {
1169
+ s4 = peg$FAILED;
1170
+ if (peg$silentFails === 0) { peg$fail(peg$e10); }
1171
+ }
1172
+ if (s4 !== peg$FAILED) {
1173
+ s5 = [];
1174
+ s6 = input.charAt(peg$currPos);
1175
+ if (peg$r2.test(s6)) {
1176
+ peg$currPos++;
1177
+ } else {
1178
+ s6 = peg$FAILED;
1179
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
1180
+ }
1181
+ while (s6 !== peg$FAILED) {
1182
+ s5.push(s6);
1183
+ s6 = input.charAt(peg$currPos);
1184
+ if (peg$r2.test(s6)) {
1185
+ peg$currPos++;
1186
+ } else {
1187
+ s6 = peg$FAILED;
1188
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
1189
+ }
1190
+ }
1191
+ s4 = [s4, s5];
1192
+ s3 = s4;
1193
+ } else {
1194
+ peg$currPos = s3;
1195
+ s3 = peg$FAILED;
1196
+ }
1197
+ if (s3 !== peg$FAILED) {
1198
+ s2 = input.substring(s2, peg$currPos);
1199
+ } else {
1200
+ s2 = s3;
1201
+ }
1202
+ if (s2 !== peg$FAILED) {
1203
+ peg$savedPos = s0;
1204
+ s0 = peg$f12(s2);
1205
+ } else {
1206
+ peg$currPos = s0;
1207
+ s0 = peg$FAILED;
1208
+ }
1209
+ } else {
1210
+ peg$currPos = s0;
1211
+ s0 = peg$FAILED;
1212
+ }
1213
+
1214
+ return s0;
1215
+ }
1216
+
1217
+ function peg$parseAtCmdBody() {
1218
+ let s0, s1, s2, s3, s4;
1219
+
1220
+ s0 = peg$currPos;
1221
+ s1 = peg$parse_();
1222
+ s2 = peg$parseObjText();
1223
+ if (s2 !== peg$FAILED) {
1224
+ if (input.charCodeAt(peg$currPos) === 61) {
1225
+ s3 = peg$c9;
1226
+ peg$currPos++;
1227
+ } else {
1228
+ s3 = peg$FAILED;
1229
+ if (peg$silentFails === 0) { peg$fail(peg$e13); }
1230
+ }
1231
+ if (s3 !== peg$FAILED) {
1232
+ s4 = peg$parseAtCmdValue();
1233
+ if (s4 !== peg$FAILED) {
1234
+ peg$savedPos = s0;
1235
+ s0 = peg$f13(s2, s4);
1236
+ } else {
1237
+ peg$currPos = s0;
1238
+ s0 = peg$FAILED;
1239
+ }
1240
+ } else {
1241
+ peg$currPos = s0;
1242
+ s0 = peg$FAILED;
1243
+ }
1244
+ } else {
1245
+ peg$currPos = s0;
1246
+ s0 = peg$FAILED;
1247
+ }
1248
+ if (s0 === peg$FAILED) {
1249
+ s0 = peg$currPos;
1250
+ s1 = peg$parse_();
1251
+ s2 = peg$parseObjText();
1252
+ if (s2 !== peg$FAILED) {
1253
+ peg$savedPos = s0;
1254
+ s0 = peg$f14(s2);
1255
+ } else {
1256
+ peg$currPos = s0;
1257
+ s0 = peg$FAILED;
1258
+ }
1259
+ }
1260
+
1261
+ return s0;
1262
+ }
1263
+
1264
+ function peg$parseAttributeSet() {
1265
+ let s0, s1, s2, s3, s4, s5, s6;
1266
+
1267
+ s0 = peg$currPos;
1268
+ if (input.charCodeAt(peg$currPos) === 38) {
1269
+ s1 = peg$c10;
1270
+ peg$currPos++;
1271
+ } else {
1272
+ s1 = peg$FAILED;
1273
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
1274
+ }
1275
+ if (s1 !== peg$FAILED) {
1276
+ s2 = peg$parseAttrIdent();
1277
+ if (s2 !== peg$FAILED) {
1278
+ s3 = peg$parse_();
1279
+ s4 = peg$parseObjText();
1280
+ if (s4 !== peg$FAILED) {
1281
+ if (input.charCodeAt(peg$currPos) === 61) {
1282
+ s5 = peg$c9;
1283
+ peg$currPos++;
1284
+ } else {
1285
+ s5 = peg$FAILED;
1286
+ if (peg$silentFails === 0) { peg$fail(peg$e13); }
1287
+ }
1288
+ if (s5 !== peg$FAILED) {
1289
+ s6 = peg$parseAtCmdValue();
1290
+ if (s6 !== peg$FAILED) {
1291
+ peg$savedPos = s0;
1292
+ s0 = peg$f15(s2, s4, s6);
1293
+ } else {
1294
+ peg$currPos = s0;
1295
+ s0 = peg$FAILED;
1296
+ }
1297
+ } else {
1298
+ peg$currPos = s0;
1299
+ s0 = peg$FAILED;
1300
+ }
1301
+ } else {
1302
+ peg$currPos = s0;
1303
+ s0 = peg$FAILED;
1304
+ }
1305
+ } else {
1306
+ peg$currPos = s0;
1307
+ s0 = peg$FAILED;
1308
+ }
1309
+ } else {
1310
+ peg$currPos = s0;
1311
+ s0 = peg$FAILED;
1312
+ }
1313
+ if (s0 === peg$FAILED) {
1314
+ s0 = peg$currPos;
1315
+ if (input.charCodeAt(peg$currPos) === 38) {
1316
+ s1 = peg$c10;
1317
+ peg$currPos++;
1318
+ } else {
1319
+ s1 = peg$FAILED;
1320
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
1321
+ }
1322
+ if (s1 !== peg$FAILED) {
1323
+ s2 = peg$parseAttrIdent();
1324
+ if (s2 !== peg$FAILED) {
1325
+ s3 = peg$parse_();
1326
+ s4 = peg$parseObjText();
1327
+ if (s4 !== peg$FAILED) {
1328
+ peg$savedPos = s0;
1329
+ s0 = peg$f16(s2, s4);
1330
+ } else {
1331
+ peg$currPos = s0;
1332
+ s0 = peg$FAILED;
1333
+ }
1334
+ } else {
1335
+ peg$currPos = s0;
1336
+ s0 = peg$FAILED;
1337
+ }
1338
+ } else {
1339
+ peg$currPos = s0;
1340
+ s0 = peg$FAILED;
1341
+ }
1342
+ }
1343
+
1344
+ return s0;
1345
+ }
1346
+
1347
+ function peg$parseAttrIdent() {
1348
+ let s0, s1, s2, s3, s4;
1349
+
1350
+ s0 = peg$currPos;
1351
+ s1 = peg$currPos;
1352
+ s2 = input.charAt(peg$currPos);
1353
+ if (peg$r3.test(s2)) {
1354
+ peg$currPos++;
1355
+ } else {
1356
+ s2 = peg$FAILED;
1357
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
1358
+ }
1359
+ if (s2 !== peg$FAILED) {
1360
+ s3 = [];
1361
+ s4 = input.charAt(peg$currPos);
1362
+ if (peg$r2.test(s4)) {
1363
+ peg$currPos++;
1364
+ } else {
1365
+ s4 = peg$FAILED;
1366
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
1367
+ }
1368
+ while (s4 !== peg$FAILED) {
1369
+ s3.push(s4);
1370
+ s4 = input.charAt(peg$currPos);
1371
+ if (peg$r2.test(s4)) {
1372
+ peg$currPos++;
1373
+ } else {
1374
+ s4 = peg$FAILED;
1375
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
1376
+ }
1377
+ }
1378
+ s2 = [s2, s3];
1379
+ s1 = s2;
1380
+ } else {
1381
+ peg$currPos = s1;
1382
+ s1 = peg$FAILED;
1383
+ }
1384
+ if (s1 !== peg$FAILED) {
1385
+ s0 = input.substring(s0, peg$currPos);
1386
+ } else {
1387
+ s0 = s1;
1388
+ }
1389
+
1390
+ return s0;
1391
+ }
1392
+
1393
+ function peg$parseUserCommand() {
1394
+ let s0, s1, s2;
1395
+
1396
+ s0 = peg$currPos;
1397
+ s1 = [];
1398
+ s2 = peg$parseCmdToken();
1399
+ while (s2 !== peg$FAILED) {
1400
+ s1.push(s2);
1401
+ s2 = peg$parseCmdToken();
1402
+ }
1403
+ peg$savedPos = s0;
1404
+ s1 = peg$f17(s1);
1405
+ s0 = s1;
1406
+
1407
+ return s0;
1408
+ }
1409
+
1410
+ function peg$parseObjText() {
1411
+ let s0, s1, s2;
1412
+
1413
+ s0 = peg$currPos;
1414
+ s1 = [];
1415
+ s2 = peg$parseObjToken();
1416
+ if (s2 !== peg$FAILED) {
1417
+ while (s2 !== peg$FAILED) {
1418
+ s1.push(s2);
1419
+ s2 = peg$parseObjToken();
1420
+ }
1421
+ } else {
1422
+ s1 = peg$FAILED;
1423
+ }
1424
+ if (s1 !== peg$FAILED) {
1425
+ peg$savedPos = s0;
1426
+ s1 = peg$f18(s1);
1427
+ }
1428
+ s0 = s1;
1429
+
1430
+ return s0;
1431
+ }
1432
+
1433
+ function peg$parseObjToken() {
1434
+ let s0;
1435
+
1436
+ s0 = peg$parseEvalBlock();
1437
+ if (s0 === peg$FAILED) {
1438
+ s0 = peg$parseBracedString();
1439
+ if (s0 === peg$FAILED) {
1440
+ s0 = peg$parseSubstitution();
1441
+ if (s0 === peg$FAILED) {
1442
+ s0 = peg$parseSpecialVar();
1443
+ if (s0 === peg$FAILED) {
1444
+ s0 = peg$parseTagRef();
1445
+ if (s0 === peg$FAILED) {
1446
+ s0 = peg$parseEscape();
1447
+ if (s0 === peg$FAILED) {
1448
+ s0 = peg$parseObjLiteralChars();
1449
+ }
1450
+ }
1451
+ }
1452
+ }
1453
+ }
1454
+ }
1455
+
1456
+ return s0;
1457
+ }
1458
+
1459
+ function peg$parseObjLiteralChars() {
1460
+ let s0, s1, s2, s3;
1461
+
1462
+ s0 = peg$currPos;
1463
+ s1 = peg$currPos;
1464
+ s2 = [];
1465
+ s3 = input.charAt(peg$currPos);
1466
+ if (peg$r4.test(s3)) {
1467
+ peg$currPos++;
1468
+ } else {
1469
+ s3 = peg$FAILED;
1470
+ if (peg$silentFails === 0) { peg$fail(peg$e16); }
1471
+ }
1472
+ if (s3 !== peg$FAILED) {
1473
+ while (s3 !== peg$FAILED) {
1474
+ s2.push(s3);
1475
+ s3 = input.charAt(peg$currPos);
1476
+ if (peg$r4.test(s3)) {
1477
+ peg$currPos++;
1478
+ } else {
1479
+ s3 = peg$FAILED;
1480
+ if (peg$silentFails === 0) { peg$fail(peg$e16); }
1481
+ }
1482
+ }
1483
+ } else {
1484
+ s2 = peg$FAILED;
1485
+ }
1486
+ if (s2 !== peg$FAILED) {
1487
+ s1 = input.substring(s1, peg$currPos);
1488
+ } else {
1489
+ s1 = s2;
1490
+ }
1491
+ if (s1 !== peg$FAILED) {
1492
+ peg$savedPos = s0;
1493
+ s1 = peg$f19(s1);
1494
+ }
1495
+ s0 = s1;
1496
+ if (s0 === peg$FAILED) {
1497
+ s0 = peg$currPos;
1498
+ if (input.charCodeAt(peg$currPos) === 35) {
1499
+ s1 = peg$c11;
1500
+ peg$currPos++;
1501
+ } else {
1502
+ s1 = peg$FAILED;
1503
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
1504
+ }
1505
+ if (s1 !== peg$FAILED) {
1506
+ s2 = peg$currPos;
1507
+ peg$silentFails++;
1508
+ s3 = input.charAt(peg$currPos);
1509
+ if (peg$r5.test(s3)) {
1510
+ peg$currPos++;
1511
+ } else {
1512
+ s3 = peg$FAILED;
1513
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
1514
+ }
1515
+ peg$silentFails--;
1516
+ if (s3 === peg$FAILED) {
1517
+ s2 = undefined;
1518
+ } else {
1519
+ peg$currPos = s2;
1520
+ s2 = peg$FAILED;
1521
+ }
1522
+ if (s2 !== peg$FAILED) {
1523
+ peg$savedPos = s0;
1524
+ s0 = peg$f20();
1525
+ } else {
1526
+ peg$currPos = s0;
1527
+ s0 = peg$FAILED;
1528
+ }
1529
+ } else {
1530
+ peg$currPos = s0;
1531
+ s0 = peg$FAILED;
1532
+ }
1533
+ }
1534
+
1535
+ return s0;
1536
+ }
1537
+
1538
+ function peg$parseCmdToken() {
1539
+ let s0;
1540
+
1541
+ s0 = peg$parseEvalBlock();
1542
+ if (s0 === peg$FAILED) {
1543
+ s0 = peg$parseBracedString();
1544
+ if (s0 === peg$FAILED) {
1545
+ s0 = peg$parseSubstitution();
1546
+ if (s0 === peg$FAILED) {
1547
+ s0 = peg$parseSpecialVar();
1548
+ if (s0 === peg$FAILED) {
1549
+ s0 = peg$parseTagRef();
1550
+ if (s0 === peg$FAILED) {
1551
+ s0 = peg$parseEscape();
1552
+ if (s0 === peg$FAILED) {
1553
+ s0 = peg$parseCmdLiteralChars();
1554
+ }
1555
+ }
1556
+ }
1557
+ }
1558
+ }
1559
+ }
1560
+
1561
+ return s0;
1562
+ }
1563
+
1564
+ function peg$parseCmdLiteralChars() {
1565
+ let s0, s1, s2, s3;
1566
+
1567
+ s0 = peg$currPos;
1568
+ s1 = peg$currPos;
1569
+ s2 = [];
1570
+ s3 = input.charAt(peg$currPos);
1571
+ if (peg$r6.test(s3)) {
1572
+ peg$currPos++;
1573
+ } else {
1574
+ s3 = peg$FAILED;
1575
+ if (peg$silentFails === 0) { peg$fail(peg$e19); }
1576
+ }
1577
+ if (s3 !== peg$FAILED) {
1578
+ while (s3 !== peg$FAILED) {
1579
+ s2.push(s3);
1580
+ s3 = input.charAt(peg$currPos);
1581
+ if (peg$r6.test(s3)) {
1582
+ peg$currPos++;
1583
+ } else {
1584
+ s3 = peg$FAILED;
1585
+ if (peg$silentFails === 0) { peg$fail(peg$e19); }
1586
+ }
1587
+ }
1588
+ } else {
1589
+ s2 = peg$FAILED;
1590
+ }
1591
+ if (s2 !== peg$FAILED) {
1592
+ s1 = input.substring(s1, peg$currPos);
1593
+ } else {
1594
+ s1 = s2;
1595
+ }
1596
+ if (s1 !== peg$FAILED) {
1597
+ peg$savedPos = s0;
1598
+ s1 = peg$f21(s1);
1599
+ }
1600
+ s0 = s1;
1601
+ if (s0 === peg$FAILED) {
1602
+ s0 = peg$currPos;
1603
+ if (input.charCodeAt(peg$currPos) === 35) {
1604
+ s1 = peg$c11;
1605
+ peg$currPos++;
1606
+ } else {
1607
+ s1 = peg$FAILED;
1608
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
1609
+ }
1610
+ if (s1 !== peg$FAILED) {
1611
+ s2 = peg$currPos;
1612
+ peg$silentFails++;
1613
+ s3 = input.charAt(peg$currPos);
1614
+ if (peg$r5.test(s3)) {
1615
+ peg$currPos++;
1616
+ } else {
1617
+ s3 = peg$FAILED;
1618
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
1619
+ }
1620
+ peg$silentFails--;
1621
+ if (s3 === peg$FAILED) {
1622
+ s2 = undefined;
1623
+ } else {
1624
+ peg$currPos = s2;
1625
+ s2 = peg$FAILED;
1626
+ }
1627
+ if (s2 !== peg$FAILED) {
1628
+ peg$savedPos = s0;
1629
+ s0 = peg$f22();
1630
+ } else {
1631
+ peg$currPos = s0;
1632
+ s0 = peg$FAILED;
1633
+ }
1634
+ } else {
1635
+ peg$currPos = s0;
1636
+ s0 = peg$FAILED;
1637
+ }
1638
+ }
1639
+
1640
+ return s0;
1641
+ }
1642
+
1643
+ function peg$parseBracedString() {
1644
+ let s0, s1, s2, s3;
1645
+
1646
+ s0 = peg$currPos;
1647
+ if (input.charCodeAt(peg$currPos) === 123) {
1648
+ s1 = peg$c12;
1649
+ peg$currPos++;
1650
+ } else {
1651
+ s1 = peg$FAILED;
1652
+ if (peg$silentFails === 0) { peg$fail(peg$e20); }
1653
+ }
1654
+ if (s1 !== peg$FAILED) {
1655
+ s2 = [];
1656
+ s3 = peg$parseBracedToken();
1657
+ while (s3 !== peg$FAILED) {
1658
+ s2.push(s3);
1659
+ s3 = peg$parseBracedToken();
1660
+ }
1661
+ if (input.charCodeAt(peg$currPos) === 125) {
1662
+ s3 = peg$c13;
1663
+ peg$currPos++;
1664
+ } else {
1665
+ s3 = peg$FAILED;
1666
+ if (peg$silentFails === 0) { peg$fail(peg$e21); }
1667
+ }
1668
+ if (s3 !== peg$FAILED) {
1669
+ peg$savedPos = s0;
1670
+ s0 = peg$f23(s2);
1671
+ } else {
1672
+ peg$currPos = s0;
1673
+ s0 = peg$FAILED;
1674
+ }
1675
+ } else {
1676
+ peg$currPos = s0;
1677
+ s0 = peg$FAILED;
1678
+ }
1679
+
1680
+ return s0;
1681
+ }
1682
+
1683
+ function peg$parseBracedToken() {
1684
+ let s0;
1685
+
1686
+ s0 = peg$parseBracedString();
1687
+ if (s0 === peg$FAILED) {
1688
+ s0 = peg$parseEvalBlock();
1689
+ if (s0 === peg$FAILED) {
1690
+ s0 = peg$parseSubstitution();
1691
+ if (s0 === peg$FAILED) {
1692
+ s0 = peg$parseSpecialVar();
1693
+ if (s0 === peg$FAILED) {
1694
+ s0 = peg$parseTagRef();
1695
+ if (s0 === peg$FAILED) {
1696
+ s0 = peg$parseEscape();
1697
+ if (s0 === peg$FAILED) {
1698
+ s0 = peg$parseBracedLiteralChars();
1699
+ }
1700
+ }
1701
+ }
1702
+ }
1703
+ }
1704
+ }
1705
+
1706
+ return s0;
1707
+ }
1708
+
1709
+ function peg$parseBracedLiteralChars() {
1710
+ let s0, s1, s2, s3;
1711
+
1712
+ s0 = peg$currPos;
1713
+ s1 = peg$currPos;
1714
+ s2 = [];
1715
+ s3 = input.charAt(peg$currPos);
1716
+ if (peg$r7.test(s3)) {
1717
+ peg$currPos++;
1718
+ } else {
1719
+ s3 = peg$FAILED;
1720
+ if (peg$silentFails === 0) { peg$fail(peg$e22); }
1721
+ }
1722
+ if (s3 !== peg$FAILED) {
1723
+ while (s3 !== peg$FAILED) {
1724
+ s2.push(s3);
1725
+ s3 = input.charAt(peg$currPos);
1726
+ if (peg$r7.test(s3)) {
1727
+ peg$currPos++;
1728
+ } else {
1729
+ s3 = peg$FAILED;
1730
+ if (peg$silentFails === 0) { peg$fail(peg$e22); }
1731
+ }
1732
+ }
1733
+ } else {
1734
+ s2 = peg$FAILED;
1735
+ }
1736
+ if (s2 !== peg$FAILED) {
1737
+ s1 = input.substring(s1, peg$currPos);
1738
+ } else {
1739
+ s1 = s2;
1740
+ }
1741
+ if (s1 !== peg$FAILED) {
1742
+ peg$savedPos = s0;
1743
+ s1 = peg$f24(s1);
1744
+ }
1745
+ s0 = s1;
1746
+ if (s0 === peg$FAILED) {
1747
+ s0 = peg$currPos;
1748
+ if (input.charCodeAt(peg$currPos) === 35) {
1749
+ s1 = peg$c11;
1750
+ peg$currPos++;
1751
+ } else {
1752
+ s1 = peg$FAILED;
1753
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
1754
+ }
1755
+ if (s1 !== peg$FAILED) {
1756
+ s2 = peg$currPos;
1757
+ peg$silentFails++;
1758
+ s3 = input.charAt(peg$currPos);
1759
+ if (peg$r5.test(s3)) {
1760
+ peg$currPos++;
1761
+ } else {
1762
+ s3 = peg$FAILED;
1763
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
1764
+ }
1765
+ peg$silentFails--;
1766
+ if (s3 === peg$FAILED) {
1767
+ s2 = undefined;
1768
+ } else {
1769
+ peg$currPos = s2;
1770
+ s2 = peg$FAILED;
1771
+ }
1772
+ if (s2 !== peg$FAILED) {
1773
+ peg$savedPos = s0;
1774
+ s0 = peg$f25();
1775
+ } else {
1776
+ peg$currPos = s0;
1777
+ s0 = peg$FAILED;
1778
+ }
1779
+ } else {
1780
+ peg$currPos = s0;
1781
+ s0 = peg$FAILED;
1782
+ }
1783
+ }
1784
+
1785
+ return s0;
1786
+ }
1787
+
1788
+ function peg$parseEvalBlock() {
1789
+ let s0, s1, s2, s3;
1790
+
1791
+ s0 = peg$currPos;
1792
+ if (input.charCodeAt(peg$currPos) === 91) {
1793
+ s1 = peg$c14;
1794
+ peg$currPos++;
1795
+ } else {
1796
+ s1 = peg$FAILED;
1797
+ if (peg$silentFails === 0) { peg$fail(peg$e23); }
1798
+ }
1799
+ if (s1 !== peg$FAILED) {
1800
+ s2 = [];
1801
+ s3 = peg$parseEvalToken();
1802
+ while (s3 !== peg$FAILED) {
1803
+ s2.push(s3);
1804
+ s3 = peg$parseEvalToken();
1805
+ }
1806
+ if (input.charCodeAt(peg$currPos) === 93) {
1807
+ s3 = peg$c15;
1808
+ peg$currPos++;
1809
+ } else {
1810
+ s3 = peg$FAILED;
1811
+ if (peg$silentFails === 0) { peg$fail(peg$e24); }
1812
+ }
1813
+ if (s3 !== peg$FAILED) {
1814
+ peg$savedPos = s0;
1815
+ s0 = peg$f26(s2);
1816
+ } else {
1817
+ peg$currPos = s0;
1818
+ s0 = peg$FAILED;
1819
+ }
1820
+ } else {
1821
+ peg$currPos = s0;
1822
+ s0 = peg$FAILED;
1823
+ }
1824
+
1825
+ return s0;
1826
+ }
1827
+
1828
+ function peg$parseEvalToken() {
1829
+ let s0;
1830
+
1831
+ s0 = peg$parseFunctionCall();
1832
+ if (s0 === peg$FAILED) {
1833
+ s0 = peg$parseEvalBlock();
1834
+ if (s0 === peg$FAILED) {
1835
+ s0 = peg$parseBracedString();
1836
+ if (s0 === peg$FAILED) {
1837
+ s0 = peg$parseSubstitution();
1838
+ if (s0 === peg$FAILED) {
1839
+ s0 = peg$parseSpecialVar();
1840
+ if (s0 === peg$FAILED) {
1841
+ s0 = peg$parseTagRef();
1842
+ if (s0 === peg$FAILED) {
1843
+ s0 = peg$parseEscape();
1844
+ if (s0 === peg$FAILED) {
1845
+ s0 = peg$parseEvalLiteralChars();
1846
+ }
1847
+ }
1848
+ }
1849
+ }
1850
+ }
1851
+ }
1852
+ }
1853
+
1854
+ return s0;
1855
+ }
1856
+
1857
+ function peg$parseEvalLiteralChars() {
1858
+ let s0, s1, s2, s3;
1859
+
1860
+ s0 = peg$currPos;
1861
+ s1 = peg$currPos;
1862
+ s2 = [];
1863
+ s3 = input.charAt(peg$currPos);
1864
+ if (peg$r8.test(s3)) {
1865
+ peg$currPos++;
1866
+ } else {
1867
+ s3 = peg$FAILED;
1868
+ if (peg$silentFails === 0) { peg$fail(peg$e25); }
1869
+ }
1870
+ if (s3 !== peg$FAILED) {
1871
+ while (s3 !== peg$FAILED) {
1872
+ s2.push(s3);
1873
+ s3 = input.charAt(peg$currPos);
1874
+ if (peg$r8.test(s3)) {
1875
+ peg$currPos++;
1876
+ } else {
1877
+ s3 = peg$FAILED;
1878
+ if (peg$silentFails === 0) { peg$fail(peg$e25); }
1879
+ }
1880
+ }
1881
+ } else {
1882
+ s2 = peg$FAILED;
1883
+ }
1884
+ if (s2 !== peg$FAILED) {
1885
+ s1 = input.substring(s1, peg$currPos);
1886
+ } else {
1887
+ s1 = s2;
1888
+ }
1889
+ if (s1 !== peg$FAILED) {
1890
+ peg$savedPos = s0;
1891
+ s1 = peg$f27(s1);
1892
+ }
1893
+ s0 = s1;
1894
+ if (s0 === peg$FAILED) {
1895
+ s0 = peg$currPos;
1896
+ if (input.charCodeAt(peg$currPos) === 35) {
1897
+ s1 = peg$c11;
1898
+ peg$currPos++;
1899
+ } else {
1900
+ s1 = peg$FAILED;
1901
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
1902
+ }
1903
+ if (s1 !== peg$FAILED) {
1904
+ s2 = peg$currPos;
1905
+ peg$silentFails++;
1906
+ s3 = input.charAt(peg$currPos);
1907
+ if (peg$r5.test(s3)) {
1908
+ peg$currPos++;
1909
+ } else {
1910
+ s3 = peg$FAILED;
1911
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
1912
+ }
1913
+ peg$silentFails--;
1914
+ if (s3 === peg$FAILED) {
1915
+ s2 = undefined;
1916
+ } else {
1917
+ peg$currPos = s2;
1918
+ s2 = peg$FAILED;
1919
+ }
1920
+ if (s2 !== peg$FAILED) {
1921
+ peg$savedPos = s0;
1922
+ s0 = peg$f28();
1923
+ } else {
1924
+ peg$currPos = s0;
1925
+ s0 = peg$FAILED;
1926
+ }
1927
+ } else {
1928
+ peg$currPos = s0;
1929
+ s0 = peg$FAILED;
1930
+ }
1931
+ }
1932
+
1933
+ return s0;
1934
+ }
1935
+
1936
+ function peg$parseFunctionCall() {
1937
+ let s0, s1, s2, s3, s4;
1938
+
1939
+ s0 = peg$currPos;
1940
+ s1 = peg$parseFuncIdent();
1941
+ if (s1 !== peg$FAILED) {
1942
+ if (input.substr(peg$currPos, 2) === peg$c16) {
1943
+ s2 = peg$c16;
1944
+ peg$currPos += 2;
1945
+ } else {
1946
+ s2 = peg$FAILED;
1947
+ if (peg$silentFails === 0) { peg$fail(peg$e26); }
1948
+ }
1949
+ if (s2 !== peg$FAILED) {
1950
+ peg$savedPos = s0;
1951
+ s0 = peg$f29(s1);
1952
+ } else {
1953
+ peg$currPos = s0;
1954
+ s0 = peg$FAILED;
1955
+ }
1956
+ } else {
1957
+ peg$currPos = s0;
1958
+ s0 = peg$FAILED;
1959
+ }
1960
+ if (s0 === peg$FAILED) {
1961
+ s0 = peg$currPos;
1962
+ s1 = peg$parseFuncIdent();
1963
+ if (s1 !== peg$FAILED) {
1964
+ if (input.charCodeAt(peg$currPos) === 40) {
1965
+ s2 = peg$c17;
1966
+ peg$currPos++;
1967
+ } else {
1968
+ s2 = peg$FAILED;
1969
+ if (peg$silentFails === 0) { peg$fail(peg$e27); }
1970
+ }
1971
+ if (s2 !== peg$FAILED) {
1972
+ s3 = peg$parseArgList();
1973
+ if (input.charCodeAt(peg$currPos) === 41) {
1974
+ s4 = peg$c18;
1975
+ peg$currPos++;
1976
+ } else {
1977
+ s4 = peg$FAILED;
1978
+ if (peg$silentFails === 0) { peg$fail(peg$e28); }
1979
+ }
1980
+ if (s4 !== peg$FAILED) {
1981
+ peg$savedPos = s0;
1982
+ s0 = peg$f30(s1, s3);
1983
+ } else {
1984
+ peg$currPos = s0;
1985
+ s0 = peg$FAILED;
1986
+ }
1987
+ } else {
1988
+ peg$currPos = s0;
1989
+ s0 = peg$FAILED;
1990
+ }
1991
+ } else {
1992
+ peg$currPos = s0;
1993
+ s0 = peg$FAILED;
1994
+ }
1995
+ }
1996
+
1997
+ return s0;
1998
+ }
1999
+
2000
+ function peg$parseFuncIdent() {
2001
+ let s0, s1, s2, s3, s4;
2002
+
2003
+ s0 = peg$currPos;
2004
+ s1 = peg$currPos;
2005
+ s2 = input.charAt(peg$currPos);
2006
+ if (peg$r3.test(s2)) {
2007
+ peg$currPos++;
2008
+ } else {
2009
+ s2 = peg$FAILED;
2010
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
2011
+ }
2012
+ if (s2 !== peg$FAILED) {
2013
+ s3 = [];
2014
+ s4 = input.charAt(peg$currPos);
2015
+ if (peg$r9.test(s4)) {
2016
+ peg$currPos++;
2017
+ } else {
2018
+ s4 = peg$FAILED;
2019
+ if (peg$silentFails === 0) { peg$fail(peg$e29); }
2020
+ }
2021
+ while (s4 !== peg$FAILED) {
2022
+ s3.push(s4);
2023
+ s4 = input.charAt(peg$currPos);
2024
+ if (peg$r9.test(s4)) {
2025
+ peg$currPos++;
2026
+ } else {
2027
+ s4 = peg$FAILED;
2028
+ if (peg$silentFails === 0) { peg$fail(peg$e29); }
2029
+ }
2030
+ }
2031
+ s2 = [s2, s3];
2032
+ s1 = s2;
2033
+ } else {
2034
+ peg$currPos = s1;
2035
+ s1 = peg$FAILED;
2036
+ }
2037
+ if (s1 !== peg$FAILED) {
2038
+ s0 = input.substring(s0, peg$currPos);
2039
+ } else {
2040
+ s0 = s1;
2041
+ }
2042
+
2043
+ return s0;
2044
+ }
2045
+
2046
+ function peg$parseArgList() {
2047
+ let s0, s1, s2, s3, s4, s5;
2048
+
2049
+ s0 = peg$currPos;
2050
+ s1 = peg$parseFuncArg();
2051
+ s2 = [];
2052
+ s3 = peg$currPos;
2053
+ if (input.charCodeAt(peg$currPos) === 44) {
2054
+ s4 = peg$c19;
2055
+ peg$currPos++;
2056
+ } else {
2057
+ s4 = peg$FAILED;
2058
+ if (peg$silentFails === 0) { peg$fail(peg$e30); }
2059
+ }
2060
+ if (s4 !== peg$FAILED) {
2061
+ s5 = peg$parseFuncArg();
2062
+ s4 = [s4, s5];
2063
+ s3 = s4;
2064
+ } else {
2065
+ peg$currPos = s3;
2066
+ s3 = peg$FAILED;
2067
+ }
2068
+ while (s3 !== peg$FAILED) {
2069
+ s2.push(s3);
2070
+ s3 = peg$currPos;
2071
+ if (input.charCodeAt(peg$currPos) === 44) {
2072
+ s4 = peg$c19;
2073
+ peg$currPos++;
2074
+ } else {
2075
+ s4 = peg$FAILED;
2076
+ if (peg$silentFails === 0) { peg$fail(peg$e30); }
2077
+ }
2078
+ if (s4 !== peg$FAILED) {
2079
+ s5 = peg$parseFuncArg();
2080
+ s4 = [s4, s5];
2081
+ s3 = s4;
2082
+ } else {
2083
+ peg$currPos = s3;
2084
+ s3 = peg$FAILED;
2085
+ }
2086
+ }
2087
+ peg$savedPos = s0;
2088
+ s0 = peg$f31(s1, s2);
2089
+
2090
+ return s0;
2091
+ }
2092
+
2093
+ function peg$parseFuncArg() {
2094
+ let s0, s1, s2;
2095
+
2096
+ s0 = peg$currPos;
2097
+ s1 = [];
2098
+ s2 = peg$parseArgToken();
2099
+ while (s2 !== peg$FAILED) {
2100
+ s1.push(s2);
2101
+ s2 = peg$parseArgToken();
2102
+ }
2103
+ peg$savedPos = s0;
2104
+ s1 = peg$f32(s1);
2105
+ s0 = s1;
2106
+
2107
+ return s0;
2108
+ }
2109
+
2110
+ function peg$parseArgToken() {
2111
+ let s0;
2112
+
2113
+ s0 = peg$parseFunctionCall();
2114
+ if (s0 === peg$FAILED) {
2115
+ s0 = peg$parseEvalBlock();
2116
+ if (s0 === peg$FAILED) {
2117
+ s0 = peg$parseBracedString();
2118
+ if (s0 === peg$FAILED) {
2119
+ s0 = peg$parseBalancedParens();
2120
+ if (s0 === peg$FAILED) {
2121
+ s0 = peg$parseSubstitution();
2122
+ if (s0 === peg$FAILED) {
2123
+ s0 = peg$parseSpecialVar();
2124
+ if (s0 === peg$FAILED) {
2125
+ s0 = peg$parseTagRef();
2126
+ if (s0 === peg$FAILED) {
2127
+ s0 = peg$parseEscape();
2128
+ if (s0 === peg$FAILED) {
2129
+ s0 = peg$parseArgLiteralChars();
2130
+ }
2131
+ }
2132
+ }
2133
+ }
2134
+ }
2135
+ }
2136
+ }
2137
+ }
2138
+
2139
+ return s0;
2140
+ }
2141
+
2142
+ function peg$parseBalancedParens() {
2143
+ let s0, s1, s2, s3;
2144
+
2145
+ s0 = peg$currPos;
2146
+ if (input.charCodeAt(peg$currPos) === 40) {
2147
+ s1 = peg$c17;
2148
+ peg$currPos++;
2149
+ } else {
2150
+ s1 = peg$FAILED;
2151
+ if (peg$silentFails === 0) { peg$fail(peg$e27); }
2152
+ }
2153
+ if (s1 !== peg$FAILED) {
2154
+ s2 = [];
2155
+ s3 = peg$parseBalancedParenToken();
2156
+ while (s3 !== peg$FAILED) {
2157
+ s2.push(s3);
2158
+ s3 = peg$parseBalancedParenToken();
2159
+ }
2160
+ if (input.charCodeAt(peg$currPos) === 41) {
2161
+ s3 = peg$c18;
2162
+ peg$currPos++;
2163
+ } else {
2164
+ s3 = peg$FAILED;
2165
+ if (peg$silentFails === 0) { peg$fail(peg$e28); }
2166
+ }
2167
+ if (s3 !== peg$FAILED) {
2168
+ peg$savedPos = s0;
2169
+ s0 = peg$f33(s2);
2170
+ } else {
2171
+ peg$currPos = s0;
2172
+ s0 = peg$FAILED;
2173
+ }
2174
+ } else {
2175
+ peg$currPos = s0;
2176
+ s0 = peg$FAILED;
2177
+ }
2178
+
2179
+ return s0;
2180
+ }
2181
+
2182
+ function peg$parseBalancedParenToken() {
2183
+ let s0;
2184
+
2185
+ s0 = peg$parseFunctionCall();
2186
+ if (s0 === peg$FAILED) {
2187
+ s0 = peg$parseEvalBlock();
2188
+ if (s0 === peg$FAILED) {
2189
+ s0 = peg$parseBracedString();
2190
+ if (s0 === peg$FAILED) {
2191
+ s0 = peg$parseBalancedParens();
2192
+ if (s0 === peg$FAILED) {
2193
+ s0 = peg$parseSubstitution();
2194
+ if (s0 === peg$FAILED) {
2195
+ s0 = peg$parseSpecialVar();
2196
+ if (s0 === peg$FAILED) {
2197
+ s0 = peg$parseTagRef();
2198
+ if (s0 === peg$FAILED) {
2199
+ s0 = peg$parseEscape();
2200
+ if (s0 === peg$FAILED) {
2201
+ s0 = peg$parseBalancedParenLiteral();
2202
+ }
2203
+ }
2204
+ }
2205
+ }
2206
+ }
2207
+ }
2208
+ }
2209
+ }
2210
+
2211
+ return s0;
2212
+ }
2213
+
2214
+ function peg$parseBalancedParenLiteral() {
2215
+ let s0, s1, s2, s3;
2216
+
2217
+ s0 = peg$currPos;
2218
+ s1 = peg$currPos;
2219
+ s2 = [];
2220
+ s3 = input.charAt(peg$currPos);
2221
+ if (peg$r10.test(s3)) {
2222
+ peg$currPos++;
2223
+ } else {
2224
+ s3 = peg$FAILED;
2225
+ if (peg$silentFails === 0) { peg$fail(peg$e31); }
2226
+ }
2227
+ if (s3 !== peg$FAILED) {
2228
+ while (s3 !== peg$FAILED) {
2229
+ s2.push(s3);
2230
+ s3 = input.charAt(peg$currPos);
2231
+ if (peg$r10.test(s3)) {
2232
+ peg$currPos++;
2233
+ } else {
2234
+ s3 = peg$FAILED;
2235
+ if (peg$silentFails === 0) { peg$fail(peg$e31); }
2236
+ }
2237
+ }
2238
+ } else {
2239
+ s2 = peg$FAILED;
2240
+ }
2241
+ if (s2 !== peg$FAILED) {
2242
+ s1 = input.substring(s1, peg$currPos);
2243
+ } else {
2244
+ s1 = s2;
2245
+ }
2246
+ if (s1 !== peg$FAILED) {
2247
+ peg$savedPos = s0;
2248
+ s1 = peg$f34(s1);
2249
+ }
2250
+ s0 = s1;
2251
+ if (s0 === peg$FAILED) {
2252
+ s0 = peg$currPos;
2253
+ if (input.charCodeAt(peg$currPos) === 35) {
2254
+ s1 = peg$c11;
2255
+ peg$currPos++;
2256
+ } else {
2257
+ s1 = peg$FAILED;
2258
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
2259
+ }
2260
+ if (s1 !== peg$FAILED) {
2261
+ s2 = peg$currPos;
2262
+ peg$silentFails++;
2263
+ s3 = input.charAt(peg$currPos);
2264
+ if (peg$r5.test(s3)) {
2265
+ peg$currPos++;
2266
+ } else {
2267
+ s3 = peg$FAILED;
2268
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
2269
+ }
2270
+ peg$silentFails--;
2271
+ if (s3 === peg$FAILED) {
2272
+ s2 = undefined;
2273
+ } else {
2274
+ peg$currPos = s2;
2275
+ s2 = peg$FAILED;
2276
+ }
2277
+ if (s2 !== peg$FAILED) {
2278
+ peg$savedPos = s0;
2279
+ s0 = peg$f35();
2280
+ } else {
2281
+ peg$currPos = s0;
2282
+ s0 = peg$FAILED;
2283
+ }
2284
+ } else {
2285
+ peg$currPos = s0;
2286
+ s0 = peg$FAILED;
2287
+ }
2288
+ }
2289
+
2290
+ return s0;
2291
+ }
2292
+
2293
+ function peg$parseArgLiteralChars() {
2294
+ let s0, s1, s2, s3;
2295
+
2296
+ s0 = peg$currPos;
2297
+ s1 = peg$currPos;
2298
+ s2 = [];
2299
+ s3 = input.charAt(peg$currPos);
2300
+ if (peg$r11.test(s3)) {
2301
+ peg$currPos++;
2302
+ } else {
2303
+ s3 = peg$FAILED;
2304
+ if (peg$silentFails === 0) { peg$fail(peg$e32); }
2305
+ }
2306
+ if (s3 !== peg$FAILED) {
2307
+ while (s3 !== peg$FAILED) {
2308
+ s2.push(s3);
2309
+ s3 = input.charAt(peg$currPos);
2310
+ if (peg$r11.test(s3)) {
2311
+ peg$currPos++;
2312
+ } else {
2313
+ s3 = peg$FAILED;
2314
+ if (peg$silentFails === 0) { peg$fail(peg$e32); }
2315
+ }
2316
+ }
2317
+ } else {
2318
+ s2 = peg$FAILED;
2319
+ }
2320
+ if (s2 !== peg$FAILED) {
2321
+ s1 = input.substring(s1, peg$currPos);
2322
+ } else {
2323
+ s1 = s2;
2324
+ }
2325
+ if (s1 !== peg$FAILED) {
2326
+ peg$savedPos = s0;
2327
+ s1 = peg$f36(s1);
2328
+ }
2329
+ s0 = s1;
2330
+ if (s0 === peg$FAILED) {
2331
+ s0 = peg$currPos;
2332
+ if (input.charCodeAt(peg$currPos) === 35) {
2333
+ s1 = peg$c11;
2334
+ peg$currPos++;
2335
+ } else {
2336
+ s1 = peg$FAILED;
2337
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
2338
+ }
2339
+ if (s1 !== peg$FAILED) {
2340
+ s2 = peg$currPos;
2341
+ peg$silentFails++;
2342
+ s3 = input.charAt(peg$currPos);
2343
+ if (peg$r5.test(s3)) {
2344
+ peg$currPos++;
2345
+ } else {
2346
+ s3 = peg$FAILED;
2347
+ if (peg$silentFails === 0) { peg$fail(peg$e18); }
2348
+ }
2349
+ peg$silentFails--;
2350
+ if (s3 === peg$FAILED) {
2351
+ s2 = undefined;
2352
+ } else {
2353
+ peg$currPos = s2;
2354
+ s2 = peg$FAILED;
2355
+ }
2356
+ if (s2 !== peg$FAILED) {
2357
+ peg$savedPos = s0;
2358
+ s0 = peg$f37();
2359
+ } else {
2360
+ peg$currPos = s0;
2361
+ s0 = peg$FAILED;
2362
+ }
2363
+ } else {
2364
+ peg$currPos = s0;
2365
+ s0 = peg$FAILED;
2366
+ }
2367
+ }
2368
+
2369
+ return s0;
2370
+ }
2371
+
2372
+ function peg$parseSubstitution() {
2373
+ let s0, s1, s2;
2374
+
2375
+ s0 = peg$currPos;
2376
+ if (input.charCodeAt(peg$currPos) === 37) {
2377
+ s1 = peg$c20;
2378
+ peg$currPos++;
2379
+ } else {
2380
+ s1 = peg$FAILED;
2381
+ if (peg$silentFails === 0) { peg$fail(peg$e33); }
2382
+ }
2383
+ if (s1 !== peg$FAILED) {
2384
+ s2 = peg$parseSubCode();
2385
+ if (s2 !== peg$FAILED) {
2386
+ peg$savedPos = s0;
2387
+ s0 = peg$f38(s2);
2388
+ } else {
2389
+ peg$currPos = s0;
2390
+ s0 = peg$FAILED;
2391
+ }
2392
+ } else {
2393
+ peg$currPos = s0;
2394
+ s0 = peg$FAILED;
2395
+ }
2396
+
2397
+ return s0;
2398
+ }
2399
+
2400
+ function peg$parseSubCode() {
2401
+ let s0, s1, s2, s3, s4, s5, s6;
2402
+
2403
+ s0 = peg$currPos;
2404
+ if (input.charCodeAt(peg$currPos) === 113) {
2405
+ s1 = peg$c21;
2406
+ peg$currPos++;
2407
+ } else {
2408
+ s1 = peg$FAILED;
2409
+ if (peg$silentFails === 0) { peg$fail(peg$e34); }
2410
+ }
2411
+ if (s1 !== peg$FAILED) {
2412
+ s2 = peg$currPos;
2413
+ s3 = [];
2414
+ s4 = input.charAt(peg$currPos);
2415
+ if (peg$r12.test(s4)) {
2416
+ peg$currPos++;
2417
+ } else {
2418
+ s4 = peg$FAILED;
2419
+ if (peg$silentFails === 0) { peg$fail(peg$e35); }
2420
+ }
2421
+ if (s4 !== peg$FAILED) {
2422
+ while (s4 !== peg$FAILED) {
2423
+ s3.push(s4);
2424
+ s4 = input.charAt(peg$currPos);
2425
+ if (peg$r12.test(s4)) {
2426
+ peg$currPos++;
2427
+ } else {
2428
+ s4 = peg$FAILED;
2429
+ if (peg$silentFails === 0) { peg$fail(peg$e35); }
2430
+ }
2431
+ }
2432
+ } else {
2433
+ s3 = peg$FAILED;
2434
+ }
2435
+ if (s3 !== peg$FAILED) {
2436
+ s2 = input.substring(s2, peg$currPos);
2437
+ } else {
2438
+ s2 = s3;
2439
+ }
2440
+ if (s2 !== peg$FAILED) {
2441
+ peg$savedPos = s0;
2442
+ s0 = peg$f39(s2);
2443
+ } else {
2444
+ peg$currPos = s0;
2445
+ s0 = peg$FAILED;
2446
+ }
2447
+ } else {
2448
+ peg$currPos = s0;
2449
+ s0 = peg$FAILED;
2450
+ }
2451
+ if (s0 === peg$FAILED) {
2452
+ s0 = peg$currPos;
2453
+ if (input.charCodeAt(peg$currPos) === 105) {
2454
+ s1 = peg$c22;
2455
+ peg$currPos++;
2456
+ } else {
2457
+ s1 = peg$FAILED;
2458
+ if (peg$silentFails === 0) { peg$fail(peg$e36); }
2459
+ }
2460
+ if (s1 !== peg$FAILED) {
2461
+ s2 = input.charAt(peg$currPos);
2462
+ if (peg$r13.test(s2)) {
2463
+ peg$currPos++;
2464
+ } else {
2465
+ s2 = peg$FAILED;
2466
+ if (peg$silentFails === 0) { peg$fail(peg$e37); }
2467
+ }
2468
+ if (s2 !== peg$FAILED) {
2469
+ peg$savedPos = s0;
2470
+ s0 = peg$f40(s2);
2471
+ } else {
2472
+ peg$currPos = s0;
2473
+ s0 = peg$FAILED;
2474
+ }
2475
+ } else {
2476
+ peg$currPos = s0;
2477
+ s0 = peg$FAILED;
2478
+ }
2479
+ if (s0 === peg$FAILED) {
2480
+ s0 = peg$currPos;
2481
+ if (input.charCodeAt(peg$currPos) === 86) {
2482
+ s1 = peg$c23;
2483
+ peg$currPos++;
2484
+ } else {
2485
+ s1 = peg$FAILED;
2486
+ if (peg$silentFails === 0) { peg$fail(peg$e38); }
2487
+ }
2488
+ if (s1 !== peg$FAILED) {
2489
+ s2 = input.charAt(peg$currPos);
2490
+ if (peg$r14.test(s2)) {
2491
+ peg$currPos++;
2492
+ } else {
2493
+ s2 = peg$FAILED;
2494
+ if (peg$silentFails === 0) { peg$fail(peg$e39); }
2495
+ }
2496
+ if (s2 !== peg$FAILED) {
2497
+ peg$savedPos = s0;
2498
+ s0 = peg$f41(s2);
2499
+ } else {
2500
+ peg$currPos = s0;
2501
+ s0 = peg$FAILED;
2502
+ }
2503
+ } else {
2504
+ peg$currPos = s0;
2505
+ s0 = peg$FAILED;
2506
+ }
2507
+ if (s0 === peg$FAILED) {
2508
+ s0 = peg$currPos;
2509
+ if (input.charCodeAt(peg$currPos) === 118) {
2510
+ s1 = peg$c24;
2511
+ peg$currPos++;
2512
+ } else {
2513
+ s1 = peg$FAILED;
2514
+ if (peg$silentFails === 0) { peg$fail(peg$e40); }
2515
+ }
2516
+ if (s1 !== peg$FAILED) {
2517
+ s2 = input.charAt(peg$currPos);
2518
+ if (peg$r14.test(s2)) {
2519
+ peg$currPos++;
2520
+ } else {
2521
+ s2 = peg$FAILED;
2522
+ if (peg$silentFails === 0) { peg$fail(peg$e39); }
2523
+ }
2524
+ if (s2 !== peg$FAILED) {
2525
+ peg$savedPos = s0;
2526
+ s0 = peg$f42(s2);
2527
+ } else {
2528
+ peg$currPos = s0;
2529
+ s0 = peg$FAILED;
2530
+ }
2531
+ } else {
2532
+ peg$currPos = s0;
2533
+ s0 = peg$FAILED;
2534
+ }
2535
+ if (s0 === peg$FAILED) {
2536
+ s0 = peg$currPos;
2537
+ if (input.charCodeAt(peg$currPos) === 120) {
2538
+ s1 = peg$c25;
2539
+ peg$currPos++;
2540
+ } else {
2541
+ s1 = peg$FAILED;
2542
+ if (peg$silentFails === 0) { peg$fail(peg$e41); }
2543
+ }
2544
+ if (s1 !== peg$FAILED) {
2545
+ if (input.charCodeAt(peg$currPos) === 60) {
2546
+ s2 = peg$c26;
2547
+ peg$currPos++;
2548
+ } else {
2549
+ s2 = peg$FAILED;
2550
+ if (peg$silentFails === 0) { peg$fail(peg$e42); }
2551
+ }
2552
+ if (s2 !== peg$FAILED) {
2553
+ s3 = peg$currPos;
2554
+ s4 = [];
2555
+ s5 = input.charAt(peg$currPos);
2556
+ if (peg$r15.test(s5)) {
2557
+ peg$currPos++;
2558
+ } else {
2559
+ s5 = peg$FAILED;
2560
+ if (peg$silentFails === 0) { peg$fail(peg$e43); }
2561
+ }
2562
+ while (s5 !== peg$FAILED) {
2563
+ s4.push(s5);
2564
+ s5 = input.charAt(peg$currPos);
2565
+ if (peg$r15.test(s5)) {
2566
+ peg$currPos++;
2567
+ } else {
2568
+ s5 = peg$FAILED;
2569
+ if (peg$silentFails === 0) { peg$fail(peg$e43); }
2570
+ }
2571
+ }
2572
+ s3 = input.substring(s3, peg$currPos);
2573
+ if (input.charCodeAt(peg$currPos) === 62) {
2574
+ s4 = peg$c27;
2575
+ peg$currPos++;
2576
+ } else {
2577
+ s4 = peg$FAILED;
2578
+ if (peg$silentFails === 0) { peg$fail(peg$e44); }
2579
+ }
2580
+ if (s4 !== peg$FAILED) {
2581
+ peg$savedPos = s0;
2582
+ s0 = peg$f43(s3);
2583
+ } else {
2584
+ peg$currPos = s0;
2585
+ s0 = peg$FAILED;
2586
+ }
2587
+ } else {
2588
+ peg$currPos = s0;
2589
+ s0 = peg$FAILED;
2590
+ }
2591
+ } else {
2592
+ peg$currPos = s0;
2593
+ s0 = peg$FAILED;
2594
+ }
2595
+ if (s0 === peg$FAILED) {
2596
+ s0 = peg$currPos;
2597
+ if (input.charCodeAt(peg$currPos) === 88) {
2598
+ s1 = peg$c28;
2599
+ peg$currPos++;
2600
+ } else {
2601
+ s1 = peg$FAILED;
2602
+ if (peg$silentFails === 0) { peg$fail(peg$e45); }
2603
+ }
2604
+ if (s1 !== peg$FAILED) {
2605
+ if (input.charCodeAt(peg$currPos) === 60) {
2606
+ s2 = peg$c26;
2607
+ peg$currPos++;
2608
+ } else {
2609
+ s2 = peg$FAILED;
2610
+ if (peg$silentFails === 0) { peg$fail(peg$e42); }
2611
+ }
2612
+ if (s2 !== peg$FAILED) {
2613
+ s3 = peg$currPos;
2614
+ s4 = [];
2615
+ s5 = input.charAt(peg$currPos);
2616
+ if (peg$r15.test(s5)) {
2617
+ peg$currPos++;
2618
+ } else {
2619
+ s5 = peg$FAILED;
2620
+ if (peg$silentFails === 0) { peg$fail(peg$e43); }
2621
+ }
2622
+ while (s5 !== peg$FAILED) {
2623
+ s4.push(s5);
2624
+ s5 = input.charAt(peg$currPos);
2625
+ if (peg$r15.test(s5)) {
2626
+ peg$currPos++;
2627
+ } else {
2628
+ s5 = peg$FAILED;
2629
+ if (peg$silentFails === 0) { peg$fail(peg$e43); }
2630
+ }
2631
+ }
2632
+ s3 = input.substring(s3, peg$currPos);
2633
+ if (input.charCodeAt(peg$currPos) === 62) {
2634
+ s4 = peg$c27;
2635
+ peg$currPos++;
2636
+ } else {
2637
+ s4 = peg$FAILED;
2638
+ if (peg$silentFails === 0) { peg$fail(peg$e44); }
2639
+ }
2640
+ if (s4 !== peg$FAILED) {
2641
+ peg$savedPos = s0;
2642
+ s0 = peg$f44(s3);
2643
+ } else {
2644
+ peg$currPos = s0;
2645
+ s0 = peg$FAILED;
2646
+ }
2647
+ } else {
2648
+ peg$currPos = s0;
2649
+ s0 = peg$FAILED;
2650
+ }
2651
+ } else {
2652
+ peg$currPos = s0;
2653
+ s0 = peg$FAILED;
2654
+ }
2655
+ if (s0 === peg$FAILED) {
2656
+ s0 = peg$currPos;
2657
+ if (input.charCodeAt(peg$currPos) === 99) {
2658
+ s1 = peg$c29;
2659
+ peg$currPos++;
2660
+ } else {
2661
+ s1 = peg$FAILED;
2662
+ if (peg$silentFails === 0) { peg$fail(peg$e46); }
2663
+ }
2664
+ if (s1 !== peg$FAILED) {
2665
+ if (input.charCodeAt(peg$currPos) === 60) {
2666
+ s2 = peg$c26;
2667
+ peg$currPos++;
2668
+ } else {
2669
+ s2 = peg$FAILED;
2670
+ if (peg$silentFails === 0) { peg$fail(peg$e42); }
2671
+ }
2672
+ if (s2 !== peg$FAILED) {
2673
+ s3 = peg$currPos;
2674
+ s4 = [];
2675
+ s5 = input.charAt(peg$currPos);
2676
+ if (peg$r15.test(s5)) {
2677
+ peg$currPos++;
2678
+ } else {
2679
+ s5 = peg$FAILED;
2680
+ if (peg$silentFails === 0) { peg$fail(peg$e43); }
2681
+ }
2682
+ while (s5 !== peg$FAILED) {
2683
+ s4.push(s5);
2684
+ s5 = input.charAt(peg$currPos);
2685
+ if (peg$r15.test(s5)) {
2686
+ peg$currPos++;
2687
+ } else {
2688
+ s5 = peg$FAILED;
2689
+ if (peg$silentFails === 0) { peg$fail(peg$e43); }
2690
+ }
2691
+ }
2692
+ s3 = input.substring(s3, peg$currPos);
2693
+ if (input.charCodeAt(peg$currPos) === 62) {
2694
+ s4 = peg$c27;
2695
+ peg$currPos++;
2696
+ } else {
2697
+ s4 = peg$FAILED;
2698
+ if (peg$silentFails === 0) { peg$fail(peg$e44); }
2699
+ }
2700
+ if (s4 !== peg$FAILED) {
2701
+ peg$savedPos = s0;
2702
+ s0 = peg$f45(s3);
2703
+ } else {
2704
+ peg$currPos = s0;
2705
+ s0 = peg$FAILED;
2706
+ }
2707
+ } else {
2708
+ peg$currPos = s0;
2709
+ s0 = peg$FAILED;
2710
+ }
2711
+ } else {
2712
+ peg$currPos = s0;
2713
+ s0 = peg$FAILED;
2714
+ }
2715
+ if (s0 === peg$FAILED) {
2716
+ s0 = peg$currPos;
2717
+ if (input.charCodeAt(peg$currPos) === 67) {
2718
+ s1 = peg$c30;
2719
+ peg$currPos++;
2720
+ } else {
2721
+ s1 = peg$FAILED;
2722
+ if (peg$silentFails === 0) { peg$fail(peg$e47); }
2723
+ }
2724
+ if (s1 !== peg$FAILED) {
2725
+ if (input.charCodeAt(peg$currPos) === 60) {
2726
+ s2 = peg$c26;
2727
+ peg$currPos++;
2728
+ } else {
2729
+ s2 = peg$FAILED;
2730
+ if (peg$silentFails === 0) { peg$fail(peg$e42); }
2731
+ }
2732
+ if (s2 !== peg$FAILED) {
2733
+ s3 = peg$currPos;
2734
+ s4 = [];
2735
+ s5 = input.charAt(peg$currPos);
2736
+ if (peg$r15.test(s5)) {
2737
+ peg$currPos++;
2738
+ } else {
2739
+ s5 = peg$FAILED;
2740
+ if (peg$silentFails === 0) { peg$fail(peg$e43); }
2741
+ }
2742
+ while (s5 !== peg$FAILED) {
2743
+ s4.push(s5);
2744
+ s5 = input.charAt(peg$currPos);
2745
+ if (peg$r15.test(s5)) {
2746
+ peg$currPos++;
2747
+ } else {
2748
+ s5 = peg$FAILED;
2749
+ if (peg$silentFails === 0) { peg$fail(peg$e43); }
2750
+ }
2751
+ }
2752
+ s3 = input.substring(s3, peg$currPos);
2753
+ if (input.charCodeAt(peg$currPos) === 62) {
2754
+ s4 = peg$c27;
2755
+ peg$currPos++;
2756
+ } else {
2757
+ s4 = peg$FAILED;
2758
+ if (peg$silentFails === 0) { peg$fail(peg$e44); }
2759
+ }
2760
+ if (s4 !== peg$FAILED) {
2761
+ peg$savedPos = s0;
2762
+ s0 = peg$f46(s3);
2763
+ } else {
2764
+ peg$currPos = s0;
2765
+ s0 = peg$FAILED;
2766
+ }
2767
+ } else {
2768
+ peg$currPos = s0;
2769
+ s0 = peg$FAILED;
2770
+ }
2771
+ } else {
2772
+ peg$currPos = s0;
2773
+ s0 = peg$FAILED;
2774
+ }
2775
+ if (s0 === peg$FAILED) {
2776
+ s0 = peg$currPos;
2777
+ if (input.charCodeAt(peg$currPos) === 120) {
2778
+ s1 = peg$c25;
2779
+ peg$currPos++;
2780
+ } else {
2781
+ s1 = peg$FAILED;
2782
+ if (peg$silentFails === 0) { peg$fail(peg$e41); }
2783
+ }
2784
+ if (s1 !== peg$FAILED) {
2785
+ s2 = input.charAt(peg$currPos);
2786
+ if (peg$r16.test(s2)) {
2787
+ peg$currPos++;
2788
+ } else {
2789
+ s2 = peg$FAILED;
2790
+ if (peg$silentFails === 0) { peg$fail(peg$e48); }
2791
+ }
2792
+ if (s2 !== peg$FAILED) {
2793
+ peg$savedPos = s0;
2794
+ s0 = peg$f47(s2);
2795
+ } else {
2796
+ peg$currPos = s0;
2797
+ s0 = peg$FAILED;
2798
+ }
2799
+ } else {
2800
+ peg$currPos = s0;
2801
+ s0 = peg$FAILED;
2802
+ }
2803
+ if (s0 === peg$FAILED) {
2804
+ s0 = peg$currPos;
2805
+ if (input.charCodeAt(peg$currPos) === 88) {
2806
+ s1 = peg$c28;
2807
+ peg$currPos++;
2808
+ } else {
2809
+ s1 = peg$FAILED;
2810
+ if (peg$silentFails === 0) { peg$fail(peg$e45); }
2811
+ }
2812
+ if (s1 !== peg$FAILED) {
2813
+ s2 = input.charAt(peg$currPos);
2814
+ if (peg$r16.test(s2)) {
2815
+ peg$currPos++;
2816
+ } else {
2817
+ s2 = peg$FAILED;
2818
+ if (peg$silentFails === 0) { peg$fail(peg$e48); }
2819
+ }
2820
+ if (s2 !== peg$FAILED) {
2821
+ peg$savedPos = s0;
2822
+ s0 = peg$f48(s2);
2823
+ } else {
2824
+ peg$currPos = s0;
2825
+ s0 = peg$FAILED;
2826
+ }
2827
+ } else {
2828
+ peg$currPos = s0;
2829
+ s0 = peg$FAILED;
2830
+ }
2831
+ if (s0 === peg$FAILED) {
2832
+ s0 = peg$currPos;
2833
+ if (input.charCodeAt(peg$currPos) === 99) {
2834
+ s1 = peg$c29;
2835
+ peg$currPos++;
2836
+ } else {
2837
+ s1 = peg$FAILED;
2838
+ if (peg$silentFails === 0) { peg$fail(peg$e46); }
2839
+ }
2840
+ if (s1 !== peg$FAILED) {
2841
+ s2 = input.charAt(peg$currPos);
2842
+ if (peg$r16.test(s2)) {
2843
+ peg$currPos++;
2844
+ } else {
2845
+ s2 = peg$FAILED;
2846
+ if (peg$silentFails === 0) { peg$fail(peg$e48); }
2847
+ }
2848
+ if (s2 !== peg$FAILED) {
2849
+ peg$savedPos = s0;
2850
+ s0 = peg$f49(s2);
2851
+ } else {
2852
+ peg$currPos = s0;
2853
+ s0 = peg$FAILED;
2854
+ }
2855
+ } else {
2856
+ peg$currPos = s0;
2857
+ s0 = peg$FAILED;
2858
+ }
2859
+ if (s0 === peg$FAILED) {
2860
+ s0 = peg$currPos;
2861
+ if (input.charCodeAt(peg$currPos) === 67) {
2862
+ s1 = peg$c30;
2863
+ peg$currPos++;
2864
+ } else {
2865
+ s1 = peg$FAILED;
2866
+ if (peg$silentFails === 0) { peg$fail(peg$e47); }
2867
+ }
2868
+ if (s1 !== peg$FAILED) {
2869
+ s2 = input.charAt(peg$currPos);
2870
+ if (peg$r16.test(s2)) {
2871
+ peg$currPos++;
2872
+ } else {
2873
+ s2 = peg$FAILED;
2874
+ if (peg$silentFails === 0) { peg$fail(peg$e48); }
2875
+ }
2876
+ if (s2 !== peg$FAILED) {
2877
+ peg$savedPos = s0;
2878
+ s0 = peg$f50(s2);
2879
+ } else {
2880
+ peg$currPos = s0;
2881
+ s0 = peg$FAILED;
2882
+ }
2883
+ } else {
2884
+ peg$currPos = s0;
2885
+ s0 = peg$FAILED;
2886
+ }
2887
+ if (s0 === peg$FAILED) {
2888
+ s0 = peg$currPos;
2889
+ if (input.charCodeAt(peg$currPos) === 92) {
2890
+ s1 = peg$c6;
2891
+ peg$currPos++;
2892
+ } else {
2893
+ s1 = peg$FAILED;
2894
+ if (peg$silentFails === 0) { peg$fail(peg$e6); }
2895
+ }
2896
+ if (s1 !== peg$FAILED) {
2897
+ peg$savedPos = s0;
2898
+ s1 = peg$f51();
2899
+ }
2900
+ s0 = s1;
2901
+ if (s0 === peg$FAILED) {
2902
+ s0 = peg$currPos;
2903
+ if (input.charCodeAt(peg$currPos) === 61) {
2904
+ s1 = peg$c9;
2905
+ peg$currPos++;
2906
+ } else {
2907
+ s1 = peg$FAILED;
2908
+ if (peg$silentFails === 0) { peg$fail(peg$e13); }
2909
+ }
2910
+ if (s1 !== peg$FAILED) {
2911
+ s2 = peg$currPos;
2912
+ s3 = peg$currPos;
2913
+ s4 = input.charAt(peg$currPos);
2914
+ if (peg$r3.test(s4)) {
2915
+ peg$currPos++;
2916
+ } else {
2917
+ s4 = peg$FAILED;
2918
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
2919
+ }
2920
+ if (s4 !== peg$FAILED) {
2921
+ s5 = [];
2922
+ s6 = input.charAt(peg$currPos);
2923
+ if (peg$r2.test(s6)) {
2924
+ peg$currPos++;
2925
+ } else {
2926
+ s6 = peg$FAILED;
2927
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
2928
+ }
2929
+ while (s6 !== peg$FAILED) {
2930
+ s5.push(s6);
2931
+ s6 = input.charAt(peg$currPos);
2932
+ if (peg$r2.test(s6)) {
2933
+ peg$currPos++;
2934
+ } else {
2935
+ s6 = peg$FAILED;
2936
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
2937
+ }
2938
+ }
2939
+ s4 = [s4, s5];
2940
+ s3 = s4;
2941
+ } else {
2942
+ peg$currPos = s3;
2943
+ s3 = peg$FAILED;
2944
+ }
2945
+ if (s3 !== peg$FAILED) {
2946
+ s2 = input.substring(s2, peg$currPos);
2947
+ } else {
2948
+ s2 = s3;
2949
+ }
2950
+ if (s2 !== peg$FAILED) {
2951
+ peg$savedPos = s0;
2952
+ s0 = peg$f52(s2);
2953
+ } else {
2954
+ peg$currPos = s0;
2955
+ s0 = peg$FAILED;
2956
+ }
2957
+ } else {
2958
+ peg$currPos = s0;
2959
+ s0 = peg$FAILED;
2960
+ }
2961
+ if (s0 === peg$FAILED) {
2962
+ s0 = peg$currPos;
2963
+ s1 = input.charAt(peg$currPos);
2964
+ if (peg$r17.test(s1)) {
2965
+ peg$currPos++;
2966
+ } else {
2967
+ s1 = peg$FAILED;
2968
+ if (peg$silentFails === 0) { peg$fail(peg$e49); }
2969
+ }
2970
+ if (s1 !== peg$FAILED) {
2971
+ peg$savedPos = s0;
2972
+ s1 = peg$f53(s1);
2973
+ }
2974
+ s0 = s1;
2975
+ if (s0 === peg$FAILED) {
2976
+ s0 = peg$currPos;
2977
+ if (input.charCodeAt(peg$currPos) === 91) {
2978
+ s1 = peg$c14;
2979
+ peg$currPos++;
2980
+ } else {
2981
+ s1 = peg$FAILED;
2982
+ if (peg$silentFails === 0) { peg$fail(peg$e23); }
2983
+ }
2984
+ if (s1 !== peg$FAILED) {
2985
+ peg$savedPos = s0;
2986
+ s1 = peg$f54();
2987
+ }
2988
+ s0 = s1;
2989
+ if (s0 === peg$FAILED) {
2990
+ s0 = peg$currPos;
2991
+ if (input.charCodeAt(peg$currPos) === 93) {
2992
+ s1 = peg$c15;
2993
+ peg$currPos++;
2994
+ } else {
2995
+ s1 = peg$FAILED;
2996
+ if (peg$silentFails === 0) { peg$fail(peg$e24); }
2997
+ }
2998
+ if (s1 !== peg$FAILED) {
2999
+ peg$savedPos = s0;
3000
+ s1 = peg$f55();
3001
+ }
3002
+ s0 = s1;
3003
+ if (s0 === peg$FAILED) {
3004
+ s0 = peg$currPos;
3005
+ if (input.charCodeAt(peg$currPos) === 44) {
3006
+ s1 = peg$c19;
3007
+ peg$currPos++;
3008
+ } else {
3009
+ s1 = peg$FAILED;
3010
+ if (peg$silentFails === 0) { peg$fail(peg$e30); }
3011
+ }
3012
+ if (s1 !== peg$FAILED) {
3013
+ peg$savedPos = s0;
3014
+ s1 = peg$f56();
3015
+ }
3016
+ s0 = s1;
3017
+ if (s0 === peg$FAILED) {
3018
+ s0 = peg$currPos;
3019
+ if (input.charCodeAt(peg$currPos) === 59) {
3020
+ s1 = peg$c3;
3021
+ peg$currPos++;
3022
+ } else {
3023
+ s1 = peg$FAILED;
3024
+ if (peg$silentFails === 0) { peg$fail(peg$e3); }
3025
+ }
3026
+ if (s1 !== peg$FAILED) {
3027
+ peg$savedPos = s0;
3028
+ s1 = peg$f57();
3029
+ }
3030
+ s0 = s1;
3031
+ }
3032
+ }
3033
+ }
3034
+ }
3035
+ }
3036
+ }
3037
+ }
3038
+ }
3039
+ }
3040
+ }
3041
+ }
3042
+ }
3043
+ }
3044
+ }
3045
+ }
3046
+ }
3047
+ }
3048
+ }
3049
+
3050
+ return s0;
3051
+ }
3052
+
3053
+ function peg$parseSpecialVar() {
3054
+ let s0, s1;
3055
+
3056
+ s0 = peg$currPos;
3057
+ if (input.substr(peg$currPos, 2) === peg$c31) {
3058
+ s1 = peg$c31;
3059
+ peg$currPos += 2;
3060
+ } else {
3061
+ s1 = peg$FAILED;
3062
+ if (peg$silentFails === 0) { peg$fail(peg$e50); }
3063
+ }
3064
+ if (s1 !== peg$FAILED) {
3065
+ peg$savedPos = s0;
3066
+ s1 = peg$f58();
3067
+ }
3068
+ s0 = s1;
3069
+ if (s0 === peg$FAILED) {
3070
+ s0 = peg$currPos;
3071
+ if (input.substr(peg$currPos, 2) === peg$c32) {
3072
+ s1 = peg$c32;
3073
+ peg$currPos += 2;
3074
+ } else {
3075
+ s1 = peg$FAILED;
3076
+ if (peg$silentFails === 0) { peg$fail(peg$e51); }
3077
+ }
3078
+ if (s1 !== peg$FAILED) {
3079
+ peg$savedPos = s0;
3080
+ s1 = peg$f59();
3081
+ }
3082
+ s0 = s1;
3083
+ if (s0 === peg$FAILED) {
3084
+ s0 = peg$currPos;
3085
+ if (input.substr(peg$currPos, 2) === peg$c33) {
3086
+ s1 = peg$c33;
3087
+ peg$currPos += 2;
3088
+ } else {
3089
+ s1 = peg$FAILED;
3090
+ if (peg$silentFails === 0) { peg$fail(peg$e52); }
3091
+ }
3092
+ if (s1 !== peg$FAILED) {
3093
+ peg$savedPos = s0;
3094
+ s1 = peg$f60();
3095
+ }
3096
+ s0 = s1;
3097
+ }
3098
+ }
3099
+
3100
+ return s0;
3101
+ }
3102
+
3103
+ function peg$parseTagRef() {
3104
+ let s0, s1, s2, s3, s4, s5, s6;
3105
+
3106
+ s0 = peg$currPos;
3107
+ if (input.charCodeAt(peg$currPos) === 35) {
3108
+ s1 = peg$c11;
3109
+ peg$currPos++;
3110
+ } else {
3111
+ s1 = peg$FAILED;
3112
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
3113
+ }
3114
+ if (s1 !== peg$FAILED) {
3115
+ s2 = peg$currPos;
3116
+ s3 = peg$currPos;
3117
+ s4 = input.charAt(peg$currPos);
3118
+ if (peg$r3.test(s4)) {
3119
+ peg$currPos++;
3120
+ } else {
3121
+ s4 = peg$FAILED;
3122
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
3123
+ }
3124
+ if (s4 !== peg$FAILED) {
3125
+ s5 = [];
3126
+ s6 = input.charAt(peg$currPos);
3127
+ if (peg$r2.test(s6)) {
3128
+ peg$currPos++;
3129
+ } else {
3130
+ s6 = peg$FAILED;
3131
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
3132
+ }
3133
+ while (s6 !== peg$FAILED) {
3134
+ s5.push(s6);
3135
+ s6 = input.charAt(peg$currPos);
3136
+ if (peg$r2.test(s6)) {
3137
+ peg$currPos++;
3138
+ } else {
3139
+ s6 = peg$FAILED;
3140
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
3141
+ }
3142
+ }
3143
+ s4 = [s4, s5];
3144
+ s3 = s4;
3145
+ } else {
3146
+ peg$currPos = s3;
3147
+ s3 = peg$FAILED;
3148
+ }
3149
+ if (s3 !== peg$FAILED) {
3150
+ s2 = input.substring(s2, peg$currPos);
3151
+ } else {
3152
+ s2 = s3;
3153
+ }
3154
+ if (s2 !== peg$FAILED) {
3155
+ peg$savedPos = s0;
3156
+ s0 = peg$f61(s2);
3157
+ } else {
3158
+ peg$currPos = s0;
3159
+ s0 = peg$FAILED;
3160
+ }
3161
+ } else {
3162
+ peg$currPos = s0;
3163
+ s0 = peg$FAILED;
3164
+ }
3165
+
3166
+ return s0;
3167
+ }
3168
+
3169
+ function peg$parseEscape() {
3170
+ let s0, s1, s2;
3171
+
3172
+ s0 = peg$currPos;
3173
+ if (input.charCodeAt(peg$currPos) === 92) {
3174
+ s1 = peg$c6;
3175
+ peg$currPos++;
3176
+ } else {
3177
+ s1 = peg$FAILED;
3178
+ if (peg$silentFails === 0) { peg$fail(peg$e6); }
3179
+ }
3180
+ if (s1 !== peg$FAILED) {
3181
+ if (input.length > peg$currPos) {
3182
+ s2 = input.charAt(peg$currPos);
3183
+ peg$currPos++;
3184
+ } else {
3185
+ s2 = peg$FAILED;
3186
+ if (peg$silentFails === 0) { peg$fail(peg$e7); }
3187
+ }
3188
+ if (s2 !== peg$FAILED) {
3189
+ peg$savedPos = s0;
3190
+ s0 = peg$f62(s2);
3191
+ } else {
3192
+ peg$currPos = s0;
3193
+ s0 = peg$FAILED;
3194
+ }
3195
+ } else {
3196
+ peg$currPos = s0;
3197
+ s0 = peg$FAILED;
3198
+ }
3199
+
3200
+ return s0;
3201
+ }
3202
+
3203
+ function peg$parseLockExpr() {
3204
+ let s0;
3205
+
3206
+ s0 = peg$parseLockOr();
3207
+
3208
+ return s0;
3209
+ }
3210
+
3211
+ function peg$parseLockOr() {
3212
+ let s0, s1, s2, s3, s4, s5;
3213
+
3214
+ s0 = peg$currPos;
3215
+ s1 = peg$parseLockAnd();
3216
+ if (s1 !== peg$FAILED) {
3217
+ s2 = [];
3218
+ s3 = peg$currPos;
3219
+ if (input.charCodeAt(peg$currPos) === 124) {
3220
+ s4 = peg$c34;
3221
+ peg$currPos++;
3222
+ } else {
3223
+ s4 = peg$FAILED;
3224
+ if (peg$silentFails === 0) { peg$fail(peg$e53); }
3225
+ }
3226
+ if (s4 !== peg$FAILED) {
3227
+ s5 = peg$parseLockAnd();
3228
+ if (s5 !== peg$FAILED) {
3229
+ s4 = [s4, s5];
3230
+ s3 = s4;
3231
+ } else {
3232
+ peg$currPos = s3;
3233
+ s3 = peg$FAILED;
3234
+ }
3235
+ } else {
3236
+ peg$currPos = s3;
3237
+ s3 = peg$FAILED;
3238
+ }
3239
+ while (s3 !== peg$FAILED) {
3240
+ s2.push(s3);
3241
+ s3 = peg$currPos;
3242
+ if (input.charCodeAt(peg$currPos) === 124) {
3243
+ s4 = peg$c34;
3244
+ peg$currPos++;
3245
+ } else {
3246
+ s4 = peg$FAILED;
3247
+ if (peg$silentFails === 0) { peg$fail(peg$e53); }
3248
+ }
3249
+ if (s4 !== peg$FAILED) {
3250
+ s5 = peg$parseLockAnd();
3251
+ if (s5 !== peg$FAILED) {
3252
+ s4 = [s4, s5];
3253
+ s3 = s4;
3254
+ } else {
3255
+ peg$currPos = s3;
3256
+ s3 = peg$FAILED;
3257
+ }
3258
+ } else {
3259
+ peg$currPos = s3;
3260
+ s3 = peg$FAILED;
3261
+ }
3262
+ }
3263
+ peg$savedPos = s0;
3264
+ s0 = peg$f63(s1, s2);
3265
+ } else {
3266
+ peg$currPos = s0;
3267
+ s0 = peg$FAILED;
3268
+ }
3269
+
3270
+ return s0;
3271
+ }
3272
+
3273
+ function peg$parseLockAnd() {
3274
+ let s0, s1, s2, s3, s4, s5;
3275
+
3276
+ s0 = peg$currPos;
3277
+ s1 = peg$parseLockNot();
3278
+ if (s1 !== peg$FAILED) {
3279
+ s2 = [];
3280
+ s3 = peg$currPos;
3281
+ if (input.charCodeAt(peg$currPos) === 38) {
3282
+ s4 = peg$c10;
3283
+ peg$currPos++;
3284
+ } else {
3285
+ s4 = peg$FAILED;
3286
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
3287
+ }
3288
+ if (s4 !== peg$FAILED) {
3289
+ s5 = peg$parseLockNot();
3290
+ if (s5 !== peg$FAILED) {
3291
+ s4 = [s4, s5];
3292
+ s3 = s4;
3293
+ } else {
3294
+ peg$currPos = s3;
3295
+ s3 = peg$FAILED;
3296
+ }
3297
+ } else {
3298
+ peg$currPos = s3;
3299
+ s3 = peg$FAILED;
3300
+ }
3301
+ while (s3 !== peg$FAILED) {
3302
+ s2.push(s3);
3303
+ s3 = peg$currPos;
3304
+ if (input.charCodeAt(peg$currPos) === 38) {
3305
+ s4 = peg$c10;
3306
+ peg$currPos++;
3307
+ } else {
3308
+ s4 = peg$FAILED;
3309
+ if (peg$silentFails === 0) { peg$fail(peg$e14); }
3310
+ }
3311
+ if (s4 !== peg$FAILED) {
3312
+ s5 = peg$parseLockNot();
3313
+ if (s5 !== peg$FAILED) {
3314
+ s4 = [s4, s5];
3315
+ s3 = s4;
3316
+ } else {
3317
+ peg$currPos = s3;
3318
+ s3 = peg$FAILED;
3319
+ }
3320
+ } else {
3321
+ peg$currPos = s3;
3322
+ s3 = peg$FAILED;
3323
+ }
3324
+ }
3325
+ peg$savedPos = s0;
3326
+ s0 = peg$f64(s1, s2);
3327
+ } else {
3328
+ peg$currPos = s0;
3329
+ s0 = peg$FAILED;
3330
+ }
3331
+
3332
+ return s0;
3333
+ }
3334
+
3335
+ function peg$parseLockNot() {
3336
+ let s0, s1, s2;
3337
+
3338
+ s0 = peg$currPos;
3339
+ if (input.charCodeAt(peg$currPos) === 33) {
3340
+ s1 = peg$c35;
3341
+ peg$currPos++;
3342
+ } else {
3343
+ s1 = peg$FAILED;
3344
+ if (peg$silentFails === 0) { peg$fail(peg$e54); }
3345
+ }
3346
+ if (s1 !== peg$FAILED) {
3347
+ s2 = peg$parseLockNot();
3348
+ if (s2 !== peg$FAILED) {
3349
+ peg$savedPos = s0;
3350
+ s0 = peg$f65(s2);
3351
+ } else {
3352
+ peg$currPos = s0;
3353
+ s0 = peg$FAILED;
3354
+ }
3355
+ } else {
3356
+ peg$currPos = s0;
3357
+ s0 = peg$FAILED;
3358
+ }
3359
+ if (s0 === peg$FAILED) {
3360
+ s0 = peg$parseLockPrimary();
3361
+ }
3362
+
3363
+ return s0;
3364
+ }
3365
+
3366
+ function peg$parseLockPrimary() {
3367
+ let s0, s1, s2, s3, s4, s5;
3368
+
3369
+ s0 = peg$currPos;
3370
+ if (input.charCodeAt(peg$currPos) === 40) {
3371
+ s1 = peg$c17;
3372
+ peg$currPos++;
3373
+ } else {
3374
+ s1 = peg$FAILED;
3375
+ if (peg$silentFails === 0) { peg$fail(peg$e27); }
3376
+ }
3377
+ if (s1 !== peg$FAILED) {
3378
+ s2 = peg$parse_();
3379
+ s3 = peg$parseLockOr();
3380
+ if (s3 !== peg$FAILED) {
3381
+ s4 = peg$parse_();
3382
+ if (input.charCodeAt(peg$currPos) === 41) {
3383
+ s5 = peg$c18;
3384
+ peg$currPos++;
3385
+ } else {
3386
+ s5 = peg$FAILED;
3387
+ if (peg$silentFails === 0) { peg$fail(peg$e28); }
3388
+ }
3389
+ if (s5 !== peg$FAILED) {
3390
+ peg$savedPos = s0;
3391
+ s0 = peg$f66(s3);
3392
+ } else {
3393
+ peg$currPos = s0;
3394
+ s0 = peg$FAILED;
3395
+ }
3396
+ } else {
3397
+ peg$currPos = s0;
3398
+ s0 = peg$FAILED;
3399
+ }
3400
+ } else {
3401
+ peg$currPos = s0;
3402
+ s0 = peg$FAILED;
3403
+ }
3404
+ if (s0 === peg$FAILED) {
3405
+ s0 = peg$currPos;
3406
+ if (input.substr(peg$currPos, 2) === peg$c36) {
3407
+ s1 = peg$c36;
3408
+ peg$currPos += 2;
3409
+ } else {
3410
+ s1 = peg$FAILED;
3411
+ if (peg$silentFails === 0) { peg$fail(peg$e55); }
3412
+ }
3413
+ if (s1 !== peg$FAILED) {
3414
+ s2 = peg$currPos;
3415
+ peg$silentFails++;
3416
+ s3 = input.charAt(peg$currPos);
3417
+ if (peg$r9.test(s3)) {
3418
+ peg$currPos++;
3419
+ } else {
3420
+ s3 = peg$FAILED;
3421
+ if (peg$silentFails === 0) { peg$fail(peg$e29); }
3422
+ }
3423
+ peg$silentFails--;
3424
+ if (s3 === peg$FAILED) {
3425
+ s2 = undefined;
3426
+ } else {
3427
+ peg$currPos = s2;
3428
+ s2 = peg$FAILED;
3429
+ }
3430
+ if (s2 !== peg$FAILED) {
3431
+ peg$savedPos = s0;
3432
+ s0 = peg$f67();
3433
+ } else {
3434
+ peg$currPos = s0;
3435
+ s0 = peg$FAILED;
3436
+ }
3437
+ } else {
3438
+ peg$currPos = s0;
3439
+ s0 = peg$FAILED;
3440
+ }
3441
+ if (s0 === peg$FAILED) {
3442
+ s0 = peg$parseLockDbref();
3443
+ if (s0 === peg$FAILED) {
3444
+ s0 = peg$parseLockFlagCheck();
3445
+ if (s0 === peg$FAILED) {
3446
+ s0 = peg$parseLockTypeCheck();
3447
+ if (s0 === peg$FAILED) {
3448
+ s0 = peg$parseLockAttrCheck();
3449
+ if (s0 === peg$FAILED) {
3450
+ s0 = peg$parseLockPlayerName();
3451
+ }
3452
+ }
3453
+ }
3454
+ }
3455
+ }
3456
+ }
3457
+
3458
+ return s0;
3459
+ }
3460
+
3461
+ function peg$parseLockDbref() {
3462
+ let s0, s1, s2, s3, s4, s5, s6;
3463
+
3464
+ s0 = peg$currPos;
3465
+ if (input.charCodeAt(peg$currPos) === 35) {
3466
+ s1 = peg$c11;
3467
+ peg$currPos++;
3468
+ } else {
3469
+ s1 = peg$FAILED;
3470
+ if (peg$silentFails === 0) { peg$fail(peg$e17); }
3471
+ }
3472
+ if (s1 !== peg$FAILED) {
3473
+ s2 = peg$currPos;
3474
+ s3 = peg$currPos;
3475
+ if (input.charCodeAt(peg$currPos) === 45) {
3476
+ s4 = peg$c37;
3477
+ peg$currPos++;
3478
+ } else {
3479
+ s4 = peg$FAILED;
3480
+ if (peg$silentFails === 0) { peg$fail(peg$e56); }
3481
+ }
3482
+ if (s4 === peg$FAILED) {
3483
+ s4 = null;
3484
+ }
3485
+ s5 = [];
3486
+ s6 = input.charAt(peg$currPos);
3487
+ if (peg$r13.test(s6)) {
3488
+ peg$currPos++;
3489
+ } else {
3490
+ s6 = peg$FAILED;
3491
+ if (peg$silentFails === 0) { peg$fail(peg$e37); }
3492
+ }
3493
+ if (s6 !== peg$FAILED) {
3494
+ while (s6 !== peg$FAILED) {
3495
+ s5.push(s6);
3496
+ s6 = input.charAt(peg$currPos);
3497
+ if (peg$r13.test(s6)) {
3498
+ peg$currPos++;
3499
+ } else {
3500
+ s6 = peg$FAILED;
3501
+ if (peg$silentFails === 0) { peg$fail(peg$e37); }
3502
+ }
3503
+ }
3504
+ } else {
3505
+ s5 = peg$FAILED;
3506
+ }
3507
+ if (s5 !== peg$FAILED) {
3508
+ s4 = [s4, s5];
3509
+ s3 = s4;
3510
+ } else {
3511
+ peg$currPos = s3;
3512
+ s3 = peg$FAILED;
3513
+ }
3514
+ if (s3 !== peg$FAILED) {
3515
+ s2 = input.substring(s2, peg$currPos);
3516
+ } else {
3517
+ s2 = s3;
3518
+ }
3519
+ if (s2 !== peg$FAILED) {
3520
+ peg$savedPos = s0;
3521
+ s0 = peg$f68(s2);
3522
+ } else {
3523
+ peg$currPos = s0;
3524
+ s0 = peg$FAILED;
3525
+ }
3526
+ } else {
3527
+ peg$currPos = s0;
3528
+ s0 = peg$FAILED;
3529
+ }
3530
+
3531
+ return s0;
3532
+ }
3533
+
3534
+ function peg$parseLockFlagCheck() {
3535
+ let s0, s1, s2, s3, s4;
3536
+
3537
+ s0 = peg$currPos;
3538
+ if (input.substr(peg$currPos, 5) === peg$c38) {
3539
+ s1 = peg$c38;
3540
+ peg$currPos += 5;
3541
+ } else {
3542
+ s1 = peg$FAILED;
3543
+ if (peg$silentFails === 0) { peg$fail(peg$e57); }
3544
+ }
3545
+ if (s1 !== peg$FAILED) {
3546
+ s2 = peg$currPos;
3547
+ s3 = [];
3548
+ s4 = input.charAt(peg$currPos);
3549
+ if (peg$r3.test(s4)) {
3550
+ peg$currPos++;
3551
+ } else {
3552
+ s4 = peg$FAILED;
3553
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
3554
+ }
3555
+ if (s4 !== peg$FAILED) {
3556
+ while (s4 !== peg$FAILED) {
3557
+ s3.push(s4);
3558
+ s4 = input.charAt(peg$currPos);
3559
+ if (peg$r3.test(s4)) {
3560
+ peg$currPos++;
3561
+ } else {
3562
+ s4 = peg$FAILED;
3563
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
3564
+ }
3565
+ }
3566
+ } else {
3567
+ s3 = peg$FAILED;
3568
+ }
3569
+ if (s3 !== peg$FAILED) {
3570
+ s2 = input.substring(s2, peg$currPos);
3571
+ } else {
3572
+ s2 = s3;
3573
+ }
3574
+ if (s2 !== peg$FAILED) {
3575
+ peg$savedPos = s0;
3576
+ s0 = peg$f69(s2);
3577
+ } else {
3578
+ peg$currPos = s0;
3579
+ s0 = peg$FAILED;
3580
+ }
3581
+ } else {
3582
+ peg$currPos = s0;
3583
+ s0 = peg$FAILED;
3584
+ }
3585
+
3586
+ return s0;
3587
+ }
3588
+
3589
+ function peg$parseLockTypeCheck() {
3590
+ let s0, s1, s2, s3, s4;
3591
+
3592
+ s0 = peg$currPos;
3593
+ if (input.substr(peg$currPos, 5) === peg$c39) {
3594
+ s1 = peg$c39;
3595
+ peg$currPos += 5;
3596
+ } else {
3597
+ s1 = peg$FAILED;
3598
+ if (peg$silentFails === 0) { peg$fail(peg$e58); }
3599
+ }
3600
+ if (s1 !== peg$FAILED) {
3601
+ s2 = peg$currPos;
3602
+ s3 = [];
3603
+ s4 = input.charAt(peg$currPos);
3604
+ if (peg$r3.test(s4)) {
3605
+ peg$currPos++;
3606
+ } else {
3607
+ s4 = peg$FAILED;
3608
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
3609
+ }
3610
+ if (s4 !== peg$FAILED) {
3611
+ while (s4 !== peg$FAILED) {
3612
+ s3.push(s4);
3613
+ s4 = input.charAt(peg$currPos);
3614
+ if (peg$r3.test(s4)) {
3615
+ peg$currPos++;
3616
+ } else {
3617
+ s4 = peg$FAILED;
3618
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
3619
+ }
3620
+ }
3621
+ } else {
3622
+ s3 = peg$FAILED;
3623
+ }
3624
+ if (s3 !== peg$FAILED) {
3625
+ s2 = input.substring(s2, peg$currPos);
3626
+ } else {
3627
+ s2 = s3;
3628
+ }
3629
+ if (s2 !== peg$FAILED) {
3630
+ peg$savedPos = s0;
3631
+ s0 = peg$f70(s2);
3632
+ } else {
3633
+ peg$currPos = s0;
3634
+ s0 = peg$FAILED;
3635
+ }
3636
+ } else {
3637
+ peg$currPos = s0;
3638
+ s0 = peg$FAILED;
3639
+ }
3640
+
3641
+ return s0;
3642
+ }
3643
+
3644
+ function peg$parseLockAttrCheck() {
3645
+ let s0, s1, s2, s3, s4, s5, s6;
3646
+
3647
+ s0 = peg$currPos;
3648
+ if (input.substr(peg$currPos, 5) === peg$c40) {
3649
+ s1 = peg$c40;
3650
+ peg$currPos += 5;
3651
+ } else {
3652
+ s1 = peg$FAILED;
3653
+ if (peg$silentFails === 0) { peg$fail(peg$e59); }
3654
+ }
3655
+ if (s1 !== peg$FAILED) {
3656
+ s2 = peg$currPos;
3657
+ s3 = peg$currPos;
3658
+ s4 = input.charAt(peg$currPos);
3659
+ if (peg$r3.test(s4)) {
3660
+ peg$currPos++;
3661
+ } else {
3662
+ s4 = peg$FAILED;
3663
+ if (peg$silentFails === 0) { peg$fail(peg$e15); }
3664
+ }
3665
+ if (s4 !== peg$FAILED) {
3666
+ s5 = [];
3667
+ s6 = input.charAt(peg$currPos);
3668
+ if (peg$r2.test(s6)) {
3669
+ peg$currPos++;
3670
+ } else {
3671
+ s6 = peg$FAILED;
3672
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
3673
+ }
3674
+ while (s6 !== peg$FAILED) {
3675
+ s5.push(s6);
3676
+ s6 = input.charAt(peg$currPos);
3677
+ if (peg$r2.test(s6)) {
3678
+ peg$currPos++;
3679
+ } else {
3680
+ s6 = peg$FAILED;
3681
+ if (peg$silentFails === 0) { peg$fail(peg$e11); }
3682
+ }
3683
+ }
3684
+ s4 = [s4, s5];
3685
+ s3 = s4;
3686
+ } else {
3687
+ peg$currPos = s3;
3688
+ s3 = peg$FAILED;
3689
+ }
3690
+ if (s3 !== peg$FAILED) {
3691
+ s2 = input.substring(s2, peg$currPos);
3692
+ } else {
3693
+ s2 = s3;
3694
+ }
3695
+ if (s2 !== peg$FAILED) {
3696
+ peg$savedPos = s0;
3697
+ s0 = peg$f71(s2);
3698
+ } else {
3699
+ peg$currPos = s0;
3700
+ s0 = peg$FAILED;
3701
+ }
3702
+ } else {
3703
+ peg$currPos = s0;
3704
+ s0 = peg$FAILED;
3705
+ }
3706
+
3707
+ return s0;
3708
+ }
3709
+
3710
+ function peg$parseLockPlayerName() {
3711
+ let s0, s1, s2, s3, s4;
3712
+
3713
+ s0 = peg$currPos;
3714
+ if (input.charCodeAt(peg$currPos) === 61) {
3715
+ s1 = peg$c9;
3716
+ peg$currPos++;
3717
+ } else {
3718
+ s1 = peg$FAILED;
3719
+ if (peg$silentFails === 0) { peg$fail(peg$e13); }
3720
+ }
3721
+ if (s1 !== peg$FAILED) {
3722
+ s2 = peg$currPos;
3723
+ s3 = [];
3724
+ s4 = input.charAt(peg$currPos);
3725
+ if (peg$r18.test(s4)) {
3726
+ peg$currPos++;
3727
+ } else {
3728
+ s4 = peg$FAILED;
3729
+ if (peg$silentFails === 0) { peg$fail(peg$e60); }
3730
+ }
3731
+ if (s4 !== peg$FAILED) {
3732
+ while (s4 !== peg$FAILED) {
3733
+ s3.push(s4);
3734
+ s4 = input.charAt(peg$currPos);
3735
+ if (peg$r18.test(s4)) {
3736
+ peg$currPos++;
3737
+ } else {
3738
+ s4 = peg$FAILED;
3739
+ if (peg$silentFails === 0) { peg$fail(peg$e60); }
3740
+ }
3741
+ }
3742
+ } else {
3743
+ s3 = peg$FAILED;
3744
+ }
3745
+ if (s3 !== peg$FAILED) {
3746
+ s2 = input.substring(s2, peg$currPos);
3747
+ } else {
3748
+ s2 = s3;
3749
+ }
3750
+ if (s2 !== peg$FAILED) {
3751
+ peg$savedPos = s0;
3752
+ s0 = peg$f72(s2);
3753
+ } else {
3754
+ peg$currPos = s0;
3755
+ s0 = peg$FAILED;
3756
+ }
3757
+ } else {
3758
+ peg$currPos = s0;
3759
+ s0 = peg$FAILED;
3760
+ }
3761
+
3762
+ return s0;
3763
+ }
3764
+
3765
+ function peg$parse_() {
3766
+ let s0, s1;
3767
+
3768
+ s0 = [];
3769
+ s1 = input.charAt(peg$currPos);
3770
+ if (peg$r19.test(s1)) {
3771
+ peg$currPos++;
3772
+ } else {
3773
+ s1 = peg$FAILED;
3774
+ if (peg$silentFails === 0) { peg$fail(peg$e61); }
3775
+ }
3776
+ while (s1 !== peg$FAILED) {
3777
+ s0.push(s1);
3778
+ s1 = input.charAt(peg$currPos);
3779
+ if (peg$r19.test(s1)) {
3780
+ peg$currPos++;
3781
+ } else {
3782
+ s1 = peg$FAILED;
3783
+ if (peg$silentFails === 0) { peg$fail(peg$e61); }
3784
+ }
3785
+ }
3786
+
3787
+ return s0;
3788
+ }
3789
+
3790
+
3791
+ // Per-parse initializer: capture the `location` function for this parse run.
3792
+ // Called once at the start of every peg$parse() invocation.
3793
+ _loc = location;
3794
+
3795
+ peg$result = peg$startRuleFunction();
3796
+
3797
+ const peg$success = (peg$result !== peg$FAILED && peg$currPos === input.length);
3798
+ function peg$throw() {
3799
+ if (peg$result !== peg$FAILED && peg$currPos < input.length) {
3800
+ peg$fail(peg$endExpectation());
3801
+ }
3802
+
3803
+ throw peg$buildStructuredError(
3804
+ peg$maxFailExpected,
3805
+ peg$maxFailPos < input.length ? peg$getUnicode(peg$maxFailPos) : null,
3806
+ peg$maxFailPos < input.length
3807
+ ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
3808
+ : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
3809
+ );
3810
+ }
3811
+ if (options.peg$library) {
3812
+ return /** @type {any} */ ({
3813
+ peg$result,
3814
+ peg$currPos,
3815
+ peg$FAILED,
3816
+ peg$maxFailExpected,
3817
+ peg$maxFailPos,
3818
+ peg$success,
3819
+ peg$throw: peg$success ? undefined : peg$throw,
3820
+ });
3821
+ }
3822
+ if (peg$success) {
3823
+ return peg$result;
3824
+ } else {
3825
+ peg$throw();
3826
+ }
3827
+ }
3828
+
3829
+ module.exports = {
3830
+ StartRules: ["Start", "LockExpr"],
3831
+ SyntaxError: peg$SyntaxError,
3832
+ parse: peg$parse,
3833
+ };