1 | define(
|
2 | "compiler",
|
3 | ["preprocessor", "parser", "generator", "exports"],
|
4 | function(preprocessor$$, parser$$, generator$$, __exports__) {
|
5 | "use strict";
|
6 |
|
7 | function __es6_export__(name, value) {
|
8 | __exports__[name] = value;
|
9 | }
|
10 |
|
11 | var preprocess;
|
12 | preprocess = preprocessor$$["parse"];
|
13 | var parse;
|
14 | parse = parser$$["parse"];
|
15 | var generate;
|
16 | generate = generator$$["generate"];
|
17 |
|
18 | var compile = function(haml){
|
19 | var ast = parse(preprocess(haml));
|
20 | return generate(ast);
|
21 | };
|
22 |
|
23 | var Compiler = { compile: compile };
|
24 |
|
25 | __es6_export__("default", Compiler);
|
26 | }
|
27 | );
|
28 |
|
29 |
|
30 | define("generator", ["exports"], function(__exports__) {
|
31 | "use strict";
|
32 |
|
33 | function __es6_export__(name, value) {
|
34 | __exports__[name] = value;
|
35 | }
|
36 |
|
37 | var isArray = function(thing) {
|
38 | if( Object.prototype.toString.call(thing) === '[object Array]' ) {
|
39 | return true;
|
40 | }
|
41 | return false;
|
42 | };
|
43 |
|
44 | var buildInlineContent = function(contents) {
|
45 | var content = [];
|
46 | if(typeof(contents) === 'string'){
|
47 | return contents;
|
48 | }
|
49 | contents.forEach(function(c){
|
50 | if(typeof(c) === 'string'){
|
51 | content.push(c);
|
52 | }else{
|
53 | content.push(build(c, 0));
|
54 | }
|
55 | });
|
56 | return content.join('');
|
57 | };
|
58 |
|
59 | var buildContent = function(node, indent) {
|
60 | var content = [];
|
61 | if(node.nodes){
|
62 | content.push('\n');
|
63 | node.nodes.forEach(function(n){
|
64 | content.push(build(n, indent + 1));
|
65 | });
|
66 | content.push('\n');
|
67 | }
|
68 | return content.join('');
|
69 | };
|
70 |
|
71 | var buildExpression = function(node, indent) {
|
72 | var lines = [];
|
73 | var indentStr = repeat(' ', indent);
|
74 | var expression = [indentStr, '{{', node.content, '}}'].join('');
|
75 | lines.push(expression);
|
76 | return lines;
|
77 | };
|
78 |
|
79 | var buildText = function(node, indent) {
|
80 | var lines = [];
|
81 | var indentStr = repeat(' ', indent);
|
82 | var text = indentStr + node.content;
|
83 | lines.push(text);
|
84 | return lines;
|
85 | };
|
86 |
|
87 | var buildBlockExpression = function(node, indent) {
|
88 | var lines = [];
|
89 | var content = buildContent(node, indent);
|
90 | var indentStr = repeat(' ', indent);
|
91 | var expression = [indentStr, '{{#', node.name, ' ', node.content, '}}', content,
|
92 | indentStr, '{{/',node.name,'}}'].join('');
|
93 | lines.push(expression);
|
94 | return lines;
|
95 | };
|
96 |
|
97 | var buildMidBlockExpression = function(node, indent) {
|
98 | var lines = [];
|
99 | var indentStr = repeat(' ', indent - 1);
|
100 | var expression = ['\n', indentStr, '{{', node.name, '}}', '\n'].join('');
|
101 | lines.push(expression);
|
102 | return lines;
|
103 | };
|
104 |
|
105 | var buildElement = function(node, indent) {
|
106 | var lines = [];
|
107 | var attributes = buildAttributes(node);
|
108 | var bindAttrs = buildAttributeBindings(node);
|
109 | var content;
|
110 | if(node.content){
|
111 | content = buildInlineContent(node.content);
|
112 | }else{
|
113 | content = buildContent(node, indent);
|
114 | }
|
115 | var indentStr = repeat(' ', indent);
|
116 | var tag = [indentStr, '<', node.tag, attributes, bindAttrs, '>', content,
|
117 | '</',node.tag,'>'].join('');
|
118 | lines.push(tag);
|
119 | return lines;
|
120 | };
|
121 |
|
122 | var buildAttribute = function(key, value, quoted){
|
123 | var quotes = '"';
|
124 | if(typeof(quoted) === 'undefined'){
|
125 | quoted = true;
|
126 | }
|
127 | if(!quoted){
|
128 | quotes = '';
|
129 | }
|
130 | if(isArray(value)){
|
131 | value = value.join(' ');
|
132 | }
|
133 | return [' ', key, '=', quotes, value, quotes].join('');
|
134 | };
|
135 |
|
136 | var buildAttributeBindings = function(node) {
|
137 | var attrs = [];
|
138 | if(node.attributeBindings){
|
139 | Object.keys(node.attributeBindings).forEach(function(key){
|
140 | var value = node.attributeBindings[key];
|
141 | attrs.push(buildAttribute(key, value, false));
|
142 | });
|
143 | }
|
144 | if(attrs.length > 0){
|
145 | return [' ', '{{', 'bind-attr'].concat(attrs).concat(['}}']).join('');
|
146 | }
|
147 | return '';
|
148 | };
|
149 |
|
150 | var buildAttributes = function(node) {
|
151 | var attrs = [];
|
152 | if(node.id){
|
153 | attrs.push(buildAttribute('id', node.id));
|
154 | }
|
155 | if(node.attributes){
|
156 | Object.keys(node.attributes).forEach(function(key){
|
157 | var value = node.attributes[key];
|
158 | attrs.push(buildAttribute(key, value));
|
159 | });
|
160 | }
|
161 | return attrs.join('');
|
162 | };
|
163 |
|
164 | var repeat = function(str, n) {
|
165 | return new Array( n + 1 ).join(str);
|
166 | };
|
167 |
|
168 | var build = function(node, indent){
|
169 | var lines;
|
170 | indent = indent || 0;
|
171 | switch(node.type){
|
172 | case 'element':
|
173 | lines = buildElement(node, indent);
|
174 | break;
|
175 | case 'block_expression':
|
176 | lines = buildBlockExpression(node, indent);
|
177 | break;
|
178 | case 'mid_block_expression':
|
179 | lines = buildMidBlockExpression(node, indent);
|
180 | break;
|
181 | case 'expression':
|
182 | lines = buildExpression(node, indent);
|
183 | break;
|
184 | case 'text':
|
185 | lines = buildText(node, indent);
|
186 | break;
|
187 | }
|
188 | return lines;
|
189 | };
|
190 |
|
191 | var generate = function(ast){
|
192 | var lines = [];
|
193 | ast.forEach(function(node){
|
194 | lines = lines.concat(build(node));
|
195 | });
|
196 | return lines.join('\n');
|
197 | };
|
198 |
|
199 | __es6_export__("generate", generate);
|
200 | });
|
201 |
|
202 |
|
203 | define('parser', function(require, exports, module){
|
204 | module.exports = (function() {
|
205 | |
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 | function peg$subclass(child, parent) {
|
212 | function ctor() { this.constructor = child; }
|
213 | ctor.prototype = parent.prototype;
|
214 | child.prototype = new ctor();
|
215 | }
|
216 |
|
217 | function SyntaxError(message, expected, found, offset, line, column) {
|
218 | this.message = message;
|
219 | this.expected = expected;
|
220 | this.found = found;
|
221 | this.offset = offset;
|
222 | this.line = line;
|
223 | this.column = column;
|
224 |
|
225 | this.name = "SyntaxError";
|
226 | }
|
227 |
|
228 | peg$subclass(SyntaxError, Error);
|
229 |
|
230 | function parse(input) {
|
231 | var options = arguments.length > 1 ? arguments[1] : {},
|
232 |
|
233 | peg$FAILED = {},
|
234 |
|
235 | peg$startRuleFunctions = { elements: peg$parseelements },
|
236 | peg$startRuleFunction = peg$parseelements,
|
237 |
|
238 | peg$c0 = [],
|
239 | peg$c1 = peg$FAILED,
|
240 | peg$c2 = /^[a-zA-Z ]/,
|
241 | peg$c3 = { type: "class", value: "[a-zA-Z ]", description: "[a-zA-Z ]" },
|
242 | peg$c4 = function(c) { return c.join(''); },
|
243 | peg$c5 = function(b) {
|
244 | var top = b[0];
|
245 | var mid = b[1];
|
246 | if(b.length == 2){
|
247 | return top.name === "if" && mid.name === "else";
|
248 | }
|
249 | return false;
|
250 | },
|
251 | peg$c6 = void 0,
|
252 | peg$c7 = function(b) {
|
253 | var top = b[0];
|
254 | var mid = b[1];
|
255 | var newMid = { type: "mid_block_expression", name: mid.name };
|
256 | if(mid.content){
|
257 | newMid.content = mid.content;
|
258 | }
|
259 | top.nodes.push(newMid);
|
260 | top.nodes.push.apply(top.nodes, mid.nodes);
|
261 | return top;
|
262 | },
|
263 | peg$c8 = null,
|
264 | peg$c9 = function(name, m, b) {
|
265 | var e = { type: 'block_expression', name:name };
|
266 | if(m) {
|
267 | e.content = m;
|
268 | }
|
269 | if(b && b.length > 0){
|
270 | e.nodes = b[1];
|
271 | }
|
272 | return e;
|
273 | },
|
274 | peg$c10 = function(m) {
|
275 | return { type: 'expression', content:m };
|
276 | },
|
277 | peg$c11 = "-",
|
278 | peg$c12 = { type: "literal", value: "-", description: "\"-\"" },
|
279 | peg$c13 = "=",
|
280 | peg$c14 = { type: "literal", value: "=", description: "\"=\"" },
|
281 | peg$c15 = function(a) { return { attributes: a }; },
|
282 | peg$c16 = function(b) { return { attributeBindings: b }; },
|
283 | peg$c17 = function(t, idClass, attrs, i) {
|
284 | return !!t || !!idClass.length;
|
285 | },
|
286 | peg$c18 = function(t, idClass, attrs, i) {
|
287 | var element = {
|
288 | type: 'element',
|
289 | tag: t || 'div'
|
290 | };
|
291 | var attributes = idClass;
|
292 | var addAtributes = condense(attrs);
|
293 | addProperties(element, 'attributes', condense(attributes.concat(addAtributes.attributes)));
|
294 | addProperties(element, 'attributeBindings', condense(addAtributes.attributeBindings));
|
295 | addProperty(element, 'content', i);
|
296 | return element;
|
297 | },
|
298 | peg$c19 = "(",
|
299 | peg$c20 = { type: "literal", value: "(", description: "\"(\"" },
|
300 | peg$c21 = ")",
|
301 | peg$c22 = { type: "literal", value: ")", description: "\")\"" },
|
302 | peg$c23 = function(a) {
|
303 | return a;
|
304 | },
|
305 | peg$c24 = "{",
|
306 | peg$c25 = { type: "literal", value: "{", description: "\"{\"" },
|
307 | peg$c26 = "}",
|
308 | peg$c27 = { type: "literal", value: "}", description: "\"}\"" },
|
309 | peg$c28 = { type: "other", description: "Attribute List" },
|
310 | peg$c29 = function(a) {
|
311 | return condense(a);
|
312 | },
|
313 | peg$c30 = function(k, v) {
|
314 | var attr = {};
|
315 | attr[k] = v;
|
316 | return attr;
|
317 | },
|
318 | peg$c31 = function(e, b) {
|
319 | if(b && b.length > 0){
|
320 | e.nodes = b[1];
|
321 | }
|
322 | return e;
|
323 | },
|
324 | peg$c32 = "#",
|
325 | peg$c33 = { type: "literal", value: "#", description: "\"#\"" },
|
326 | peg$c34 = function(i) { return { id: i } },
|
327 | peg$c35 = "%",
|
328 | peg$c36 = { type: "literal", value: "%", description: "\"%\"" },
|
329 | peg$c37 = function(t) { return t; },
|
330 | peg$c38 = ".",
|
331 | peg$c39 = { type: "literal", value: ".", description: "\".\"" },
|
332 | peg$c40 = function(c) { return { class: c } },
|
333 | peg$c41 = "'",
|
334 | peg$c42 = { type: "literal", value: "'", description: "\"'\"" },
|
335 | peg$c43 = "\"",
|
336 | peg$c44 = { type: "literal", value: "\"", description: "\"\\\"\"" },
|
337 | peg$c45 = function(chars) { return chars.join('') },
|
338 | peg$c46 = /^[_a-z0-9\-]/i,
|
339 | peg$c47 = { type: "class", value: "[_a-z0-9\\-]i", description: "[_a-z0-9\\-]i" },
|
340 | peg$c48 = function(t) { return { type: 'text', content: t }; },
|
341 | peg$c49 = function(t) {
|
342 | var content = [];
|
343 | t.forEach(function(node){
|
344 | content.push(node);
|
345 | });
|
346 | if(t.length === 1 && typeof(t[0]) === 'string'){
|
347 | return t[0];
|
348 | }
|
349 | return content;
|
350 | },
|
351 | peg$c50 = "#{",
|
352 | peg$c51 = { type: "literal", value: "#{", description: "\"#{\"" },
|
353 | peg$c52 = function(t) { return { type: 'expression', content: t }; },
|
354 | peg$c53 = function(c) { return c; },
|
355 | peg$c54 = function(t) { return t.join(''); },
|
356 | peg$c55 = { type: "any", description: "any character" },
|
357 | peg$c56 = function(i) { return i !== TERM_CHAR },
|
358 | peg$c57 = function(i) { return i; },
|
359 | peg$c58 = /^[%.=\-]/,
|
360 | peg$c59 = { type: "class", value: "[%.=\\-]", description: "[%.=\\-]" },
|
361 | peg$c60 = /^[%.#=\-]/,
|
362 | peg$c61 = { type: "class", value: "[%.#=\\-]", description: "[%.#=\\-]" },
|
363 | peg$c62 = { type: "other", description: "INDENT" },
|
364 | peg$c63 = function(i) { return i === INDENT_CHAR },
|
365 | peg$c64 = function(i) { return ''; },
|
366 | peg$c65 = { type: "other", description: "DEDENT" },
|
367 | peg$c66 = function(i) { return i === DEDENT_CHAR },
|
368 | peg$c67 = { type: "other", description: "TERM" },
|
369 | peg$c68 = function(i) { return i === TERM_CHAR },
|
370 | peg$c69 = { type: "other", description: "required whitespace" },
|
371 | peg$c70 = { type: "other", description: "whitespace" },
|
372 | peg$c71 = /^[ \t\n\r]/,
|
373 | peg$c72 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" },
|
374 |
|
375 | peg$currPos = 0,
|
376 | peg$reportedPos = 0,
|
377 | peg$cachedPos = 0,
|
378 | peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
|
379 | peg$maxFailPos = 0,
|
380 | peg$maxFailExpected = [],
|
381 | peg$silentFails = 0,
|
382 |
|
383 | peg$result;
|
384 |
|
385 | if ("startRule" in options) {
|
386 | if (!(options.startRule in peg$startRuleFunctions)) {
|
387 | throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
|
388 | }
|
389 |
|
390 | peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
|
391 | }
|
392 |
|
393 | function text() {
|
394 | return input.substring(peg$reportedPos, peg$currPos);
|
395 | }
|
396 |
|
397 | function offset() {
|
398 | return peg$reportedPos;
|
399 | }
|
400 |
|
401 | function line() {
|
402 | return peg$computePosDetails(peg$reportedPos).line;
|
403 | }
|
404 |
|
405 | function column() {
|
406 | return peg$computePosDetails(peg$reportedPos).column;
|
407 | }
|
408 |
|
409 | function expected(description) {
|
410 | throw peg$buildException(
|
411 | null,
|
412 | [{ type: "other", description: description }],
|
413 | peg$reportedPos
|
414 | );
|
415 | }
|
416 |
|
417 | function error(message) {
|
418 | throw peg$buildException(message, null, peg$reportedPos);
|
419 | }
|
420 |
|
421 | function peg$computePosDetails(pos) {
|
422 | function advance(details, startPos, endPos) {
|
423 | var p, ch;
|
424 |
|
425 | for (p = startPos; p < endPos; p++) {
|
426 | ch = input.charAt(p);
|
427 | if (ch === "\n") {
|
428 | if (!details.seenCR) { details.line++; }
|
429 | details.column = 1;
|
430 | details.seenCR = false;
|
431 | } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
|
432 | details.line++;
|
433 | details.column = 1;
|
434 | details.seenCR = true;
|
435 | } else {
|
436 | details.column++;
|
437 | details.seenCR = false;
|
438 | }
|
439 | }
|
440 | }
|
441 |
|
442 | if (peg$cachedPos !== pos) {
|
443 | if (peg$cachedPos > pos) {
|
444 | peg$cachedPos = 0;
|
445 | peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
|
446 | }
|
447 | advance(peg$cachedPosDetails, peg$cachedPos, pos);
|
448 | peg$cachedPos = pos;
|
449 | }
|
450 |
|
451 | return peg$cachedPosDetails;
|
452 | }
|
453 |
|
454 | function peg$fail(expected) {
|
455 | if (peg$currPos < peg$maxFailPos) { return; }
|
456 |
|
457 | if (peg$currPos > peg$maxFailPos) {
|
458 | peg$maxFailPos = peg$currPos;
|
459 | peg$maxFailExpected = [];
|
460 | }
|
461 |
|
462 | peg$maxFailExpected.push(expected);
|
463 | }
|
464 |
|
465 | function peg$buildException(message, expected, pos) {
|
466 | function cleanupExpected(expected) {
|
467 | var i = 1;
|
468 |
|
469 | expected.sort(function(a, b) {
|
470 | if (a.description < b.description) {
|
471 | return -1;
|
472 | } else if (a.description > b.description) {
|
473 | return 1;
|
474 | } else {
|
475 | return 0;
|
476 | }
|
477 | });
|
478 |
|
479 | while (i < expected.length) {
|
480 | if (expected[i - 1] === expected[i]) {
|
481 | expected.splice(i, 1);
|
482 | } else {
|
483 | i++;
|
484 | }
|
485 | }
|
486 | }
|
487 |
|
488 | function buildMessage(expected, found) {
|
489 | function stringEscape(s) {
|
490 | function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
|
491 |
|
492 | return s
|
493 | .replace(/\\/g, '\\\\')
|
494 | .replace(/"/g, '\\"')
|
495 | .replace(/\x08/g, '\\b')
|
496 | .replace(/\t/g, '\\t')
|
497 | .replace(/\n/g, '\\n')
|
498 | .replace(/\f/g, '\\f')
|
499 | .replace(/\r/g, '\\r')
|
500 | .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
|
501 | .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
|
502 | .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
|
503 | .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
|
504 | }
|
505 |
|
506 | var expectedDescs = new Array(expected.length),
|
507 | expectedDesc, foundDesc, i;
|
508 |
|
509 | for (i = 0; i < expected.length; i++) {
|
510 | expectedDescs[i] = expected[i].description;
|
511 | }
|
512 |
|
513 | expectedDesc = expected.length > 1
|
514 | ? expectedDescs.slice(0, -1).join(", ")
|
515 | + " or "
|
516 | + expectedDescs[expected.length - 1]
|
517 | : expectedDescs[0];
|
518 |
|
519 | foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
|
520 |
|
521 | return "Expected " + expectedDesc + " but " + foundDesc + " found.";
|
522 | }
|
523 |
|
524 | var posDetails = peg$computePosDetails(pos),
|
525 | found = pos < input.length ? input.charAt(pos) : null;
|
526 |
|
527 | if (expected !== null) {
|
528 | cleanupExpected(expected);
|
529 | }
|
530 |
|
531 | return new SyntaxError(
|
532 | message !== null ? message : buildMessage(expected, found),
|
533 | expected,
|
534 | found,
|
535 | pos,
|
536 | posDetails.line,
|
537 | posDetails.column
|
538 | );
|
539 | }
|
540 |
|
541 | function peg$parseelements() {
|
542 | var s0, s1;
|
543 |
|
544 | s0 = [];
|
545 | s1 = peg$parseblockElement();
|
546 | if (s1 === peg$FAILED) {
|
547 | s1 = peg$parsemustache();
|
548 | if (s1 === peg$FAILED) {
|
549 | s1 = peg$parsetextLine();
|
550 | }
|
551 | }
|
552 | while (s1 !== peg$FAILED) {
|
553 | s0.push(s1);
|
554 | s1 = peg$parseblockElement();
|
555 | if (s1 === peg$FAILED) {
|
556 | s1 = peg$parsemustache();
|
557 | if (s1 === peg$FAILED) {
|
558 | s1 = peg$parsetextLine();
|
559 | }
|
560 | }
|
561 | }
|
562 |
|
563 | return s0;
|
564 | }
|
565 |
|
566 | function peg$parsemustacheContent() {
|
567 | var s0, s1, s2;
|
568 |
|
569 | s0 = peg$currPos;
|
570 | s1 = [];
|
571 | if (peg$c2.test(input.charAt(peg$currPos))) {
|
572 | s2 = input.charAt(peg$currPos);
|
573 | peg$currPos++;
|
574 | } else {
|
575 | s2 = peg$FAILED;
|
576 | if (peg$silentFails === 0) { peg$fail(peg$c3); }
|
577 | }
|
578 | if (s2 !== peg$FAILED) {
|
579 | while (s2 !== peg$FAILED) {
|
580 | s1.push(s2);
|
581 | if (peg$c2.test(input.charAt(peg$currPos))) {
|
582 | s2 = input.charAt(peg$currPos);
|
583 | peg$currPos++;
|
584 | } else {
|
585 | s2 = peg$FAILED;
|
586 | if (peg$silentFails === 0) { peg$fail(peg$c3); }
|
587 | }
|
588 | }
|
589 | } else {
|
590 | s1 = peg$c1;
|
591 | }
|
592 | if (s1 !== peg$FAILED) {
|
593 | peg$reportedPos = s0;
|
594 | s1 = peg$c4(s1);
|
595 | }
|
596 | s0 = s1;
|
597 |
|
598 | return s0;
|
599 | }
|
600 |
|
601 | function peg$parsemustache() {
|
602 | var s0;
|
603 |
|
604 | s0 = peg$parseblockChainExpression();
|
605 | if (s0 === peg$FAILED) {
|
606 | s0 = peg$parseblockExpression();
|
607 | if (s0 === peg$FAILED) {
|
608 | s0 = peg$parsemustacheExpression();
|
609 | }
|
610 | }
|
611 |
|
612 | return s0;
|
613 | }
|
614 |
|
615 | function peg$parseblockChainExpression() {
|
616 | var s0, s1, s2;
|
617 |
|
618 | s0 = peg$currPos;
|
619 | s1 = [];
|
620 | s2 = peg$parseblockExpression();
|
621 | if (s2 !== peg$FAILED) {
|
622 | while (s2 !== peg$FAILED) {
|
623 | s1.push(s2);
|
624 | s2 = peg$parseblockExpression();
|
625 | }
|
626 | } else {
|
627 | s1 = peg$c1;
|
628 | }
|
629 | if (s1 !== peg$FAILED) {
|
630 | peg$reportedPos = peg$currPos;
|
631 | s2 = peg$c5(s1);
|
632 | if (s2) {
|
633 | s2 = peg$c6;
|
634 | } else {
|
635 | s2 = peg$c1;
|
636 | }
|
637 | if (s2 !== peg$FAILED) {
|
638 | peg$reportedPos = s0;
|
639 | s1 = peg$c7(s1);
|
640 | s0 = s1;
|
641 | } else {
|
642 | peg$currPos = s0;
|
643 | s0 = peg$c1;
|
644 | }
|
645 | } else {
|
646 | peg$currPos = s0;
|
647 | s0 = peg$c1;
|
648 | }
|
649 |
|
650 | return s0;
|
651 | }
|
652 |
|
653 | function peg$parseblockExpression() {
|
654 | var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12;
|
655 |
|
656 | s0 = peg$currPos;
|
657 | s1 = peg$parse_();
|
658 | if (s1 !== peg$FAILED) {
|
659 | s2 = peg$parsedash();
|
660 | if (s2 !== peg$FAILED) {
|
661 | s3 = peg$parse_();
|
662 | if (s3 !== peg$FAILED) {
|
663 | s4 = peg$parsename();
|
664 | if (s4 !== peg$FAILED) {
|
665 | s5 = peg$parse_();
|
666 | if (s5 !== peg$FAILED) {
|
667 | s6 = peg$parsemustacheContent();
|
668 | if (s6 === peg$FAILED) {
|
669 | s6 = peg$c8;
|
670 | }
|
671 | if (s6 !== peg$FAILED) {
|
672 | s7 = peg$parse_();
|
673 | if (s7 !== peg$FAILED) {
|
674 | s8 = peg$parseTERM();
|
675 | if (s8 !== peg$FAILED) {
|
676 | s9 = peg$currPos;
|
677 | s10 = peg$parseINDENT();
|
678 | if (s10 !== peg$FAILED) {
|
679 | s11 = peg$parseelements();
|
680 | if (s11 !== peg$FAILED) {
|
681 | s12 = peg$parseDEDENT();
|
682 | if (s12 !== peg$FAILED) {
|
683 | s10 = [s10, s11, s12];
|
684 | s9 = s10;
|
685 | } else {
|
686 | peg$currPos = s9;
|
687 | s9 = peg$c1;
|
688 | }
|
689 | } else {
|
690 | peg$currPos = s9;
|
691 | s9 = peg$c1;
|
692 | }
|
693 | } else {
|
694 | peg$currPos = s9;
|
695 | s9 = peg$c1;
|
696 | }
|
697 | if (s9 === peg$FAILED) {
|
698 | s9 = peg$c8;
|
699 | }
|
700 | if (s9 !== peg$FAILED) {
|
701 | peg$reportedPos = s0;
|
702 | s1 = peg$c9(s4, s6, s9);
|
703 | s0 = s1;
|
704 | } else {
|
705 | peg$currPos = s0;
|
706 | s0 = peg$c1;
|
707 | }
|
708 | } else {
|
709 | peg$currPos = s0;
|
710 | s0 = peg$c1;
|
711 | }
|
712 | } else {
|
713 | peg$currPos = s0;
|
714 | s0 = peg$c1;
|
715 | }
|
716 | } else {
|
717 | peg$currPos = s0;
|
718 | s0 = peg$c1;
|
719 | }
|
720 | } else {
|
721 | peg$currPos = s0;
|
722 | s0 = peg$c1;
|
723 | }
|
724 | } else {
|
725 | peg$currPos = s0;
|
726 | s0 = peg$c1;
|
727 | }
|
728 | } else {
|
729 | peg$currPos = s0;
|
730 | s0 = peg$c1;
|
731 | }
|
732 | } else {
|
733 | peg$currPos = s0;
|
734 | s0 = peg$c1;
|
735 | }
|
736 | } else {
|
737 | peg$currPos = s0;
|
738 | s0 = peg$c1;
|
739 | }
|
740 |
|
741 | return s0;
|
742 | }
|
743 |
|
744 | function peg$parsemustacheExpression() {
|
745 | var s0, s1, s2, s3, s4, s5, s6;
|
746 |
|
747 | s0 = peg$currPos;
|
748 | s1 = peg$parse_();
|
749 | if (s1 !== peg$FAILED) {
|
750 | s2 = peg$parseequal();
|
751 | if (s2 !== peg$FAILED) {
|
752 | s3 = peg$parse_();
|
753 | if (s3 !== peg$FAILED) {
|
754 | s4 = peg$parsemustacheContent();
|
755 | if (s4 !== peg$FAILED) {
|
756 | s5 = peg$parse_();
|
757 | if (s5 !== peg$FAILED) {
|
758 | s6 = peg$parseTERM();
|
759 | if (s6 !== peg$FAILED) {
|
760 | peg$reportedPos = s0;
|
761 | s1 = peg$c10(s4);
|
762 | s0 = s1;
|
763 | } else {
|
764 | peg$currPos = s0;
|
765 | s0 = peg$c1;
|
766 | }
|
767 | } else {
|
768 | peg$currPos = s0;
|
769 | s0 = peg$c1;
|
770 | }
|
771 | } else {
|
772 | peg$currPos = s0;
|
773 | s0 = peg$c1;
|
774 | }
|
775 | } else {
|
776 | peg$currPos = s0;
|
777 | s0 = peg$c1;
|
778 | }
|
779 | } else {
|
780 | peg$currPos = s0;
|
781 | s0 = peg$c1;
|
782 | }
|
783 | } else {
|
784 | peg$currPos = s0;
|
785 | s0 = peg$c1;
|
786 | }
|
787 |
|
788 | return s0;
|
789 | }
|
790 |
|
791 | function peg$parsedash() {
|
792 | var s0;
|
793 |
|
794 | if (input.charCodeAt(peg$currPos) === 45) {
|
795 | s0 = peg$c11;
|
796 | peg$currPos++;
|
797 | } else {
|
798 | s0 = peg$FAILED;
|
799 | if (peg$silentFails === 0) { peg$fail(peg$c12); }
|
800 | }
|
801 |
|
802 | return s0;
|
803 | }
|
804 |
|
805 | function peg$parseequal() {
|
806 | var s0;
|
807 |
|
808 | if (input.charCodeAt(peg$currPos) === 61) {
|
809 | s0 = peg$c13;
|
810 | peg$currPos++;
|
811 | } else {
|
812 | s0 = peg$FAILED;
|
813 | if (peg$silentFails === 0) { peg$fail(peg$c14); }
|
814 | }
|
815 |
|
816 | return s0;
|
817 | }
|
818 |
|
819 | function peg$parseelement() {
|
820 | var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9;
|
821 |
|
822 | s0 = peg$currPos;
|
823 | s1 = peg$parsetag();
|
824 | if (s1 === peg$FAILED) {
|
825 | s1 = peg$c8;
|
826 | }
|
827 | if (s1 !== peg$FAILED) {
|
828 | s2 = [];
|
829 | s3 = peg$parseid();
|
830 | if (s3 === peg$FAILED) {
|
831 | s3 = peg$parseclass();
|
832 | }
|
833 | while (s3 !== peg$FAILED) {
|
834 | s2.push(s3);
|
835 | s3 = peg$parseid();
|
836 | if (s3 === peg$FAILED) {
|
837 | s3 = peg$parseclass();
|
838 | }
|
839 | }
|
840 | if (s2 !== peg$FAILED) {
|
841 | s3 = peg$parse_();
|
842 | if (s3 !== peg$FAILED) {
|
843 | s4 = [];
|
844 | s5 = peg$currPos;
|
845 | s6 = peg$parseattributes();
|
846 | if (s6 !== peg$FAILED) {
|
847 | peg$reportedPos = s5;
|
848 | s6 = peg$c15(s6);
|
849 | }
|
850 | s5 = s6;
|
851 | if (s5 === peg$FAILED) {
|
852 | s5 = peg$currPos;
|
853 | s6 = peg$parseattributeBindings();
|
854 | if (s6 !== peg$FAILED) {
|
855 | peg$reportedPos = s5;
|
856 | s6 = peg$c16(s6);
|
857 | }
|
858 | s5 = s6;
|
859 | }
|
860 | while (s5 !== peg$FAILED) {
|
861 | s4.push(s5);
|
862 | s5 = peg$currPos;
|
863 | s6 = peg$parseattributes();
|
864 | if (s6 !== peg$FAILED) {
|
865 | peg$reportedPos = s5;
|
866 | s6 = peg$c15(s6);
|
867 | }
|
868 | s5 = s6;
|
869 | if (s5 === peg$FAILED) {
|
870 | s5 = peg$currPos;
|
871 | s6 = peg$parseattributeBindings();
|
872 | if (s6 !== peg$FAILED) {
|
873 | peg$reportedPos = s5;
|
874 | s6 = peg$c16(s6);
|
875 | }
|
876 | s5 = s6;
|
877 | }
|
878 | }
|
879 | if (s4 !== peg$FAILED) {
|
880 | s5 = peg$parse_();
|
881 | if (s5 !== peg$FAILED) {
|
882 | s6 = peg$parseinlineText();
|
883 | if (s6 === peg$FAILED) {
|
884 | s6 = peg$c8;
|
885 | }
|
886 | if (s6 !== peg$FAILED) {
|
887 | s7 = peg$parse_();
|
888 | if (s7 !== peg$FAILED) {
|
889 | s8 = peg$parseTERM();
|
890 | if (s8 !== peg$FAILED) {
|
891 | peg$reportedPos = peg$currPos;
|
892 | s9 = peg$c17(s1, s2, s4, s6);
|
893 | if (s9) {
|
894 | s9 = peg$c6;
|
895 | } else {
|
896 | s9 = peg$c1;
|
897 | }
|
898 | if (s9 !== peg$FAILED) {
|
899 | peg$reportedPos = s0;
|
900 | s1 = peg$c18(s1, s2, s4, s6);
|
901 | s0 = s1;
|
902 | } else {
|
903 | peg$currPos = s0;
|
904 | s0 = peg$c1;
|
905 | }
|
906 | } else {
|
907 | peg$currPos = s0;
|
908 | s0 = peg$c1;
|
909 | }
|
910 | } else {
|
911 | peg$currPos = s0;
|
912 | s0 = peg$c1;
|
913 | }
|
914 | } else {
|
915 | peg$currPos = s0;
|
916 | s0 = peg$c1;
|
917 | }
|
918 | } else {
|
919 | peg$currPos = s0;
|
920 | s0 = peg$c1;
|
921 | }
|
922 | } else {
|
923 | peg$currPos = s0;
|
924 | s0 = peg$c1;
|
925 | }
|
926 | } else {
|
927 | peg$currPos = s0;
|
928 | s0 = peg$c1;
|
929 | }
|
930 | } else {
|
931 | peg$currPos = s0;
|
932 | s0 = peg$c1;
|
933 | }
|
934 | } else {
|
935 | peg$currPos = s0;
|
936 | s0 = peg$c1;
|
937 | }
|
938 |
|
939 | return s0;
|
940 | }
|
941 |
|
942 | function peg$parseattributes() {
|
943 | var s0, s1, s2, s3;
|
944 |
|
945 | s0 = peg$currPos;
|
946 | if (input.charCodeAt(peg$currPos) === 40) {
|
947 | s1 = peg$c19;
|
948 | peg$currPos++;
|
949 | } else {
|
950 | s1 = peg$FAILED;
|
951 | if (peg$silentFails === 0) { peg$fail(peg$c20); }
|
952 | }
|
953 | if (s1 !== peg$FAILED) {
|
954 | s2 = peg$parseattributeList();
|
955 | if (s2 !== peg$FAILED) {
|
956 | if (input.charCodeAt(peg$currPos) === 41) {
|
957 | s3 = peg$c21;
|
958 | peg$currPos++;
|
959 | } else {
|
960 | s3 = peg$FAILED;
|
961 | if (peg$silentFails === 0) { peg$fail(peg$c22); }
|
962 | }
|
963 | if (s3 !== peg$FAILED) {
|
964 | peg$reportedPos = s0;
|
965 | s1 = peg$c23(s2);
|
966 | s0 = s1;
|
967 | } else {
|
968 | peg$currPos = s0;
|
969 | s0 = peg$c1;
|
970 | }
|
971 | } else {
|
972 | peg$currPos = s0;
|
973 | s0 = peg$c1;
|
974 | }
|
975 | } else {
|
976 | peg$currPos = s0;
|
977 | s0 = peg$c1;
|
978 | }
|
979 |
|
980 | return s0;
|
981 | }
|
982 |
|
983 | function peg$parseattributeBindings() {
|
984 | var s0, s1, s2, s3;
|
985 |
|
986 | s0 = peg$currPos;
|
987 | if (input.charCodeAt(peg$currPos) === 123) {
|
988 | s1 = peg$c24;
|
989 | peg$currPos++;
|
990 | } else {
|
991 | s1 = peg$FAILED;
|
992 | if (peg$silentFails === 0) { peg$fail(peg$c25); }
|
993 | }
|
994 | if (s1 !== peg$FAILED) {
|
995 | s2 = peg$parseattributeList();
|
996 | if (s2 !== peg$FAILED) {
|
997 | if (input.charCodeAt(peg$currPos) === 125) {
|
998 | s3 = peg$c26;
|
999 | peg$currPos++;
|
1000 | } else {
|
1001 | s3 = peg$FAILED;
|
1002 | if (peg$silentFails === 0) { peg$fail(peg$c27); }
|
1003 | }
|
1004 | if (s3 !== peg$FAILED) {
|
1005 | peg$reportedPos = s0;
|
1006 | s1 = peg$c23(s2);
|
1007 | s0 = s1;
|
1008 | } else {
|
1009 | peg$currPos = s0;
|
1010 | s0 = peg$c1;
|
1011 | }
|
1012 | } else {
|
1013 | peg$currPos = s0;
|
1014 | s0 = peg$c1;
|
1015 | }
|
1016 | } else {
|
1017 | peg$currPos = s0;
|
1018 | s0 = peg$c1;
|
1019 | }
|
1020 |
|
1021 | return s0;
|
1022 | }
|
1023 |
|
1024 | function peg$parseattributeList() {
|
1025 | var s0, s1, s2;
|
1026 |
|
1027 | peg$silentFails++;
|
1028 | s0 = peg$currPos;
|
1029 | s1 = [];
|
1030 | s2 = peg$parseattribute();
|
1031 | while (s2 !== peg$FAILED) {
|
1032 | s1.push(s2);
|
1033 | s2 = peg$parseattribute();
|
1034 | }
|
1035 | if (s1 !== peg$FAILED) {
|
1036 | peg$reportedPos = s0;
|
1037 | s1 = peg$c29(s1);
|
1038 | }
|
1039 | s0 = s1;
|
1040 | peg$silentFails--;
|
1041 | if (s0 === peg$FAILED) {
|
1042 | s1 = peg$FAILED;
|
1043 | if (peg$silentFails === 0) { peg$fail(peg$c28); }
|
1044 | }
|
1045 |
|
1046 | return s0;
|
1047 | }
|
1048 |
|
1049 | function peg$parseattribute() {
|
1050 | var s0, s1, s2, s3, s4, s5;
|
1051 |
|
1052 | s0 = peg$currPos;
|
1053 | s1 = peg$parse_();
|
1054 | if (s1 !== peg$FAILED) {
|
1055 | s2 = peg$parsename();
|
1056 | if (s2 !== peg$FAILED) {
|
1057 | if (input.charCodeAt(peg$currPos) === 61) {
|
1058 | s3 = peg$c13;
|
1059 | peg$currPos++;
|
1060 | } else {
|
1061 | s3 = peg$FAILED;
|
1062 | if (peg$silentFails === 0) { peg$fail(peg$c14); }
|
1063 | }
|
1064 | if (s3 !== peg$FAILED) {
|
1065 | s4 = peg$parsename();
|
1066 | if (s4 === peg$FAILED) {
|
1067 | s4 = peg$parsequoted();
|
1068 | }
|
1069 | if (s4 !== peg$FAILED) {
|
1070 | s5 = peg$parse_();
|
1071 | if (s5 !== peg$FAILED) {
|
1072 | peg$reportedPos = s0;
|
1073 | s1 = peg$c30(s2, s4);
|
1074 | s0 = s1;
|
1075 | } else {
|
1076 | peg$currPos = s0;
|
1077 | s0 = peg$c1;
|
1078 | }
|
1079 | } else {
|
1080 | peg$currPos = s0;
|
1081 | s0 = peg$c1;
|
1082 | }
|
1083 | } else {
|
1084 | peg$currPos = s0;
|
1085 | s0 = peg$c1;
|
1086 | }
|
1087 | } else {
|
1088 | peg$currPos = s0;
|
1089 | s0 = peg$c1;
|
1090 | }
|
1091 | } else {
|
1092 | peg$currPos = s0;
|
1093 | s0 = peg$c1;
|
1094 | }
|
1095 |
|
1096 | return s0;
|
1097 | }
|
1098 |
|
1099 | function peg$parseblockElement() {
|
1100 | var s0, s1, s2, s3, s4, s5;
|
1101 |
|
1102 | s0 = peg$currPos;
|
1103 | s1 = peg$parseelement();
|
1104 | if (s1 !== peg$FAILED) {
|
1105 | s2 = peg$currPos;
|
1106 | s3 = peg$parseINDENT();
|
1107 | if (s3 !== peg$FAILED) {
|
1108 | s4 = peg$parseelements();
|
1109 | if (s4 !== peg$FAILED) {
|
1110 | s5 = peg$parseDEDENT();
|
1111 | if (s5 !== peg$FAILED) {
|
1112 | s3 = [s3, s4, s5];
|
1113 | s2 = s3;
|
1114 | } else {
|
1115 | peg$currPos = s2;
|
1116 | s2 = peg$c1;
|
1117 | }
|
1118 | } else {
|
1119 | peg$currPos = s2;
|
1120 | s2 = peg$c1;
|
1121 | }
|
1122 | } else {
|
1123 | peg$currPos = s2;
|
1124 | s2 = peg$c1;
|
1125 | }
|
1126 | if (s2 === peg$FAILED) {
|
1127 | s2 = peg$c8;
|
1128 | }
|
1129 | if (s2 !== peg$FAILED) {
|
1130 | peg$reportedPos = s0;
|
1131 | s1 = peg$c31(s1, s2);
|
1132 | s0 = s1;
|
1133 | } else {
|
1134 | peg$currPos = s0;
|
1135 | s0 = peg$c1;
|
1136 | }
|
1137 | } else {
|
1138 | peg$currPos = s0;
|
1139 | s0 = peg$c1;
|
1140 | }
|
1141 |
|
1142 | return s0;
|
1143 | }
|
1144 |
|
1145 | function peg$parseid() {
|
1146 | var s0, s1, s2;
|
1147 |
|
1148 | s0 = peg$currPos;
|
1149 | if (input.charCodeAt(peg$currPos) === 35) {
|
1150 | s1 = peg$c32;
|
1151 | peg$currPos++;
|
1152 | } else {
|
1153 | s1 = peg$FAILED;
|
1154 | if (peg$silentFails === 0) { peg$fail(peg$c33); }
|
1155 | }
|
1156 | if (s1 !== peg$FAILED) {
|
1157 | s2 = peg$parsename();
|
1158 | if (s2 !== peg$FAILED) {
|
1159 | peg$reportedPos = s0;
|
1160 | s1 = peg$c34(s2);
|
1161 | s0 = s1;
|
1162 | } else {
|
1163 | peg$currPos = s0;
|
1164 | s0 = peg$c1;
|
1165 | }
|
1166 | } else {
|
1167 | peg$currPos = s0;
|
1168 | s0 = peg$c1;
|
1169 | }
|
1170 |
|
1171 | return s0;
|
1172 | }
|
1173 |
|
1174 | function peg$parsetag() {
|
1175 | var s0, s1, s2;
|
1176 |
|
1177 | s0 = peg$currPos;
|
1178 | if (input.charCodeAt(peg$currPos) === 37) {
|
1179 | s1 = peg$c35;
|
1180 | peg$currPos++;
|
1181 | } else {
|
1182 | s1 = peg$FAILED;
|
1183 | if (peg$silentFails === 0) { peg$fail(peg$c36); }
|
1184 | }
|
1185 | if (s1 !== peg$FAILED) {
|
1186 | s2 = peg$parsename();
|
1187 | if (s2 !== peg$FAILED) {
|
1188 | peg$reportedPos = s0;
|
1189 | s1 = peg$c37(s2);
|
1190 | s0 = s1;
|
1191 | } else {
|
1192 | peg$currPos = s0;
|
1193 | s0 = peg$c1;
|
1194 | }
|
1195 | } else {
|
1196 | peg$currPos = s0;
|
1197 | s0 = peg$c1;
|
1198 | }
|
1199 |
|
1200 | return s0;
|
1201 | }
|
1202 |
|
1203 | function peg$parseclass() {
|
1204 | var s0, s1, s2;
|
1205 |
|
1206 | s0 = peg$currPos;
|
1207 | if (input.charCodeAt(peg$currPos) === 46) {
|
1208 | s1 = peg$c38;
|
1209 | peg$currPos++;
|
1210 | } else {
|
1211 | s1 = peg$FAILED;
|
1212 | if (peg$silentFails === 0) { peg$fail(peg$c39); }
|
1213 | }
|
1214 | if (s1 !== peg$FAILED) {
|
1215 | s2 = peg$parsename();
|
1216 | if (s2 !== peg$FAILED) {
|
1217 | peg$reportedPos = s0;
|
1218 | s1 = peg$c40(s2);
|
1219 | s0 = s1;
|
1220 | } else {
|
1221 | peg$currPos = s0;
|
1222 | s0 = peg$c1;
|
1223 | }
|
1224 | } else {
|
1225 | peg$currPos = s0;
|
1226 | s0 = peg$c1;
|
1227 | }
|
1228 |
|
1229 | return s0;
|
1230 | }
|
1231 |
|
1232 | function peg$parsequoted() {
|
1233 | var s0, s1, s2, s3, s4;
|
1234 |
|
1235 | s0 = peg$currPos;
|
1236 | s1 = peg$currPos;
|
1237 | if (input.charCodeAt(peg$currPos) === 39) {
|
1238 | s2 = peg$c41;
|
1239 | peg$currPos++;
|
1240 | } else {
|
1241 | s2 = peg$FAILED;
|
1242 | if (peg$silentFails === 0) { peg$fail(peg$c42); }
|
1243 | }
|
1244 | if (s2 !== peg$FAILED) {
|
1245 | s3 = peg$parsename();
|
1246 | if (s3 !== peg$FAILED) {
|
1247 | if (input.charCodeAt(peg$currPos) === 39) {
|
1248 | s4 = peg$c41;
|
1249 | peg$currPos++;
|
1250 | } else {
|
1251 | s4 = peg$FAILED;
|
1252 | if (peg$silentFails === 0) { peg$fail(peg$c42); }
|
1253 | }
|
1254 | if (s4 !== peg$FAILED) {
|
1255 | s2 = [s2, s3, s4];
|
1256 | s1 = s2;
|
1257 | } else {
|
1258 | peg$currPos = s1;
|
1259 | s1 = peg$c1;
|
1260 | }
|
1261 | } else {
|
1262 | peg$currPos = s1;
|
1263 | s1 = peg$c1;
|
1264 | }
|
1265 | } else {
|
1266 | peg$currPos = s1;
|
1267 | s1 = peg$c1;
|
1268 | }
|
1269 | if (s1 === peg$FAILED) {
|
1270 | s1 = peg$currPos;
|
1271 | if (input.charCodeAt(peg$currPos) === 34) {
|
1272 | s2 = peg$c43;
|
1273 | peg$currPos++;
|
1274 | } else {
|
1275 | s2 = peg$FAILED;
|
1276 | if (peg$silentFails === 0) { peg$fail(peg$c44); }
|
1277 | }
|
1278 | if (s2 !== peg$FAILED) {
|
1279 | s3 = peg$parsename();
|
1280 | if (s3 !== peg$FAILED) {
|
1281 | if (input.charCodeAt(peg$currPos) === 34) {
|
1282 | s4 = peg$c43;
|
1283 | peg$currPos++;
|
1284 | } else {
|
1285 | s4 = peg$FAILED;
|
1286 | if (peg$silentFails === 0) { peg$fail(peg$c44); }
|
1287 | }
|
1288 | if (s4 !== peg$FAILED) {
|
1289 | s2 = [s2, s3, s4];
|
1290 | s1 = s2;
|
1291 | } else {
|
1292 | peg$currPos = s1;
|
1293 | s1 = peg$c1;
|
1294 | }
|
1295 | } else {
|
1296 | peg$currPos = s1;
|
1297 | s1 = peg$c1;
|
1298 | }
|
1299 | } else {
|
1300 | peg$currPos = s1;
|
1301 | s1 = peg$c1;
|
1302 | }
|
1303 | }
|
1304 | if (s1 !== peg$FAILED) {
|
1305 | peg$reportedPos = s0;
|
1306 | s1 = peg$c45(s1);
|
1307 | }
|
1308 | s0 = s1;
|
1309 |
|
1310 | return s0;
|
1311 | }
|
1312 |
|
1313 | function peg$parsename() {
|
1314 | var s0, s1, s2;
|
1315 |
|
1316 | s0 = peg$currPos;
|
1317 | s1 = [];
|
1318 | s2 = peg$parsenameChar();
|
1319 | if (s2 !== peg$FAILED) {
|
1320 | while (s2 !== peg$FAILED) {
|
1321 | s1.push(s2);
|
1322 | s2 = peg$parsenameChar();
|
1323 | }
|
1324 | } else {
|
1325 | s1 = peg$c1;
|
1326 | }
|
1327 | if (s1 !== peg$FAILED) {
|
1328 | peg$reportedPos = s0;
|
1329 | s1 = peg$c45(s1);
|
1330 | }
|
1331 | s0 = s1;
|
1332 |
|
1333 | return s0;
|
1334 | }
|
1335 |
|
1336 | function peg$parsenameChar() {
|
1337 | var s0;
|
1338 |
|
1339 | if (peg$c46.test(input.charAt(peg$currPos))) {
|
1340 | s0 = input.charAt(peg$currPos);
|
1341 | peg$currPos++;
|
1342 | } else {
|
1343 | s0 = peg$FAILED;
|
1344 | if (peg$silentFails === 0) { peg$fail(peg$c47); }
|
1345 | }
|
1346 |
|
1347 | return s0;
|
1348 | }
|
1349 |
|
1350 | function peg$parsetextLine() {
|
1351 | var s0, s1, s2, s3, s4, s5;
|
1352 |
|
1353 | s0 = peg$currPos;
|
1354 | s1 = peg$parse_();
|
1355 | if (s1 !== peg$FAILED) {
|
1356 | s2 = peg$currPos;
|
1357 | peg$silentFails++;
|
1358 | s3 = peg$parsenonTextStart();
|
1359 | peg$silentFails--;
|
1360 | if (s3 === peg$FAILED) {
|
1361 | s2 = peg$c6;
|
1362 | } else {
|
1363 | peg$currPos = s2;
|
1364 | s2 = peg$c1;
|
1365 | }
|
1366 | if (s2 !== peg$FAILED) {
|
1367 | s3 = peg$parsetext();
|
1368 | if (s3 !== peg$FAILED) {
|
1369 | s4 = peg$parse_();
|
1370 | if (s4 !== peg$FAILED) {
|
1371 | s5 = peg$parseTERM();
|
1372 | if (s5 !== peg$FAILED) {
|
1373 | peg$reportedPos = s0;
|
1374 | s1 = peg$c48(s3);
|
1375 | s0 = s1;
|
1376 | } else {
|
1377 | peg$currPos = s0;
|
1378 | s0 = peg$c1;
|
1379 | }
|
1380 | } else {
|
1381 | peg$currPos = s0;
|
1382 | s0 = peg$c1;
|
1383 | }
|
1384 | } else {
|
1385 | peg$currPos = s0;
|
1386 | s0 = peg$c1;
|
1387 | }
|
1388 | } else {
|
1389 | peg$currPos = s0;
|
1390 | s0 = peg$c1;
|
1391 | }
|
1392 | } else {
|
1393 | peg$currPos = s0;
|
1394 | s0 = peg$c1;
|
1395 | }
|
1396 |
|
1397 | return s0;
|
1398 | }
|
1399 |
|
1400 | function peg$parseinlineText() {
|
1401 | var s0, s1, s2, s3, s4;
|
1402 |
|
1403 | s0 = peg$currPos;
|
1404 | s1 = peg$currPos;
|
1405 | peg$silentFails++;
|
1406 | s2 = peg$parsenonInlineTextStart();
|
1407 | peg$silentFails--;
|
1408 | if (s2 === peg$FAILED) {
|
1409 | s1 = peg$c6;
|
1410 | } else {
|
1411 | peg$currPos = s1;
|
1412 | s1 = peg$c1;
|
1413 | }
|
1414 | if (s1 !== peg$FAILED) {
|
1415 | s2 = peg$parse_();
|
1416 | if (s2 !== peg$FAILED) {
|
1417 | s3 = [];
|
1418 | s4 = peg$parseinterpolation();
|
1419 | if (s4 === peg$FAILED) {
|
1420 | s4 = peg$parseinterpolationText();
|
1421 | }
|
1422 | while (s4 !== peg$FAILED) {
|
1423 | s3.push(s4);
|
1424 | s4 = peg$parseinterpolation();
|
1425 | if (s4 === peg$FAILED) {
|
1426 | s4 = peg$parseinterpolationText();
|
1427 | }
|
1428 | }
|
1429 | if (s3 !== peg$FAILED) {
|
1430 | peg$reportedPos = s0;
|
1431 | s1 = peg$c49(s3);
|
1432 | s0 = s1;
|
1433 | } else {
|
1434 | peg$currPos = s0;
|
1435 | s0 = peg$c1;
|
1436 | }
|
1437 | } else {
|
1438 | peg$currPos = s0;
|
1439 | s0 = peg$c1;
|
1440 | }
|
1441 | } else {
|
1442 | peg$currPos = s0;
|
1443 | s0 = peg$c1;
|
1444 | }
|
1445 |
|
1446 | return s0;
|
1447 | }
|
1448 |
|
1449 | function peg$parseinterpolation() {
|
1450 | var s0, s1, s2, s3;
|
1451 |
|
1452 | s0 = peg$currPos;
|
1453 | if (input.substr(peg$currPos, 2) === peg$c50) {
|
1454 | s1 = peg$c50;
|
1455 | peg$currPos += 2;
|
1456 | } else {
|
1457 | s1 = peg$FAILED;
|
1458 | if (peg$silentFails === 0) { peg$fail(peg$c51); }
|
1459 | }
|
1460 | if (s1 !== peg$FAILED) {
|
1461 | s2 = peg$parsemustacheContent();
|
1462 | if (s2 !== peg$FAILED) {
|
1463 | if (input.charCodeAt(peg$currPos) === 125) {
|
1464 | s3 = peg$c26;
|
1465 | peg$currPos++;
|
1466 | } else {
|
1467 | s3 = peg$FAILED;
|
1468 | if (peg$silentFails === 0) { peg$fail(peg$c27); }
|
1469 | }
|
1470 | if (s3 !== peg$FAILED) {
|
1471 | peg$reportedPos = s0;
|
1472 | s1 = peg$c52(s2);
|
1473 | s0 = s1;
|
1474 | } else {
|
1475 | peg$currPos = s0;
|
1476 | s0 = peg$c1;
|
1477 | }
|
1478 | } else {
|
1479 | peg$currPos = s0;
|
1480 | s0 = peg$c1;
|
1481 | }
|
1482 | } else {
|
1483 | peg$currPos = s0;
|
1484 | s0 = peg$c1;
|
1485 | }
|
1486 |
|
1487 | return s0;
|
1488 | }
|
1489 |
|
1490 | function peg$parseinterpolationText() {
|
1491 | var s0, s1, s2, s3, s4;
|
1492 |
|
1493 | s0 = peg$currPos;
|
1494 | s1 = [];
|
1495 | s2 = peg$currPos;
|
1496 | s3 = peg$currPos;
|
1497 | peg$silentFails++;
|
1498 | if (input.substr(peg$currPos, 2) === peg$c50) {
|
1499 | s4 = peg$c50;
|
1500 | peg$currPos += 2;
|
1501 | } else {
|
1502 | s4 = peg$FAILED;
|
1503 | if (peg$silentFails === 0) { peg$fail(peg$c51); }
|
1504 | }
|
1505 | peg$silentFails--;
|
1506 | if (s4 === peg$FAILED) {
|
1507 | s3 = peg$c6;
|
1508 | } else {
|
1509 | peg$currPos = s3;
|
1510 | s3 = peg$c1;
|
1511 | }
|
1512 | if (s3 !== peg$FAILED) {
|
1513 | s4 = peg$parsetextChar();
|
1514 | if (s4 !== peg$FAILED) {
|
1515 | peg$reportedPos = s2;
|
1516 | s3 = peg$c53(s4);
|
1517 | s2 = s3;
|
1518 | } else {
|
1519 | peg$currPos = s2;
|
1520 | s2 = peg$c1;
|
1521 | }
|
1522 | } else {
|
1523 | peg$currPos = s2;
|
1524 | s2 = peg$c1;
|
1525 | }
|
1526 | if (s2 !== peg$FAILED) {
|
1527 | while (s2 !== peg$FAILED) {
|
1528 | s1.push(s2);
|
1529 | s2 = peg$currPos;
|
1530 | s3 = peg$currPos;
|
1531 | peg$silentFails++;
|
1532 | if (input.substr(peg$currPos, 2) === peg$c50) {
|
1533 | s4 = peg$c50;
|
1534 | peg$currPos += 2;
|
1535 | } else {
|
1536 | s4 = peg$FAILED;
|
1537 | if (peg$silentFails === 0) { peg$fail(peg$c51); }
|
1538 | }
|
1539 | peg$silentFails--;
|
1540 | if (s4 === peg$FAILED) {
|
1541 | s3 = peg$c6;
|
1542 | } else {
|
1543 | peg$currPos = s3;
|
1544 | s3 = peg$c1;
|
1545 | }
|
1546 | if (s3 !== peg$FAILED) {
|
1547 | s4 = peg$parsetextChar();
|
1548 | if (s4 !== peg$FAILED) {
|
1549 | peg$reportedPos = s2;
|
1550 | s3 = peg$c53(s4);
|
1551 | s2 = s3;
|
1552 | } else {
|
1553 | peg$currPos = s2;
|
1554 | s2 = peg$c1;
|
1555 | }
|
1556 | } else {
|
1557 | peg$currPos = s2;
|
1558 | s2 = peg$c1;
|
1559 | }
|
1560 | }
|
1561 | } else {
|
1562 | s1 = peg$c1;
|
1563 | }
|
1564 | if (s1 !== peg$FAILED) {
|
1565 | peg$reportedPos = s0;
|
1566 | s1 = peg$c54(s1);
|
1567 | }
|
1568 | s0 = s1;
|
1569 |
|
1570 | return s0;
|
1571 | }
|
1572 |
|
1573 | function peg$parsetext() {
|
1574 | var s0, s1, s2;
|
1575 |
|
1576 | s0 = peg$currPos;
|
1577 | s1 = [];
|
1578 | s2 = peg$parsetextChar();
|
1579 | if (s2 !== peg$FAILED) {
|
1580 | while (s2 !== peg$FAILED) {
|
1581 | s1.push(s2);
|
1582 | s2 = peg$parsetextChar();
|
1583 | }
|
1584 | } else {
|
1585 | s1 = peg$c1;
|
1586 | }
|
1587 | if (s1 !== peg$FAILED) {
|
1588 | peg$reportedPos = s0;
|
1589 | s1 = peg$c54(s1);
|
1590 | }
|
1591 | s0 = s1;
|
1592 |
|
1593 | return s0;
|
1594 | }
|
1595 |
|
1596 | function peg$parsetextChar() {
|
1597 | var s0, s1, s2;
|
1598 |
|
1599 | s0 = peg$currPos;
|
1600 | if (input.length > peg$currPos) {
|
1601 | s1 = input.charAt(peg$currPos);
|
1602 | peg$currPos++;
|
1603 | } else {
|
1604 | s1 = peg$FAILED;
|
1605 | if (peg$silentFails === 0) { peg$fail(peg$c55); }
|
1606 | }
|
1607 | if (s1 !== peg$FAILED) {
|
1608 | peg$reportedPos = peg$currPos;
|
1609 | s2 = peg$c56(s1);
|
1610 | if (s2) {
|
1611 | s2 = peg$c6;
|
1612 | } else {
|
1613 | s2 = peg$c1;
|
1614 | }
|
1615 | if (s2 !== peg$FAILED) {
|
1616 | peg$reportedPos = s0;
|
1617 | s1 = peg$c57(s1);
|
1618 | s0 = s1;
|
1619 | } else {
|
1620 | peg$currPos = s0;
|
1621 | s0 = peg$c1;
|
1622 | }
|
1623 | } else {
|
1624 | peg$currPos = s0;
|
1625 | s0 = peg$c1;
|
1626 | }
|
1627 |
|
1628 | return s0;
|
1629 | }
|
1630 |
|
1631 | function peg$parsenonTextChar() {
|
1632 | var s0;
|
1633 |
|
1634 | s0 = peg$parseTERM();
|
1635 | if (s0 === peg$FAILED) {
|
1636 | s0 = peg$parseDEDENT();
|
1637 | if (s0 === peg$FAILED) {
|
1638 | s0 = peg$parseINDENT();
|
1639 | if (s0 === peg$FAILED) {
|
1640 | s0 = peg$parseEOF();
|
1641 | }
|
1642 | }
|
1643 | }
|
1644 |
|
1645 | return s0;
|
1646 | }
|
1647 |
|
1648 | function peg$parsenonInlineTextStart() {
|
1649 | var s0;
|
1650 |
|
1651 | if (peg$c58.test(input.charAt(peg$currPos))) {
|
1652 | s0 = input.charAt(peg$currPos);
|
1653 | peg$currPos++;
|
1654 | } else {
|
1655 | s0 = peg$FAILED;
|
1656 | if (peg$silentFails === 0) { peg$fail(peg$c59); }
|
1657 | }
|
1658 | if (s0 === peg$FAILED) {
|
1659 | s0 = peg$parseTERM();
|
1660 | if (s0 === peg$FAILED) {
|
1661 | s0 = peg$parseDEDENT();
|
1662 | }
|
1663 | }
|
1664 |
|
1665 | return s0;
|
1666 | }
|
1667 |
|
1668 | function peg$parsenonTextStart() {
|
1669 | var s0;
|
1670 |
|
1671 | if (peg$c60.test(input.charAt(peg$currPos))) {
|
1672 | s0 = input.charAt(peg$currPos);
|
1673 | peg$currPos++;
|
1674 | } else {
|
1675 | s0 = peg$FAILED;
|
1676 | if (peg$silentFails === 0) { peg$fail(peg$c61); }
|
1677 | }
|
1678 | if (s0 === peg$FAILED) {
|
1679 | s0 = peg$parseTERM();
|
1680 | if (s0 === peg$FAILED) {
|
1681 | s0 = peg$parseDEDENT();
|
1682 | }
|
1683 | }
|
1684 |
|
1685 | return s0;
|
1686 | }
|
1687 |
|
1688 | function peg$parseINDENT() {
|
1689 | var s0, s1, s2;
|
1690 |
|
1691 | peg$silentFails++;
|
1692 | s0 = peg$currPos;
|
1693 | if (input.length > peg$currPos) {
|
1694 | s1 = input.charAt(peg$currPos);
|
1695 | peg$currPos++;
|
1696 | } else {
|
1697 | s1 = peg$FAILED;
|
1698 | if (peg$silentFails === 0) { peg$fail(peg$c55); }
|
1699 | }
|
1700 | if (s1 !== peg$FAILED) {
|
1701 | peg$reportedPos = peg$currPos;
|
1702 | s2 = peg$c63(s1);
|
1703 | if (s2) {
|
1704 | s2 = peg$c6;
|
1705 | } else {
|
1706 | s2 = peg$c1;
|
1707 | }
|
1708 | if (s2 !== peg$FAILED) {
|
1709 | peg$reportedPos = s0;
|
1710 | s1 = peg$c64(s1);
|
1711 | s0 = s1;
|
1712 | } else {
|
1713 | peg$currPos = s0;
|
1714 | s0 = peg$c1;
|
1715 | }
|
1716 | } else {
|
1717 | peg$currPos = s0;
|
1718 | s0 = peg$c1;
|
1719 | }
|
1720 | peg$silentFails--;
|
1721 | if (s0 === peg$FAILED) {
|
1722 | s1 = peg$FAILED;
|
1723 | if (peg$silentFails === 0) { peg$fail(peg$c62); }
|
1724 | }
|
1725 |
|
1726 | return s0;
|
1727 | }
|
1728 |
|
1729 | function peg$parseDEDENT() {
|
1730 | var s0, s1, s2;
|
1731 |
|
1732 | peg$silentFails++;
|
1733 | s0 = peg$currPos;
|
1734 | if (input.length > peg$currPos) {
|
1735 | s1 = input.charAt(peg$currPos);
|
1736 | peg$currPos++;
|
1737 | } else {
|
1738 | s1 = peg$FAILED;
|
1739 | if (peg$silentFails === 0) { peg$fail(peg$c55); }
|
1740 | }
|
1741 | if (s1 !== peg$FAILED) {
|
1742 | peg$reportedPos = peg$currPos;
|
1743 | s2 = peg$c66(s1);
|
1744 | if (s2) {
|
1745 | s2 = peg$c6;
|
1746 | } else {
|
1747 | s2 = peg$c1;
|
1748 | }
|
1749 | if (s2 !== peg$FAILED) {
|
1750 | peg$reportedPos = s0;
|
1751 | s1 = peg$c64(s1);
|
1752 | s0 = s1;
|
1753 | } else {
|
1754 | peg$currPos = s0;
|
1755 | s0 = peg$c1;
|
1756 | }
|
1757 | } else {
|
1758 | peg$currPos = s0;
|
1759 | s0 = peg$c1;
|
1760 | }
|
1761 | peg$silentFails--;
|
1762 | if (s0 === peg$FAILED) {
|
1763 | s1 = peg$FAILED;
|
1764 | if (peg$silentFails === 0) { peg$fail(peg$c65); }
|
1765 | }
|
1766 |
|
1767 | return s0;
|
1768 | }
|
1769 |
|
1770 | function peg$parseTERM() {
|
1771 | var s0, s1, s2;
|
1772 |
|
1773 | peg$silentFails++;
|
1774 | s0 = peg$currPos;
|
1775 | if (input.length > peg$currPos) {
|
1776 | s1 = input.charAt(peg$currPos);
|
1777 | peg$currPos++;
|
1778 | } else {
|
1779 | s1 = peg$FAILED;
|
1780 | if (peg$silentFails === 0) { peg$fail(peg$c55); }
|
1781 | }
|
1782 | if (s1 !== peg$FAILED) {
|
1783 | peg$reportedPos = peg$currPos;
|
1784 | s2 = peg$c68(s1);
|
1785 | if (s2) {
|
1786 | s2 = peg$c6;
|
1787 | } else {
|
1788 | s2 = peg$c1;
|
1789 | }
|
1790 | if (s2 !== peg$FAILED) {
|
1791 | peg$reportedPos = s0;
|
1792 | s1 = peg$c64(s1);
|
1793 | s0 = s1;
|
1794 | } else {
|
1795 | peg$currPos = s0;
|
1796 | s0 = peg$c1;
|
1797 | }
|
1798 | } else {
|
1799 | peg$currPos = s0;
|
1800 | s0 = peg$c1;
|
1801 | }
|
1802 | peg$silentFails--;
|
1803 | if (s0 === peg$FAILED) {
|
1804 | s1 = peg$FAILED;
|
1805 | if (peg$silentFails === 0) { peg$fail(peg$c67); }
|
1806 | }
|
1807 |
|
1808 | return s0;
|
1809 | }
|
1810 |
|
1811 | function peg$parse__() {
|
1812 | var s0, s1;
|
1813 |
|
1814 | peg$silentFails++;
|
1815 | s0 = [];
|
1816 | s1 = peg$parsewhitespace();
|
1817 | if (s1 !== peg$FAILED) {
|
1818 | while (s1 !== peg$FAILED) {
|
1819 | s0.push(s1);
|
1820 | s1 = peg$parsewhitespace();
|
1821 | }
|
1822 | } else {
|
1823 | s0 = peg$c1;
|
1824 | }
|
1825 | peg$silentFails--;
|
1826 | if (s0 === peg$FAILED) {
|
1827 | s1 = peg$FAILED;
|
1828 | if (peg$silentFails === 0) { peg$fail(peg$c69); }
|
1829 | }
|
1830 |
|
1831 | return s0;
|
1832 | }
|
1833 |
|
1834 | function peg$parse_() {
|
1835 | var s0, s1;
|
1836 |
|
1837 | peg$silentFails++;
|
1838 | s0 = [];
|
1839 | s1 = peg$parsewhitespace();
|
1840 | while (s1 !== peg$FAILED) {
|
1841 | s0.push(s1);
|
1842 | s1 = peg$parsewhitespace();
|
1843 | }
|
1844 | peg$silentFails--;
|
1845 | if (s0 === peg$FAILED) {
|
1846 | s1 = peg$FAILED;
|
1847 | if (peg$silentFails === 0) { peg$fail(peg$c70); }
|
1848 | }
|
1849 |
|
1850 | return s0;
|
1851 | }
|
1852 |
|
1853 | function peg$parsewhitespace() {
|
1854 | var s0;
|
1855 |
|
1856 | if (peg$c71.test(input.charAt(peg$currPos))) {
|
1857 | s0 = input.charAt(peg$currPos);
|
1858 | peg$currPos++;
|
1859 | } else {
|
1860 | s0 = peg$FAILED;
|
1861 | if (peg$silentFails === 0) { peg$fail(peg$c72); }
|
1862 | }
|
1863 |
|
1864 | return s0;
|
1865 | }
|
1866 |
|
1867 | function peg$parseEOF() {
|
1868 | var s0, s1;
|
1869 |
|
1870 | s0 = peg$currPos;
|
1871 | peg$silentFails++;
|
1872 | if (input.length > peg$currPos) {
|
1873 | s1 = input.charAt(peg$currPos);
|
1874 | peg$currPos++;
|
1875 | } else {
|
1876 | s1 = peg$FAILED;
|
1877 | if (peg$silentFails === 0) { peg$fail(peg$c55); }
|
1878 | }
|
1879 | peg$silentFails--;
|
1880 | if (s1 === peg$FAILED) {
|
1881 | s0 = peg$c6;
|
1882 | } else {
|
1883 | peg$currPos = s0;
|
1884 | s0 = peg$c1;
|
1885 | }
|
1886 |
|
1887 | return s0;
|
1888 | }
|
1889 |
|
1890 |
|
1891 | var INDENT_CHAR = options.INDENT_CHAR || '\uEFEF',
|
1892 | DEDENT_CHAR = options.DEDENT_CHAR || '\uEFFE',
|
1893 | TERM_CHAR = options.TERM_CHAR || '\uEFFF';
|
1894 |
|
1895 | function array(input){
|
1896 | if(typeof(input) !== 'array'){
|
1897 | input = [input];
|
1898 | }
|
1899 | return input;
|
1900 | }
|
1901 |
|
1902 | function compact(input){
|
1903 | if(typeof(input) === 'array'){
|
1904 | if(input.length === 0){
|
1905 | return;
|
1906 | }
|
1907 | }else if(typeof(input) === 'object'){
|
1908 | if(Object.keys(input).length === 0){
|
1909 | return;
|
1910 | }
|
1911 | }
|
1912 | return input;
|
1913 | }
|
1914 |
|
1915 | function isArray(thing) {
|
1916 | if( Object.prototype.toString.call(thing) === '[object Array]' ) {
|
1917 | return true;
|
1918 | }
|
1919 | return false;
|
1920 | }
|
1921 |
|
1922 | function condense(objects) {
|
1923 | var target = {}, sources;
|
1924 | if(isArray(objects)){
|
1925 | sources = objects;
|
1926 | }else{
|
1927 | sources = [].slice.call(arguments, 0);
|
1928 | }
|
1929 | sources.forEach(function (source) {
|
1930 | for (var prop in source) {
|
1931 | if(target[prop]){
|
1932 | target[prop] = array(target[prop]);
|
1933 | target[prop].push(source[prop]);
|
1934 | }else{
|
1935 | target[prop] = source[prop];
|
1936 | }
|
1937 | }
|
1938 | });
|
1939 | return target;
|
1940 | }
|
1941 |
|
1942 | function addProperties(target, key, value) {
|
1943 | if(Object.keys(value).length > 0){
|
1944 | target[key] = value;
|
1945 | }
|
1946 | }
|
1947 |
|
1948 | function addProperty(target, key, value) {
|
1949 | if(typeof(value) !== 'undefined' && value !== null){
|
1950 | target[key] = value;
|
1951 | }
|
1952 | }
|
1953 |
|
1954 |
|
1955 | peg$result = peg$startRuleFunction();
|
1956 |
|
1957 | if (peg$result !== peg$FAILED && peg$currPos === input.length) {
|
1958 | return peg$result;
|
1959 | } else {
|
1960 | if (peg$result !== peg$FAILED && peg$currPos < input.length) {
|
1961 | peg$fail({ type: "end", description: "end of input" });
|
1962 | }
|
1963 |
|
1964 | throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
|
1965 | }
|
1966 | }
|
1967 |
|
1968 | return {
|
1969 | SyntaxError: SyntaxError,
|
1970 | parse: parse
|
1971 | };
|
1972 | })();});
|
1973 | define('preprocessor', function(require, exports, module){
|
1974 | module.exports = (function() {
|
1975 | |
1976 |
|
1977 |
|
1978 |
|
1979 |
|
1980 |
|
1981 | function peg$subclass(child, parent) {
|
1982 | function ctor() { this.constructor = child; }
|
1983 | ctor.prototype = parent.prototype;
|
1984 | child.prototype = new ctor();
|
1985 | }
|
1986 |
|
1987 | function SyntaxError(message, expected, found, offset, line, column) {
|
1988 | this.message = message;
|
1989 | this.expected = expected;
|
1990 | this.found = found;
|
1991 | this.offset = offset;
|
1992 | this.line = line;
|
1993 | this.column = column;
|
1994 |
|
1995 | this.name = "SyntaxError";
|
1996 | }
|
1997 |
|
1998 | peg$subclass(SyntaxError, Error);
|
1999 |
|
2000 | function parse(input) {
|
2001 | var options = arguments.length > 1 ? arguments[1] : {},
|
2002 |
|
2003 | peg$FAILED = {},
|
2004 |
|
2005 | peg$startRuleFunctions = { start: peg$parsestart },
|
2006 | peg$startRuleFunction = peg$parsestart,
|
2007 |
|
2008 | peg$c0 = peg$FAILED,
|
2009 | peg$c1 = null,
|
2010 | peg$c2 = [],
|
2011 | peg$c3 = function(l) {
|
2012 | var lines = compact(l).map(function(line){
|
2013 | if(lastChar(line) !== DEDENT_CHAR){
|
2014 | line = line + TERM_CHAR
|
2015 | }
|
2016 | return line;
|
2017 | });
|
2018 | return lines.join('');
|
2019 | },
|
2020 | peg$c4 = function() { return },
|
2021 | peg$c5 = void 0,
|
2022 | peg$c6 = { type: "any", description: "any character" },
|
2023 | peg$c7 = function(c) {
|
2024 | return c;
|
2025 | },
|
2026 | peg$c8 = function(i, c, d) {
|
2027 | var out = '';
|
2028 | if(i){
|
2029 | out = out + TERM_CHAR + i;
|
2030 | }
|
2031 | out = out + c.join(TERM_CHAR);
|
2032 | if(d){
|
2033 | if(lastChar(out) !== DEDENT_CHAR){
|
2034 | out = out + TERM_CHAR;
|
2035 | }
|
2036 | out = out + d;
|
2037 | }
|
2038 | return out;
|
2039 | },
|
2040 | peg$c9 = function(line, e, children) {
|
2041 | var out = line.join('');
|
2042 | if(children){
|
2043 | out = out + children;
|
2044 | }
|
2045 | return out;
|
2046 | },
|
2047 | peg$c10 = "\r\n",
|
2048 | peg$c11 = { type: "literal", value: "\r\n", description: "\"\\r\\n\"" },
|
2049 | peg$c12 = "\n",
|
2050 | peg$c13 = { type: "literal", value: "\n", description: "\"\\n\"" },
|
2051 | peg$c14 = "\r",
|
2052 | peg$c15 = { type: "literal", value: "\r", description: "\"\\r\"" },
|
2053 | peg$c16 = /^[ \t]/,
|
2054 | peg$c17 = { type: "class", value: "[ \\t]", description: "[ \\t]" },
|
2055 | peg$c18 = function(i) { return i.join("") === indent; },
|
2056 | peg$c19 = { type: "other", description: "INDENT" },
|
2057 | peg$c20 = function(i) { return i.length > indent.length; },
|
2058 | peg$c21 = function(i) {
|
2059 | indentStack.push(indent);
|
2060 | indent = i.join('');
|
2061 | pos = offset;
|
2062 | },
|
2063 | peg$c22 = function() {
|
2064 | return INDENT_CHAR;
|
2065 | },
|
2066 | peg$c23 = { type: "other", description: "DEDENT" },
|
2067 | peg$c24 = function() {
|
2068 | indent = indentStack.pop();
|
2069 | return DEDENT_CHAR;
|
2070 | },
|
2071 |
|
2072 | peg$currPos = 0,
|
2073 | peg$reportedPos = 0,
|
2074 | peg$cachedPos = 0,
|
2075 | peg$cachedPosDetails = { line: 1, column: 1, seenCR: false },
|
2076 | peg$maxFailPos = 0,
|
2077 | peg$maxFailExpected = [],
|
2078 | peg$silentFails = 0,
|
2079 |
|
2080 | peg$result;
|
2081 |
|
2082 | if ("startRule" in options) {
|
2083 | if (!(options.startRule in peg$startRuleFunctions)) {
|
2084 | throw new Error("Can't start parsing from rule \"" + options.startRule + "\".");
|
2085 | }
|
2086 |
|
2087 | peg$startRuleFunction = peg$startRuleFunctions[options.startRule];
|
2088 | }
|
2089 |
|
2090 | function text() {
|
2091 | return input.substring(peg$reportedPos, peg$currPos);
|
2092 | }
|
2093 |
|
2094 | function offset() {
|
2095 | return peg$reportedPos;
|
2096 | }
|
2097 |
|
2098 | function line() {
|
2099 | return peg$computePosDetails(peg$reportedPos).line;
|
2100 | }
|
2101 |
|
2102 | function column() {
|
2103 | return peg$computePosDetails(peg$reportedPos).column;
|
2104 | }
|
2105 |
|
2106 | function expected(description) {
|
2107 | throw peg$buildException(
|
2108 | null,
|
2109 | [{ type: "other", description: description }],
|
2110 | peg$reportedPos
|
2111 | );
|
2112 | }
|
2113 |
|
2114 | function error(message) {
|
2115 | throw peg$buildException(message, null, peg$reportedPos);
|
2116 | }
|
2117 |
|
2118 | function peg$computePosDetails(pos) {
|
2119 | function advance(details, startPos, endPos) {
|
2120 | var p, ch;
|
2121 |
|
2122 | for (p = startPos; p < endPos; p++) {
|
2123 | ch = input.charAt(p);
|
2124 | if (ch === "\n") {
|
2125 | if (!details.seenCR) { details.line++; }
|
2126 | details.column = 1;
|
2127 | details.seenCR = false;
|
2128 | } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
|
2129 | details.line++;
|
2130 | details.column = 1;
|
2131 | details.seenCR = true;
|
2132 | } else {
|
2133 | details.column++;
|
2134 | details.seenCR = false;
|
2135 | }
|
2136 | }
|
2137 | }
|
2138 |
|
2139 | if (peg$cachedPos !== pos) {
|
2140 | if (peg$cachedPos > pos) {
|
2141 | peg$cachedPos = 0;
|
2142 | peg$cachedPosDetails = { line: 1, column: 1, seenCR: false };
|
2143 | }
|
2144 | advance(peg$cachedPosDetails, peg$cachedPos, pos);
|
2145 | peg$cachedPos = pos;
|
2146 | }
|
2147 |
|
2148 | return peg$cachedPosDetails;
|
2149 | }
|
2150 |
|
2151 | function peg$fail(expected) {
|
2152 | if (peg$currPos < peg$maxFailPos) { return; }
|
2153 |
|
2154 | if (peg$currPos > peg$maxFailPos) {
|
2155 | peg$maxFailPos = peg$currPos;
|
2156 | peg$maxFailExpected = [];
|
2157 | }
|
2158 |
|
2159 | peg$maxFailExpected.push(expected);
|
2160 | }
|
2161 |
|
2162 | function peg$buildException(message, expected, pos) {
|
2163 | function cleanupExpected(expected) {
|
2164 | var i = 1;
|
2165 |
|
2166 | expected.sort(function(a, b) {
|
2167 | if (a.description < b.description) {
|
2168 | return -1;
|
2169 | } else if (a.description > b.description) {
|
2170 | return 1;
|
2171 | } else {
|
2172 | return 0;
|
2173 | }
|
2174 | });
|
2175 |
|
2176 | while (i < expected.length) {
|
2177 | if (expected[i - 1] === expected[i]) {
|
2178 | expected.splice(i, 1);
|
2179 | } else {
|
2180 | i++;
|
2181 | }
|
2182 | }
|
2183 | }
|
2184 |
|
2185 | function buildMessage(expected, found) {
|
2186 | function stringEscape(s) {
|
2187 | function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); }
|
2188 |
|
2189 | return s
|
2190 | .replace(/\\/g, '\\\\')
|
2191 | .replace(/"/g, '\\"')
|
2192 | .replace(/\x08/g, '\\b')
|
2193 | .replace(/\t/g, '\\t')
|
2194 | .replace(/\n/g, '\\n')
|
2195 | .replace(/\f/g, '\\f')
|
2196 | .replace(/\r/g, '\\r')
|
2197 | .replace(/[\x00-\x07\x0B\x0E\x0F]/g, function(ch) { return '\\x0' + hex(ch); })
|
2198 | .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); })
|
2199 | .replace(/[\u0180-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); })
|
2200 | .replace(/[\u1080-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); });
|
2201 | }
|
2202 |
|
2203 | var expectedDescs = new Array(expected.length),
|
2204 | expectedDesc, foundDesc, i;
|
2205 |
|
2206 | for (i = 0; i < expected.length; i++) {
|
2207 | expectedDescs[i] = expected[i].description;
|
2208 | }
|
2209 |
|
2210 | expectedDesc = expected.length > 1
|
2211 | ? expectedDescs.slice(0, -1).join(", ")
|
2212 | + " or "
|
2213 | + expectedDescs[expected.length - 1]
|
2214 | : expectedDescs[0];
|
2215 |
|
2216 | foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input";
|
2217 |
|
2218 | return "Expected " + expectedDesc + " but " + foundDesc + " found.";
|
2219 | }
|
2220 |
|
2221 | var posDetails = peg$computePosDetails(pos),
|
2222 | found = pos < input.length ? input.charAt(pos) : null;
|
2223 |
|
2224 | if (expected !== null) {
|
2225 | cleanupExpected(expected);
|
2226 | }
|
2227 |
|
2228 | return new SyntaxError(
|
2229 | message !== null ? message : buildMessage(expected, found),
|
2230 | expected,
|
2231 | found,
|
2232 | pos,
|
2233 | posDetails.line,
|
2234 | posDetails.column
|
2235 | );
|
2236 | }
|
2237 |
|
2238 | function peg$parsestart() {
|
2239 | var s0, s1, s2, s3;
|
2240 |
|
2241 | s0 = peg$currPos;
|
2242 | s1 = peg$parseINDENT();
|
2243 | if (s1 === peg$FAILED) {
|
2244 | s1 = peg$c1;
|
2245 | }
|
2246 | if (s1 !== peg$FAILED) {
|
2247 | s2 = [];
|
2248 | s3 = peg$parseline();
|
2249 | while (s3 !== peg$FAILED) {
|
2250 | s2.push(s3);
|
2251 | s3 = peg$parseline();
|
2252 | }
|
2253 | if (s2 !== peg$FAILED) {
|
2254 | peg$reportedPos = s0;
|
2255 | s1 = peg$c3(s2);
|
2256 | s0 = s1;
|
2257 | } else {
|
2258 | peg$currPos = s0;
|
2259 | s0 = peg$c0;
|
2260 | }
|
2261 | } else {
|
2262 | peg$currPos = s0;
|
2263 | s0 = peg$c0;
|
2264 | }
|
2265 |
|
2266 | return s0;
|
2267 | }
|
2268 |
|
2269 | function peg$parseline() {
|
2270 | var s0, s1, s2, s3, s4, s5, s6, s7;
|
2271 |
|
2272 | s0 = peg$currPos;
|
2273 | s1 = peg$parseEOL();
|
2274 | if (s1 !== peg$FAILED) {
|
2275 | peg$reportedPos = s0;
|
2276 | s1 = peg$c4();
|
2277 | }
|
2278 | s0 = s1;
|
2279 | if (s0 === peg$FAILED) {
|
2280 | s0 = peg$currPos;
|
2281 | s1 = peg$parseSAMEDENT();
|
2282 | if (s1 !== peg$FAILED) {
|
2283 | s2 = [];
|
2284 | s3 = peg$currPos;
|
2285 | s4 = peg$currPos;
|
2286 | peg$silentFails++;
|
2287 | s5 = peg$parseEOL();
|
2288 | peg$silentFails--;
|
2289 | if (s5 === peg$FAILED) {
|
2290 | s4 = peg$c5;
|
2291 | } else {
|
2292 | peg$currPos = s4;
|
2293 | s4 = peg$c0;
|
2294 | }
|
2295 | if (s4 !== peg$FAILED) {
|
2296 | if (input.length > peg$currPos) {
|
2297 | s5 = input.charAt(peg$currPos);
|
2298 | peg$currPos++;
|
2299 | } else {
|
2300 | s5 = peg$FAILED;
|
2301 | if (peg$silentFails === 0) { peg$fail(peg$c6); }
|
2302 | }
|
2303 | if (s5 !== peg$FAILED) {
|
2304 | peg$reportedPos = s3;
|
2305 | s4 = peg$c7(s5);
|
2306 | s3 = s4;
|
2307 | } else {
|
2308 | peg$currPos = s3;
|
2309 | s3 = peg$c0;
|
2310 | }
|
2311 | } else {
|
2312 | peg$currPos = s3;
|
2313 | s3 = peg$c0;
|
2314 | }
|
2315 | if (s3 !== peg$FAILED) {
|
2316 | while (s3 !== peg$FAILED) {
|
2317 | s2.push(s3);
|
2318 | s3 = peg$currPos;
|
2319 | s4 = peg$currPos;
|
2320 | peg$silentFails++;
|
2321 | s5 = peg$parseEOL();
|
2322 | peg$silentFails--;
|
2323 | if (s5 === peg$FAILED) {
|
2324 | s4 = peg$c5;
|
2325 | } else {
|
2326 | peg$currPos = s4;
|
2327 | s4 = peg$c0;
|
2328 | }
|
2329 | if (s4 !== peg$FAILED) {
|
2330 | if (input.length > peg$currPos) {
|
2331 | s5 = input.charAt(peg$currPos);
|
2332 | peg$currPos++;
|
2333 | } else {
|
2334 | s5 = peg$FAILED;
|
2335 | if (peg$silentFails === 0) { peg$fail(peg$c6); }
|
2336 | }
|
2337 | if (s5 !== peg$FAILED) {
|
2338 | peg$reportedPos = s3;
|
2339 | s4 = peg$c7(s5);
|
2340 | s3 = s4;
|
2341 | } else {
|
2342 | peg$currPos = s3;
|
2343 | s3 = peg$c0;
|
2344 | }
|
2345 | } else {
|
2346 | peg$currPos = s3;
|
2347 | s3 = peg$c0;
|
2348 | }
|
2349 | }
|
2350 | } else {
|
2351 | s2 = peg$c0;
|
2352 | }
|
2353 | if (s2 !== peg$FAILED) {
|
2354 | s3 = peg$parseEOL();
|
2355 | if (s3 === peg$FAILED) {
|
2356 | s3 = peg$c1;
|
2357 | }
|
2358 | if (s3 !== peg$FAILED) {
|
2359 | s4 = peg$currPos;
|
2360 | s5 = peg$parseINDENT();
|
2361 | if (s5 !== peg$FAILED) {
|
2362 | s6 = [];
|
2363 | s7 = peg$parseline();
|
2364 | while (s7 !== peg$FAILED) {
|
2365 | s6.push(s7);
|
2366 | s7 = peg$parseline();
|
2367 | }
|
2368 | if (s6 !== peg$FAILED) {
|
2369 | s7 = peg$parseDEDENT();
|
2370 | if (s7 !== peg$FAILED) {
|
2371 | peg$reportedPos = s4;
|
2372 | s5 = peg$c8(s5, s6, s7);
|
2373 | s4 = s5;
|
2374 | } else {
|
2375 | peg$currPos = s4;
|
2376 | s4 = peg$c0;
|
2377 | }
|
2378 | } else {
|
2379 | peg$currPos = s4;
|
2380 | s4 = peg$c0;
|
2381 | }
|
2382 | } else {
|
2383 | peg$currPos = s4;
|
2384 | s4 = peg$c0;
|
2385 | }
|
2386 | if (s4 === peg$FAILED) {
|
2387 | s4 = peg$c1;
|
2388 | }
|
2389 | if (s4 !== peg$FAILED) {
|
2390 | peg$reportedPos = s0;
|
2391 | s1 = peg$c9(s2, s3, s4);
|
2392 | s0 = s1;
|
2393 | } else {
|
2394 | peg$currPos = s0;
|
2395 | s0 = peg$c0;
|
2396 | }
|
2397 | } else {
|
2398 | peg$currPos = s0;
|
2399 | s0 = peg$c0;
|
2400 | }
|
2401 | } else {
|
2402 | peg$currPos = s0;
|
2403 | s0 = peg$c0;
|
2404 | }
|
2405 | } else {
|
2406 | peg$currPos = s0;
|
2407 | s0 = peg$c0;
|
2408 | }
|
2409 | }
|
2410 |
|
2411 | return s0;
|
2412 | }
|
2413 |
|
2414 | function peg$parseEOL() {
|
2415 | var s0;
|
2416 |
|
2417 | if (input.substr(peg$currPos, 2) === peg$c10) {
|
2418 | s0 = peg$c10;
|
2419 | peg$currPos += 2;
|
2420 | } else {
|
2421 | s0 = peg$FAILED;
|
2422 | if (peg$silentFails === 0) { peg$fail(peg$c11); }
|
2423 | }
|
2424 | if (s0 === peg$FAILED) {
|
2425 | if (input.charCodeAt(peg$currPos) === 10) {
|
2426 | s0 = peg$c12;
|
2427 | peg$currPos++;
|
2428 | } else {
|
2429 | s0 = peg$FAILED;
|
2430 | if (peg$silentFails === 0) { peg$fail(peg$c13); }
|
2431 | }
|
2432 | if (s0 === peg$FAILED) {
|
2433 | if (input.charCodeAt(peg$currPos) === 13) {
|
2434 | s0 = peg$c14;
|
2435 | peg$currPos++;
|
2436 | } else {
|
2437 | s0 = peg$FAILED;
|
2438 | if (peg$silentFails === 0) { peg$fail(peg$c15); }
|
2439 | }
|
2440 | }
|
2441 | }
|
2442 |
|
2443 | return s0;
|
2444 | }
|
2445 |
|
2446 | function peg$parseSAMEDENT() {
|
2447 | var s0, s1, s2;
|
2448 |
|
2449 | s0 = peg$currPos;
|
2450 | s1 = [];
|
2451 | if (peg$c16.test(input.charAt(peg$currPos))) {
|
2452 | s2 = input.charAt(peg$currPos);
|
2453 | peg$currPos++;
|
2454 | } else {
|
2455 | s2 = peg$FAILED;
|
2456 | if (peg$silentFails === 0) { peg$fail(peg$c17); }
|
2457 | }
|
2458 | while (s2 !== peg$FAILED) {
|
2459 | s1.push(s2);
|
2460 | if (peg$c16.test(input.charAt(peg$currPos))) {
|
2461 | s2 = input.charAt(peg$currPos);
|
2462 | peg$currPos++;
|
2463 | } else {
|
2464 | s2 = peg$FAILED;
|
2465 | if (peg$silentFails === 0) { peg$fail(peg$c17); }
|
2466 | }
|
2467 | }
|
2468 | if (s1 !== peg$FAILED) {
|
2469 | peg$reportedPos = peg$currPos;
|
2470 | s2 = peg$c18(s1);
|
2471 | if (s2) {
|
2472 | s2 = peg$c5;
|
2473 | } else {
|
2474 | s2 = peg$c0;
|
2475 | }
|
2476 | if (s2 !== peg$FAILED) {
|
2477 | s1 = [s1, s2];
|
2478 | s0 = s1;
|
2479 | } else {
|
2480 | peg$currPos = s0;
|
2481 | s0 = peg$c0;
|
2482 | }
|
2483 | } else {
|
2484 | peg$currPos = s0;
|
2485 | s0 = peg$c0;
|
2486 | }
|
2487 |
|
2488 | return s0;
|
2489 | }
|
2490 |
|
2491 | function peg$parseINDENT() {
|
2492 | var s0, s1, s2, s3, s4;
|
2493 |
|
2494 | peg$silentFails++;
|
2495 | s0 = peg$currPos;
|
2496 | s1 = peg$currPos;
|
2497 | peg$silentFails++;
|
2498 | s2 = peg$currPos;
|
2499 | s3 = [];
|
2500 | if (peg$c16.test(input.charAt(peg$currPos))) {
|
2501 | s4 = input.charAt(peg$currPos);
|
2502 | peg$currPos++;
|
2503 | } else {
|
2504 | s4 = peg$FAILED;
|
2505 | if (peg$silentFails === 0) { peg$fail(peg$c17); }
|
2506 | }
|
2507 | if (s4 !== peg$FAILED) {
|
2508 | while (s4 !== peg$FAILED) {
|
2509 | s3.push(s4);
|
2510 | if (peg$c16.test(input.charAt(peg$currPos))) {
|
2511 | s4 = input.charAt(peg$currPos);
|
2512 | peg$currPos++;
|
2513 | } else {
|
2514 | s4 = peg$FAILED;
|
2515 | if (peg$silentFails === 0) { peg$fail(peg$c17); }
|
2516 | }
|
2517 | }
|
2518 | } else {
|
2519 | s3 = peg$c0;
|
2520 | }
|
2521 | if (s3 !== peg$FAILED) {
|
2522 | peg$reportedPos = peg$currPos;
|
2523 | s4 = peg$c20(s3);
|
2524 | if (s4) {
|
2525 | s4 = peg$c5;
|
2526 | } else {
|
2527 | s4 = peg$c0;
|
2528 | }
|
2529 | if (s4 !== peg$FAILED) {
|
2530 | peg$reportedPos = s2;
|
2531 | s3 = peg$c21(s3);
|
2532 | s2 = s3;
|
2533 | } else {
|
2534 | peg$currPos = s2;
|
2535 | s2 = peg$c0;
|
2536 | }
|
2537 | } else {
|
2538 | peg$currPos = s2;
|
2539 | s2 = peg$c0;
|
2540 | }
|
2541 | peg$silentFails--;
|
2542 | if (s2 !== peg$FAILED) {
|
2543 | peg$currPos = s1;
|
2544 | s1 = peg$c5;
|
2545 | } else {
|
2546 | s1 = peg$c0;
|
2547 | }
|
2548 | if (s1 !== peg$FAILED) {
|
2549 | peg$reportedPos = s0;
|
2550 | s1 = peg$c22();
|
2551 | }
|
2552 | s0 = s1;
|
2553 | peg$silentFails--;
|
2554 | if (s0 === peg$FAILED) {
|
2555 | s1 = peg$FAILED;
|
2556 | if (peg$silentFails === 0) { peg$fail(peg$c19); }
|
2557 | }
|
2558 |
|
2559 | return s0;
|
2560 | }
|
2561 |
|
2562 | function peg$parseDEDENT() {
|
2563 | var s0, s1;
|
2564 |
|
2565 | peg$silentFails++;
|
2566 | s0 = peg$currPos;
|
2567 | s1 = [];
|
2568 | if (s1 !== peg$FAILED) {
|
2569 | peg$reportedPos = s0;
|
2570 | s1 = peg$c24();
|
2571 | }
|
2572 | s0 = s1;
|
2573 | peg$silentFails--;
|
2574 | if (s0 === peg$FAILED) {
|
2575 | s1 = peg$FAILED;
|
2576 | if (peg$silentFails === 0) { peg$fail(peg$c23); }
|
2577 | }
|
2578 |
|
2579 | return s0;
|
2580 | }
|
2581 |
|
2582 |
|
2583 | var indentStack = [],
|
2584 | indent = "",
|
2585 | INDENT_CHAR = options.INDENT_CHAR || '\uEFEF',
|
2586 | DEDENT_CHAR = options.DEDENT_CHAR || '\uEFFE',
|
2587 | TERM_CHAR = options.TERM_CHAR || '\uEFFF';
|
2588 |
|
2589 | function isArray(obj) {
|
2590 | return Object.prototype.toString.call(obj) === '[object Array]';
|
2591 | }
|
2592 |
|
2593 | function compact(arr) {
|
2594 | if (!isArray(arr)) {
|
2595 | return arr;
|
2596 | } else {
|
2597 | return arr.filter( function(elem) {
|
2598 | return typeof(elem) !== 'undefined'
|
2599 | } ).map(compact)
|
2600 | }
|
2601 | }
|
2602 |
|
2603 | function lastChar(str){
|
2604 | return str.slice(-1);
|
2605 | }
|
2606 |
|
2607 |
|
2608 |
|
2609 | peg$result = peg$startRuleFunction();
|
2610 |
|
2611 | if (peg$result !== peg$FAILED && peg$currPos === input.length) {
|
2612 | return peg$result;
|
2613 | } else {
|
2614 | if (peg$result !== peg$FAILED && peg$currPos < input.length) {
|
2615 | peg$fail({ type: "end", description: "end of input" });
|
2616 | }
|
2617 |
|
2618 | throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
|
2619 | }
|
2620 | }
|
2621 |
|
2622 | return {
|
2623 | SyntaxError: SyntaxError,
|
2624 | parse: parse
|
2625 | };
|
2626 | })();}); |
\ | No newline at end of file |