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