PluginProbe
Gutenberg / 12.1.0
Gutenberg v12.1.0
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / build / block-serialization-spec-parser / index.js

index.js in Gutenberg 12.1.0, at build/block-serialization-spec-parser/index.js

1,831 lines 48.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /******/ (function() { // webpackBootstrap
2 /******/ "use strict";
3 /******/ var __webpack_modules__ = ({
4
5 /***/ 6494:
6 /***/ (function(module) {
7
8 /*
9 * Generated by PEG.js 0.10.0.
10 *
11 * http://pegjs.org/
12 */
13
14
15
16 function peg$subclass(child, parent) {
17 function ctor() { this.constructor = child; }
18 ctor.prototype = parent.prototype;
19 child.prototype = new ctor();
20 }
21
22 function peg$SyntaxError(message, expected, found, location) {
23 this.message = message;
24 this.expected = expected;
25 this.found = found;
26 this.location = location;
27 this.name = "SyntaxError";
28
29 if (typeof Error.captureStackTrace === "function") {
30 Error.captureStackTrace(this, peg$SyntaxError);
31 }
32 }
33
34 peg$subclass(peg$SyntaxError, Error);
35
36 peg$SyntaxError.buildMessage = function(expected, found) {
37 var DESCRIBE_EXPECTATION_FNS = {
38 literal: function(expectation) {
39 return "\"" + literalEscape(expectation.text) + "\"";
40 },
41
42 "class": function(expectation) {
43 var escapedParts = "",
44 i;
45
46 for (i = 0; i < expectation.parts.length; i++) {
47 escapedParts += expectation.parts[i] instanceof Array
48 ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1])
49 : classEscape(expectation.parts[i]);
50 }
51
52 return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
53 },
54
55 any: function(expectation) {
56 return "any character";
57 },
58
59 end: function(expectation) {
60 return "end of input";
61 },
62
63 other: function(expectation) {
64 return expectation.description;
65 }
66 };
67
68 function hex(ch) {
69 return ch.charCodeAt(0).toString(16).toUpperCase();
70 }
71
72 function literalEscape(s) {
73 return s
74 .replace(/\\/g, '\\\\')
75 .replace(/"/g, '\\"')
76 .replace(/\0/g, '\\0')
77 .replace(/\t/g, '\\t')
78 .replace(/\n/g, '\\n')
79 .replace(/\r/g, '\\r')
80 .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
81 .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
82 }
83
84 function classEscape(s) {
85 return s
86 .replace(/\\/g, '\\\\')
87 .replace(/\]/g, '\\]')
88 .replace(/\^/g, '\\^')
89 .replace(/-/g, '\\-')
90 .replace(/\0/g, '\\0')
91 .replace(/\t/g, '\\t')
92 .replace(/\n/g, '\\n')
93 .replace(/\r/g, '\\r')
94 .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
95 .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); });
96 }
97
98 function describeExpectation(expectation) {
99 return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation);
100 }
101
102 function describeExpected(expected) {
103 var descriptions = new Array(expected.length),
104 i, j;
105
106 for (i = 0; i < expected.length; i++) {
107 descriptions[i] = describeExpectation(expected[i]);
108 }
109
110 descriptions.sort();
111
112 if (descriptions.length > 0) {
113 for (i = 1, j = 1; i < descriptions.length; i++) {
114 if (descriptions[i - 1] !== descriptions[i]) {
115 descriptions[j] = descriptions[i];
116 j++;
117 }
118 }
119 descriptions.length = j;
120 }
121
122 switch (descriptions.length) {
123 case 1:
124 return descriptions[0];
125
126 case 2:
127 return descriptions[0] + " or " + descriptions[1];
128
129 default:
130 return descriptions.slice(0, -1).join(", ")
131 + ", or "
132 + descriptions[descriptions.length - 1];
133 }
134 }
135
136 function describeFound(found) {
137 return found ? "\"" + literalEscape(found) + "\"" : "end of input";
138 }
139
140 return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found.";
141 };
142
143 function peg$parse(input, options) {
144 options = options !== void 0 ? options : {};
145
146 var peg$FAILED = {},
147
148 peg$startRuleFunctions = { Block_List: peg$parseBlock_List },
149 peg$startRuleFunction = peg$parseBlock_List,
150
151 peg$c0 = peg$anyExpectation(),
152 peg$c1 = function(pre, b, html) { /** <?php return array( $b, $html ); ?> **/ return [ b, html ] },
153 peg$c2 = function(pre, bs, post) { /** <?php return peg_join_blocks( $pre, $bs, $post ); ?> **/
154 return joinBlocks( pre, bs, post );
155 },
156 peg$c3 = "<!--",
157 peg$c4 = peg$literalExpectation("<!--", false),
158 peg$c5 = "wp:",
159 peg$c6 = peg$literalExpectation("wp:", false),
160 peg$c7 = function(blockName, a) {
161 /** <?php return $a; ?> **/
162 return a;
163 },
164 peg$c8 = "/-->",
165 peg$c9 = peg$literalExpectation("/-->", false),
166 peg$c10 = function(blockName, attrs) {
167 /** <?php
168 return array(
169 'blockName' => $blockName,
170 'attrs' => empty( $attrs ) ? peg_empty_attrs() : $attrs,
171 'innerBlocks' => array(),
172 'innerHTML' => '',
173 'innerContent' => array(),
174 );
175 ?> **/
176
177 return {
178 blockName: blockName,
179 attrs: attrs || {},
180 innerBlocks: [],
181 innerHTML: '',
182 innerContent: []
183 };
184 },
185 peg$c11 = function(s, children, e) {
186 /** <?php
187 list( $innerHTML, $innerBlocks, $innerContent ) = peg_process_inner_content( $children );
188
189 return array(
190 'blockName' => $s['blockName'],
191 'attrs' => empty( $s['attrs'] ) ? peg_empty_attrs() : $s['attrs'],
192 'innerBlocks' => $innerBlocks,
193 'innerHTML' => $innerHTML,
194 'innerContent' => $innerContent,
195 );
196 ?> **/
197
198 var innerParts = processInnerContent( children );
199 var innerHTML = innerParts[ 0 ];
200 var innerBlocks = innerParts[ 1 ];
201 var innerContent = innerParts[ 2 ];
202
203 return {
204 blockName: s.blockName,
205 attrs: s.attrs,
206 innerBlocks: innerBlocks,
207 innerHTML: innerHTML,
208 innerContent: innerContent,
209 };
210 },
211 peg$c12 = "-->",
212 peg$c13 = peg$literalExpectation("-->", false),
213 peg$c14 = function(blockName, attrs) {
214 /** <?php
215 return array(
216 'blockName' => $blockName,
217 'attrs' => isset( $attrs ) ? $attrs : array(),
218 );
219 ?> **/
220
221 return {
222 blockName: blockName,
223 attrs: attrs || {}
224 };
225 },
226 peg$c15 = "/wp:",
227 peg$c16 = peg$literalExpectation("/wp:", false),
228 peg$c17 = function(blockName) {
229 /** <?php
230 return array(
231 'blockName' => $blockName,
232 );
233 ?> **/
234
235 return {
236 blockName: blockName
237 };
238 },
239 peg$c18 = "/",
240 peg$c19 = peg$literalExpectation("/", false),
241 peg$c20 = function(type) {
242 /** <?php return "core/$type"; ?> **/
243 return 'core/' + type;
244 },
245 peg$c21 = /^[a-z]/,
246 peg$c22 = peg$classExpectation([["a", "z"]], false, false),
247 peg$c23 = /^[a-z0-9_\-]/,
248 peg$c24 = peg$classExpectation([["a", "z"], ["0", "9"], "_", "-"], false, false),
249 peg$c25 = peg$otherExpectation("JSON-encoded attributes embedded in a block's opening comment"),
250 peg$c26 = "{",
251 peg$c27 = peg$literalExpectation("{", false),
252 peg$c28 = "}",
253 peg$c29 = peg$literalExpectation("}", false),
254 peg$c30 = "",
255 peg$c31 = function(attrs) {
256 /** <?php return json_decode( $attrs, true ); ?> **/
257 return maybeJSON( attrs );
258 },
259 peg$c32 = /^[ \t\r\n]/,
260 peg$c33 = peg$classExpectation([" ", "\t", "\r", "\n"], false, false),
261
262 peg$currPos = 0,
263 peg$savedPos = 0,
264 peg$posDetailsCache = [{ line: 1, column: 1 }],
265 peg$maxFailPos = 0,
266 peg$maxFailExpected = [],
267 peg$silentFails = 0,
268
269 peg$result;
270
271 if ("startRule" in options) {
272 if (!(options.startRule in peg$startRuleFunctions)) {
273 throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
274 }
275
276 peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
277 }
278
279 function text() {
280 return input.substring(peg$savedPos, peg$currPos);
281 }
282
283 function location() {
284 return peg$computeLocation(peg$savedPos, peg$currPos);
285 }
286
287 function expected(description, location) {
288 location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
289
290 throw peg$buildStructuredError(
291 [peg$otherExpectation(description)],
292 input.substring(peg$savedPos, peg$currPos),
293 location
294 );
295 }
296
297 function error(message, location) {
298 location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos)
299
300 throw peg$buildSimpleError(message, location);
301 }
302
303 function peg$literalExpectation(text, ignoreCase) {
304 return { type: "literal", text: text, ignoreCase: ignoreCase };
305 }
306
307 function peg$classExpectation(parts, inverted, ignoreCase) {
308 return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase };
309 }
310
311 function peg$anyExpectation() {
312 return { type: "any" };
313 }
314
315 function peg$endExpectation() {
316 return { type: "end" };
317 }
318
319 function peg$otherExpectation(description) {
320 return { type: "other", description: description };
321 }
322
323 function peg$computePosDetails(pos) {
324 var details = peg$posDetailsCache[pos], p;
325
326 if (details) {
327 return details;
328 } else {
329 p = pos - 1;
330 while (!peg$posDetailsCache[p]) {
331 p--;
332 }
333
334 details = peg$posDetailsCache[p];
335 details = {
336 line: details.line,
337 column: details.column
338 };
339
340 while (p < pos) {
341 if (input.charCodeAt(p) === 10) {
342 details.line++;
343 details.column = 1;
344 } else {
345 details.column++;
346 }
347
348 p++;
349 }
350
351 peg$posDetailsCache[pos] = details;
352 return details;
353 }
354 }
355
356 function peg$computeLocation(startPos, endPos) {
357 var startPosDetails = peg$computePosDetails(startPos),
358 endPosDetails = peg$computePosDetails(endPos);
359
360 return {
361 start: {
362 offset: startPos,
363 line: startPosDetails.line,
364 column: startPosDetails.column
365 },
366 end: {
367 offset: endPos,
368 line: endPosDetails.line,
369 column: endPosDetails.column
370 }
371 };
372 }
373
374 function peg$fail(expected) {
375 if (peg$currPos < peg$maxFailPos) { return; }
376
377 if (peg$currPos > peg$maxFailPos) {
378 peg$maxFailPos = peg$currPos;
379 peg$maxFailExpected = [];
380 }
381
382 peg$maxFailExpected.push(expected);
383 }
384
385 function peg$buildSimpleError(message, location) {
386 return new peg$SyntaxError(message, null, null, location);
387 }
388
389 function peg$buildStructuredError(expected, found, location) {
390 return new peg$SyntaxError(
391 peg$SyntaxError.buildMessage(expected, found),
392 expected,
393 found,
394 location
395 );
396 }
397
398 function peg$parseBlock_List() {
399 var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
400
401 s0 = peg$currPos;
402 s1 = peg$currPos;
403 s2 = [];
404 s3 = peg$currPos;
405 s4 = peg$currPos;
406 peg$silentFails++;
407 s5 = peg$parseBlock();
408 peg$silentFails--;
409 if (s5 === peg$FAILED) {
410 s4 = void 0;
411 } else {
412 peg$currPos = s4;
413 s4 = peg$FAILED;
414 }
415 if (s4 !== peg$FAILED) {
416 if (input.length > peg$currPos) {
417 s5 = input.charAt(peg$currPos);
418 peg$currPos++;
419 } else {
420 s5 = peg$FAILED;
421 if (peg$silentFails === 0) { peg$fail(peg$c0); }
422 }
423 if (s5 !== peg$FAILED) {
424 s4 = [s4, s5];
425 s3 = s4;
426 } else {
427 peg$currPos = s3;
428 s3 = peg$FAILED;
429 }
430 } else {
431 peg$currPos = s3;
432 s3 = peg$FAILED;
433 }
434 while (s3 !== peg$FAILED) {
435 s2.push(s3);
436 s3 = peg$currPos;
437 s4 = peg$currPos;
438 peg$silentFails++;
439 s5 = peg$parseBlock();
440 peg$silentFails--;
441 if (s5 === peg$FAILED) {
442 s4 = void 0;
443 } else {
444 peg$currPos = s4;
445 s4 = peg$FAILED;
446 }
447 if (s4 !== peg$FAILED) {
448 if (input.length > peg$currPos) {
449 s5 = input.charAt(peg$currPos);
450 peg$currPos++;
451 } else {
452 s5 = peg$FAILED;
453 if (peg$silentFails === 0) { peg$fail(peg$c0); }
454 }
455 if (s5 !== peg$FAILED) {
456 s4 = [s4, s5];
457 s3 = s4;
458 } else {
459 peg$currPos = s3;
460 s3 = peg$FAILED;
461 }
462 } else {
463 peg$currPos = s3;
464 s3 = peg$FAILED;
465 }
466 }
467 if (s2 !== peg$FAILED) {
468 s1 = input.substring(s1, peg$currPos);
469 } else {
470 s1 = s2;
471 }
472 if (s1 !== peg$FAILED) {
473 s2 = [];
474 s3 = peg$currPos;
475 s4 = peg$parseBlock();
476 if (s4 !== peg$FAILED) {
477 s5 = peg$currPos;
478 s6 = [];
479 s7 = peg$currPos;
480 s8 = peg$currPos;
481 peg$silentFails++;
482 s9 = peg$parseBlock();
483 peg$silentFails--;
484 if (s9 === peg$FAILED) {
485 s8 = void 0;
486 } else {
487 peg$currPos = s8;
488 s8 = peg$FAILED;
489 }
490 if (s8 !== peg$FAILED) {
491 if (input.length > peg$currPos) {
492 s9 = input.charAt(peg$currPos);
493 peg$currPos++;
494 } else {
495 s9 = peg$FAILED;
496 if (peg$silentFails === 0) { peg$fail(peg$c0); }
497 }
498 if (s9 !== peg$FAILED) {
499 s8 = [s8, s9];
500 s7 = s8;
501 } else {
502 peg$currPos = s7;
503 s7 = peg$FAILED;
504 }
505 } else {
506 peg$currPos = s7;
507 s7 = peg$FAILED;
508 }
509 while (s7 !== peg$FAILED) {
510 s6.push(s7);
511 s7 = peg$currPos;
512 s8 = peg$currPos;
513 peg$silentFails++;
514 s9 = peg$parseBlock();
515 peg$silentFails--;
516 if (s9 === peg$FAILED) {
517 s8 = void 0;
518 } else {
519 peg$currPos = s8;
520 s8 = peg$FAILED;
521 }
522 if (s8 !== peg$FAILED) {
523 if (input.length > peg$currPos) {
524 s9 = input.charAt(peg$currPos);
525 peg$currPos++;
526 } else {
527 s9 = peg$FAILED;
528 if (peg$silentFails === 0) { peg$fail(peg$c0); }
529 }
530 if (s9 !== peg$FAILED) {
531 s8 = [s8, s9];
532 s7 = s8;
533 } else {
534 peg$currPos = s7;
535 s7 = peg$FAILED;
536 }
537 } else {
538 peg$currPos = s7;
539 s7 = peg$FAILED;
540 }
541 }
542 if (s6 !== peg$FAILED) {
543 s5 = input.substring(s5, peg$currPos);
544 } else {
545 s5 = s6;
546 }
547 if (s5 !== peg$FAILED) {
548 peg$savedPos = s3;
549 s4 = peg$c1(s1, s4, s5);
550 s3 = s4;
551 } else {
552 peg$currPos = s3;
553 s3 = peg$FAILED;
554 }
555 } else {
556 peg$currPos = s3;
557 s3 = peg$FAILED;
558 }
559 while (s3 !== peg$FAILED) {
560 s2.push(s3);
561 s3 = peg$currPos;
562 s4 = peg$parseBlock();
563 if (s4 !== peg$FAILED) {
564 s5 = peg$currPos;
565 s6 = [];
566 s7 = peg$currPos;
567 s8 = peg$currPos;
568 peg$silentFails++;
569 s9 = peg$parseBlock();
570 peg$silentFails--;
571 if (s9 === peg$FAILED) {
572 s8 = void 0;
573 } else {
574 peg$currPos = s8;
575 s8 = peg$FAILED;
576 }
577 if (s8 !== peg$FAILED) {
578 if (input.length > peg$currPos) {
579 s9 = input.charAt(peg$currPos);
580 peg$currPos++;
581 } else {
582 s9 = peg$FAILED;
583 if (peg$silentFails === 0) { peg$fail(peg$c0); }
584 }
585 if (s9 !== peg$FAILED) {
586 s8 = [s8, s9];
587 s7 = s8;
588 } else {
589 peg$currPos = s7;
590 s7 = peg$FAILED;
591 }
592 } else {
593 peg$currPos = s7;
594 s7 = peg$FAILED;
595 }
596 while (s7 !== peg$FAILED) {
597 s6.push(s7);
598 s7 = peg$currPos;
599 s8 = peg$currPos;
600 peg$silentFails++;
601 s9 = peg$parseBlock();
602 peg$silentFails--;
603 if (s9 === peg$FAILED) {
604 s8 = void 0;
605 } else {
606 peg$currPos = s8;
607 s8 = peg$FAILED;
608 }
609 if (s8 !== peg$FAILED) {
610 if (input.length > peg$currPos) {
611 s9 = input.charAt(peg$currPos);
612 peg$currPos++;
613 } else {
614 s9 = peg$FAILED;
615 if (peg$silentFails === 0) { peg$fail(peg$c0); }
616 }
617 if (s9 !== peg$FAILED) {
618 s8 = [s8, s9];
619 s7 = s8;
620 } else {
621 peg$currPos = s7;
622 s7 = peg$FAILED;
623 }
624 } else {
625 peg$currPos = s7;
626 s7 = peg$FAILED;
627 }
628 }
629 if (s6 !== peg$FAILED) {
630 s5 = input.substring(s5, peg$currPos);
631 } else {
632 s5 = s6;
633 }
634 if (s5 !== peg$FAILED) {
635 peg$savedPos = s3;
636 s4 = peg$c1(s1, s4, s5);
637 s3 = s4;
638 } else {
639 peg$currPos = s3;
640 s3 = peg$FAILED;
641 }
642 } else {
643 peg$currPos = s3;
644 s3 = peg$FAILED;
645 }
646 }
647 if (s2 !== peg$FAILED) {
648 s3 = peg$currPos;
649 s4 = [];
650 if (input.length > peg$currPos) {
651 s5 = input.charAt(peg$currPos);
652 peg$currPos++;
653 } else {
654 s5 = peg$FAILED;
655 if (peg$silentFails === 0) { peg$fail(peg$c0); }
656 }
657 while (s5 !== peg$FAILED) {
658 s4.push(s5);
659 if (input.length > peg$currPos) {
660 s5 = input.charAt(peg$currPos);
661 peg$currPos++;
662 } else {
663 s5 = peg$FAILED;
664 if (peg$silentFails === 0) { peg$fail(peg$c0); }
665 }
666 }
667 if (s4 !== peg$FAILED) {
668 s3 = input.substring(s3, peg$currPos);
669 } else {
670 s3 = s4;
671 }
672 if (s3 !== peg$FAILED) {
673 peg$savedPos = s0;
674 s1 = peg$c2(s1, s2, s3);
675 s0 = s1;
676 } else {
677 peg$currPos = s0;
678 s0 = peg$FAILED;
679 }
680 } else {
681 peg$currPos = s0;
682 s0 = peg$FAILED;
683 }
684 } else {
685 peg$currPos = s0;
686 s0 = peg$FAILED;
687 }
688
689 return s0;
690 }
691
692 function peg$parseBlock() {
693 var s0;
694
695 s0 = peg$parseBlock_Void();
696 if (s0 === peg$FAILED) {
697 s0 = peg$parseBlock_Balanced();
698 }
699
700 return s0;
701 }
702
703 function peg$parseBlock_Void() {
704 var s0, s1, s2, s3, s4, s5, s6, s7, s8;
705
706 s0 = peg$currPos;
707 if (input.substr(peg$currPos, 4) === peg$c3) {
708 s1 = peg$c3;
709 peg$currPos += 4;
710 } else {
711 s1 = peg$FAILED;
712 if (peg$silentFails === 0) { peg$fail(peg$c4); }
713 }
714 if (s1 !== peg$FAILED) {
715 s2 = peg$parse__();
716 if (s2 !== peg$FAILED) {
717 if (input.substr(peg$currPos, 3) === peg$c5) {
718 s3 = peg$c5;
719 peg$currPos += 3;
720 } else {
721 s3 = peg$FAILED;
722 if (peg$silentFails === 0) { peg$fail(peg$c6); }
723 }
724 if (s3 !== peg$FAILED) {
725 s4 = peg$parseBlock_Name();
726 if (s4 !== peg$FAILED) {
727 s5 = peg$parse__();
728 if (s5 !== peg$FAILED) {
729 s6 = peg$currPos;
730 s7 = peg$parseBlock_Attributes();
731 if (s7 !== peg$FAILED) {
732 s8 = peg$parse__();
733 if (s8 !== peg$FAILED) {
734 peg$savedPos = s6;
735 s7 = peg$c7(s4, s7);
736 s6 = s7;
737 } else {
738 peg$currPos = s6;
739 s6 = peg$FAILED;
740 }
741 } else {
742 peg$currPos = s6;
743 s6 = peg$FAILED;
744 }
745 if (s6 === peg$FAILED) {
746 s6 = null;
747 }
748 if (s6 !== peg$FAILED) {
749 if (input.substr(peg$currPos, 4) === peg$c8) {
750 s7 = peg$c8;
751 peg$currPos += 4;
752 } else {
753 s7 = peg$FAILED;
754 if (peg$silentFails === 0) { peg$fail(peg$c9); }
755 }
756 if (s7 !== peg$FAILED) {
757 peg$savedPos = s0;
758 s1 = peg$c10(s4, s6);
759 s0 = s1;
760 } else {
761 peg$currPos = s0;
762 s0 = peg$FAILED;
763 }
764 } else {
765 peg$currPos = s0;
766 s0 = peg$FAILED;
767 }
768 } else {
769 peg$currPos = s0;
770 s0 = peg$FAILED;
771 }
772 } else {
773 peg$currPos = s0;
774 s0 = peg$FAILED;
775 }
776 } else {
777 peg$currPos = s0;
778 s0 = peg$FAILED;
779 }
780 } else {
781 peg$currPos = s0;
782 s0 = peg$FAILED;
783 }
784 } else {
785 peg$currPos = s0;
786 s0 = peg$FAILED;
787 }
788
789 return s0;
790 }
791
792 function peg$parseBlock_Balanced() {
793 var s0, s1, s2, s3, s4, s5, s6, s7, s8;
794
795 s0 = peg$currPos;
796 s1 = peg$parseBlock_Start();
797 if (s1 !== peg$FAILED) {
798 s2 = [];
799 s3 = peg$parseBlock();
800 if (s3 === peg$FAILED) {
801 s3 = peg$currPos;
802 s4 = [];
803 s5 = peg$currPos;
804 s6 = peg$currPos;
805 peg$silentFails++;
806 s7 = peg$parseBlock();
807 peg$silentFails--;
808 if (s7 === peg$FAILED) {
809 s6 = void 0;
810 } else {
811 peg$currPos = s6;
812 s6 = peg$FAILED;
813 }
814 if (s6 !== peg$FAILED) {
815 s7 = peg$currPos;
816 peg$silentFails++;
817 s8 = peg$parseBlock_End();
818 peg$silentFails--;
819 if (s8 === peg$FAILED) {
820 s7 = void 0;
821 } else {
822 peg$currPos = s7;
823 s7 = peg$FAILED;
824 }
825 if (s7 !== peg$FAILED) {
826 if (input.length > peg$currPos) {
827 s8 = input.charAt(peg$currPos);
828 peg$currPos++;
829 } else {
830 s8 = peg$FAILED;
831 if (peg$silentFails === 0) { peg$fail(peg$c0); }
832 }
833 if (s8 !== peg$FAILED) {
834 s6 = [s6, s7, s8];
835 s5 = s6;
836 } else {
837 peg$currPos = s5;
838 s5 = peg$FAILED;
839 }
840 } else {
841 peg$currPos = s5;
842 s5 = peg$FAILED;
843 }
844 } else {
845 peg$currPos = s5;
846 s5 = peg$FAILED;
847 }
848 if (s5 !== peg$FAILED) {
849 while (s5 !== peg$FAILED) {
850 s4.push(s5);
851 s5 = peg$currPos;
852 s6 = peg$currPos;
853 peg$silentFails++;
854 s7 = peg$parseBlock();
855 peg$silentFails--;
856 if (s7 === peg$FAILED) {
857 s6 = void 0;
858 } else {
859 peg$currPos = s6;
860 s6 = peg$FAILED;
861 }
862 if (s6 !== peg$FAILED) {
863 s7 = peg$currPos;
864 peg$silentFails++;
865 s8 = peg$parseBlock_End();
866 peg$silentFails--;
867 if (s8 === peg$FAILED) {
868 s7 = void 0;
869 } else {
870 peg$currPos = s7;
871 s7 = peg$FAILED;
872 }
873 if (s7 !== peg$FAILED) {
874 if (input.length > peg$currPos) {
875 s8 = input.charAt(peg$currPos);
876 peg$currPos++;
877 } else {
878 s8 = peg$FAILED;
879 if (peg$silentFails === 0) { peg$fail(peg$c0); }
880 }
881 if (s8 !== peg$FAILED) {
882 s6 = [s6, s7, s8];
883 s5 = s6;
884 } else {
885 peg$currPos = s5;
886 s5 = peg$FAILED;
887 }
888 } else {
889 peg$currPos = s5;
890 s5 = peg$FAILED;
891 }
892 } else {
893 peg$currPos = s5;
894 s5 = peg$FAILED;
895 }
896 }
897 } else {
898 s4 = peg$FAILED;
899 }
900 if (s4 !== peg$FAILED) {
901 s3 = input.substring(s3, peg$currPos);
902 } else {
903 s3 = s4;
904 }
905 }
906 while (s3 !== peg$FAILED) {
907 s2.push(s3);
908 s3 = peg$parseBlock();
909 if (s3 === peg$FAILED) {
910 s3 = peg$currPos;
911 s4 = [];
912 s5 = peg$currPos;
913 s6 = peg$currPos;
914 peg$silentFails++;
915 s7 = peg$parseBlock();
916 peg$silentFails--;
917 if (s7 === peg$FAILED) {
918 s6 = void 0;
919 } else {
920 peg$currPos = s6;
921 s6 = peg$FAILED;
922 }
923 if (s6 !== peg$FAILED) {
924 s7 = peg$currPos;
925 peg$silentFails++;
926 s8 = peg$parseBlock_End();
927 peg$silentFails--;
928 if (s8 === peg$FAILED) {
929 s7 = void 0;
930 } else {
931 peg$currPos = s7;
932 s7 = peg$FAILED;
933 }
934 if (s7 !== peg$FAILED) {
935 if (input.length > peg$currPos) {
936 s8 = input.charAt(peg$currPos);
937 peg$currPos++;
938 } else {
939 s8 = peg$FAILED;
940 if (peg$silentFails === 0) { peg$fail(peg$c0); }
941 }
942 if (s8 !== peg$FAILED) {
943 s6 = [s6, s7, s8];
944 s5 = s6;
945 } else {
946 peg$currPos = s5;
947 s5 = peg$FAILED;
948 }
949 } else {
950 peg$currPos = s5;
951 s5 = peg$FAILED;
952 }
953 } else {
954 peg$currPos = s5;
955 s5 = peg$FAILED;
956 }
957 if (s5 !== peg$FAILED) {
958 while (s5 !== peg$FAILED) {
959 s4.push(s5);
960 s5 = peg$currPos;
961 s6 = peg$currPos;
962 peg$silentFails++;
963 s7 = peg$parseBlock();
964 peg$silentFails--;
965 if (s7 === peg$FAILED) {
966 s6 = void 0;
967 } else {
968 peg$currPos = s6;
969 s6 = peg$FAILED;
970 }
971 if (s6 !== peg$FAILED) {
972 s7 = peg$currPos;
973 peg$silentFails++;
974 s8 = peg$parseBlock_End();
975 peg$silentFails--;
976 if (s8 === peg$FAILED) {
977 s7 = void 0;
978 } else {
979 peg$currPos = s7;
980 s7 = peg$FAILED;
981 }
982 if (s7 !== peg$FAILED) {
983 if (input.length > peg$currPos) {
984 s8 = input.charAt(peg$currPos);
985 peg$currPos++;
986 } else {
987 s8 = peg$FAILED;
988 if (peg$silentFails === 0) { peg$fail(peg$c0); }
989 }
990 if (s8 !== peg$FAILED) {
991 s6 = [s6, s7, s8];
992 s5 = s6;
993 } else {
994 peg$currPos = s5;
995 s5 = peg$FAILED;
996 }
997 } else {
998 peg$currPos = s5;
999 s5 = peg$FAILED;
1000 }
1001 } else {
1002 peg$currPos = s5;
1003 s5 = peg$FAILED;
1004 }
1005 }
1006 } else {
1007 s4 = peg$FAILED;
1008 }
1009 if (s4 !== peg$FAILED) {
1010 s3 = input.substring(s3, peg$currPos);
1011 } else {
1012 s3 = s4;
1013 }
1014 }
1015 }
1016 if (s2 !== peg$FAILED) {
1017 s3 = peg$parseBlock_End();
1018 if (s3 !== peg$FAILED) {
1019 peg$savedPos = s0;
1020 s1 = peg$c11(s1, s2, s3);
1021 s0 = s1;
1022 } else {
1023 peg$currPos = s0;
1024 s0 = peg$FAILED;
1025 }
1026 } else {
1027 peg$currPos = s0;
1028 s0 = peg$FAILED;
1029 }
1030 } else {
1031 peg$currPos = s0;
1032 s0 = peg$FAILED;
1033 }
1034
1035 return s0;
1036 }
1037
1038 function peg$parseBlock_Start() {
1039 var s0, s1, s2, s3, s4, s5, s6, s7, s8;
1040
1041 s0 = peg$currPos;
1042 if (input.substr(peg$currPos, 4) === peg$c3) {
1043 s1 = peg$c3;
1044 peg$currPos += 4;
1045 } else {
1046 s1 = peg$FAILED;
1047 if (peg$silentFails === 0) { peg$fail(peg$c4); }
1048 }
1049 if (s1 !== peg$FAILED) {
1050 s2 = peg$parse__();
1051 if (s2 !== peg$FAILED) {
1052 if (input.substr(peg$currPos, 3) === peg$c5) {
1053 s3 = peg$c5;
1054 peg$currPos += 3;
1055 } else {
1056 s3 = peg$FAILED;
1057 if (peg$silentFails === 0) { peg$fail(peg$c6); }
1058 }
1059 if (s3 !== peg$FAILED) {
1060 s4 = peg$parseBlock_Name();
1061 if (s4 !== peg$FAILED) {
1062 s5 = peg$parse__();
1063 if (s5 !== peg$FAILED) {
1064 s6 = peg$currPos;
1065 s7 = peg$parseBlock_Attributes();
1066 if (s7 !== peg$FAILED) {
1067 s8 = peg$parse__();
1068 if (s8 !== peg$FAILED) {
1069 peg$savedPos = s6;
1070 s7 = peg$c7(s4, s7);
1071 s6 = s7;
1072 } else {
1073 peg$currPos = s6;
1074 s6 = peg$FAILED;
1075 }
1076 } else {
1077 peg$currPos = s6;
1078 s6 = peg$FAILED;
1079 }
1080 if (s6 === peg$FAILED) {
1081 s6 = null;
1082 }
1083 if (s6 !== peg$FAILED) {
1084 if (input.substr(peg$currPos, 3) === peg$c12) {
1085 s7 = peg$c12;
1086 peg$currPos += 3;
1087 } else {
1088 s7 = peg$FAILED;
1089 if (peg$silentFails === 0) { peg$fail(peg$c13); }
1090 }
1091 if (s7 !== peg$FAILED) {
1092 peg$savedPos = s0;
1093 s1 = peg$c14(s4, s6);
1094 s0 = s1;
1095 } else {
1096 peg$currPos = s0;
1097 s0 = peg$FAILED;
1098 }
1099 } else {
1100 peg$currPos = s0;
1101 s0 = peg$FAILED;
1102 }
1103 } else {
1104 peg$currPos = s0;
1105 s0 = peg$FAILED;
1106 }
1107 } else {
1108 peg$currPos = s0;
1109 s0 = peg$FAILED;
1110 }
1111 } else {
1112 peg$currPos = s0;
1113 s0 = peg$FAILED;
1114 }
1115 } else {
1116 peg$currPos = s0;
1117 s0 = peg$FAILED;
1118 }
1119 } else {
1120 peg$currPos = s0;
1121 s0 = peg$FAILED;
1122 }
1123
1124 return s0;
1125 }
1126
1127 function peg$parseBlock_End() {
1128 var s0, s1, s2, s3, s4, s5, s6;
1129
1130 s0 = peg$currPos;
1131 if (input.substr(peg$currPos, 4) === peg$c3) {
1132 s1 = peg$c3;
1133 peg$currPos += 4;
1134 } else {
1135 s1 = peg$FAILED;
1136 if (peg$silentFails === 0) { peg$fail(peg$c4); }
1137 }
1138 if (s1 !== peg$FAILED) {
1139 s2 = peg$parse__();
1140 if (s2 !== peg$FAILED) {
1141 if (input.substr(peg$currPos, 4) === peg$c15) {
1142 s3 = peg$c15;
1143 peg$currPos += 4;
1144 } else {
1145 s3 = peg$FAILED;
1146 if (peg$silentFails === 0) { peg$fail(peg$c16); }
1147 }
1148 if (s3 !== peg$FAILED) {
1149 s4 = peg$parseBlock_Name();
1150 if (s4 !== peg$FAILED) {
1151 s5 = peg$parse__();
1152 if (s5 !== peg$FAILED) {
1153 if (input.substr(peg$currPos, 3) === peg$c12) {
1154 s6 = peg$c12;
1155 peg$currPos += 3;
1156 } else {
1157 s6 = peg$FAILED;
1158 if (peg$silentFails === 0) { peg$fail(peg$c13); }
1159 }
1160 if (s6 !== peg$FAILED) {
1161 peg$savedPos = s0;
1162 s1 = peg$c17(s4);
1163 s0 = s1;
1164 } else {
1165 peg$currPos = s0;
1166 s0 = peg$FAILED;
1167 }
1168 } else {
1169 peg$currPos = s0;
1170 s0 = peg$FAILED;
1171 }
1172 } else {
1173 peg$currPos = s0;
1174 s0 = peg$FAILED;
1175 }
1176 } else {
1177 peg$currPos = s0;
1178 s0 = peg$FAILED;
1179 }
1180 } else {
1181 peg$currPos = s0;
1182 s0 = peg$FAILED;
1183 }
1184 } else {
1185 peg$currPos = s0;
1186 s0 = peg$FAILED;
1187 }
1188
1189 return s0;
1190 }
1191
1192 function peg$parseBlock_Name() {
1193 var s0;
1194
1195 s0 = peg$parseNamespaced_Block_Name();
1196 if (s0 === peg$FAILED) {
1197 s0 = peg$parseCore_Block_Name();
1198 }
1199
1200 return s0;
1201 }
1202
1203 function peg$parseNamespaced_Block_Name() {
1204 var s0, s1, s2, s3, s4;
1205
1206 s0 = peg$currPos;
1207 s1 = peg$currPos;
1208 s2 = peg$parseBlock_Name_Part();
1209 if (s2 !== peg$FAILED) {
1210 if (input.charCodeAt(peg$currPos) === 47) {
1211 s3 = peg$c18;
1212 peg$currPos++;
1213 } else {
1214 s3 = peg$FAILED;
1215 if (peg$silentFails === 0) { peg$fail(peg$c19); }
1216 }
1217 if (s3 !== peg$FAILED) {
1218 s4 = peg$parseBlock_Name_Part();
1219 if (s4 !== peg$FAILED) {
1220 s2 = [s2, s3, s4];
1221 s1 = s2;
1222 } else {
1223 peg$currPos = s1;
1224 s1 = peg$FAILED;
1225 }
1226 } else {
1227 peg$currPos = s1;
1228 s1 = peg$FAILED;
1229 }
1230 } else {
1231 peg$currPos = s1;
1232 s1 = peg$FAILED;
1233 }
1234 if (s1 !== peg$FAILED) {
1235 s0 = input.substring(s0, peg$currPos);
1236 } else {
1237 s0 = s1;
1238 }
1239
1240 return s0;
1241 }
1242
1243 function peg$parseCore_Block_Name() {
1244 var s0, s1, s2;
1245
1246 s0 = peg$currPos;
1247 s1 = peg$currPos;
1248 s2 = peg$parseBlock_Name_Part();
1249 if (s2 !== peg$FAILED) {
1250 s1 = input.substring(s1, peg$currPos);
1251 } else {
1252 s1 = s2;
1253 }
1254 if (s1 !== peg$FAILED) {
1255 peg$savedPos = s0;
1256 s1 = peg$c20(s1);
1257 }
1258 s0 = s1;
1259
1260 return s0;
1261 }
1262
1263 function peg$parseBlock_Name_Part() {
1264 var s0, s1, s2, s3, s4;
1265
1266 s0 = peg$currPos;
1267 s1 = peg$currPos;
1268 if (peg$c21.test(input.charAt(peg$currPos))) {
1269 s2 = input.charAt(peg$currPos);
1270 peg$currPos++;
1271 } else {
1272 s2 = peg$FAILED;
1273 if (peg$silentFails === 0) { peg$fail(peg$c22); }
1274 }
1275 if (s2 !== peg$FAILED) {
1276 s3 = [];
1277 if (peg$c23.test(input.charAt(peg$currPos))) {
1278 s4 = input.charAt(peg$currPos);
1279 peg$currPos++;
1280 } else {
1281 s4 = peg$FAILED;
1282 if (peg$silentFails === 0) { peg$fail(peg$c24); }
1283 }
1284 while (s4 !== peg$FAILED) {
1285 s3.push(s4);
1286 if (peg$c23.test(input.charAt(peg$currPos))) {
1287 s4 = input.charAt(peg$currPos);
1288 peg$currPos++;
1289 } else {
1290 s4 = peg$FAILED;
1291 if (peg$silentFails === 0) { peg$fail(peg$c24); }
1292 }
1293 }
1294 if (s3 !== peg$FAILED) {
1295 s2 = [s2, s3];
1296 s1 = s2;
1297 } else {
1298 peg$currPos = s1;
1299 s1 = peg$FAILED;
1300 }
1301 } else {
1302 peg$currPos = s1;
1303 s1 = peg$FAILED;
1304 }
1305 if (s1 !== peg$FAILED) {
1306 s0 = input.substring(s0, peg$currPos);
1307 } else {
1308 s0 = s1;
1309 }
1310
1311 return s0;
1312 }
1313
1314 function peg$parseBlock_Attributes() {
1315 var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;
1316
1317 peg$silentFails++;
1318 s0 = peg$currPos;
1319 s1 = peg$currPos;
1320 s2 = peg$currPos;
1321 if (input.charCodeAt(peg$currPos) === 123) {
1322 s3 = peg$c26;
1323 peg$currPos++;
1324 } else {
1325 s3 = peg$FAILED;
1326 if (peg$silentFails === 0) { peg$fail(peg$c27); }
1327 }
1328 if (s3 !== peg$FAILED) {
1329 s4 = [];
1330 s5 = peg$currPos;
1331 s6 = peg$currPos;
1332 peg$silentFails++;
1333 s7 = peg$currPos;
1334 if (input.charCodeAt(peg$currPos) === 125) {
1335 s8 = peg$c28;
1336 peg$currPos++;
1337 } else {
1338 s8 = peg$FAILED;
1339 if (peg$silentFails === 0) { peg$fail(peg$c29); }
1340 }
1341 if (s8 !== peg$FAILED) {
1342 s9 = peg$parse__();
1343 if (s9 !== peg$FAILED) {
1344 s10 = peg$c30;
1345 if (s10 !== peg$FAILED) {
1346 if (input.charCodeAt(peg$currPos) === 47) {
1347 s11 = peg$c18;
1348 peg$currPos++;
1349 } else {
1350 s11 = peg$FAILED;
1351 if (peg$silentFails === 0) { peg$fail(peg$c19); }
1352 }
1353 if (s11 === peg$FAILED) {
1354 s11 = null;
1355 }
1356 if (s11 !== peg$FAILED) {
1357 if (input.substr(peg$currPos, 3) === peg$c12) {
1358 s12 = peg$c12;
1359 peg$currPos += 3;
1360 } else {
1361 s12 = peg$FAILED;
1362 if (peg$silentFails === 0) { peg$fail(peg$c13); }
1363 }
1364 if (s12 !== peg$FAILED) {
1365 s8 = [s8, s9, s10, s11, s12];
1366 s7 = s8;
1367 } else {
1368 peg$currPos = s7;
1369 s7 = peg$FAILED;
1370 }
1371 } else {
1372 peg$currPos = s7;
1373 s7 = peg$FAILED;
1374 }
1375 } else {
1376 peg$currPos = s7;
1377 s7 = peg$FAILED;
1378 }
1379 } else {
1380 peg$currPos = s7;
1381 s7 = peg$FAILED;
1382 }
1383 } else {
1384 peg$currPos = s7;
1385 s7 = peg$FAILED;
1386 }
1387 peg$silentFails--;
1388 if (s7 === peg$FAILED) {
1389 s6 = void 0;
1390 } else {
1391 peg$currPos = s6;
1392 s6 = peg$FAILED;
1393 }
1394 if (s6 !== peg$FAILED) {
1395 if (input.length > peg$currPos) {
1396 s7 = input.charAt(peg$currPos);
1397 peg$currPos++;
1398 } else {
1399 s7 = peg$FAILED;
1400 if (peg$silentFails === 0) { peg$fail(peg$c0); }
1401 }
1402 if (s7 !== peg$FAILED) {
1403 s6 = [s6, s7];
1404 s5 = s6;
1405 } else {
1406 peg$currPos = s5;
1407 s5 = peg$FAILED;
1408 }
1409 } else {
1410 peg$currPos = s5;
1411 s5 = peg$FAILED;
1412 }
1413 while (s5 !== peg$FAILED) {
1414 s4.push(s5);
1415 s5 = peg$currPos;
1416 s6 = peg$currPos;
1417 peg$silentFails++;
1418 s7 = peg$currPos;
1419 if (input.charCodeAt(peg$currPos) === 125) {
1420 s8 = peg$c28;
1421 peg$currPos++;
1422 } else {
1423 s8 = peg$FAILED;
1424 if (peg$silentFails === 0) { peg$fail(peg$c29); }
1425 }
1426 if (s8 !== peg$FAILED) {
1427 s9 = peg$parse__();
1428 if (s9 !== peg$FAILED) {
1429 s10 = peg$c30;
1430 if (s10 !== peg$FAILED) {
1431 if (input.charCodeAt(peg$currPos) === 47) {
1432 s11 = peg$c18;
1433 peg$currPos++;
1434 } else {
1435 s11 = peg$FAILED;
1436 if (peg$silentFails === 0) { peg$fail(peg$c19); }
1437 }
1438 if (s11 === peg$FAILED) {
1439 s11 = null;
1440 }
1441 if (s11 !== peg$FAILED) {
1442 if (input.substr(peg$currPos, 3) === peg$c12) {
1443 s12 = peg$c12;
1444 peg$currPos += 3;
1445 } else {
1446 s12 = peg$FAILED;
1447 if (peg$silentFails === 0) { peg$fail(peg$c13); }
1448 }
1449 if (s12 !== peg$FAILED) {
1450 s8 = [s8, s9, s10, s11, s12];
1451 s7 = s8;
1452 } else {
1453 peg$currPos = s7;
1454 s7 = peg$FAILED;
1455 }
1456 } else {
1457 peg$currPos = s7;
1458 s7 = peg$FAILED;
1459 }
1460 } else {
1461 peg$currPos = s7;
1462 s7 = peg$FAILED;
1463 }
1464 } else {
1465 peg$currPos = s7;
1466 s7 = peg$FAILED;
1467 }
1468 } else {
1469 peg$currPos = s7;
1470 s7 = peg$FAILED;
1471 }
1472 peg$silentFails--;
1473 if (s7 === peg$FAILED) {
1474 s6 = void 0;
1475 } else {
1476 peg$currPos = s6;
1477 s6 = peg$FAILED;
1478 }
1479 if (s6 !== peg$FAILED) {
1480 if (input.length > peg$currPos) {
1481 s7 = input.charAt(peg$currPos);
1482 peg$currPos++;
1483 } else {
1484 s7 = peg$FAILED;
1485 if (peg$silentFails === 0) { peg$fail(peg$c0); }
1486 }
1487 if (s7 !== peg$FAILED) {
1488 s6 = [s6, s7];
1489 s5 = s6;
1490 } else {
1491 peg$currPos = s5;
1492 s5 = peg$FAILED;
1493 }
1494 } else {
1495 peg$currPos = s5;
1496 s5 = peg$FAILED;
1497 }
1498 }
1499 if (s4 !== peg$FAILED) {
1500 if (input.charCodeAt(peg$currPos) === 125) {
1501 s5 = peg$c28;
1502 peg$currPos++;
1503 } else {
1504 s5 = peg$FAILED;
1505 if (peg$silentFails === 0) { peg$fail(peg$c29); }
1506 }
1507 if (s5 !== peg$FAILED) {
1508 s3 = [s3, s4, s5];
1509 s2 = s3;
1510 } else {
1511 peg$currPos = s2;
1512 s2 = peg$FAILED;
1513 }
1514 } else {
1515 peg$currPos = s2;
1516 s2 = peg$FAILED;
1517 }
1518 } else {
1519 peg$currPos = s2;
1520 s2 = peg$FAILED;
1521 }
1522 if (s2 !== peg$FAILED) {
1523 s1 = input.substring(s1, peg$currPos);
1524 } else {
1525 s1 = s2;
1526 }
1527 if (s1 !== peg$FAILED) {
1528 peg$savedPos = s0;
1529 s1 = peg$c31(s1);
1530 }
1531 s0 = s1;
1532 peg$silentFails--;
1533 if (s0 === peg$FAILED) {
1534 s1 = peg$FAILED;
1535 if (peg$silentFails === 0) { peg$fail(peg$c25); }
1536 }
1537
1538 return s0;
1539 }
1540
1541 function peg$parse__() {
1542 var s0, s1;
1543
1544 s0 = [];
1545 if (peg$c32.test(input.charAt(peg$currPos))) {
1546 s1 = input.charAt(peg$currPos);
1547 peg$currPos++;
1548 } else {
1549 s1 = peg$FAILED;
1550 if (peg$silentFails === 0) { peg$fail(peg$c33); }
1551 }
1552 if (s1 !== peg$FAILED) {
1553 while (s1 !== peg$FAILED) {
1554 s0.push(s1);
1555 if (peg$c32.test(input.charAt(peg$currPos))) {
1556 s1 = input.charAt(peg$currPos);
1557 peg$currPos++;
1558 } else {
1559 s1 = peg$FAILED;
1560 if (peg$silentFails === 0) { peg$fail(peg$c33); }
1561 }
1562 }
1563 } else {
1564 s0 = peg$FAILED;
1565 }
1566
1567 return s0;
1568 }
1569
1570
1571
1572 /*
1573 *
1574 * _____ _ _
1575 * / ____| | | | |
1576 * | | __ _ _| |_ ___ _ __ | |__ ___ _ __ __ _
1577 * | | |_ | | | | __/ _ \ '_ \| '_ \ / _ \ '__/ _` |
1578 * | |__| | |_| | || __/ | | | |_) | __/ | | (_| |
1579 * \_____|\__,_|\__\___|_| |_|_.__/ \___|_| \__, |
1580 * __/ |
1581 * GRAMMAR |___/
1582 *
1583 *
1584 * Welcome to the grammar file for Gutenberg posts!
1585 *
1586 * Please don't be distracted by the functions at the top
1587 * here - they're just helpers for the grammar below. We
1588 * try to keep them as minimal and simple as possible,
1589 * but the parser generator forces us to declare them at
1590 * the beginning of the file.
1591 *
1592 * What follows is the official specification grammar for
1593 * documents created or edited in Gutenberg. It starts at
1594 * the top-level rule `Block_List`
1595 *
1596 * The grammar is defined by a series of _rules_ and ways
1597 * to return matches on those rules. It's a _PEG_, a
1598 * parsing expression grammar, which simply means that for
1599 * each of our rules we have a set of sub-rules to match
1600 * on and the generated parser will try them in order
1601 * until it finds the first match.
1602 *
1603 * This grammar is a _specification_ (with as little actual
1604 * code as we can get away with) which is used by the
1605 * parser generator to generate the actual _parser_ which
1606 * is used by Gutenberg. We generate two parsers: one in
1607 * JavaScript for use the browser and one in PHP for
1608 * WordPress itself. PEG parser generators are available
1609 * in many languages, though different libraries may require
1610 * some translation of this grammar into their syntax.
1611 *
1612 * For more information:
1613 * @see https://pegjs.org
1614 * @see https://en.wikipedia.org/wiki/Parsing_expression_grammar
1615 *
1616 */
1617
1618 /** <?php
1619 // The `maybeJSON` function is not needed in PHP because its return semantics
1620 // are the same as `json_decode`
1621
1622 if ( ! function_exists( 'peg_empty_attrs' ) ) {
1623 function peg_empty_attrs() {
1624 static $empty_attrs = null;
1625
1626 if ( null === $empty_attrs ) {
1627 $empty_attrs = json_decode( '{}', true );
1628 }
1629
1630 return $empty_attrs;
1631 }
1632 }
1633
1634 // array arguments are backwards because of PHP
1635 if ( ! function_exists( 'peg_process_inner_content' ) ) {
1636 function peg_process_inner_content( $array ) {
1637 $html = '';
1638 $blocks = array();
1639 $content = array();
1640
1641 foreach ( $array as $item ) {
1642 if ( is_string( $item ) ) {
1643 $html .= $item;
1644 $content[] = $item;
1645 } else {
1646 $blocks[] = $item;
1647 $content[] = null;
1648 }
1649 }
1650
1651 return array( $html, $blocks, $content );
1652 }
1653 }
1654
1655 if ( ! function_exists( 'peg_join_blocks' ) ) {
1656 function peg_join_blocks( $pre, $tokens, $post ) {
1657 $blocks = array();
1658
1659 if ( ! empty( $pre ) ) {
1660 $blocks[] = array(
1661 'blockName' => null,
1662 'attrs' => peg_empty_attrs(),
1663 'innerBlocks' => array(),
1664 'innerHTML' => $pre,
1665 'innerContent' => array( $pre ),
1666 );
1667 }
1668
1669 foreach ( $tokens as $token ) {
1670 list( $token, $html ) = $token;
1671
1672 $blocks[] = $token;
1673
1674 if ( ! empty( $html ) ) {
1675 $blocks[] = array(
1676 'blockName' => null,
1677 'attrs' => peg_empty_attrs(),
1678 'innerBlocks' => array(),
1679 'innerHTML' => $html,
1680 'innerContent' => array( $html ),
1681 );
1682 }
1683 }
1684
1685 if ( ! empty( $post ) ) {
1686 $blocks[] = array(
1687 'blockName' => null,
1688 'attrs' => peg_empty_attrs(),
1689 'innerBlocks' => array(),
1690 'innerHTML' => $post,
1691 'innerContent' => array( $post ),
1692 );
1693 }
1694
1695 return $blocks;
1696 }
1697 }
1698
1699 ?> **/
1700
1701 function freeform( s ) {
1702 return s.length && {
1703 blockName: null,
1704 attrs: {},
1705 innerBlocks: [],
1706 innerHTML: s,
1707 innerContent: [ s ],
1708 };
1709 }
1710
1711 function joinBlocks( pre, tokens, post ) {
1712 var blocks = [], i, l, html, item, token;
1713
1714 if ( pre.length ) {
1715 blocks.push( freeform( pre ) );
1716 }
1717
1718 for ( i = 0, l = tokens.length; i < l; i++ ) {
1719 item = tokens[ i ];
1720 token = item[ 0 ];
1721 html = item[ 1 ];
1722
1723 blocks.push( token );
1724 if ( html.length ) {
1725 blocks.push( freeform( html ) );
1726 }
1727 }
1728
1729 if ( post.length ) {
1730 blocks.push( freeform( post ) );
1731 }
1732
1733 return blocks;
1734 }
1735
1736 function maybeJSON( s ) {
1737 try {
1738 return JSON.parse( s );
1739 } catch (e) {
1740 return null;
1741 }
1742 }
1743
1744 function processInnerContent( list ) {
1745 var i, l, item;
1746 var html = '';
1747 var blocks = [];
1748 var content = [];
1749
1750 // nod to performance over a simpler reduce
1751 // and clone model we could have taken here
1752 for ( i = 0, l = list.length; i < l; i++ ) {
1753 item = list[ i ];
1754
1755 if ( 'string' === typeof item ) {
1756 html += item;
1757 content.push( item );
1758 } else {
1759 blocks.push( item );
1760 content.push( null );
1761 }
1762 };
1763
1764 return [ html, blocks, content ];
1765 }
1766
1767
1768
1769 peg$result = peg$startRuleFunction();
1770
1771 if (peg$result !== peg$FAILED && peg$currPos === input.length) {
1772 return peg$result;
1773 } else {
1774 if (peg$result !== peg$FAILED && peg$currPos < input.length) {
1775 peg$fail(peg$endExpectation());
1776 }
1777
1778 throw peg$buildStructuredError(
1779 peg$maxFailExpected,
1780 peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null,
1781 peg$maxFailPos < input.length
1782 ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1)
1783 : peg$computeLocation(peg$maxFailPos, peg$maxFailPos)
1784 );
1785 }
1786 }
1787
1788 module.exports = {
1789 SyntaxError: peg$SyntaxError,
1790 parse: peg$parse
1791 };
1792
1793
1794 /***/ })
1795
1796 /******/ });
1797 /************************************************************************/
1798 /******/ // The module cache
1799 /******/ var __webpack_module_cache__ = {};
1800 /******/
1801 /******/ // The require function
1802 /******/ function __webpack_require__(moduleId) {
1803 /******/ // Check if module is in cache
1804 /******/ var cachedModule = __webpack_module_cache__[moduleId];
1805 /******/ if (cachedModule !== undefined) {
1806 /******/ return cachedModule.exports;
1807 /******/ }
1808 /******/ // Create a new module (and put it into the cache)
1809 /******/ var module = __webpack_module_cache__[moduleId] = {
1810 /******/ // no module.id needed
1811 /******/ // no module.loaded needed
1812 /******/ exports: {}
1813 /******/ };
1814 /******/
1815 /******/ // Execute the module function
1816 /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
1817 /******/
1818 /******/ // Return the exports of the module
1819 /******/ return module.exports;
1820 /******/ }
1821 /******/
1822 /************************************************************************/
1823 /******/
1824 /******/ // startup
1825 /******/ // Load entry module and return exports
1826 /******/ // This entry module is referenced by other modules so it can't be inlined
1827 /******/ var __webpack_exports__ = __webpack_require__(6494);
1828 /******/ (window.wp = window.wp || {}).blockSerializationSpecParser = __webpack_exports__;
1829 /******/
1830 /******/ })()
1831 ;