dust-rails 0.3.0 → 0.4.0
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.
- data/dust-rails.gemspec +1 -1
- data/lib/dust-rails/rails/dust_template.rb +1 -1
- data/lib/dust-rails/version.rb +1 -1
- data/vendor/assets/javascripts/dust-core.js +294 -49
- data/vendor/assets/javascripts/dust-full.js +2272 -1800
- data/vendor/dustjs/lib/dust.js +3675 -0
- metadata +45 -77
- data/vendor/assets/javascripts/dust-core.min.js +0 -21
- data/vendor/assets/javascripts/dust-full-for-compile.js +0 -3209
- data/vendor/assets/javascripts/dust-full.min.js +0 -61
@@ -1,5 +1,5 @@
|
|
1
1
|
//
|
2
|
-
// Dust - Asynchronous Templating
|
2
|
+
// Dust - Asynchronous Templating v1.0.0
|
3
3
|
// http://akdubya.github.com/dustjs
|
4
4
|
//
|
5
5
|
// Copyright (c) 2010, Aleksander Williams
|
@@ -8,6 +8,12 @@
|
|
8
8
|
|
9
9
|
var dust = {};
|
10
10
|
|
11
|
+
function getGlobal(){
|
12
|
+
return (function(){
|
13
|
+
return this.dust;
|
14
|
+
}).call(null);
|
15
|
+
}
|
16
|
+
|
11
17
|
(function(dust) {
|
12
18
|
|
13
19
|
dust.cache = {};
|
@@ -75,9 +81,15 @@ if (Array.isArray) {
|
|
75
81
|
};
|
76
82
|
}
|
77
83
|
|
78
|
-
dust.nextTick = function(
|
79
|
-
|
80
|
-
|
84
|
+
dust.nextTick = (function() {
|
85
|
+
if (typeof process !== "undefined") {
|
86
|
+
return process.nextTick;
|
87
|
+
} else {
|
88
|
+
return function(callback) {
|
89
|
+
setTimeout(callback,0);
|
90
|
+
}
|
91
|
+
}
|
92
|
+
} )();
|
81
93
|
|
82
94
|
dust.isEmpty = function(value) {
|
83
95
|
if (dust.isArray(value) && !value.length) return true;
|
@@ -106,8 +118,10 @@ dust.filters = {
|
|
106
118
|
h: function(value) { return dust.escapeHtml(value); },
|
107
119
|
j: function(value) { return dust.escapeJs(value); },
|
108
120
|
u: encodeURI,
|
109
|
-
uc: encodeURIComponent
|
110
|
-
}
|
121
|
+
uc: encodeURIComponent,
|
122
|
+
js: function(value) { if (!JSON) { return value; } return JSON.stringify(value); },
|
123
|
+
jp: function(value) { if (!JSON) { return value; } return JSON.parse(value); }
|
124
|
+
};
|
111
125
|
|
112
126
|
function Context(stack, global, blocks) {
|
113
127
|
this.stack = stack;
|
@@ -117,14 +131,14 @@ function Context(stack, global, blocks) {
|
|
117
131
|
|
118
132
|
dust.makeBase = function(global) {
|
119
133
|
return new Context(new Stack(), global);
|
120
|
-
}
|
134
|
+
};
|
121
135
|
|
122
136
|
Context.wrap = function(context) {
|
123
137
|
if (context instanceof Context) {
|
124
138
|
return context;
|
125
139
|
}
|
126
140
|
return new Context(new Stack(context));
|
127
|
-
}
|
141
|
+
};
|
128
142
|
|
129
143
|
Context.prototype.get = function(key) {
|
130
144
|
var ctx = this.stack, value;
|
@@ -146,7 +160,6 @@ Context.prototype.getPath = function(cur, down) {
|
|
146
160
|
len = down.length;
|
147
161
|
|
148
162
|
if (cur && len === 0) return ctx.head;
|
149
|
-
if (!ctx.isObject) return undefined;
|
150
163
|
ctx = ctx.head;
|
151
164
|
var i = 0;
|
152
165
|
while(ctx && i < len) {
|
@@ -168,7 +181,12 @@ Context.prototype.current = function() {
|
|
168
181
|
return this.stack.head;
|
169
182
|
};
|
170
183
|
|
171
|
-
Context.prototype.getBlock = function(key) {
|
184
|
+
Context.prototype.getBlock = function(key, chk, ctx) {
|
185
|
+
if (typeof key === "function") {
|
186
|
+
key = key(chk, ctx).data;
|
187
|
+
chk.data = "";
|
188
|
+
}
|
189
|
+
|
172
190
|
var blocks = this.blocks;
|
173
191
|
|
174
192
|
if (!blocks) return;
|
@@ -177,7 +195,7 @@ Context.prototype.getBlock = function(key) {
|
|
177
195
|
fn = blocks[len][key];
|
178
196
|
if (fn) return fn;
|
179
197
|
}
|
180
|
-
}
|
198
|
+
};
|
181
199
|
|
182
200
|
Context.prototype.shiftBlocks = function(locals) {
|
183
201
|
var blocks = this.blocks;
|
@@ -191,7 +209,7 @@ Context.prototype.shiftBlocks = function(locals) {
|
|
191
209
|
return new Context(this.stack, this.global, newBlocks);
|
192
210
|
}
|
193
211
|
return this;
|
194
|
-
}
|
212
|
+
};
|
195
213
|
|
196
214
|
function Stack(head, tail, idx, len) {
|
197
215
|
this.tail = tail;
|
@@ -224,7 +242,7 @@ Stub.prototype.flush = function() {
|
|
224
242
|
this.head = chunk;
|
225
243
|
}
|
226
244
|
this.callback(null, this.out);
|
227
|
-
}
|
245
|
+
};
|
228
246
|
|
229
247
|
function Stream() {
|
230
248
|
this.head = new Chunk(this);
|
@@ -247,23 +265,46 @@ Stream.prototype.flush = function() {
|
|
247
265
|
this.head = chunk;
|
248
266
|
}
|
249
267
|
this.emit('end');
|
250
|
-
}
|
268
|
+
};
|
251
269
|
|
252
270
|
Stream.prototype.emit = function(type, data) {
|
253
|
-
|
254
|
-
|
255
|
-
if (
|
256
|
-
|
271
|
+
if (!this.events) return false;
|
272
|
+
var handler = this.events[type];
|
273
|
+
if (!handler) return false;
|
274
|
+
if (typeof handler == 'function') {
|
275
|
+
handler(data);
|
276
|
+
} else {
|
277
|
+
var listeners = handler.slice(0);
|
278
|
+
for (var i = 0, l = listeners.length; i < l; i++) {
|
279
|
+
listeners[i](data);
|
280
|
+
}
|
257
281
|
}
|
258
|
-
}
|
282
|
+
};
|
259
283
|
|
260
284
|
Stream.prototype.on = function(type, callback) {
|
261
285
|
if (!this.events) {
|
262
286
|
this.events = {};
|
263
287
|
}
|
264
|
-
this.events[type]
|
288
|
+
if (!this.events[type]) {
|
289
|
+
this.events[type] = callback;
|
290
|
+
} else if(typeof this.events[type] === 'function') {
|
291
|
+
this.events[type] = [this.events[type], callback];
|
292
|
+
} else {
|
293
|
+
this.events[type].push(callback);
|
294
|
+
}
|
265
295
|
return this;
|
266
|
-
}
|
296
|
+
};
|
297
|
+
|
298
|
+
Stream.prototype.pipe = function(stream) {
|
299
|
+
this.on("data", function(data) {
|
300
|
+
stream.write(data, "utf8");
|
301
|
+
}).on("end", function() {
|
302
|
+
stream.end();
|
303
|
+
}).on("error", function(err) {
|
304
|
+
stream.error(err);
|
305
|
+
});
|
306
|
+
return this;
|
307
|
+
};
|
267
308
|
|
268
309
|
function Chunk(root, next, taps) {
|
269
310
|
this.root = root;
|
@@ -281,7 +322,7 @@ Chunk.prototype.write = function(data) {
|
|
281
322
|
}
|
282
323
|
this.data += data;
|
283
324
|
return this;
|
284
|
-
}
|
325
|
+
};
|
285
326
|
|
286
327
|
Chunk.prototype.end = function(data) {
|
287
328
|
if (data) {
|
@@ -290,7 +331,7 @@ Chunk.prototype.end = function(data) {
|
|
290
331
|
this.flushable = true;
|
291
332
|
this.root.flush();
|
292
333
|
return this;
|
293
|
-
}
|
334
|
+
};
|
294
335
|
|
295
336
|
Chunk.prototype.map = function(callback) {
|
296
337
|
var cursor = new Chunk(this.root, this.next, this.taps),
|
@@ -300,7 +341,7 @@ Chunk.prototype.map = function(callback) {
|
|
300
341
|
this.flushable = true;
|
301
342
|
callback(branch);
|
302
343
|
return cursor;
|
303
|
-
}
|
344
|
+
};
|
304
345
|
|
305
346
|
Chunk.prototype.tap = function(tap) {
|
306
347
|
var taps = this.taps;
|
@@ -311,20 +352,22 @@ Chunk.prototype.tap = function(tap) {
|
|
311
352
|
this.taps = new Tap(tap);
|
312
353
|
}
|
313
354
|
return this;
|
314
|
-
}
|
355
|
+
};
|
315
356
|
|
316
357
|
Chunk.prototype.untap = function() {
|
317
358
|
this.taps = this.taps.tail;
|
318
359
|
return this;
|
319
|
-
}
|
360
|
+
};
|
320
361
|
|
321
362
|
Chunk.prototype.render = function(body, context) {
|
322
363
|
return body(this, context);
|
323
|
-
}
|
364
|
+
};
|
324
365
|
|
325
366
|
Chunk.prototype.reference = function(elem, context, auto, filters) {
|
326
367
|
if (typeof elem === "function") {
|
327
|
-
elem =
|
368
|
+
elem.isReference = true;
|
369
|
+
// Changed the function calling to use apply with the current context to make sure that "this" is wat we expect it to be inside the function
|
370
|
+
elem = elem.apply(context.current(), [this, context, null, {auto: auto, filters: filters}]);
|
328
371
|
if (elem instanceof Chunk) {
|
329
372
|
return elem;
|
330
373
|
}
|
@@ -338,7 +381,7 @@ Chunk.prototype.reference = function(elem, context, auto, filters) {
|
|
338
381
|
|
339
382
|
Chunk.prototype.section = function(elem, context, bodies, params) {
|
340
383
|
if (typeof elem === "function") {
|
341
|
-
elem = elem(this, context, bodies, params);
|
384
|
+
elem = elem.apply(context.current(), [this, context, bodies, params]);
|
342
385
|
if (elem instanceof Chunk) {
|
343
386
|
return elem;
|
344
387
|
}
|
@@ -354,15 +397,26 @@ Chunk.prototype.section = function(elem, context, bodies, params) {
|
|
354
397
|
if (dust.isArray(elem)) {
|
355
398
|
if (body) {
|
356
399
|
var len = elem.length, chunk = this;
|
400
|
+
context.stack.head['$len'] = len;
|
357
401
|
for (var i=0; i<len; i++) {
|
402
|
+
context.stack.head['$idx'] = i;
|
358
403
|
chunk = body(chunk, context.push(elem[i], i, len));
|
359
404
|
}
|
405
|
+
context.stack.head['$idx'] = undefined;
|
406
|
+
context.stack.head['$len'] = undefined;
|
360
407
|
return chunk;
|
361
408
|
}
|
362
409
|
} else if (elem === true) {
|
363
410
|
if (body) return body(this, context);
|
364
411
|
} else if (elem || elem === 0) {
|
365
|
-
if (body)
|
412
|
+
if (body) {
|
413
|
+
context.stack.head['$idx'] = 0;
|
414
|
+
context.stack.head['$len'] = 1;
|
415
|
+
chunk = body(this, context.push(elem));
|
416
|
+
context.stack.head['$idx'] = undefined;
|
417
|
+
context.stack.head['$len'] = undefined;
|
418
|
+
return chunk;
|
419
|
+
}
|
366
420
|
} else if (skip) {
|
367
421
|
return skip(this, context);
|
368
422
|
}
|
@@ -379,7 +433,7 @@ Chunk.prototype.exists = function(elem, context, bodies) {
|
|
379
433
|
return skip(this, context);
|
380
434
|
}
|
381
435
|
return this;
|
382
|
-
}
|
436
|
+
};
|
383
437
|
|
384
438
|
Chunk.prototype.notexists = function(elem, context, bodies) {
|
385
439
|
var body = bodies.block,
|
@@ -391,7 +445,7 @@ Chunk.prototype.notexists = function(elem, context, bodies) {
|
|
391
445
|
return skip(this, context);
|
392
446
|
}
|
393
447
|
return this;
|
394
|
-
}
|
448
|
+
};
|
395
449
|
|
396
450
|
Chunk.prototype.block = function(elem, context, bodies) {
|
397
451
|
var body = bodies.block;
|
@@ -406,7 +460,17 @@ Chunk.prototype.block = function(elem, context, bodies) {
|
|
406
460
|
return this;
|
407
461
|
};
|
408
462
|
|
409
|
-
Chunk.prototype.partial = function(elem, context) {
|
463
|
+
Chunk.prototype.partial = function(elem, context, params) {
|
464
|
+
var ctx = context.stack, tempHead = ctx.head;
|
465
|
+
if (params){
|
466
|
+
//put the params context second to match what section does. {.} matches the current context without parameters
|
467
|
+
//remove head
|
468
|
+
context = context.rebase(ctx.tail);
|
469
|
+
//put params on
|
470
|
+
context = context.push(params);
|
471
|
+
//reattach the head
|
472
|
+
context = context.push(tempHead);
|
473
|
+
}
|
410
474
|
if (typeof elem === "function") {
|
411
475
|
return this.capture(elem, context, function(name, chunk) {
|
412
476
|
dust.load(name, chunk, context).end();
|
@@ -438,19 +502,6 @@ Chunk.prototype.setError = function(err) {
|
|
438
502
|
return this;
|
439
503
|
};
|
440
504
|
|
441
|
-
dust.helpers = {
|
442
|
-
sep: function(chunk, context, bodies) {
|
443
|
-
if (context.stack.index === context.stack.of - 1) {
|
444
|
-
return chunk;
|
445
|
-
}
|
446
|
-
return bodies.block(chunk, context);
|
447
|
-
},
|
448
|
-
|
449
|
-
idx: function(chunk, context, bodies) {
|
450
|
-
return bodies.block(chunk, context.push(context.stack.index));
|
451
|
-
}
|
452
|
-
}
|
453
|
-
|
454
505
|
function Tap(head, tail) {
|
455
506
|
this.head = head;
|
456
507
|
this.tail = tail;
|
@@ -470,18 +521,19 @@ Tap.prototype.go = function(value) {
|
|
470
521
|
return value;
|
471
522
|
};
|
472
523
|
|
473
|
-
var HCHARS = new RegExp(/[&<>\"]/),
|
524
|
+
var HCHARS = new RegExp(/[&<>\"\']/),
|
474
525
|
AMP = /&/g,
|
475
526
|
LT = /</g,
|
476
527
|
GT = />/g,
|
477
|
-
QUOT = /\"/g
|
528
|
+
QUOT = /\"/g,
|
529
|
+
SQUOT = /\'/g;
|
478
530
|
|
479
531
|
dust.escapeHtml = function(s) {
|
480
532
|
if (typeof s === "string") {
|
481
533
|
if (!HCHARS.test(s)) {
|
482
534
|
return s;
|
483
535
|
}
|
484
|
-
return s.replace(AMP,'&').replace(LT,'<').replace(GT,'>').replace(QUOT,'"');
|
536
|
+
return s.replace(AMP,'&').replace(LT,'<').replace(GT,'>').replace(QUOT,'"').replace(SQUOT, ''');
|
485
537
|
}
|
486
538
|
return s;
|
487
539
|
};
|
@@ -515,16 +567,216 @@ dust.escapeJs = function(s) {
|
|
515
567
|
})(dust);
|
516
568
|
|
517
569
|
if (typeof exports !== "undefined") {
|
570
|
+
//TODO: Remove the helpers from dust core in the next release.
|
571
|
+
dust.helpers = require("./dust-helpers").helpers;
|
518
572
|
if (typeof process !== "undefined") {
|
519
573
|
require('./server')(dust);
|
520
574
|
}
|
521
575
|
module.exports = dust;
|
522
576
|
}
|
577
|
+
(function(dust){
|
578
|
+
|
579
|
+
/* make a safe version of console if it is not available
|
580
|
+
* currently supporting:
|
581
|
+
* _console.log
|
582
|
+
* */
|
583
|
+
var _console = (typeof console !== 'undefined')? console: {
|
584
|
+
log: function(){
|
585
|
+
/* a noop*/
|
586
|
+
}
|
587
|
+
};
|
588
|
+
|
589
|
+
function isSelect(context) {
|
590
|
+
var value = context.current();
|
591
|
+
return typeof value === "object" && value.isSelect === true;
|
592
|
+
}
|
593
|
+
|
594
|
+
function filter(chunk, context, bodies, params, filter) {
|
595
|
+
var params = params || {},
|
596
|
+
actual,
|
597
|
+
expected;
|
598
|
+
if (params.key) {
|
599
|
+
actual = helpers.tap(params.key, chunk, context);
|
600
|
+
} else if (isSelect(context)) {
|
601
|
+
actual = context.current().selectKey;
|
602
|
+
if (context.current().isResolved) {
|
603
|
+
filter = function() { return false; };
|
604
|
+
}
|
605
|
+
} else {
|
606
|
+
throw "No key specified for filter and no key found in context from select statement";
|
607
|
+
}
|
608
|
+
expected = helpers.tap(params.value, chunk, context);
|
609
|
+
if (filter(expected, coerce(actual, params.type, context))) {
|
610
|
+
if (isSelect(context)) {
|
611
|
+
context.current().isResolved = true;
|
612
|
+
}
|
613
|
+
return chunk.render(bodies.block, context);
|
614
|
+
} else if (bodies['else']) {
|
615
|
+
return chunk.render(bodies['else'], context);
|
616
|
+
}
|
617
|
+
|
618
|
+
return chunk.write('');
|
619
|
+
}
|
620
|
+
|
621
|
+
function coerce (value, type, context) {
|
622
|
+
if (value) {
|
623
|
+
switch (type || typeof(value)) {
|
624
|
+
case 'number': return +value;
|
625
|
+
case 'string': return String(value);
|
626
|
+
case 'boolean': return Boolean(value);
|
627
|
+
case 'date': return new Date(value);
|
628
|
+
case 'context': return context.get(value);
|
629
|
+
}
|
630
|
+
}
|
631
|
+
|
632
|
+
return value;
|
633
|
+
}
|
634
|
+
|
635
|
+
var helpers = {
|
636
|
+
|
637
|
+
sep: function(chunk, context, bodies) {
|
638
|
+
if (context.stack.index === context.stack.of - 1) {
|
639
|
+
return chunk;
|
640
|
+
}
|
641
|
+
return bodies.block(chunk, context);
|
642
|
+
},
|
643
|
+
|
644
|
+
idx: function(chunk, context, bodies) {
|
645
|
+
return bodies.block(chunk, context.push(context.stack.index));
|
646
|
+
},
|
647
|
+
|
648
|
+
contextDump: function(chunk, context, bodies) {
|
649
|
+
_console.log(JSON.stringify(context.stack));
|
650
|
+
return chunk;
|
651
|
+
},
|
652
|
+
|
653
|
+
// Utility helping to resolve dust references in the given chunk
|
654
|
+
tap: function( input, chunk, context ){
|
655
|
+
// return given input if there is no dust reference to resolve
|
656
|
+
var output = input;
|
657
|
+
// dust compiles a string to function, if there are references
|
658
|
+
if( typeof input === "function"){
|
659
|
+
if( ( typeof input.isReference !== "undefined" ) && ( input.isReference === true ) ){ // just a plain function, not a dust `body` function
|
660
|
+
output = input();
|
661
|
+
} else {
|
662
|
+
output = '';
|
663
|
+
chunk.tap(function(data){
|
664
|
+
output += data;
|
665
|
+
return '';
|
666
|
+
}).render(input, context).untap();
|
667
|
+
if( output === '' ){
|
668
|
+
output = false;
|
669
|
+
}
|
670
|
+
}
|
671
|
+
}
|
672
|
+
return output;
|
673
|
+
},
|
674
|
+
|
675
|
+
/**
|
676
|
+
if helper
|
677
|
+
@param cond, either a string literal value or a dust reference
|
678
|
+
a string literal value, is enclosed in double quotes, e.g. cond="2>3"
|
679
|
+
a dust reference is also enclosed in double quotes, e.g. cond="'{val}'' > 3"
|
680
|
+
cond argument should evaluate to a valid javascript expression
|
681
|
+
**/
|
682
|
+
|
683
|
+
"if": function( chunk, context, bodies, params ){
|
684
|
+
if( params && params.cond ){
|
685
|
+
var cond = params.cond;
|
686
|
+
cond = this.tap(cond, chunk, context);
|
687
|
+
// eval expressions with given dust references
|
688
|
+
if( eval( cond ) ){
|
689
|
+
return chunk.render( bodies.block, context );
|
690
|
+
}
|
691
|
+
if( bodies['else'] ){
|
692
|
+
return chunk.render( bodies['else'], context );
|
693
|
+
}
|
694
|
+
}
|
695
|
+
// no condition
|
696
|
+
else {
|
697
|
+
_console.log( "No condition given in the if helper!" );
|
698
|
+
}
|
699
|
+
return chunk;
|
700
|
+
},
|
701
|
+
|
702
|
+
/**
|
703
|
+
select/eq/lt/lte/gt/gte/default helper
|
704
|
+
@param key, either a string literal value or a dust reference
|
705
|
+
a string literal value, is enclosed in double quotes, e.g. key="foo"
|
706
|
+
a dust reference may or may not be enclosed in double quotes, e.g. key="{val}" and key=val are both valid
|
707
|
+
@param type (optiona), supported types are number, boolean, string, date, context, defaults to string
|
708
|
+
**/
|
709
|
+
select: function(chunk, context, bodies, params) {
|
710
|
+
if( params && params.key){
|
711
|
+
// returns given input as output, if the input is not a dust reference, else does a context lookup
|
712
|
+
var key = this.tap(params.key, chunk, context);
|
713
|
+
return chunk.render(bodies.block, context.push({ isSelect: true, isResolved: false, selectKey: key }));
|
714
|
+
}
|
715
|
+
// no key
|
716
|
+
else {
|
717
|
+
_console.log( "No key given in the select helper!" );
|
718
|
+
}
|
719
|
+
return chunk;
|
720
|
+
},
|
721
|
+
|
722
|
+
eq: function(chunk, context, bodies, params) {
|
723
|
+
return filter(chunk, context, bodies, params, function(expected, actual) { return actual === expected; });
|
724
|
+
},
|
725
|
+
|
726
|
+
lt: function(chunk, context, bodies, params) {
|
727
|
+
return filter(chunk, context, bodies, params, function(expected, actual) { return actual < expected; });
|
728
|
+
},
|
729
|
+
|
730
|
+
lte: function(chunk, context, bodies, params) {
|
731
|
+
return filter(chunk, context, bodies, params, function(expected, actual) { return actual <= expected; });
|
732
|
+
},
|
733
|
+
|
734
|
+
gt: function(chunk, context, bodies, params) {
|
735
|
+
return filter(chunk, context, bodies, params, function(expected, actual) { return actual > expected; });
|
736
|
+
},
|
737
|
+
|
738
|
+
gte: function(chunk, context, bodies, params) {
|
739
|
+
return filter(chunk, context, bodies, params, function(expected, actual) { return actual >= expected; });
|
740
|
+
},
|
741
|
+
|
742
|
+
"default": function(chunk, context, bodies, params) {
|
743
|
+
return filter(chunk, context, bodies, params, function(expected, actual) { return true; });
|
744
|
+
},
|
745
|
+
size: function( chunk, context, bodies, params ) {
|
746
|
+
var subject = params.subject;
|
747
|
+
var value = 0;
|
748
|
+
if (!subject) { //undefined, "", 0
|
749
|
+
value = 0;
|
750
|
+
} else if(dust.isArray(subject)) { //array
|
751
|
+
value = subject.length;
|
752
|
+
} else if (!isNaN(subject)) { //numeric values
|
753
|
+
value = subject;
|
754
|
+
} else if (Object(subject) === subject) { //object test
|
755
|
+
var nr = 0;
|
756
|
+
for(var k in subject) if(Object.hasOwnProperty.call(subject,k)) nr++;
|
757
|
+
value = nr;
|
758
|
+
} else {
|
759
|
+
value = (subject + '').length; //any other value (strings etc.)
|
760
|
+
}
|
761
|
+
return chunk.write(value);
|
762
|
+
}
|
763
|
+
};
|
764
|
+
|
765
|
+
dust.helpers = helpers;
|
766
|
+
|
767
|
+
})(typeof exports !== 'undefined' ? exports : getGlobal());
|
523
768
|
(function(dust) {
|
524
769
|
|
525
770
|
dust.compile = function(source, name) {
|
526
|
-
|
527
|
-
|
771
|
+
try {
|
772
|
+
var ast = filterAST(dust.parse(source));
|
773
|
+
return compile(ast, name);
|
774
|
+
}
|
775
|
+
catch(err)
|
776
|
+
{
|
777
|
+
if(!err.line || !err.column) throw err;
|
778
|
+
throw new SyntaxError(err.message + " At line : " + err.line + ", column : " + err.column);
|
779
|
+
}
|
528
780
|
};
|
529
781
|
|
530
782
|
function filterAST(ast) {
|
@@ -639,7 +891,7 @@ function compileBlocks(context) {
|
|
639
891
|
blocks = context.blocks;
|
640
892
|
|
641
893
|
for (var name in blocks) {
|
642
|
-
out.push(name + ":" + blocks[name]);
|
894
|
+
out.push("'" + name + "':" + blocks[name]);
|
643
895
|
}
|
644
896
|
if (out.length) {
|
645
897
|
context.blocks = "ctx=ctx.shiftBlocks(blocks);";
|
@@ -718,12 +970,20 @@ dust.nodes = {
|
|
718
970
|
},
|
719
971
|
|
720
972
|
"+": function(context, node) {
|
721
|
-
|
973
|
+
if(typeof(node[1].text) === "undefined" && typeof(node[4]) === "undefined"){
|
974
|
+
return ".block(ctx.getBlock("
|
975
|
+
+ dust.compileNode(context, node[1])
|
976
|
+
+ ",chk, ctx)," + dust.compileNode(context, node[2]) + ", {},"
|
977
|
+
+ dust.compileNode(context, node[3])
|
978
|
+
+ ")";
|
979
|
+
}else {
|
980
|
+
return ".block(ctx.getBlock("
|
722
981
|
+ escape(node[1].text)
|
723
982
|
+ ")," + dust.compileNode(context, node[2]) + ","
|
724
983
|
+ dust.compileNode(context, node[4]) + ","
|
725
984
|
+ dust.compileNode(context, node[3])
|
726
985
|
+ ")";
|
986
|
+
}
|
727
987
|
},
|
728
988
|
|
729
989
|
"@": function(context, node) {
|
@@ -762,7 +1022,8 @@ dust.nodes = {
|
|
762
1022
|
partial: function(context, node) {
|
763
1023
|
return ".partial("
|
764
1024
|
+ dust.compileNode(context, node[1])
|
765
|
-
+ "," + dust.compileNode(context, node[2])
|
1025
|
+
+ "," + dust.compileNode(context, node[2])
|
1026
|
+
+ "," + dust.compileNode(context, node[3]) + ")";
|
766
1027
|
},
|
767
1028
|
|
768
1029
|
context: function(context, node) {
|
@@ -838,11 +1099,38 @@ var escape = (typeof JSON === "undefined")
|
|
838
1099
|
? function(str) { return "\"" + dust.escapeJs(str) + "\"" }
|
839
1100
|
: JSON.stringify;
|
840
1101
|
|
841
|
-
})(typeof exports !== 'undefined' ? exports :
|
1102
|
+
})(typeof exports !== 'undefined' ? exports : getGlobal());
|
842
1103
|
(function(dust){
|
843
1104
|
|
844
1105
|
var parser = (function(){
|
845
|
-
/*
|
1106
|
+
/*
|
1107
|
+
* Generated by PEG.js 0.7.0.
|
1108
|
+
*
|
1109
|
+
* http://pegjs.majda.cz/
|
1110
|
+
*/
|
1111
|
+
|
1112
|
+
function quote(s) {
|
1113
|
+
/*
|
1114
|
+
* ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a
|
1115
|
+
* string literal except for the closing quote character, backslash,
|
1116
|
+
* carriage return, line separator, paragraph separator, and line feed.
|
1117
|
+
* Any character may appear in the form of an escape sequence.
|
1118
|
+
*
|
1119
|
+
* For portability, we also escape escape all control and non-ASCII
|
1120
|
+
* characters. Note that "\0" and "\v" escape sequences are not used
|
1121
|
+
* because JSHint does not like the first and IE the second.
|
1122
|
+
*/
|
1123
|
+
return '"' + s
|
1124
|
+
.replace(/\\/g, '\\\\') // backslash
|
1125
|
+
.replace(/"/g, '\\"') // closing quote character
|
1126
|
+
.replace(/\x08/g, '\\b') // backspace
|
1127
|
+
.replace(/\t/g, '\\t') // horizontal tab
|
1128
|
+
.replace(/\n/g, '\\n') // line feed
|
1129
|
+
.replace(/\f/g, '\\f') // form feed
|
1130
|
+
.replace(/\r/g, '\\r') // carriage return
|
1131
|
+
.replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g, escape)
|
1132
|
+
+ '"';
|
1133
|
+
}
|
846
1134
|
|
847
1135
|
var result = {
|
848
1136
|
/*
|
@@ -851,12 +1139,53 @@ var parser = (function(){
|
|
851
1139
|
* which the parser was generated (see |PEG.buildParser|). If the parsing is
|
852
1140
|
* unsuccessful, throws |PEG.parser.SyntaxError| describing the error.
|
853
1141
|
*/
|
854
|
-
parse: function(input) {
|
855
|
-
var
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
1142
|
+
parse: function(input, startRule) {
|
1143
|
+
var parseFunctions = {
|
1144
|
+
"body": parse_body,
|
1145
|
+
"part": parse_part,
|
1146
|
+
"section": parse_section,
|
1147
|
+
"sec_tag_start": parse_sec_tag_start,
|
1148
|
+
"end_tag": parse_end_tag,
|
1149
|
+
"context": parse_context,
|
1150
|
+
"params": parse_params,
|
1151
|
+
"bodies": parse_bodies,
|
1152
|
+
"reference": parse_reference,
|
1153
|
+
"partial": parse_partial,
|
1154
|
+
"filters": parse_filters,
|
1155
|
+
"special": parse_special,
|
1156
|
+
"identifier": parse_identifier,
|
1157
|
+
"number": parse_number,
|
1158
|
+
"frac": parse_frac,
|
1159
|
+
"integer": parse_integer,
|
1160
|
+
"path": parse_path,
|
1161
|
+
"key": parse_key,
|
1162
|
+
"array": parse_array,
|
1163
|
+
"array_part": parse_array_part,
|
1164
|
+
"inline": parse_inline,
|
1165
|
+
"inline_part": parse_inline_part,
|
1166
|
+
"buffer": parse_buffer,
|
1167
|
+
"literal": parse_literal,
|
1168
|
+
"esc": parse_esc,
|
1169
|
+
"comment": parse_comment,
|
1170
|
+
"tag": parse_tag,
|
1171
|
+
"ld": parse_ld,
|
1172
|
+
"rd": parse_rd,
|
1173
|
+
"eol": parse_eol,
|
1174
|
+
"ws": parse_ws
|
1175
|
+
};
|
1176
|
+
|
1177
|
+
if (startRule !== undefined) {
|
1178
|
+
if (parseFunctions[startRule] === undefined) {
|
1179
|
+
throw new Error("Invalid rule name: " + quote(startRule) + ".");
|
1180
|
+
}
|
1181
|
+
} else {
|
1182
|
+
startRule = "body";
|
1183
|
+
}
|
1184
|
+
|
1185
|
+
var pos = { offset: 0, line: 1, column: 1, seenCR: false };
|
1186
|
+
var reportFailures = 0;
|
1187
|
+
var rightmostFailuresPos = { offset: 0, line: 1, column: 1, seenCR: false };
|
1188
|
+
var rightmostFailuresExpected = [];
|
860
1189
|
|
861
1190
|
function padLeft(input, padding, length) {
|
862
1191
|
var result = input;
|
@@ -871,2284 +1200,2398 @@ var parser = (function(){
|
|
871
1200
|
|
872
1201
|
function escape(ch) {
|
873
1202
|
var charCode = ch.charCodeAt(0);
|
1203
|
+
var escapeChar;
|
1204
|
+
var length;
|
874
1205
|
|
875
|
-
if (charCode
|
876
|
-
|
877
|
-
|
1206
|
+
if (charCode <= 0xFF) {
|
1207
|
+
escapeChar = 'x';
|
1208
|
+
length = 2;
|
878
1209
|
} else {
|
879
|
-
|
880
|
-
|
1210
|
+
escapeChar = 'u';
|
1211
|
+
length = 4;
|
881
1212
|
}
|
882
1213
|
|
883
1214
|
return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length);
|
884
1215
|
}
|
885
1216
|
|
886
|
-
function
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
.
|
899
|
-
|
1217
|
+
function clone(object) {
|
1218
|
+
var result = {};
|
1219
|
+
for (var key in object) {
|
1220
|
+
result[key] = object[key];
|
1221
|
+
}
|
1222
|
+
return result;
|
1223
|
+
}
|
1224
|
+
|
1225
|
+
function advance(pos, n) {
|
1226
|
+
var endOffset = pos.offset + n;
|
1227
|
+
|
1228
|
+
for (var offset = pos.offset; offset < endOffset; offset++) {
|
1229
|
+
var ch = input.charAt(offset);
|
1230
|
+
if (ch === "\n") {
|
1231
|
+
if (!pos.seenCR) { pos.line++; }
|
1232
|
+
pos.column = 1;
|
1233
|
+
pos.seenCR = false;
|
1234
|
+
} else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
|
1235
|
+
pos.line++;
|
1236
|
+
pos.column = 1;
|
1237
|
+
pos.seenCR = true;
|
1238
|
+
} else {
|
1239
|
+
pos.column++;
|
1240
|
+
pos.seenCR = false;
|
1241
|
+
}
|
1242
|
+
}
|
1243
|
+
|
1244
|
+
pos.offset += n;
|
900
1245
|
}
|
901
1246
|
|
902
1247
|
function matchFailed(failure) {
|
903
|
-
if (pos <
|
1248
|
+
if (pos.offset < rightmostFailuresPos.offset) {
|
904
1249
|
return;
|
905
1250
|
}
|
906
1251
|
|
907
|
-
if (pos >
|
908
|
-
|
909
|
-
|
1252
|
+
if (pos.offset > rightmostFailuresPos.offset) {
|
1253
|
+
rightmostFailuresPos = clone(pos);
|
1254
|
+
rightmostFailuresExpected = [];
|
910
1255
|
}
|
911
1256
|
|
912
|
-
|
1257
|
+
rightmostFailuresExpected.push(failure);
|
913
1258
|
}
|
914
1259
|
|
915
1260
|
function parse_body() {
|
916
|
-
var
|
917
|
-
var
|
918
|
-
if (cachedResult) {
|
919
|
-
pos = cachedResult.nextPos;
|
920
|
-
return cachedResult.result;
|
921
|
-
}
|
922
|
-
|
923
|
-
|
924
|
-
var result1 = [];
|
925
|
-
var result2 = parse_part();
|
926
|
-
while (result2 !== null) {
|
927
|
-
result1.push(result2);
|
928
|
-
var result2 = parse_part();
|
929
|
-
}
|
930
|
-
var result0 = result1 !== null
|
931
|
-
? (function(p) { return ["body"].concat(p) })(result1)
|
932
|
-
: null;
|
1261
|
+
var result0, result1;
|
1262
|
+
var pos0;
|
933
1263
|
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
1264
|
+
pos0 = clone(pos);
|
1265
|
+
result0 = [];
|
1266
|
+
result1 = parse_part();
|
1267
|
+
while (result1 !== null) {
|
1268
|
+
result0.push(result1);
|
1269
|
+
result1 = parse_part();
|
1270
|
+
}
|
1271
|
+
if (result0 !== null) {
|
1272
|
+
result0 = (function(offset, line, column, p) { return ["body"].concat(p) })(pos0.offset, pos0.line, pos0.column, result0);
|
1273
|
+
}
|
1274
|
+
if (result0 === null) {
|
1275
|
+
pos = clone(pos0);
|
1276
|
+
}
|
940
1277
|
return result0;
|
941
1278
|
}
|
942
1279
|
|
943
1280
|
function parse_part() {
|
944
|
-
var
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
if (result4 !== null) {
|
962
|
-
var result0 = result4;
|
963
|
-
} else {
|
964
|
-
var result3 = parse_special();
|
965
|
-
if (result3 !== null) {
|
966
|
-
var result0 = result3;
|
967
|
-
} else {
|
968
|
-
var result2 = parse_reference();
|
969
|
-
if (result2 !== null) {
|
970
|
-
var result0 = result2;
|
971
|
-
} else {
|
972
|
-
var result1 = parse_buffer();
|
973
|
-
if (result1 !== null) {
|
974
|
-
var result0 = result1;
|
975
|
-
} else {
|
976
|
-
var result0 = null;;
|
977
|
-
};
|
978
|
-
};
|
979
|
-
};
|
980
|
-
};
|
981
|
-
};
|
1281
|
+
var result0;
|
1282
|
+
|
1283
|
+
result0 = parse_comment();
|
1284
|
+
if (result0 === null) {
|
1285
|
+
result0 = parse_section();
|
1286
|
+
if (result0 === null) {
|
1287
|
+
result0 = parse_partial();
|
1288
|
+
if (result0 === null) {
|
1289
|
+
result0 = parse_special();
|
1290
|
+
if (result0 === null) {
|
1291
|
+
result0 = parse_reference();
|
1292
|
+
if (result0 === null) {
|
1293
|
+
result0 = parse_buffer();
|
1294
|
+
}
|
1295
|
+
}
|
1296
|
+
}
|
1297
|
+
}
|
982
1298
|
}
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
cache[cacheKey] = {
|
987
|
-
nextPos: pos,
|
988
|
-
result: result0
|
989
|
-
};
|
990
1299
|
return result0;
|
991
1300
|
}
|
992
1301
|
|
993
1302
|
function parse_section() {
|
994
|
-
var
|
995
|
-
var
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1303
|
+
var result0, result1, result2, result3, result4, result5, result6;
|
1304
|
+
var pos0, pos1;
|
1305
|
+
|
1306
|
+
reportFailures++;
|
1307
|
+
pos0 = clone(pos);
|
1308
|
+
pos1 = clone(pos);
|
1309
|
+
result0 = parse_sec_tag_start();
|
1310
|
+
if (result0 !== null) {
|
1311
|
+
result1 = [];
|
1312
|
+
result2 = parse_ws();
|
1313
|
+
while (result2 !== null) {
|
1314
|
+
result1.push(result2);
|
1315
|
+
result2 = parse_ws();
|
1316
|
+
}
|
1317
|
+
if (result1 !== null) {
|
1318
|
+
result2 = parse_rd();
|
1319
|
+
if (result2 !== null) {
|
1320
|
+
result3 = parse_body();
|
1321
|
+
if (result3 !== null) {
|
1322
|
+
result4 = parse_bodies();
|
1323
|
+
if (result4 !== null) {
|
1324
|
+
result5 = parse_end_tag();
|
1325
|
+
if (result5 !== null) {
|
1326
|
+
result6 = (function(offset, line, column, t, b, e, n) { return t[1].text === n.text;})(pos.offset, pos.line, pos.column, result0, result3, result4, result5) ? "" : null;
|
1327
|
+
if (result6 !== null) {
|
1328
|
+
result0 = [result0, result1, result2, result3, result4, result5, result6];
|
1329
|
+
} else {
|
1330
|
+
result0 = null;
|
1331
|
+
pos = clone(pos1);
|
1332
|
+
}
|
1017
1333
|
} else {
|
1018
|
-
|
1019
|
-
pos =
|
1334
|
+
result0 = null;
|
1335
|
+
pos = clone(pos1);
|
1020
1336
|
}
|
1021
1337
|
} else {
|
1022
|
-
|
1023
|
-
pos =
|
1338
|
+
result0 = null;
|
1339
|
+
pos = clone(pos1);
|
1024
1340
|
}
|
1025
1341
|
} else {
|
1026
|
-
|
1027
|
-
pos =
|
1342
|
+
result0 = null;
|
1343
|
+
pos = clone(pos1);
|
1028
1344
|
}
|
1029
1345
|
} else {
|
1030
|
-
|
1031
|
-
pos =
|
1346
|
+
result0 = null;
|
1347
|
+
pos = clone(pos1);
|
1032
1348
|
}
|
1033
1349
|
} else {
|
1034
|
-
|
1035
|
-
pos =
|
1350
|
+
result0 = null;
|
1351
|
+
pos = clone(pos1);
|
1036
1352
|
}
|
1037
1353
|
} else {
|
1038
|
-
|
1039
|
-
pos =
|
1040
|
-
}
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
if (
|
1045
|
-
|
1046
|
-
}
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
}
|
1354
|
+
result0 = null;
|
1355
|
+
pos = clone(pos1);
|
1356
|
+
}
|
1357
|
+
if (result0 !== null) {
|
1358
|
+
result0 = (function(offset, line, column, t, b, e, n) { e.push(["param", ["literal", "block"], b]); t.push(e); return t })(pos0.offset, pos0.line, pos0.column, result0[0], result0[3], result0[4], result0[5]);
|
1359
|
+
}
|
1360
|
+
if (result0 === null) {
|
1361
|
+
pos = clone(pos0);
|
1362
|
+
}
|
1363
|
+
if (result0 === null) {
|
1364
|
+
pos0 = clone(pos);
|
1365
|
+
pos1 = clone(pos);
|
1366
|
+
result0 = parse_sec_tag_start();
|
1367
|
+
if (result0 !== null) {
|
1368
|
+
result1 = [];
|
1369
|
+
result2 = parse_ws();
|
1370
|
+
while (result2 !== null) {
|
1371
|
+
result1.push(result2);
|
1372
|
+
result2 = parse_ws();
|
1058
1373
|
}
|
1059
|
-
if (
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1374
|
+
if (result1 !== null) {
|
1375
|
+
if (input.charCodeAt(pos.offset) === 47) {
|
1376
|
+
result2 = "/";
|
1377
|
+
advance(pos, 1);
|
1378
|
+
} else {
|
1379
|
+
result2 = null;
|
1380
|
+
if (reportFailures === 0) {
|
1381
|
+
matchFailed("\"/\"");
|
1382
|
+
}
|
1383
|
+
}
|
1384
|
+
if (result2 !== null) {
|
1385
|
+
result3 = parse_rd();
|
1386
|
+
if (result3 !== null) {
|
1387
|
+
result0 = [result0, result1, result2, result3];
|
1388
|
+
} else {
|
1389
|
+
result0 = null;
|
1390
|
+
pos = clone(pos1);
|
1391
|
+
}
|
1063
1392
|
} else {
|
1064
|
-
|
1065
|
-
pos =
|
1393
|
+
result0 = null;
|
1394
|
+
pos = clone(pos1);
|
1066
1395
|
}
|
1067
1396
|
} else {
|
1068
|
-
|
1069
|
-
pos =
|
1397
|
+
result0 = null;
|
1398
|
+
pos = clone(pos1);
|
1070
1399
|
}
|
1071
1400
|
} else {
|
1072
|
-
|
1073
|
-
pos =
|
1401
|
+
result0 = null;
|
1402
|
+
pos = clone(pos1);
|
1403
|
+
}
|
1404
|
+
if (result0 !== null) {
|
1405
|
+
result0 = (function(offset, line, column, t) { t.push(["bodies"]); return t })(pos0.offset, pos0.line, pos0.column, result0[0]);
|
1406
|
+
}
|
1407
|
+
if (result0 === null) {
|
1408
|
+
pos = clone(pos0);
|
1074
1409
|
}
|
1075
|
-
var result1 = result2 !== null
|
1076
|
-
? (function(t) { t.push(["bodies"]); return t })(result2[0])
|
1077
|
-
: null;
|
1078
|
-
if (result1 !== null) {
|
1079
|
-
var result0 = result1;
|
1080
|
-
} else {
|
1081
|
-
var result0 = null;;
|
1082
|
-
};
|
1083
1410
|
}
|
1084
|
-
|
1085
|
-
if (
|
1411
|
+
reportFailures--;
|
1412
|
+
if (reportFailures === 0 && result0 === null) {
|
1086
1413
|
matchFailed("section");
|
1087
1414
|
}
|
1088
|
-
|
1089
|
-
cache[cacheKey] = {
|
1090
|
-
nextPos: pos,
|
1091
|
-
result: result0
|
1092
|
-
};
|
1093
1415
|
return result0;
|
1094
1416
|
}
|
1095
1417
|
|
1096
1418
|
function parse_sec_tag_start() {
|
1097
|
-
var
|
1098
|
-
var
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
if (result2 !== null) {
|
1108
|
-
if (input.substr(pos).match(/^[#?^<+@%]/) !== null) {
|
1109
|
-
var result3 = input.charAt(pos);
|
1110
|
-
pos++;
|
1419
|
+
var result0, result1, result2, result3, result4, result5;
|
1420
|
+
var pos0, pos1;
|
1421
|
+
|
1422
|
+
pos0 = clone(pos);
|
1423
|
+
pos1 = clone(pos);
|
1424
|
+
result0 = parse_ld();
|
1425
|
+
if (result0 !== null) {
|
1426
|
+
if (/^[#?^<+@%]/.test(input.charAt(pos.offset))) {
|
1427
|
+
result1 = input.charAt(pos.offset);
|
1428
|
+
advance(pos, 1);
|
1111
1429
|
} else {
|
1112
|
-
|
1113
|
-
if (
|
1430
|
+
result1 = null;
|
1431
|
+
if (reportFailures === 0) {
|
1114
1432
|
matchFailed("[#?^<+@%]");
|
1115
1433
|
}
|
1116
1434
|
}
|
1117
|
-
if (
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1435
|
+
if (result1 !== null) {
|
1436
|
+
result2 = [];
|
1437
|
+
result3 = parse_ws();
|
1438
|
+
while (result3 !== null) {
|
1439
|
+
result2.push(result3);
|
1440
|
+
result3 = parse_ws();
|
1441
|
+
}
|
1442
|
+
if (result2 !== null) {
|
1443
|
+
result3 = parse_identifier();
|
1444
|
+
if (result3 !== null) {
|
1445
|
+
result4 = parse_context();
|
1446
|
+
if (result4 !== null) {
|
1447
|
+
result5 = parse_params();
|
1448
|
+
if (result5 !== null) {
|
1449
|
+
result0 = [result0, result1, result2, result3, result4, result5];
|
1450
|
+
} else {
|
1451
|
+
result0 = null;
|
1452
|
+
pos = clone(pos1);
|
1453
|
+
}
|
1125
1454
|
} else {
|
1126
|
-
|
1127
|
-
pos =
|
1455
|
+
result0 = null;
|
1456
|
+
pos = clone(pos1);
|
1128
1457
|
}
|
1129
1458
|
} else {
|
1130
|
-
|
1131
|
-
pos =
|
1459
|
+
result0 = null;
|
1460
|
+
pos = clone(pos1);
|
1132
1461
|
}
|
1133
1462
|
} else {
|
1134
|
-
|
1135
|
-
pos =
|
1463
|
+
result0 = null;
|
1464
|
+
pos = clone(pos1);
|
1136
1465
|
}
|
1137
1466
|
} else {
|
1138
|
-
|
1139
|
-
pos =
|
1467
|
+
result0 = null;
|
1468
|
+
pos = clone(pos1);
|
1140
1469
|
}
|
1141
1470
|
} else {
|
1142
|
-
|
1143
|
-
pos =
|
1471
|
+
result0 = null;
|
1472
|
+
pos = clone(pos1);
|
1473
|
+
}
|
1474
|
+
if (result0 !== null) {
|
1475
|
+
result0 = (function(offset, line, column, t, n, c, p) { return [t, n, c, p] })(pos0.offset, pos0.line, pos0.column, result0[1], result0[3], result0[4], result0[5]);
|
1476
|
+
}
|
1477
|
+
if (result0 === null) {
|
1478
|
+
pos = clone(pos0);
|
1144
1479
|
}
|
1145
|
-
var result0 = result1 !== null
|
1146
|
-
? (function(t, n, c, p) { return [t, n, c, p] })(result1[1], result1[2], result1[3], result1[4])
|
1147
|
-
: null;
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
cache[cacheKey] = {
|
1152
|
-
nextPos: pos,
|
1153
|
-
result: result0
|
1154
|
-
};
|
1155
1480
|
return result0;
|
1156
1481
|
}
|
1157
1482
|
|
1158
1483
|
function parse_end_tag() {
|
1159
|
-
var
|
1160
|
-
var
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
if (result2 !== null) {
|
1171
|
-
if (input.substr(pos, 1) === "/") {
|
1172
|
-
var result3 = "/";
|
1173
|
-
pos += 1;
|
1484
|
+
var result0, result1, result2, result3, result4, result5;
|
1485
|
+
var pos0, pos1;
|
1486
|
+
|
1487
|
+
reportFailures++;
|
1488
|
+
pos0 = clone(pos);
|
1489
|
+
pos1 = clone(pos);
|
1490
|
+
result0 = parse_ld();
|
1491
|
+
if (result0 !== null) {
|
1492
|
+
if (input.charCodeAt(pos.offset) === 47) {
|
1493
|
+
result1 = "/";
|
1494
|
+
advance(pos, 1);
|
1174
1495
|
} else {
|
1175
|
-
|
1176
|
-
if (
|
1496
|
+
result1 = null;
|
1497
|
+
if (reportFailures === 0) {
|
1177
1498
|
matchFailed("\"/\"");
|
1178
1499
|
}
|
1179
1500
|
}
|
1180
|
-
if (
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1501
|
+
if (result1 !== null) {
|
1502
|
+
result2 = [];
|
1503
|
+
result3 = parse_ws();
|
1504
|
+
while (result3 !== null) {
|
1505
|
+
result2.push(result3);
|
1506
|
+
result3 = parse_ws();
|
1507
|
+
}
|
1508
|
+
if (result2 !== null) {
|
1509
|
+
result3 = parse_identifier();
|
1510
|
+
if (result3 !== null) {
|
1511
|
+
result4 = [];
|
1512
|
+
result5 = parse_ws();
|
1513
|
+
while (result5 !== null) {
|
1514
|
+
result4.push(result5);
|
1515
|
+
result5 = parse_ws();
|
1516
|
+
}
|
1517
|
+
if (result4 !== null) {
|
1518
|
+
result5 = parse_rd();
|
1519
|
+
if (result5 !== null) {
|
1520
|
+
result0 = [result0, result1, result2, result3, result4, result5];
|
1521
|
+
} else {
|
1522
|
+
result0 = null;
|
1523
|
+
pos = clone(pos1);
|
1524
|
+
}
|
1525
|
+
} else {
|
1526
|
+
result0 = null;
|
1527
|
+
pos = clone(pos1);
|
1528
|
+
}
|
1186
1529
|
} else {
|
1187
|
-
|
1188
|
-
pos =
|
1530
|
+
result0 = null;
|
1531
|
+
pos = clone(pos1);
|
1189
1532
|
}
|
1190
1533
|
} else {
|
1191
|
-
|
1192
|
-
pos =
|
1534
|
+
result0 = null;
|
1535
|
+
pos = clone(pos1);
|
1193
1536
|
}
|
1194
1537
|
} else {
|
1195
|
-
|
1196
|
-
pos =
|
1538
|
+
result0 = null;
|
1539
|
+
pos = clone(pos1);
|
1197
1540
|
}
|
1198
1541
|
} else {
|
1199
|
-
|
1200
|
-
pos =
|
1201
|
-
}
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1542
|
+
result0 = null;
|
1543
|
+
pos = clone(pos1);
|
1544
|
+
}
|
1545
|
+
if (result0 !== null) {
|
1546
|
+
result0 = (function(offset, line, column, n) { return n })(pos0.offset, pos0.line, pos0.column, result0[3]);
|
1547
|
+
}
|
1548
|
+
if (result0 === null) {
|
1549
|
+
pos = clone(pos0);
|
1550
|
+
}
|
1551
|
+
reportFailures--;
|
1552
|
+
if (reportFailures === 0 && result0 === null) {
|
1207
1553
|
matchFailed("end tag");
|
1208
1554
|
}
|
1209
|
-
|
1210
|
-
cache[cacheKey] = {
|
1211
|
-
nextPos: pos,
|
1212
|
-
result: result0
|
1213
|
-
};
|
1214
1555
|
return result0;
|
1215
1556
|
}
|
1216
1557
|
|
1217
1558
|
function parse_context() {
|
1218
|
-
var
|
1219
|
-
var
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
if (input.substr(pos, 1) === ":") {
|
1228
|
-
var result4 = ":";
|
1229
|
-
pos += 1;
|
1559
|
+
var result0, result1;
|
1560
|
+
var pos0, pos1, pos2;
|
1561
|
+
|
1562
|
+
pos0 = clone(pos);
|
1563
|
+
pos1 = clone(pos);
|
1564
|
+
pos2 = clone(pos);
|
1565
|
+
if (input.charCodeAt(pos.offset) === 58) {
|
1566
|
+
result0 = ":";
|
1567
|
+
advance(pos, 1);
|
1230
1568
|
} else {
|
1231
|
-
|
1232
|
-
if (
|
1569
|
+
result0 = null;
|
1570
|
+
if (reportFailures === 0) {
|
1233
1571
|
matchFailed("\":\"");
|
1234
1572
|
}
|
1235
1573
|
}
|
1236
|
-
if (
|
1237
|
-
|
1238
|
-
if (
|
1239
|
-
|
1574
|
+
if (result0 !== null) {
|
1575
|
+
result1 = parse_identifier();
|
1576
|
+
if (result1 !== null) {
|
1577
|
+
result0 = [result0, result1];
|
1240
1578
|
} else {
|
1241
|
-
|
1242
|
-
pos =
|
1579
|
+
result0 = null;
|
1580
|
+
pos = clone(pos2);
|
1243
1581
|
}
|
1244
1582
|
} else {
|
1245
|
-
|
1246
|
-
pos =
|
1247
|
-
}
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
};
|
1583
|
+
result0 = null;
|
1584
|
+
pos = clone(pos2);
|
1585
|
+
}
|
1586
|
+
if (result0 !== null) {
|
1587
|
+
result0 = (function(offset, line, column, n) {return n})(pos1.offset, pos1.line, pos1.column, result0[1]);
|
1588
|
+
}
|
1589
|
+
if (result0 === null) {
|
1590
|
+
pos = clone(pos1);
|
1591
|
+
}
|
1592
|
+
result0 = result0 !== null ? result0 : "";
|
1593
|
+
if (result0 !== null) {
|
1594
|
+
result0 = (function(offset, line, column, n) { return n ? ["context", n] : ["context"] })(pos0.offset, pos0.line, pos0.column, result0);
|
1595
|
+
}
|
1596
|
+
if (result0 === null) {
|
1597
|
+
pos = clone(pos0);
|
1598
|
+
}
|
1262
1599
|
return result0;
|
1263
1600
|
}
|
1264
1601
|
|
1265
1602
|
function parse_params() {
|
1266
|
-
var
|
1267
|
-
var
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1603
|
+
var result0, result1, result2, result3, result4;
|
1604
|
+
var pos0, pos1, pos2;
|
1605
|
+
|
1606
|
+
reportFailures++;
|
1607
|
+
pos0 = clone(pos);
|
1608
|
+
result0 = [];
|
1609
|
+
pos1 = clone(pos);
|
1610
|
+
pos2 = clone(pos);
|
1611
|
+
result2 = parse_ws();
|
1612
|
+
if (result2 !== null) {
|
1613
|
+
result1 = [];
|
1614
|
+
while (result2 !== null) {
|
1615
|
+
result1.push(result2);
|
1616
|
+
result2 = parse_ws();
|
1617
|
+
}
|
1618
|
+
} else {
|
1619
|
+
result1 = null;
|
1620
|
+
}
|
1621
|
+
if (result1 !== null) {
|
1622
|
+
result2 = parse_key();
|
1623
|
+
if (result2 !== null) {
|
1624
|
+
if (input.charCodeAt(pos.offset) === 61) {
|
1625
|
+
result3 = "=";
|
1626
|
+
advance(pos, 1);
|
1627
|
+
} else {
|
1628
|
+
result3 = null;
|
1629
|
+
if (reportFailures === 0) {
|
1630
|
+
matchFailed("\"=\"");
|
1288
1631
|
}
|
1289
1632
|
}
|
1290
|
-
if (
|
1291
|
-
|
1292
|
-
if (
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
var result7 = result8;
|
1298
|
-
} else {
|
1299
|
-
var result7 = null;;
|
1300
|
-
};
|
1633
|
+
if (result3 !== null) {
|
1634
|
+
result4 = parse_number();
|
1635
|
+
if (result4 === null) {
|
1636
|
+
result4 = parse_identifier();
|
1637
|
+
if (result4 === null) {
|
1638
|
+
result4 = parse_inline();
|
1639
|
+
}
|
1301
1640
|
}
|
1302
|
-
if (
|
1303
|
-
|
1641
|
+
if (result4 !== null) {
|
1642
|
+
result1 = [result1, result2, result3, result4];
|
1304
1643
|
} else {
|
1305
|
-
|
1306
|
-
pos =
|
1644
|
+
result1 = null;
|
1645
|
+
pos = clone(pos2);
|
1307
1646
|
}
|
1308
1647
|
} else {
|
1309
|
-
|
1310
|
-
pos =
|
1648
|
+
result1 = null;
|
1649
|
+
pos = clone(pos2);
|
1311
1650
|
}
|
1312
1651
|
} else {
|
1313
|
-
|
1314
|
-
pos =
|
1652
|
+
result1 = null;
|
1653
|
+
pos = clone(pos2);
|
1315
1654
|
}
|
1316
1655
|
} else {
|
1317
|
-
|
1318
|
-
pos =
|
1319
|
-
}
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1656
|
+
result1 = null;
|
1657
|
+
pos = clone(pos2);
|
1658
|
+
}
|
1659
|
+
if (result1 !== null) {
|
1660
|
+
result1 = (function(offset, line, column, k, v) {return ["param", ["literal", k], v]})(pos1.offset, pos1.line, pos1.column, result1[1], result1[3]);
|
1661
|
+
}
|
1662
|
+
if (result1 === null) {
|
1663
|
+
pos = clone(pos1);
|
1664
|
+
}
|
1665
|
+
while (result1 !== null) {
|
1666
|
+
result0.push(result1);
|
1667
|
+
pos1 = clone(pos);
|
1668
|
+
pos2 = clone(pos);
|
1669
|
+
result2 = parse_ws();
|
1670
|
+
if (result2 !== null) {
|
1671
|
+
result1 = [];
|
1672
|
+
while (result2 !== null) {
|
1673
|
+
result1.push(result2);
|
1674
|
+
result2 = parse_ws();
|
1675
|
+
}
|
1676
|
+
} else {
|
1677
|
+
result1 = null;
|
1678
|
+
}
|
1679
|
+
if (result1 !== null) {
|
1680
|
+
result2 = parse_key();
|
1681
|
+
if (result2 !== null) {
|
1682
|
+
if (input.charCodeAt(pos.offset) === 61) {
|
1683
|
+
result3 = "=";
|
1684
|
+
advance(pos, 1);
|
1333
1685
|
} else {
|
1334
|
-
|
1335
|
-
if (
|
1686
|
+
result3 = null;
|
1687
|
+
if (reportFailures === 0) {
|
1336
1688
|
matchFailed("\"=\"");
|
1337
1689
|
}
|
1338
1690
|
}
|
1339
|
-
if (
|
1340
|
-
|
1341
|
-
if (
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
var result7 = result8;
|
1347
|
-
} else {
|
1348
|
-
var result7 = null;;
|
1349
|
-
};
|
1691
|
+
if (result3 !== null) {
|
1692
|
+
result4 = parse_number();
|
1693
|
+
if (result4 === null) {
|
1694
|
+
result4 = parse_identifier();
|
1695
|
+
if (result4 === null) {
|
1696
|
+
result4 = parse_inline();
|
1697
|
+
}
|
1350
1698
|
}
|
1351
|
-
if (
|
1352
|
-
|
1699
|
+
if (result4 !== null) {
|
1700
|
+
result1 = [result1, result2, result3, result4];
|
1353
1701
|
} else {
|
1354
|
-
|
1355
|
-
pos =
|
1702
|
+
result1 = null;
|
1703
|
+
pos = clone(pos2);
|
1356
1704
|
}
|
1357
1705
|
} else {
|
1358
|
-
|
1359
|
-
pos =
|
1706
|
+
result1 = null;
|
1707
|
+
pos = clone(pos2);
|
1360
1708
|
}
|
1361
1709
|
} else {
|
1362
|
-
|
1363
|
-
pos =
|
1710
|
+
result1 = null;
|
1711
|
+
pos = clone(pos2);
|
1364
1712
|
}
|
1365
1713
|
} else {
|
1366
|
-
|
1367
|
-
pos =
|
1368
|
-
}
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1714
|
+
result1 = null;
|
1715
|
+
pos = clone(pos2);
|
1716
|
+
}
|
1717
|
+
if (result1 !== null) {
|
1718
|
+
result1 = (function(offset, line, column, k, v) {return ["param", ["literal", k], v]})(pos1.offset, pos1.line, pos1.column, result1[1], result1[3]);
|
1719
|
+
}
|
1720
|
+
if (result1 === null) {
|
1721
|
+
pos = clone(pos1);
|
1722
|
+
}
|
1723
|
+
}
|
1724
|
+
if (result0 !== null) {
|
1725
|
+
result0 = (function(offset, line, column, p) { return ["params"].concat(p) })(pos0.offset, pos0.line, pos0.column, result0);
|
1726
|
+
}
|
1727
|
+
if (result0 === null) {
|
1728
|
+
pos = clone(pos0);
|
1729
|
+
}
|
1730
|
+
reportFailures--;
|
1731
|
+
if (reportFailures === 0 && result0 === null) {
|
1378
1732
|
matchFailed("params");
|
1379
1733
|
}
|
1380
|
-
|
1381
|
-
cache[cacheKey] = {
|
1382
|
-
nextPos: pos,
|
1383
|
-
result: result0
|
1384
|
-
};
|
1385
1734
|
return result0;
|
1386
1735
|
}
|
1387
1736
|
|
1388
1737
|
function parse_bodies() {
|
1389
|
-
var
|
1390
|
-
var
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
if (input.substr(pos, 1) === ":") {
|
1403
|
-
var result5 = ":";
|
1404
|
-
pos += 1;
|
1738
|
+
var result0, result1, result2, result3, result4, result5;
|
1739
|
+
var pos0, pos1, pos2;
|
1740
|
+
|
1741
|
+
reportFailures++;
|
1742
|
+
pos0 = clone(pos);
|
1743
|
+
result0 = [];
|
1744
|
+
pos1 = clone(pos);
|
1745
|
+
pos2 = clone(pos);
|
1746
|
+
result1 = parse_ld();
|
1747
|
+
if (result1 !== null) {
|
1748
|
+
if (input.charCodeAt(pos.offset) === 58) {
|
1749
|
+
result2 = ":";
|
1750
|
+
advance(pos, 1);
|
1405
1751
|
} else {
|
1406
|
-
|
1407
|
-
if (
|
1752
|
+
result2 = null;
|
1753
|
+
if (reportFailures === 0) {
|
1408
1754
|
matchFailed("\":\"");
|
1409
1755
|
}
|
1410
1756
|
}
|
1411
|
-
if (
|
1412
|
-
|
1413
|
-
if (
|
1414
|
-
|
1415
|
-
if (
|
1416
|
-
|
1417
|
-
if (
|
1418
|
-
|
1757
|
+
if (result2 !== null) {
|
1758
|
+
result3 = parse_key();
|
1759
|
+
if (result3 !== null) {
|
1760
|
+
result4 = parse_rd();
|
1761
|
+
if (result4 !== null) {
|
1762
|
+
result5 = parse_body();
|
1763
|
+
if (result5 !== null) {
|
1764
|
+
result1 = [result1, result2, result3, result4, result5];
|
1419
1765
|
} else {
|
1420
|
-
|
1421
|
-
pos =
|
1766
|
+
result1 = null;
|
1767
|
+
pos = clone(pos2);
|
1422
1768
|
}
|
1423
1769
|
} else {
|
1424
|
-
|
1425
|
-
pos =
|
1770
|
+
result1 = null;
|
1771
|
+
pos = clone(pos2);
|
1426
1772
|
}
|
1427
1773
|
} else {
|
1428
|
-
|
1429
|
-
pos =
|
1774
|
+
result1 = null;
|
1775
|
+
pos = clone(pos2);
|
1430
1776
|
}
|
1431
1777
|
} else {
|
1432
|
-
|
1433
|
-
pos =
|
1778
|
+
result1 = null;
|
1779
|
+
pos = clone(pos2);
|
1434
1780
|
}
|
1435
1781
|
} else {
|
1436
|
-
|
1437
|
-
pos =
|
1438
|
-
}
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
|
1447
|
-
|
1448
|
-
|
1449
|
-
|
1782
|
+
result1 = null;
|
1783
|
+
pos = clone(pos2);
|
1784
|
+
}
|
1785
|
+
if (result1 !== null) {
|
1786
|
+
result1 = (function(offset, line, column, k, v) {return ["param", ["literal", k], v]})(pos1.offset, pos1.line, pos1.column, result1[2], result1[4]);
|
1787
|
+
}
|
1788
|
+
if (result1 === null) {
|
1789
|
+
pos = clone(pos1);
|
1790
|
+
}
|
1791
|
+
while (result1 !== null) {
|
1792
|
+
result0.push(result1);
|
1793
|
+
pos1 = clone(pos);
|
1794
|
+
pos2 = clone(pos);
|
1795
|
+
result1 = parse_ld();
|
1796
|
+
if (result1 !== null) {
|
1797
|
+
if (input.charCodeAt(pos.offset) === 58) {
|
1798
|
+
result2 = ":";
|
1799
|
+
advance(pos, 1);
|
1450
1800
|
} else {
|
1451
|
-
|
1452
|
-
if (
|
1801
|
+
result2 = null;
|
1802
|
+
if (reportFailures === 0) {
|
1453
1803
|
matchFailed("\":\"");
|
1454
1804
|
}
|
1455
1805
|
}
|
1456
|
-
if (
|
1457
|
-
|
1458
|
-
if (
|
1459
|
-
|
1460
|
-
if (
|
1461
|
-
|
1462
|
-
if (
|
1463
|
-
|
1806
|
+
if (result2 !== null) {
|
1807
|
+
result3 = parse_key();
|
1808
|
+
if (result3 !== null) {
|
1809
|
+
result4 = parse_rd();
|
1810
|
+
if (result4 !== null) {
|
1811
|
+
result5 = parse_body();
|
1812
|
+
if (result5 !== null) {
|
1813
|
+
result1 = [result1, result2, result3, result4, result5];
|
1464
1814
|
} else {
|
1465
|
-
|
1466
|
-
pos =
|
1815
|
+
result1 = null;
|
1816
|
+
pos = clone(pos2);
|
1467
1817
|
}
|
1468
1818
|
} else {
|
1469
|
-
|
1470
|
-
pos =
|
1819
|
+
result1 = null;
|
1820
|
+
pos = clone(pos2);
|
1471
1821
|
}
|
1472
1822
|
} else {
|
1473
|
-
|
1474
|
-
pos =
|
1823
|
+
result1 = null;
|
1824
|
+
pos = clone(pos2);
|
1475
1825
|
}
|
1476
1826
|
} else {
|
1477
|
-
|
1478
|
-
pos =
|
1827
|
+
result1 = null;
|
1828
|
+
pos = clone(pos2);
|
1479
1829
|
}
|
1480
1830
|
} else {
|
1481
|
-
|
1482
|
-
pos =
|
1483
|
-
}
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1831
|
+
result1 = null;
|
1832
|
+
pos = clone(pos2);
|
1833
|
+
}
|
1834
|
+
if (result1 !== null) {
|
1835
|
+
result1 = (function(offset, line, column, k, v) {return ["param", ["literal", k], v]})(pos1.offset, pos1.line, pos1.column, result1[2], result1[4]);
|
1836
|
+
}
|
1837
|
+
if (result1 === null) {
|
1838
|
+
pos = clone(pos1);
|
1839
|
+
}
|
1840
|
+
}
|
1841
|
+
if (result0 !== null) {
|
1842
|
+
result0 = (function(offset, line, column, p) { return ["bodies"].concat(p) })(pos0.offset, pos0.line, pos0.column, result0);
|
1843
|
+
}
|
1844
|
+
if (result0 === null) {
|
1845
|
+
pos = clone(pos0);
|
1846
|
+
}
|
1847
|
+
reportFailures--;
|
1848
|
+
if (reportFailures === 0 && result0 === null) {
|
1493
1849
|
matchFailed("bodies");
|
1494
1850
|
}
|
1495
|
-
|
1496
|
-
cache[cacheKey] = {
|
1497
|
-
nextPos: pos,
|
1498
|
-
result: result0
|
1499
|
-
};
|
1500
1851
|
return result0;
|
1501
1852
|
}
|
1502
1853
|
|
1503
1854
|
function parse_reference() {
|
1504
|
-
var
|
1505
|
-
var
|
1506
|
-
|
1507
|
-
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
|
1518
|
-
|
1519
|
-
if (result4 !== null) {
|
1520
|
-
var result5 = parse_rd();
|
1521
|
-
if (result5 !== null) {
|
1522
|
-
var result1 = [result2, result3, result4, result5];
|
1855
|
+
var result0, result1, result2, result3;
|
1856
|
+
var pos0, pos1;
|
1857
|
+
|
1858
|
+
reportFailures++;
|
1859
|
+
pos0 = clone(pos);
|
1860
|
+
pos1 = clone(pos);
|
1861
|
+
result0 = parse_ld();
|
1862
|
+
if (result0 !== null) {
|
1863
|
+
result1 = parse_identifier();
|
1864
|
+
if (result1 !== null) {
|
1865
|
+
result2 = parse_filters();
|
1866
|
+
if (result2 !== null) {
|
1867
|
+
result3 = parse_rd();
|
1868
|
+
if (result3 !== null) {
|
1869
|
+
result0 = [result0, result1, result2, result3];
|
1523
1870
|
} else {
|
1524
|
-
|
1525
|
-
pos =
|
1871
|
+
result0 = null;
|
1872
|
+
pos = clone(pos1);
|
1526
1873
|
}
|
1527
1874
|
} else {
|
1528
|
-
|
1529
|
-
pos =
|
1875
|
+
result0 = null;
|
1876
|
+
pos = clone(pos1);
|
1530
1877
|
}
|
1531
1878
|
} else {
|
1532
|
-
|
1533
|
-
pos =
|
1879
|
+
result0 = null;
|
1880
|
+
pos = clone(pos1);
|
1534
1881
|
}
|
1535
1882
|
} else {
|
1536
|
-
|
1537
|
-
pos =
|
1538
|
-
}
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1883
|
+
result0 = null;
|
1884
|
+
pos = clone(pos1);
|
1885
|
+
}
|
1886
|
+
if (result0 !== null) {
|
1887
|
+
result0 = (function(offset, line, column, n, f) { return ["reference", n, f] })(pos0.offset, pos0.line, pos0.column, result0[1], result0[2]);
|
1888
|
+
}
|
1889
|
+
if (result0 === null) {
|
1890
|
+
pos = clone(pos0);
|
1891
|
+
}
|
1892
|
+
reportFailures--;
|
1893
|
+
if (reportFailures === 0 && result0 === null) {
|
1544
1894
|
matchFailed("reference");
|
1545
1895
|
}
|
1546
|
-
|
1547
|
-
cache[cacheKey] = {
|
1548
|
-
nextPos: pos,
|
1549
|
-
result: result0
|
1550
|
-
};
|
1551
1896
|
return result0;
|
1552
1897
|
}
|
1553
1898
|
|
1554
1899
|
function parse_partial() {
|
1555
|
-
var
|
1556
|
-
var
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
if (result2 !== null) {
|
1567
|
-
if (input.substr(pos, 1) === ">") {
|
1568
|
-
var result3 = ">";
|
1569
|
-
pos += 1;
|
1900
|
+
var result0, result1, result2, result3, result4, result5, result6, result7;
|
1901
|
+
var pos0, pos1, pos2;
|
1902
|
+
|
1903
|
+
reportFailures++;
|
1904
|
+
pos0 = clone(pos);
|
1905
|
+
pos1 = clone(pos);
|
1906
|
+
result0 = parse_ld();
|
1907
|
+
if (result0 !== null) {
|
1908
|
+
if (input.charCodeAt(pos.offset) === 62) {
|
1909
|
+
result1 = ">";
|
1910
|
+
advance(pos, 1);
|
1570
1911
|
} else {
|
1571
|
-
|
1572
|
-
if (
|
1912
|
+
result1 = null;
|
1913
|
+
if (reportFailures === 0) {
|
1573
1914
|
matchFailed("\">\"");
|
1574
1915
|
}
|
1575
1916
|
}
|
1576
|
-
if (
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
: null;
|
1581
|
-
if (result9 !== null) {
|
1582
|
-
var result4 = result9;
|
1917
|
+
if (result1 === null) {
|
1918
|
+
if (input.charCodeAt(pos.offset) === 43) {
|
1919
|
+
result1 = "+";
|
1920
|
+
advance(pos, 1);
|
1583
1921
|
} else {
|
1584
|
-
|
1585
|
-
if (
|
1586
|
-
|
1587
|
-
}
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1922
|
+
result1 = null;
|
1923
|
+
if (reportFailures === 0) {
|
1924
|
+
matchFailed("\"+\"");
|
1925
|
+
}
|
1926
|
+
}
|
1927
|
+
}
|
1928
|
+
if (result1 !== null) {
|
1929
|
+
pos2 = clone(pos);
|
1930
|
+
result2 = parse_key();
|
1931
|
+
if (result2 !== null) {
|
1932
|
+
result2 = (function(offset, line, column, k) {return ["literal", k]})(pos2.offset, pos2.line, pos2.column, result2);
|
1933
|
+
}
|
1934
|
+
if (result2 === null) {
|
1935
|
+
pos = clone(pos2);
|
1936
|
+
}
|
1937
|
+
if (result2 === null) {
|
1938
|
+
result2 = parse_inline();
|
1939
|
+
}
|
1940
|
+
if (result2 !== null) {
|
1941
|
+
result3 = parse_context();
|
1942
|
+
if (result3 !== null) {
|
1943
|
+
result4 = parse_params();
|
1944
|
+
if (result4 !== null) {
|
1945
|
+
result5 = [];
|
1946
|
+
result6 = parse_ws();
|
1947
|
+
while (result6 !== null) {
|
1948
|
+
result5.push(result6);
|
1949
|
+
result6 = parse_ws();
|
1601
1950
|
}
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
|
1951
|
+
if (result5 !== null) {
|
1952
|
+
if (input.charCodeAt(pos.offset) === 47) {
|
1953
|
+
result6 = "/";
|
1954
|
+
advance(pos, 1);
|
1955
|
+
} else {
|
1956
|
+
result6 = null;
|
1957
|
+
if (reportFailures === 0) {
|
1958
|
+
matchFailed("\"/\"");
|
1959
|
+
}
|
1960
|
+
}
|
1961
|
+
if (result6 !== null) {
|
1962
|
+
result7 = parse_rd();
|
1963
|
+
if (result7 !== null) {
|
1964
|
+
result0 = [result0, result1, result2, result3, result4, result5, result6, result7];
|
1965
|
+
} else {
|
1966
|
+
result0 = null;
|
1967
|
+
pos = clone(pos1);
|
1968
|
+
}
|
1969
|
+
} else {
|
1970
|
+
result0 = null;
|
1971
|
+
pos = clone(pos1);
|
1972
|
+
}
|
1607
1973
|
} else {
|
1608
|
-
|
1609
|
-
pos =
|
1974
|
+
result0 = null;
|
1975
|
+
pos = clone(pos1);
|
1610
1976
|
}
|
1611
1977
|
} else {
|
1612
|
-
|
1613
|
-
pos =
|
1978
|
+
result0 = null;
|
1979
|
+
pos = clone(pos1);
|
1614
1980
|
}
|
1615
1981
|
} else {
|
1616
|
-
|
1617
|
-
pos =
|
1982
|
+
result0 = null;
|
1983
|
+
pos = clone(pos1);
|
1618
1984
|
}
|
1619
1985
|
} else {
|
1620
|
-
|
1621
|
-
pos =
|
1986
|
+
result0 = null;
|
1987
|
+
pos = clone(pos1);
|
1622
1988
|
}
|
1623
1989
|
} else {
|
1624
|
-
|
1625
|
-
pos =
|
1990
|
+
result0 = null;
|
1991
|
+
pos = clone(pos1);
|
1626
1992
|
}
|
1627
1993
|
} else {
|
1628
|
-
|
1629
|
-
pos =
|
1630
|
-
}
|
1631
|
-
|
1632
|
-
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1994
|
+
result0 = null;
|
1995
|
+
pos = clone(pos1);
|
1996
|
+
}
|
1997
|
+
if (result0 !== null) {
|
1998
|
+
result0 = (function(offset, line, column, s, n, c, p) { var key = (s ===">")? "partial" : s; return [key, n, c, p] })(pos0.offset, pos0.line, pos0.column, result0[1], result0[2], result0[3], result0[4]);
|
1999
|
+
}
|
2000
|
+
if (result0 === null) {
|
2001
|
+
pos = clone(pos0);
|
2002
|
+
}
|
2003
|
+
reportFailures--;
|
2004
|
+
if (reportFailures === 0 && result0 === null) {
|
1636
2005
|
matchFailed("partial");
|
1637
2006
|
}
|
1638
|
-
|
1639
|
-
cache[cacheKey] = {
|
1640
|
-
nextPos: pos,
|
1641
|
-
result: result0
|
1642
|
-
};
|
1643
2007
|
return result0;
|
1644
2008
|
}
|
1645
2009
|
|
1646
2010
|
function parse_filters() {
|
1647
|
-
var
|
1648
|
-
var
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
if (input.substr(pos, 1) === "|") {
|
1659
|
-
var result4 = "|";
|
1660
|
-
pos += 1;
|
2011
|
+
var result0, result1, result2;
|
2012
|
+
var pos0, pos1, pos2;
|
2013
|
+
|
2014
|
+
reportFailures++;
|
2015
|
+
pos0 = clone(pos);
|
2016
|
+
result0 = [];
|
2017
|
+
pos1 = clone(pos);
|
2018
|
+
pos2 = clone(pos);
|
2019
|
+
if (input.charCodeAt(pos.offset) === 124) {
|
2020
|
+
result1 = "|";
|
2021
|
+
advance(pos, 1);
|
1661
2022
|
} else {
|
1662
|
-
|
1663
|
-
if (
|
2023
|
+
result1 = null;
|
2024
|
+
if (reportFailures === 0) {
|
1664
2025
|
matchFailed("\"|\"");
|
1665
2026
|
}
|
1666
2027
|
}
|
1667
|
-
if (
|
1668
|
-
|
1669
|
-
if (
|
1670
|
-
|
2028
|
+
if (result1 !== null) {
|
2029
|
+
result2 = parse_key();
|
2030
|
+
if (result2 !== null) {
|
2031
|
+
result1 = [result1, result2];
|
1671
2032
|
} else {
|
1672
|
-
|
1673
|
-
pos =
|
2033
|
+
result1 = null;
|
2034
|
+
pos = clone(pos2);
|
1674
2035
|
}
|
1675
2036
|
} else {
|
1676
|
-
|
1677
|
-
pos =
|
1678
|
-
}
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
2037
|
+
result1 = null;
|
2038
|
+
pos = clone(pos2);
|
2039
|
+
}
|
2040
|
+
if (result1 !== null) {
|
2041
|
+
result1 = (function(offset, line, column, n) {return n})(pos1.offset, pos1.line, pos1.column, result1[1]);
|
2042
|
+
}
|
2043
|
+
if (result1 === null) {
|
2044
|
+
pos = clone(pos1);
|
2045
|
+
}
|
2046
|
+
while (result1 !== null) {
|
2047
|
+
result0.push(result1);
|
2048
|
+
pos1 = clone(pos);
|
2049
|
+
pos2 = clone(pos);
|
2050
|
+
if (input.charCodeAt(pos.offset) === 124) {
|
2051
|
+
result1 = "|";
|
2052
|
+
advance(pos, 1);
|
1688
2053
|
} else {
|
1689
|
-
|
1690
|
-
if (
|
2054
|
+
result1 = null;
|
2055
|
+
if (reportFailures === 0) {
|
1691
2056
|
matchFailed("\"|\"");
|
1692
2057
|
}
|
1693
2058
|
}
|
1694
|
-
if (
|
1695
|
-
|
1696
|
-
if (
|
1697
|
-
|
2059
|
+
if (result1 !== null) {
|
2060
|
+
result2 = parse_key();
|
2061
|
+
if (result2 !== null) {
|
2062
|
+
result1 = [result1, result2];
|
1698
2063
|
} else {
|
1699
|
-
|
1700
|
-
pos =
|
2064
|
+
result1 = null;
|
2065
|
+
pos = clone(pos2);
|
1701
2066
|
}
|
1702
2067
|
} else {
|
1703
|
-
|
1704
|
-
pos =
|
1705
|
-
}
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
2068
|
+
result1 = null;
|
2069
|
+
pos = clone(pos2);
|
2070
|
+
}
|
2071
|
+
if (result1 !== null) {
|
2072
|
+
result1 = (function(offset, line, column, n) {return n})(pos1.offset, pos1.line, pos1.column, result1[1]);
|
2073
|
+
}
|
2074
|
+
if (result1 === null) {
|
2075
|
+
pos = clone(pos1);
|
2076
|
+
}
|
2077
|
+
}
|
2078
|
+
if (result0 !== null) {
|
2079
|
+
result0 = (function(offset, line, column, f) { return ["filters"].concat(f) })(pos0.offset, pos0.line, pos0.column, result0);
|
2080
|
+
}
|
2081
|
+
if (result0 === null) {
|
2082
|
+
pos = clone(pos0);
|
2083
|
+
}
|
2084
|
+
reportFailures--;
|
2085
|
+
if (reportFailures === 0 && result0 === null) {
|
1715
2086
|
matchFailed("filters");
|
1716
2087
|
}
|
1717
|
-
|
1718
|
-
cache[cacheKey] = {
|
1719
|
-
nextPos: pos,
|
1720
|
-
result: result0
|
1721
|
-
};
|
1722
2088
|
return result0;
|
1723
2089
|
}
|
1724
2090
|
|
1725
2091
|
function parse_special() {
|
1726
|
-
var
|
1727
|
-
var
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1736
|
-
|
1737
|
-
if (result2 !== null) {
|
1738
|
-
if (input.substr(pos, 1) === "~") {
|
1739
|
-
var result3 = "~";
|
1740
|
-
pos += 1;
|
2092
|
+
var result0, result1, result2, result3;
|
2093
|
+
var pos0, pos1;
|
2094
|
+
|
2095
|
+
reportFailures++;
|
2096
|
+
pos0 = clone(pos);
|
2097
|
+
pos1 = clone(pos);
|
2098
|
+
result0 = parse_ld();
|
2099
|
+
if (result0 !== null) {
|
2100
|
+
if (input.charCodeAt(pos.offset) === 126) {
|
2101
|
+
result1 = "~";
|
2102
|
+
advance(pos, 1);
|
1741
2103
|
} else {
|
1742
|
-
|
1743
|
-
if (
|
2104
|
+
result1 = null;
|
2105
|
+
if (reportFailures === 0) {
|
1744
2106
|
matchFailed("\"~\"");
|
1745
2107
|
}
|
1746
2108
|
}
|
1747
|
-
if (
|
1748
|
-
|
1749
|
-
if (
|
1750
|
-
|
1751
|
-
if (
|
1752
|
-
|
2109
|
+
if (result1 !== null) {
|
2110
|
+
result2 = parse_key();
|
2111
|
+
if (result2 !== null) {
|
2112
|
+
result3 = parse_rd();
|
2113
|
+
if (result3 !== null) {
|
2114
|
+
result0 = [result0, result1, result2, result3];
|
1753
2115
|
} else {
|
1754
|
-
|
1755
|
-
pos =
|
2116
|
+
result0 = null;
|
2117
|
+
pos = clone(pos1);
|
1756
2118
|
}
|
1757
2119
|
} else {
|
1758
|
-
|
1759
|
-
pos =
|
2120
|
+
result0 = null;
|
2121
|
+
pos = clone(pos1);
|
1760
2122
|
}
|
1761
2123
|
} else {
|
1762
|
-
|
1763
|
-
pos =
|
2124
|
+
result0 = null;
|
2125
|
+
pos = clone(pos1);
|
1764
2126
|
}
|
1765
2127
|
} else {
|
1766
|
-
|
1767
|
-
pos =
|
1768
|
-
}
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
2128
|
+
result0 = null;
|
2129
|
+
pos = clone(pos1);
|
2130
|
+
}
|
2131
|
+
if (result0 !== null) {
|
2132
|
+
result0 = (function(offset, line, column, k) { return ["special", k] })(pos0.offset, pos0.line, pos0.column, result0[2]);
|
2133
|
+
}
|
2134
|
+
if (result0 === null) {
|
2135
|
+
pos = clone(pos0);
|
2136
|
+
}
|
2137
|
+
reportFailures--;
|
2138
|
+
if (reportFailures === 0 && result0 === null) {
|
1774
2139
|
matchFailed("special");
|
1775
2140
|
}
|
1776
|
-
|
1777
|
-
cache[cacheKey] = {
|
1778
|
-
nextPos: pos,
|
1779
|
-
result: result0
|
1780
|
-
};
|
1781
2141
|
return result0;
|
1782
2142
|
}
|
1783
2143
|
|
1784
2144
|
function parse_identifier() {
|
1785
|
-
var
|
1786
|
-
var
|
1787
|
-
|
1788
|
-
|
1789
|
-
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1801
|
-
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
var result0 = result1;
|
1807
|
-
} else {
|
1808
|
-
var result0 = null;;
|
1809
|
-
};
|
2145
|
+
var result0;
|
2146
|
+
var pos0;
|
2147
|
+
|
2148
|
+
reportFailures++;
|
2149
|
+
pos0 = clone(pos);
|
2150
|
+
result0 = parse_path();
|
2151
|
+
if (result0 !== null) {
|
2152
|
+
result0 = (function(offset, line, column, p) { var arr = ["path"].concat(p); arr.text = p[1].join('.'); return arr; })(pos0.offset, pos0.line, pos0.column, result0);
|
2153
|
+
}
|
2154
|
+
if (result0 === null) {
|
2155
|
+
pos = clone(pos0);
|
2156
|
+
}
|
2157
|
+
if (result0 === null) {
|
2158
|
+
pos0 = clone(pos);
|
2159
|
+
result0 = parse_key();
|
2160
|
+
if (result0 !== null) {
|
2161
|
+
result0 = (function(offset, line, column, k) { var arr = ["key", k]; arr.text = k; return arr; })(pos0.offset, pos0.line, pos0.column, result0);
|
2162
|
+
}
|
2163
|
+
if (result0 === null) {
|
2164
|
+
pos = clone(pos0);
|
2165
|
+
}
|
1810
2166
|
}
|
1811
|
-
|
1812
|
-
if (
|
2167
|
+
reportFailures--;
|
2168
|
+
if (reportFailures === 0 && result0 === null) {
|
1813
2169
|
matchFailed("identifier");
|
1814
2170
|
}
|
1815
|
-
|
1816
|
-
cache[cacheKey] = {
|
1817
|
-
nextPos: pos,
|
1818
|
-
result: result0
|
1819
|
-
};
|
1820
2171
|
return result0;
|
1821
2172
|
}
|
1822
2173
|
|
1823
|
-
function
|
1824
|
-
var
|
1825
|
-
var
|
1826
|
-
if (cachedResult) {
|
1827
|
-
pos = cachedResult.nextPos;
|
1828
|
-
return cachedResult.result;
|
1829
|
-
}
|
2174
|
+
function parse_number() {
|
2175
|
+
var result0;
|
2176
|
+
var pos0;
|
1830
2177
|
|
1831
|
-
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
2178
|
+
reportFailures++;
|
2179
|
+
pos0 = clone(pos);
|
2180
|
+
result0 = parse_frac();
|
2181
|
+
if (result0 === null) {
|
2182
|
+
result0 = parse_integer();
|
2183
|
+
}
|
2184
|
+
if (result0 !== null) {
|
2185
|
+
result0 = (function(offset, line, column, n) { return ['literal', n]; })(pos0.offset, pos0.line, pos0.column, result0);
|
2186
|
+
}
|
2187
|
+
if (result0 === null) {
|
2188
|
+
pos = clone(pos0);
|
2189
|
+
}
|
2190
|
+
reportFailures--;
|
2191
|
+
if (reportFailures === 0 && result0 === null) {
|
2192
|
+
matchFailed("number");
|
2193
|
+
}
|
2194
|
+
return result0;
|
2195
|
+
}
|
2196
|
+
|
2197
|
+
function parse_frac() {
|
2198
|
+
var result0, result1, result2, result3;
|
2199
|
+
var pos0, pos1;
|
2200
|
+
|
2201
|
+
reportFailures++;
|
2202
|
+
pos0 = clone(pos);
|
2203
|
+
pos1 = clone(pos);
|
2204
|
+
result0 = parse_integer();
|
2205
|
+
if (result0 !== null) {
|
2206
|
+
if (input.charCodeAt(pos.offset) === 46) {
|
2207
|
+
result1 = ".";
|
2208
|
+
advance(pos, 1);
|
1841
2209
|
} else {
|
1842
|
-
|
1843
|
-
if (
|
2210
|
+
result1 = null;
|
2211
|
+
if (reportFailures === 0) {
|
1844
2212
|
matchFailed("\".\"");
|
1845
2213
|
}
|
1846
2214
|
}
|
1847
|
-
if (
|
1848
|
-
|
1849
|
-
if (
|
1850
|
-
|
2215
|
+
if (result1 !== null) {
|
2216
|
+
result3 = parse_integer();
|
2217
|
+
if (result3 !== null) {
|
2218
|
+
result2 = [];
|
2219
|
+
while (result3 !== null) {
|
2220
|
+
result2.push(result3);
|
2221
|
+
result3 = parse_integer();
|
2222
|
+
}
|
2223
|
+
} else {
|
2224
|
+
result2 = null;
|
2225
|
+
}
|
2226
|
+
if (result2 !== null) {
|
2227
|
+
result0 = [result0, result1, result2];
|
1851
2228
|
} else {
|
1852
|
-
|
1853
|
-
pos =
|
2229
|
+
result0 = null;
|
2230
|
+
pos = clone(pos1);
|
1854
2231
|
}
|
1855
2232
|
} else {
|
1856
|
-
|
1857
|
-
pos =
|
1858
|
-
}
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1864
|
-
|
1865
|
-
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
2233
|
+
result0 = null;
|
2234
|
+
pos = clone(pos1);
|
2235
|
+
}
|
2236
|
+
} else {
|
2237
|
+
result0 = null;
|
2238
|
+
pos = clone(pos1);
|
2239
|
+
}
|
2240
|
+
if (result0 !== null) {
|
2241
|
+
result0 = (function(offset, line, column, l, r) { return parseFloat(l + "." + r.join('')); })(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
|
2242
|
+
}
|
2243
|
+
if (result0 === null) {
|
2244
|
+
pos = clone(pos0);
|
2245
|
+
}
|
2246
|
+
reportFailures--;
|
2247
|
+
if (reportFailures === 0 && result0 === null) {
|
2248
|
+
matchFailed("frac");
|
2249
|
+
}
|
2250
|
+
return result0;
|
2251
|
+
}
|
2252
|
+
|
2253
|
+
function parse_integer() {
|
2254
|
+
var result0, result1;
|
2255
|
+
var pos0;
|
2256
|
+
|
2257
|
+
reportFailures++;
|
2258
|
+
pos0 = clone(pos);
|
2259
|
+
if (/^[0-9]/.test(input.charAt(pos.offset))) {
|
2260
|
+
result1 = input.charAt(pos.offset);
|
2261
|
+
advance(pos, 1);
|
2262
|
+
} else {
|
2263
|
+
result1 = null;
|
2264
|
+
if (reportFailures === 0) {
|
2265
|
+
matchFailed("[0-9]");
|
2266
|
+
}
|
2267
|
+
}
|
2268
|
+
if (result1 !== null) {
|
2269
|
+
result0 = [];
|
2270
|
+
while (result1 !== null) {
|
2271
|
+
result0.push(result1);
|
2272
|
+
if (/^[0-9]/.test(input.charAt(pos.offset))) {
|
2273
|
+
result1 = input.charAt(pos.offset);
|
2274
|
+
advance(pos, 1);
|
2275
|
+
} else {
|
2276
|
+
result1 = null;
|
2277
|
+
if (reportFailures === 0) {
|
2278
|
+
matchFailed("[0-9]");
|
1875
2279
|
}
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
|
1880
|
-
|
1881
|
-
|
1882
|
-
|
1883
|
-
|
1884
|
-
|
1885
|
-
|
1886
|
-
|
2280
|
+
}
|
2281
|
+
}
|
2282
|
+
} else {
|
2283
|
+
result0 = null;
|
2284
|
+
}
|
2285
|
+
if (result0 !== null) {
|
2286
|
+
result0 = (function(offset, line, column, digits) { return parseInt(digits.join(""), 10); })(pos0.offset, pos0.line, pos0.column, result0);
|
2287
|
+
}
|
2288
|
+
if (result0 === null) {
|
2289
|
+
pos = clone(pos0);
|
2290
|
+
}
|
2291
|
+
reportFailures--;
|
2292
|
+
if (reportFailures === 0 && result0 === null) {
|
2293
|
+
matchFailed("integer");
|
2294
|
+
}
|
2295
|
+
return result0;
|
2296
|
+
}
|
2297
|
+
|
2298
|
+
function parse_path() {
|
2299
|
+
var result0, result1, result2;
|
2300
|
+
var pos0, pos1;
|
2301
|
+
|
2302
|
+
reportFailures++;
|
2303
|
+
pos0 = clone(pos);
|
2304
|
+
pos1 = clone(pos);
|
2305
|
+
result0 = parse_key();
|
2306
|
+
result0 = result0 !== null ? result0 : "";
|
2307
|
+
if (result0 !== null) {
|
2308
|
+
result2 = parse_array_part();
|
2309
|
+
if (result2 === null) {
|
2310
|
+
result2 = parse_array();
|
2311
|
+
}
|
2312
|
+
if (result2 !== null) {
|
2313
|
+
result1 = [];
|
2314
|
+
while (result2 !== null) {
|
2315
|
+
result1.push(result2);
|
2316
|
+
result2 = parse_array_part();
|
2317
|
+
if (result2 === null) {
|
2318
|
+
result2 = parse_array();
|
1887
2319
|
}
|
1888
|
-
var result7 = result8 !== null
|
1889
|
-
? (function(k) {return k})(result8[1])
|
1890
|
-
: null;
|
1891
2320
|
}
|
1892
2321
|
} else {
|
1893
|
-
|
2322
|
+
result1 = null;
|
1894
2323
|
}
|
1895
|
-
if (
|
1896
|
-
|
2324
|
+
if (result1 !== null) {
|
2325
|
+
result0 = [result0, result1];
|
1897
2326
|
} else {
|
1898
|
-
|
1899
|
-
pos =
|
2327
|
+
result0 = null;
|
2328
|
+
pos = clone(pos1);
|
1900
2329
|
}
|
1901
2330
|
} else {
|
1902
|
-
|
1903
|
-
pos =
|
1904
|
-
}
|
1905
|
-
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1910
|
-
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
2331
|
+
result0 = null;
|
2332
|
+
pos = clone(pos1);
|
2333
|
+
}
|
2334
|
+
if (result0 !== null) {
|
2335
|
+
result0 = (function(offset, line, column, k, d) {
|
2336
|
+
d = d[0];
|
2337
|
+
if (k && d) {
|
2338
|
+
d.unshift(k);
|
2339
|
+
return [false, d];
|
2340
|
+
}
|
2341
|
+
return [true, d];
|
2342
|
+
})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
|
2343
|
+
}
|
2344
|
+
if (result0 === null) {
|
2345
|
+
pos = clone(pos0);
|
2346
|
+
}
|
2347
|
+
if (result0 === null) {
|
2348
|
+
pos0 = clone(pos);
|
2349
|
+
pos1 = clone(pos);
|
2350
|
+
if (input.charCodeAt(pos.offset) === 46) {
|
2351
|
+
result0 = ".";
|
2352
|
+
advance(pos, 1);
|
1917
2353
|
} else {
|
1918
|
-
|
1919
|
-
if (
|
2354
|
+
result0 = null;
|
2355
|
+
if (reportFailures === 0) {
|
1920
2356
|
matchFailed("\".\"");
|
1921
2357
|
}
|
1922
2358
|
}
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
2359
|
+
if (result0 !== null) {
|
2360
|
+
result1 = [];
|
2361
|
+
result2 = parse_array_part();
|
2362
|
+
if (result2 === null) {
|
2363
|
+
result2 = parse_array();
|
2364
|
+
}
|
2365
|
+
while (result2 !== null) {
|
2366
|
+
result1.push(result2);
|
2367
|
+
result2 = parse_array_part();
|
2368
|
+
if (result2 === null) {
|
2369
|
+
result2 = parse_array();
|
2370
|
+
}
|
2371
|
+
}
|
2372
|
+
if (result1 !== null) {
|
2373
|
+
result0 = [result0, result1];
|
2374
|
+
} else {
|
2375
|
+
result0 = null;
|
2376
|
+
pos = clone(pos1);
|
2377
|
+
}
|
1928
2378
|
} else {
|
1929
|
-
|
1930
|
-
|
2379
|
+
result0 = null;
|
2380
|
+
pos = clone(pos1);
|
2381
|
+
}
|
2382
|
+
if (result0 !== null) {
|
2383
|
+
result0 = (function(offset, line, column, d) {
|
2384
|
+
if (d.length > 0) {
|
2385
|
+
return [true, d[0]];
|
2386
|
+
}
|
2387
|
+
return [true, []]
|
2388
|
+
})(pos0.offset, pos0.line, pos0.column, result0[1]);
|
2389
|
+
}
|
2390
|
+
if (result0 === null) {
|
2391
|
+
pos = clone(pos0);
|
2392
|
+
}
|
1931
2393
|
}
|
1932
|
-
|
1933
|
-
if (
|
2394
|
+
reportFailures--;
|
2395
|
+
if (reportFailures === 0 && result0 === null) {
|
1934
2396
|
matchFailed("path");
|
1935
2397
|
}
|
1936
|
-
|
1937
|
-
cache[cacheKey] = {
|
1938
|
-
nextPos: pos,
|
1939
|
-
result: result0
|
1940
|
-
};
|
1941
2398
|
return result0;
|
1942
2399
|
}
|
1943
2400
|
|
1944
2401
|
function parse_key() {
|
1945
|
-
var
|
1946
|
-
var
|
1947
|
-
|
1948
|
-
|
1949
|
-
|
1950
|
-
|
1951
|
-
|
1952
|
-
|
1953
|
-
|
1954
|
-
var savedPos0 = pos;
|
1955
|
-
if (input.substr(pos).match(/^[a-zA-Z_$]/) !== null) {
|
1956
|
-
var result2 = input.charAt(pos);
|
1957
|
-
pos++;
|
2402
|
+
var result0, result1, result2;
|
2403
|
+
var pos0, pos1;
|
2404
|
+
|
2405
|
+
reportFailures++;
|
2406
|
+
pos0 = clone(pos);
|
2407
|
+
pos1 = clone(pos);
|
2408
|
+
if (/^[a-zA-Z_$]/.test(input.charAt(pos.offset))) {
|
2409
|
+
result0 = input.charAt(pos.offset);
|
2410
|
+
advance(pos, 1);
|
1958
2411
|
} else {
|
1959
|
-
|
1960
|
-
if (
|
2412
|
+
result0 = null;
|
2413
|
+
if (reportFailures === 0) {
|
1961
2414
|
matchFailed("[a-zA-Z_$]");
|
1962
2415
|
}
|
1963
2416
|
}
|
1964
|
-
if (
|
1965
|
-
|
1966
|
-
if (
|
1967
|
-
|
1968
|
-
pos
|
2417
|
+
if (result0 !== null) {
|
2418
|
+
result1 = [];
|
2419
|
+
if (/^[0-9a-zA-Z_$\-]/.test(input.charAt(pos.offset))) {
|
2420
|
+
result2 = input.charAt(pos.offset);
|
2421
|
+
advance(pos, 1);
|
1969
2422
|
} else {
|
1970
|
-
|
1971
|
-
if (
|
1972
|
-
matchFailed("[0-9a-zA-Z_
|
2423
|
+
result2 = null;
|
2424
|
+
if (reportFailures === 0) {
|
2425
|
+
matchFailed("[0-9a-zA-Z_$\\-]");
|
1973
2426
|
}
|
1974
2427
|
}
|
1975
|
-
while (
|
1976
|
-
|
1977
|
-
if (
|
1978
|
-
|
1979
|
-
pos
|
2428
|
+
while (result2 !== null) {
|
2429
|
+
result1.push(result2);
|
2430
|
+
if (/^[0-9a-zA-Z_$\-]/.test(input.charAt(pos.offset))) {
|
2431
|
+
result2 = input.charAt(pos.offset);
|
2432
|
+
advance(pos, 1);
|
1980
2433
|
} else {
|
1981
|
-
|
1982
|
-
if (
|
1983
|
-
matchFailed("[0-9a-zA-Z_
|
2434
|
+
result2 = null;
|
2435
|
+
if (reportFailures === 0) {
|
2436
|
+
matchFailed("[0-9a-zA-Z_$\\-]");
|
1984
2437
|
}
|
1985
2438
|
}
|
1986
2439
|
}
|
1987
|
-
if (
|
1988
|
-
|
2440
|
+
if (result1 !== null) {
|
2441
|
+
result0 = [result0, result1];
|
1989
2442
|
} else {
|
1990
|
-
|
1991
|
-
pos =
|
2443
|
+
result0 = null;
|
2444
|
+
pos = clone(pos1);
|
1992
2445
|
}
|
1993
2446
|
} else {
|
1994
|
-
|
1995
|
-
pos =
|
1996
|
-
}
|
1997
|
-
|
1998
|
-
|
1999
|
-
|
2000
|
-
|
2001
|
-
|
2447
|
+
result0 = null;
|
2448
|
+
pos = clone(pos1);
|
2449
|
+
}
|
2450
|
+
if (result0 !== null) {
|
2451
|
+
result0 = (function(offset, line, column, h, t) { return h + t.join('') })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
|
2452
|
+
}
|
2453
|
+
if (result0 === null) {
|
2454
|
+
pos = clone(pos0);
|
2455
|
+
}
|
2456
|
+
reportFailures--;
|
2457
|
+
if (reportFailures === 0 && result0 === null) {
|
2002
2458
|
matchFailed("key");
|
2003
2459
|
}
|
2004
|
-
|
2005
|
-
cache[cacheKey] = {
|
2006
|
-
nextPos: pos,
|
2007
|
-
result: result0
|
2008
|
-
};
|
2009
2460
|
return result0;
|
2010
2461
|
}
|
2011
2462
|
|
2012
|
-
function
|
2013
|
-
var
|
2014
|
-
var
|
2015
|
-
|
2016
|
-
|
2017
|
-
|
2463
|
+
function parse_array() {
|
2464
|
+
var result0, result1, result2;
|
2465
|
+
var pos0, pos1, pos2, pos3;
|
2466
|
+
|
2467
|
+
reportFailures++;
|
2468
|
+
pos0 = clone(pos);
|
2469
|
+
pos1 = clone(pos);
|
2470
|
+
pos2 = clone(pos);
|
2471
|
+
pos3 = clone(pos);
|
2472
|
+
if (input.charCodeAt(pos.offset) === 91) {
|
2473
|
+
result0 = "[";
|
2474
|
+
advance(pos, 1);
|
2475
|
+
} else {
|
2476
|
+
result0 = null;
|
2477
|
+
if (reportFailures === 0) {
|
2478
|
+
matchFailed("\"[\"");
|
2479
|
+
}
|
2018
2480
|
}
|
2019
|
-
|
2020
|
-
|
2021
|
-
|
2022
|
-
|
2023
|
-
|
2024
|
-
|
2025
|
-
|
2481
|
+
if (result0 !== null) {
|
2482
|
+
if (/^[0-9]/.test(input.charAt(pos.offset))) {
|
2483
|
+
result2 = input.charAt(pos.offset);
|
2484
|
+
advance(pos, 1);
|
2485
|
+
} else {
|
2486
|
+
result2 = null;
|
2487
|
+
if (reportFailures === 0) {
|
2488
|
+
matchFailed("[0-9]");
|
2489
|
+
}
|
2490
|
+
}
|
2491
|
+
if (result2 !== null) {
|
2492
|
+
result1 = [];
|
2493
|
+
while (result2 !== null) {
|
2494
|
+
result1.push(result2);
|
2495
|
+
if (/^[0-9]/.test(input.charAt(pos.offset))) {
|
2496
|
+
result2 = input.charAt(pos.offset);
|
2497
|
+
advance(pos, 1);
|
2498
|
+
} else {
|
2499
|
+
result2 = null;
|
2500
|
+
if (reportFailures === 0) {
|
2501
|
+
matchFailed("[0-9]");
|
2502
|
+
}
|
2503
|
+
}
|
2504
|
+
}
|
2505
|
+
} else {
|
2506
|
+
result1 = null;
|
2507
|
+
}
|
2508
|
+
if (result1 !== null) {
|
2509
|
+
if (input.charCodeAt(pos.offset) === 93) {
|
2510
|
+
result2 = "]";
|
2511
|
+
advance(pos, 1);
|
2512
|
+
} else {
|
2513
|
+
result2 = null;
|
2514
|
+
if (reportFailures === 0) {
|
2515
|
+
matchFailed("\"]\"");
|
2516
|
+
}
|
2517
|
+
}
|
2518
|
+
if (result2 !== null) {
|
2519
|
+
result0 = [result0, result1, result2];
|
2520
|
+
} else {
|
2521
|
+
result0 = null;
|
2522
|
+
pos = clone(pos3);
|
2523
|
+
}
|
2524
|
+
} else {
|
2525
|
+
result0 = null;
|
2526
|
+
pos = clone(pos3);
|
2527
|
+
}
|
2528
|
+
} else {
|
2529
|
+
result0 = null;
|
2530
|
+
pos = clone(pos3);
|
2531
|
+
}
|
2532
|
+
if (result0 !== null) {
|
2533
|
+
result0 = (function(offset, line, column, a) {return a.join('')})(pos2.offset, pos2.line, pos2.column, result0[1]);
|
2534
|
+
}
|
2535
|
+
if (result0 === null) {
|
2536
|
+
pos = clone(pos2);
|
2537
|
+
}
|
2538
|
+
if (result0 !== null) {
|
2539
|
+
result1 = parse_array_part();
|
2540
|
+
result1 = result1 !== null ? result1 : "";
|
2541
|
+
if (result1 !== null) {
|
2542
|
+
result0 = [result0, result1];
|
2543
|
+
} else {
|
2544
|
+
result0 = null;
|
2545
|
+
pos = clone(pos1);
|
2546
|
+
}
|
2547
|
+
} else {
|
2548
|
+
result0 = null;
|
2549
|
+
pos = clone(pos1);
|
2550
|
+
}
|
2551
|
+
if (result0 !== null) {
|
2552
|
+
result0 = (function(offset, line, column, i, nk) { if(nk) { nk.unshift(i); } else {nk = [i] } return nk; })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
|
2553
|
+
}
|
2554
|
+
if (result0 === null) {
|
2555
|
+
pos = clone(pos0);
|
2556
|
+
}
|
2557
|
+
reportFailures--;
|
2558
|
+
if (reportFailures === 0 && result0 === null) {
|
2559
|
+
matchFailed("array");
|
2560
|
+
}
|
2561
|
+
return result0;
|
2562
|
+
}
|
2563
|
+
|
2564
|
+
function parse_array_part() {
|
2565
|
+
var result0, result1, result2;
|
2566
|
+
var pos0, pos1, pos2, pos3;
|
2567
|
+
|
2568
|
+
reportFailures++;
|
2569
|
+
pos0 = clone(pos);
|
2570
|
+
pos1 = clone(pos);
|
2571
|
+
pos2 = clone(pos);
|
2572
|
+
pos3 = clone(pos);
|
2573
|
+
if (input.charCodeAt(pos.offset) === 46) {
|
2574
|
+
result1 = ".";
|
2575
|
+
advance(pos, 1);
|
2576
|
+
} else {
|
2577
|
+
result1 = null;
|
2578
|
+
if (reportFailures === 0) {
|
2579
|
+
matchFailed("\".\"");
|
2580
|
+
}
|
2581
|
+
}
|
2582
|
+
if (result1 !== null) {
|
2583
|
+
result2 = parse_key();
|
2584
|
+
if (result2 !== null) {
|
2585
|
+
result1 = [result1, result2];
|
2586
|
+
} else {
|
2587
|
+
result1 = null;
|
2588
|
+
pos = clone(pos3);
|
2589
|
+
}
|
2590
|
+
} else {
|
2591
|
+
result1 = null;
|
2592
|
+
pos = clone(pos3);
|
2593
|
+
}
|
2594
|
+
if (result1 !== null) {
|
2595
|
+
result1 = (function(offset, line, column, k) {return k})(pos2.offset, pos2.line, pos2.column, result1[1]);
|
2596
|
+
}
|
2597
|
+
if (result1 === null) {
|
2598
|
+
pos = clone(pos2);
|
2599
|
+
}
|
2600
|
+
if (result1 !== null) {
|
2601
|
+
result0 = [];
|
2602
|
+
while (result1 !== null) {
|
2603
|
+
result0.push(result1);
|
2604
|
+
pos2 = clone(pos);
|
2605
|
+
pos3 = clone(pos);
|
2606
|
+
if (input.charCodeAt(pos.offset) === 46) {
|
2607
|
+
result1 = ".";
|
2608
|
+
advance(pos, 1);
|
2609
|
+
} else {
|
2610
|
+
result1 = null;
|
2611
|
+
if (reportFailures === 0) {
|
2612
|
+
matchFailed("\".\"");
|
2613
|
+
}
|
2614
|
+
}
|
2615
|
+
if (result1 !== null) {
|
2616
|
+
result2 = parse_key();
|
2617
|
+
if (result2 !== null) {
|
2618
|
+
result1 = [result1, result2];
|
2619
|
+
} else {
|
2620
|
+
result1 = null;
|
2621
|
+
pos = clone(pos3);
|
2622
|
+
}
|
2623
|
+
} else {
|
2624
|
+
result1 = null;
|
2625
|
+
pos = clone(pos3);
|
2626
|
+
}
|
2627
|
+
if (result1 !== null) {
|
2628
|
+
result1 = (function(offset, line, column, k) {return k})(pos2.offset, pos2.line, pos2.column, result1[1]);
|
2629
|
+
}
|
2630
|
+
if (result1 === null) {
|
2631
|
+
pos = clone(pos2);
|
2632
|
+
}
|
2633
|
+
}
|
2026
2634
|
} else {
|
2027
|
-
|
2028
|
-
|
2635
|
+
result0 = null;
|
2636
|
+
}
|
2637
|
+
if (result0 !== null) {
|
2638
|
+
result1 = parse_array();
|
2639
|
+
result1 = result1 !== null ? result1 : "";
|
2640
|
+
if (result1 !== null) {
|
2641
|
+
result0 = [result0, result1];
|
2642
|
+
} else {
|
2643
|
+
result0 = null;
|
2644
|
+
pos = clone(pos1);
|
2645
|
+
}
|
2646
|
+
} else {
|
2647
|
+
result0 = null;
|
2648
|
+
pos = clone(pos1);
|
2649
|
+
}
|
2650
|
+
if (result0 !== null) {
|
2651
|
+
result0 = (function(offset, line, column, d, a) { if (a) { return d.concat(a); } else { return d; } })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
|
2652
|
+
}
|
2653
|
+
if (result0 === null) {
|
2654
|
+
pos = clone(pos0);
|
2655
|
+
}
|
2656
|
+
reportFailures--;
|
2657
|
+
if (reportFailures === 0 && result0 === null) {
|
2658
|
+
matchFailed("array_part");
|
2659
|
+
}
|
2660
|
+
return result0;
|
2661
|
+
}
|
2662
|
+
|
2663
|
+
function parse_inline() {
|
2664
|
+
var result0, result1, result2;
|
2665
|
+
var pos0, pos1;
|
2666
|
+
|
2667
|
+
reportFailures++;
|
2668
|
+
pos0 = clone(pos);
|
2669
|
+
pos1 = clone(pos);
|
2670
|
+
if (input.charCodeAt(pos.offset) === 34) {
|
2671
|
+
result0 = "\"";
|
2672
|
+
advance(pos, 1);
|
2673
|
+
} else {
|
2674
|
+
result0 = null;
|
2675
|
+
if (reportFailures === 0) {
|
2029
2676
|
matchFailed("\"\\\"\"");
|
2030
2677
|
}
|
2031
2678
|
}
|
2032
|
-
if (
|
2033
|
-
if (input.
|
2034
|
-
|
2035
|
-
pos
|
2679
|
+
if (result0 !== null) {
|
2680
|
+
if (input.charCodeAt(pos.offset) === 34) {
|
2681
|
+
result1 = "\"";
|
2682
|
+
advance(pos, 1);
|
2036
2683
|
} else {
|
2037
|
-
|
2038
|
-
if (
|
2684
|
+
result1 = null;
|
2685
|
+
if (reportFailures === 0) {
|
2039
2686
|
matchFailed("\"\\\"\"");
|
2040
2687
|
}
|
2041
2688
|
}
|
2042
|
-
if (
|
2043
|
-
|
2689
|
+
if (result1 !== null) {
|
2690
|
+
result0 = [result0, result1];
|
2044
2691
|
} else {
|
2045
|
-
|
2046
|
-
pos =
|
2692
|
+
result0 = null;
|
2693
|
+
pos = clone(pos1);
|
2047
2694
|
}
|
2048
2695
|
} else {
|
2049
|
-
|
2050
|
-
pos =
|
2051
|
-
}
|
2052
|
-
|
2053
|
-
|
2054
|
-
|
2055
|
-
if (
|
2056
|
-
|
2057
|
-
}
|
2058
|
-
|
2059
|
-
|
2060
|
-
|
2061
|
-
|
2696
|
+
result0 = null;
|
2697
|
+
pos = clone(pos1);
|
2698
|
+
}
|
2699
|
+
if (result0 !== null) {
|
2700
|
+
result0 = (function(offset, line, column) { return ["literal", ""] })(pos0.offset, pos0.line, pos0.column);
|
2701
|
+
}
|
2702
|
+
if (result0 === null) {
|
2703
|
+
pos = clone(pos0);
|
2704
|
+
}
|
2705
|
+
if (result0 === null) {
|
2706
|
+
pos0 = clone(pos);
|
2707
|
+
pos1 = clone(pos);
|
2708
|
+
if (input.charCodeAt(pos.offset) === 34) {
|
2709
|
+
result0 = "\"";
|
2710
|
+
advance(pos, 1);
|
2062
2711
|
} else {
|
2063
|
-
|
2064
|
-
if (
|
2712
|
+
result0 = null;
|
2713
|
+
if (reportFailures === 0) {
|
2065
2714
|
matchFailed("\"\\\"\"");
|
2066
2715
|
}
|
2067
2716
|
}
|
2068
|
-
if (
|
2069
|
-
|
2070
|
-
if (
|
2071
|
-
if (input.
|
2072
|
-
|
2073
|
-
pos
|
2717
|
+
if (result0 !== null) {
|
2718
|
+
result1 = parse_literal();
|
2719
|
+
if (result1 !== null) {
|
2720
|
+
if (input.charCodeAt(pos.offset) === 34) {
|
2721
|
+
result2 = "\"";
|
2722
|
+
advance(pos, 1);
|
2074
2723
|
} else {
|
2075
|
-
|
2076
|
-
if (
|
2724
|
+
result2 = null;
|
2725
|
+
if (reportFailures === 0) {
|
2077
2726
|
matchFailed("\"\\\"\"");
|
2078
2727
|
}
|
2079
2728
|
}
|
2080
|
-
if (
|
2081
|
-
|
2729
|
+
if (result2 !== null) {
|
2730
|
+
result0 = [result0, result1, result2];
|
2082
2731
|
} else {
|
2083
|
-
|
2084
|
-
pos =
|
2732
|
+
result0 = null;
|
2733
|
+
pos = clone(pos1);
|
2085
2734
|
}
|
2086
2735
|
} else {
|
2087
|
-
|
2088
|
-
pos =
|
2736
|
+
result0 = null;
|
2737
|
+
pos = clone(pos1);
|
2089
2738
|
}
|
2090
2739
|
} else {
|
2091
|
-
|
2092
|
-
pos =
|
2093
|
-
}
|
2094
|
-
|
2095
|
-
|
2096
|
-
|
2097
|
-
if (
|
2098
|
-
|
2099
|
-
}
|
2100
|
-
|
2101
|
-
|
2102
|
-
|
2103
|
-
|
2740
|
+
result0 = null;
|
2741
|
+
pos = clone(pos1);
|
2742
|
+
}
|
2743
|
+
if (result0 !== null) {
|
2744
|
+
result0 = (function(offset, line, column, l) { return ["literal", l] })(pos0.offset, pos0.line, pos0.column, result0[1]);
|
2745
|
+
}
|
2746
|
+
if (result0 === null) {
|
2747
|
+
pos = clone(pos0);
|
2748
|
+
}
|
2749
|
+
if (result0 === null) {
|
2750
|
+
pos0 = clone(pos);
|
2751
|
+
pos1 = clone(pos);
|
2752
|
+
if (input.charCodeAt(pos.offset) === 34) {
|
2753
|
+
result0 = "\"";
|
2754
|
+
advance(pos, 1);
|
2104
2755
|
} else {
|
2105
|
-
|
2106
|
-
if (
|
2756
|
+
result0 = null;
|
2757
|
+
if (reportFailures === 0) {
|
2107
2758
|
matchFailed("\"\\\"\"");
|
2108
2759
|
}
|
2109
2760
|
}
|
2110
|
-
if (
|
2111
|
-
|
2112
|
-
if (
|
2113
|
-
|
2114
|
-
while (
|
2115
|
-
|
2116
|
-
|
2761
|
+
if (result0 !== null) {
|
2762
|
+
result2 = parse_inline_part();
|
2763
|
+
if (result2 !== null) {
|
2764
|
+
result1 = [];
|
2765
|
+
while (result2 !== null) {
|
2766
|
+
result1.push(result2);
|
2767
|
+
result2 = parse_inline_part();
|
2117
2768
|
}
|
2118
2769
|
} else {
|
2119
|
-
|
2770
|
+
result1 = null;
|
2120
2771
|
}
|
2121
|
-
if (
|
2122
|
-
if (input.
|
2123
|
-
|
2124
|
-
pos
|
2772
|
+
if (result1 !== null) {
|
2773
|
+
if (input.charCodeAt(pos.offset) === 34) {
|
2774
|
+
result2 = "\"";
|
2775
|
+
advance(pos, 1);
|
2125
2776
|
} else {
|
2126
|
-
|
2127
|
-
if (
|
2777
|
+
result2 = null;
|
2778
|
+
if (reportFailures === 0) {
|
2128
2779
|
matchFailed("\"\\\"\"");
|
2129
2780
|
}
|
2130
2781
|
}
|
2131
|
-
if (
|
2132
|
-
|
2782
|
+
if (result2 !== null) {
|
2783
|
+
result0 = [result0, result1, result2];
|
2133
2784
|
} else {
|
2134
|
-
|
2135
|
-
pos =
|
2785
|
+
result0 = null;
|
2786
|
+
pos = clone(pos1);
|
2136
2787
|
}
|
2137
2788
|
} else {
|
2138
|
-
|
2139
|
-
pos =
|
2789
|
+
result0 = null;
|
2790
|
+
pos = clone(pos1);
|
2140
2791
|
}
|
2141
2792
|
} else {
|
2142
|
-
|
2143
|
-
pos =
|
2793
|
+
result0 = null;
|
2794
|
+
pos = clone(pos1);
|
2144
2795
|
}
|
2145
|
-
|
2146
|
-
|
2147
|
-
|
2148
|
-
if (
|
2149
|
-
|
2150
|
-
}
|
2151
|
-
|
2152
|
-
};
|
2153
|
-
};
|
2796
|
+
if (result0 !== null) {
|
2797
|
+
result0 = (function(offset, line, column, p) { return ["body"].concat(p) })(pos0.offset, pos0.line, pos0.column, result0[1]);
|
2798
|
+
}
|
2799
|
+
if (result0 === null) {
|
2800
|
+
pos = clone(pos0);
|
2801
|
+
}
|
2802
|
+
}
|
2154
2803
|
}
|
2155
|
-
|
2156
|
-
if (
|
2804
|
+
reportFailures--;
|
2805
|
+
if (reportFailures === 0 && result0 === null) {
|
2157
2806
|
matchFailed("inline");
|
2158
2807
|
}
|
2159
|
-
|
2160
|
-
cache[cacheKey] = {
|
2161
|
-
nextPos: pos,
|
2162
|
-
result: result0
|
2163
|
-
};
|
2164
2808
|
return result0;
|
2165
2809
|
}
|
2166
2810
|
|
2167
2811
|
function parse_inline_part() {
|
2168
|
-
var
|
2169
|
-
var
|
2170
|
-
|
2171
|
-
|
2172
|
-
|
2173
|
-
|
2174
|
-
|
2175
|
-
|
2176
|
-
|
2177
|
-
|
2178
|
-
|
2179
|
-
|
2180
|
-
|
2181
|
-
|
2182
|
-
|
2183
|
-
}
|
2184
|
-
var result2 = parse_literal();
|
2185
|
-
var result1 = result2 !== null
|
2186
|
-
? (function(l) { return ["buffer", l] })(result2)
|
2187
|
-
: null;
|
2188
|
-
if (result1 !== null) {
|
2189
|
-
var result0 = result1;
|
2190
|
-
} else {
|
2191
|
-
var result0 = null;;
|
2192
|
-
};
|
2193
|
-
};
|
2812
|
+
var result0;
|
2813
|
+
var pos0;
|
2814
|
+
|
2815
|
+
result0 = parse_special();
|
2816
|
+
if (result0 === null) {
|
2817
|
+
result0 = parse_reference();
|
2818
|
+
if (result0 === null) {
|
2819
|
+
pos0 = clone(pos);
|
2820
|
+
result0 = parse_literal();
|
2821
|
+
if (result0 !== null) {
|
2822
|
+
result0 = (function(offset, line, column, l) { return ["buffer", l] })(pos0.offset, pos0.line, pos0.column, result0);
|
2823
|
+
}
|
2824
|
+
if (result0 === null) {
|
2825
|
+
pos = clone(pos0);
|
2826
|
+
}
|
2827
|
+
}
|
2194
2828
|
}
|
2195
|
-
|
2196
|
-
|
2197
|
-
|
2198
|
-
cache[cacheKey] = {
|
2199
|
-
nextPos: pos,
|
2200
|
-
result: result0
|
2201
|
-
};
|
2202
2829
|
return result0;
|
2203
2830
|
}
|
2204
2831
|
|
2205
2832
|
function parse_buffer() {
|
2206
|
-
var
|
2207
|
-
var
|
2208
|
-
|
2209
|
-
|
2210
|
-
|
2211
|
-
|
2212
|
-
|
2213
|
-
|
2214
|
-
|
2215
|
-
|
2216
|
-
|
2217
|
-
|
2218
|
-
|
2219
|
-
|
2220
|
-
|
2221
|
-
|
2222
|
-
var result16 = parse_ws();
|
2223
|
-
}
|
2224
|
-
if (result15 !== null) {
|
2225
|
-
var result13 = [result14, result15];
|
2833
|
+
var result0, result1, result2, result3, result4;
|
2834
|
+
var pos0, pos1, pos2, pos3;
|
2835
|
+
|
2836
|
+
reportFailures++;
|
2837
|
+
pos0 = clone(pos);
|
2838
|
+
pos1 = clone(pos);
|
2839
|
+
result0 = parse_eol();
|
2840
|
+
if (result0 !== null) {
|
2841
|
+
result1 = [];
|
2842
|
+
result2 = parse_ws();
|
2843
|
+
while (result2 !== null) {
|
2844
|
+
result1.push(result2);
|
2845
|
+
result2 = parse_ws();
|
2846
|
+
}
|
2847
|
+
if (result1 !== null) {
|
2848
|
+
result0 = [result0, result1];
|
2226
2849
|
} else {
|
2227
|
-
|
2228
|
-
pos =
|
2850
|
+
result0 = null;
|
2851
|
+
pos = clone(pos1);
|
2229
2852
|
}
|
2230
2853
|
} else {
|
2231
|
-
|
2232
|
-
pos =
|
2233
|
-
}
|
2234
|
-
|
2235
|
-
|
2236
|
-
|
2237
|
-
if (
|
2238
|
-
|
2239
|
-
}
|
2240
|
-
|
2241
|
-
|
2242
|
-
|
2243
|
-
|
2244
|
-
|
2245
|
-
|
2246
|
-
|
2247
|
-
|
2854
|
+
result0 = null;
|
2855
|
+
pos = clone(pos1);
|
2856
|
+
}
|
2857
|
+
if (result0 !== null) {
|
2858
|
+
result0 = (function(offset, line, column, e, w) { return ["format", e, w.join('')] })(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
|
2859
|
+
}
|
2860
|
+
if (result0 === null) {
|
2861
|
+
pos = clone(pos0);
|
2862
|
+
}
|
2863
|
+
if (result0 === null) {
|
2864
|
+
pos0 = clone(pos);
|
2865
|
+
pos1 = clone(pos);
|
2866
|
+
pos2 = clone(pos);
|
2867
|
+
pos3 = clone(pos);
|
2868
|
+
reportFailures++;
|
2869
|
+
result1 = parse_tag();
|
2870
|
+
reportFailures--;
|
2871
|
+
if (result1 === null) {
|
2872
|
+
result1 = "";
|
2248
2873
|
} else {
|
2249
|
-
|
2250
|
-
pos =
|
2251
|
-
}
|
2252
|
-
if (
|
2253
|
-
|
2254
|
-
|
2255
|
-
|
2256
|
-
|
2257
|
-
|
2258
|
-
|
2259
|
-
var result6 = '';
|
2874
|
+
result1 = null;
|
2875
|
+
pos = clone(pos3);
|
2876
|
+
}
|
2877
|
+
if (result1 !== null) {
|
2878
|
+
pos3 = clone(pos);
|
2879
|
+
reportFailures++;
|
2880
|
+
result2 = parse_eol();
|
2881
|
+
reportFailures--;
|
2882
|
+
if (result2 === null) {
|
2883
|
+
result2 = "";
|
2260
2884
|
} else {
|
2261
|
-
|
2262
|
-
pos =
|
2263
|
-
}
|
2264
|
-
if (
|
2265
|
-
|
2266
|
-
|
2267
|
-
|
2268
|
-
|
2269
|
-
|
2270
|
-
|
2271
|
-
var result7 = '';
|
2885
|
+
result2 = null;
|
2886
|
+
pos = clone(pos3);
|
2887
|
+
}
|
2888
|
+
if (result2 !== null) {
|
2889
|
+
pos3 = clone(pos);
|
2890
|
+
reportFailures++;
|
2891
|
+
result3 = parse_comment();
|
2892
|
+
reportFailures--;
|
2893
|
+
if (result3 === null) {
|
2894
|
+
result3 = "";
|
2272
2895
|
} else {
|
2273
|
-
|
2274
|
-
pos =
|
2896
|
+
result3 = null;
|
2897
|
+
pos = clone(pos3);
|
2275
2898
|
}
|
2276
|
-
if (
|
2277
|
-
if (input.length > pos) {
|
2278
|
-
|
2279
|
-
pos
|
2899
|
+
if (result3 !== null) {
|
2900
|
+
if (input.length > pos.offset) {
|
2901
|
+
result4 = input.charAt(pos.offset);
|
2902
|
+
advance(pos, 1);
|
2280
2903
|
} else {
|
2281
|
-
|
2282
|
-
if (
|
2283
|
-
matchFailed(
|
2904
|
+
result4 = null;
|
2905
|
+
if (reportFailures === 0) {
|
2906
|
+
matchFailed("any character");
|
2284
2907
|
}
|
2285
2908
|
}
|
2286
|
-
if (
|
2287
|
-
|
2909
|
+
if (result4 !== null) {
|
2910
|
+
result1 = [result1, result2, result3, result4];
|
2288
2911
|
} else {
|
2289
|
-
|
2290
|
-
pos =
|
2912
|
+
result1 = null;
|
2913
|
+
pos = clone(pos2);
|
2291
2914
|
}
|
2292
2915
|
} else {
|
2293
|
-
|
2294
|
-
pos =
|
2916
|
+
result1 = null;
|
2917
|
+
pos = clone(pos2);
|
2295
2918
|
}
|
2296
2919
|
} else {
|
2297
|
-
|
2298
|
-
pos =
|
2920
|
+
result1 = null;
|
2921
|
+
pos = clone(pos2);
|
2299
2922
|
}
|
2300
2923
|
} else {
|
2301
|
-
|
2302
|
-
pos =
|
2303
|
-
}
|
2304
|
-
|
2305
|
-
|
2306
|
-
|
2307
|
-
if (
|
2308
|
-
|
2309
|
-
|
2310
|
-
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2314
|
-
|
2315
|
-
|
2316
|
-
|
2317
|
-
|
2318
|
-
|
2924
|
+
result1 = null;
|
2925
|
+
pos = clone(pos2);
|
2926
|
+
}
|
2927
|
+
if (result1 !== null) {
|
2928
|
+
result1 = (function(offset, line, column, c) {return c})(pos1.offset, pos1.line, pos1.column, result1[3]);
|
2929
|
+
}
|
2930
|
+
if (result1 === null) {
|
2931
|
+
pos = clone(pos1);
|
2932
|
+
}
|
2933
|
+
if (result1 !== null) {
|
2934
|
+
result0 = [];
|
2935
|
+
while (result1 !== null) {
|
2936
|
+
result0.push(result1);
|
2937
|
+
pos1 = clone(pos);
|
2938
|
+
pos2 = clone(pos);
|
2939
|
+
pos3 = clone(pos);
|
2940
|
+
reportFailures++;
|
2941
|
+
result1 = parse_tag();
|
2942
|
+
reportFailures--;
|
2943
|
+
if (result1 === null) {
|
2944
|
+
result1 = "";
|
2319
2945
|
} else {
|
2320
|
-
|
2321
|
-
pos =
|
2946
|
+
result1 = null;
|
2947
|
+
pos = clone(pos3);
|
2322
2948
|
}
|
2323
|
-
if (
|
2324
|
-
|
2325
|
-
|
2326
|
-
|
2327
|
-
|
2328
|
-
|
2329
|
-
|
2330
|
-
var result6 = '';
|
2949
|
+
if (result1 !== null) {
|
2950
|
+
pos3 = clone(pos);
|
2951
|
+
reportFailures++;
|
2952
|
+
result2 = parse_eol();
|
2953
|
+
reportFailures--;
|
2954
|
+
if (result2 === null) {
|
2955
|
+
result2 = "";
|
2331
2956
|
} else {
|
2332
|
-
|
2333
|
-
pos =
|
2957
|
+
result2 = null;
|
2958
|
+
pos = clone(pos3);
|
2334
2959
|
}
|
2335
|
-
if (
|
2336
|
-
|
2337
|
-
|
2338
|
-
|
2339
|
-
|
2340
|
-
|
2341
|
-
|
2342
|
-
var result7 = '';
|
2960
|
+
if (result2 !== null) {
|
2961
|
+
pos3 = clone(pos);
|
2962
|
+
reportFailures++;
|
2963
|
+
result3 = parse_comment();
|
2964
|
+
reportFailures--;
|
2965
|
+
if (result3 === null) {
|
2966
|
+
result3 = "";
|
2343
2967
|
} else {
|
2344
|
-
|
2345
|
-
pos =
|
2968
|
+
result3 = null;
|
2969
|
+
pos = clone(pos3);
|
2346
2970
|
}
|
2347
|
-
if (
|
2348
|
-
if (input.length > pos) {
|
2349
|
-
|
2350
|
-
pos
|
2971
|
+
if (result3 !== null) {
|
2972
|
+
if (input.length > pos.offset) {
|
2973
|
+
result4 = input.charAt(pos.offset);
|
2974
|
+
advance(pos, 1);
|
2351
2975
|
} else {
|
2352
|
-
|
2353
|
-
if (
|
2354
|
-
matchFailed(
|
2976
|
+
result4 = null;
|
2977
|
+
if (reportFailures === 0) {
|
2978
|
+
matchFailed("any character");
|
2355
2979
|
}
|
2356
2980
|
}
|
2357
|
-
if (
|
2358
|
-
|
2981
|
+
if (result4 !== null) {
|
2982
|
+
result1 = [result1, result2, result3, result4];
|
2359
2983
|
} else {
|
2360
|
-
|
2361
|
-
pos =
|
2984
|
+
result1 = null;
|
2985
|
+
pos = clone(pos2);
|
2362
2986
|
}
|
2363
2987
|
} else {
|
2364
|
-
|
2365
|
-
pos =
|
2988
|
+
result1 = null;
|
2989
|
+
pos = clone(pos2);
|
2366
2990
|
}
|
2367
2991
|
} else {
|
2368
|
-
|
2369
|
-
pos =
|
2992
|
+
result1 = null;
|
2993
|
+
pos = clone(pos2);
|
2370
2994
|
}
|
2371
2995
|
} else {
|
2372
|
-
|
2373
|
-
pos =
|
2996
|
+
result1 = null;
|
2997
|
+
pos = clone(pos2);
|
2998
|
+
}
|
2999
|
+
if (result1 !== null) {
|
3000
|
+
result1 = (function(offset, line, column, c) {return c})(pos1.offset, pos1.line, pos1.column, result1[3]);
|
3001
|
+
}
|
3002
|
+
if (result1 === null) {
|
3003
|
+
pos = clone(pos1);
|
2374
3004
|
}
|
2375
|
-
var result3 = result4 !== null
|
2376
|
-
? (function(c) {return c})(result4[3])
|
2377
|
-
: null;
|
2378
3005
|
}
|
2379
3006
|
} else {
|
2380
|
-
|
3007
|
+
result0 = null;
|
3008
|
+
}
|
3009
|
+
if (result0 !== null) {
|
3010
|
+
result0 = (function(offset, line, column, b) { return ["buffer", b.join('')] })(pos0.offset, pos0.line, pos0.column, result0);
|
3011
|
+
}
|
3012
|
+
if (result0 === null) {
|
3013
|
+
pos = clone(pos0);
|
2381
3014
|
}
|
2382
|
-
var result1 = result2 !== null
|
2383
|
-
? (function(b) { return ["buffer", b.join('')] })(result2)
|
2384
|
-
: null;
|
2385
|
-
if (result1 !== null) {
|
2386
|
-
var result0 = result1;
|
2387
|
-
} else {
|
2388
|
-
var result0 = null;;
|
2389
|
-
};
|
2390
3015
|
}
|
2391
|
-
|
2392
|
-
if (
|
3016
|
+
reportFailures--;
|
3017
|
+
if (reportFailures === 0 && result0 === null) {
|
2393
3018
|
matchFailed("buffer");
|
2394
3019
|
}
|
2395
|
-
|
2396
|
-
cache[cacheKey] = {
|
2397
|
-
nextPos: pos,
|
2398
|
-
result: result0
|
2399
|
-
};
|
2400
3020
|
return result0;
|
2401
3021
|
}
|
2402
3022
|
|
2403
3023
|
function parse_literal() {
|
2404
|
-
var
|
2405
|
-
var
|
2406
|
-
|
2407
|
-
|
2408
|
-
|
2409
|
-
|
2410
|
-
|
2411
|
-
|
2412
|
-
|
2413
|
-
|
2414
|
-
|
2415
|
-
|
2416
|
-
|
2417
|
-
var result10 = parse_tag();
|
2418
|
-
reportMatchFailures = savedReportMatchFailuresVar1;
|
2419
|
-
if (result10 === null) {
|
2420
|
-
var result4 = '';
|
3024
|
+
var result0, result1, result2;
|
3025
|
+
var pos0, pos1, pos2, pos3;
|
3026
|
+
|
3027
|
+
reportFailures++;
|
3028
|
+
pos0 = clone(pos);
|
3029
|
+
pos1 = clone(pos);
|
3030
|
+
pos2 = clone(pos);
|
3031
|
+
pos3 = clone(pos);
|
3032
|
+
reportFailures++;
|
3033
|
+
result1 = parse_tag();
|
3034
|
+
reportFailures--;
|
3035
|
+
if (result1 === null) {
|
3036
|
+
result1 = "";
|
2421
3037
|
} else {
|
2422
|
-
|
2423
|
-
pos =
|
2424
|
-
}
|
2425
|
-
if (
|
2426
|
-
|
2427
|
-
|
2428
|
-
|
2429
|
-
|
2430
|
-
|
2431
|
-
if (result9 === null) {
|
2432
|
-
var result5 = '';
|
2433
|
-
} else {
|
2434
|
-
var result5 = null;
|
2435
|
-
pos = savedPos1;
|
2436
|
-
}
|
2437
|
-
if (result5 !== null) {
|
2438
|
-
var result8 = parse_esc();
|
2439
|
-
if (result8 !== null) {
|
2440
|
-
var result6 = result8;
|
3038
|
+
result1 = null;
|
3039
|
+
pos = clone(pos3);
|
3040
|
+
}
|
3041
|
+
if (result1 !== null) {
|
3042
|
+
result2 = parse_esc();
|
3043
|
+
if (result2 === null) {
|
3044
|
+
if (/^[^"]/.test(input.charAt(pos.offset))) {
|
3045
|
+
result2 = input.charAt(pos.offset);
|
3046
|
+
advance(pos, 1);
|
2441
3047
|
} else {
|
2442
|
-
|
2443
|
-
|
2444
|
-
|
2445
|
-
} else {
|
2446
|
-
var result7 = null;
|
2447
|
-
if (reportMatchFailures) {
|
2448
|
-
matchFailed("[^\"]");
|
2449
|
-
}
|
3048
|
+
result2 = null;
|
3049
|
+
if (reportFailures === 0) {
|
3050
|
+
matchFailed("[^\"]");
|
2450
3051
|
}
|
2451
|
-
if (result7 !== null) {
|
2452
|
-
var result6 = result7;
|
2453
|
-
} else {
|
2454
|
-
var result6 = null;;
|
2455
|
-
};
|
2456
|
-
}
|
2457
|
-
if (result6 !== null) {
|
2458
|
-
var result3 = [result4, result5, result6];
|
2459
|
-
} else {
|
2460
|
-
var result3 = null;
|
2461
|
-
pos = savedPos0;
|
2462
3052
|
}
|
3053
|
+
}
|
3054
|
+
if (result2 !== null) {
|
3055
|
+
result1 = [result1, result2];
|
2463
3056
|
} else {
|
2464
|
-
|
2465
|
-
pos =
|
3057
|
+
result1 = null;
|
3058
|
+
pos = clone(pos2);
|
2466
3059
|
}
|
2467
3060
|
} else {
|
2468
|
-
|
2469
|
-
pos =
|
2470
|
-
}
|
2471
|
-
|
2472
|
-
|
2473
|
-
|
2474
|
-
if (
|
2475
|
-
|
2476
|
-
|
2477
|
-
|
2478
|
-
|
2479
|
-
|
2480
|
-
|
2481
|
-
|
2482
|
-
|
2483
|
-
|
2484
|
-
|
2485
|
-
|
3061
|
+
result1 = null;
|
3062
|
+
pos = clone(pos2);
|
3063
|
+
}
|
3064
|
+
if (result1 !== null) {
|
3065
|
+
result1 = (function(offset, line, column, c) {return c})(pos1.offset, pos1.line, pos1.column, result1[1]);
|
3066
|
+
}
|
3067
|
+
if (result1 === null) {
|
3068
|
+
pos = clone(pos1);
|
3069
|
+
}
|
3070
|
+
if (result1 !== null) {
|
3071
|
+
result0 = [];
|
3072
|
+
while (result1 !== null) {
|
3073
|
+
result0.push(result1);
|
3074
|
+
pos1 = clone(pos);
|
3075
|
+
pos2 = clone(pos);
|
3076
|
+
pos3 = clone(pos);
|
3077
|
+
reportFailures++;
|
3078
|
+
result1 = parse_tag();
|
3079
|
+
reportFailures--;
|
3080
|
+
if (result1 === null) {
|
3081
|
+
result1 = "";
|
2486
3082
|
} else {
|
2487
|
-
|
2488
|
-
pos =
|
2489
|
-
}
|
2490
|
-
if (
|
2491
|
-
|
2492
|
-
|
2493
|
-
|
2494
|
-
|
2495
|
-
|
2496
|
-
if (result9 === null) {
|
2497
|
-
var result5 = '';
|
2498
|
-
} else {
|
2499
|
-
var result5 = null;
|
2500
|
-
pos = savedPos1;
|
2501
|
-
}
|
2502
|
-
if (result5 !== null) {
|
2503
|
-
var result8 = parse_esc();
|
2504
|
-
if (result8 !== null) {
|
2505
|
-
var result6 = result8;
|
3083
|
+
result1 = null;
|
3084
|
+
pos = clone(pos3);
|
3085
|
+
}
|
3086
|
+
if (result1 !== null) {
|
3087
|
+
result2 = parse_esc();
|
3088
|
+
if (result2 === null) {
|
3089
|
+
if (/^[^"]/.test(input.charAt(pos.offset))) {
|
3090
|
+
result2 = input.charAt(pos.offset);
|
3091
|
+
advance(pos, 1);
|
2506
3092
|
} else {
|
2507
|
-
|
2508
|
-
|
2509
|
-
|
2510
|
-
} else {
|
2511
|
-
var result7 = null;
|
2512
|
-
if (reportMatchFailures) {
|
2513
|
-
matchFailed("[^\"]");
|
2514
|
-
}
|
3093
|
+
result2 = null;
|
3094
|
+
if (reportFailures === 0) {
|
3095
|
+
matchFailed("[^\"]");
|
2515
3096
|
}
|
2516
|
-
if (result7 !== null) {
|
2517
|
-
var result6 = result7;
|
2518
|
-
} else {
|
2519
|
-
var result6 = null;;
|
2520
|
-
};
|
2521
|
-
}
|
2522
|
-
if (result6 !== null) {
|
2523
|
-
var result3 = [result4, result5, result6];
|
2524
|
-
} else {
|
2525
|
-
var result3 = null;
|
2526
|
-
pos = savedPos0;
|
2527
3097
|
}
|
3098
|
+
}
|
3099
|
+
if (result2 !== null) {
|
3100
|
+
result1 = [result1, result2];
|
2528
3101
|
} else {
|
2529
|
-
|
2530
|
-
pos =
|
3102
|
+
result1 = null;
|
3103
|
+
pos = clone(pos2);
|
2531
3104
|
}
|
2532
3105
|
} else {
|
2533
|
-
|
2534
|
-
pos =
|
3106
|
+
result1 = null;
|
3107
|
+
pos = clone(pos2);
|
3108
|
+
}
|
3109
|
+
if (result1 !== null) {
|
3110
|
+
result1 = (function(offset, line, column, c) {return c})(pos1.offset, pos1.line, pos1.column, result1[1]);
|
3111
|
+
}
|
3112
|
+
if (result1 === null) {
|
3113
|
+
pos = clone(pos1);
|
2535
3114
|
}
|
2536
|
-
var result2 = result3 !== null
|
2537
|
-
? (function(c) {return c})(result3[2])
|
2538
|
-
: null;
|
2539
3115
|
}
|
2540
3116
|
} else {
|
2541
|
-
|
3117
|
+
result0 = null;
|
2542
3118
|
}
|
2543
|
-
|
2544
|
-
|
2545
|
-
|
2546
|
-
|
2547
|
-
|
3119
|
+
if (result0 !== null) {
|
3120
|
+
result0 = (function(offset, line, column, b) { return b.join('') })(pos0.offset, pos0.line, pos0.column, result0);
|
3121
|
+
}
|
3122
|
+
if (result0 === null) {
|
3123
|
+
pos = clone(pos0);
|
3124
|
+
}
|
3125
|
+
reportFailures--;
|
3126
|
+
if (reportFailures === 0 && result0 === null) {
|
2548
3127
|
matchFailed("literal");
|
2549
3128
|
}
|
2550
|
-
|
2551
|
-
cache[cacheKey] = {
|
2552
|
-
nextPos: pos,
|
2553
|
-
result: result0
|
2554
|
-
};
|
2555
3129
|
return result0;
|
2556
3130
|
}
|
2557
3131
|
|
2558
3132
|
function parse_esc() {
|
2559
|
-
var
|
2560
|
-
var
|
2561
|
-
if (cachedResult) {
|
2562
|
-
pos = cachedResult.nextPos;
|
2563
|
-
return cachedResult.result;
|
2564
|
-
}
|
3133
|
+
var result0;
|
3134
|
+
var pos0;
|
2565
3135
|
|
2566
|
-
|
2567
|
-
if (input.substr(pos, 2) === "\\\"") {
|
2568
|
-
|
2569
|
-
pos
|
3136
|
+
pos0 = clone(pos);
|
3137
|
+
if (input.substr(pos.offset, 2) === "\\\"") {
|
3138
|
+
result0 = "\\\"";
|
3139
|
+
advance(pos, 2);
|
2570
3140
|
} else {
|
2571
|
-
|
2572
|
-
if (
|
3141
|
+
result0 = null;
|
3142
|
+
if (reportFailures === 0) {
|
2573
3143
|
matchFailed("\"\\\\\\\"\"");
|
2574
3144
|
}
|
2575
3145
|
}
|
2576
|
-
|
2577
|
-
|
2578
|
-
|
2579
|
-
|
2580
|
-
|
2581
|
-
|
2582
|
-
cache[cacheKey] = {
|
2583
|
-
nextPos: pos,
|
2584
|
-
result: result0
|
2585
|
-
};
|
3146
|
+
if (result0 !== null) {
|
3147
|
+
result0 = (function(offset, line, column) { return '"' })(pos0.offset, pos0.line, pos0.column);
|
3148
|
+
}
|
3149
|
+
if (result0 === null) {
|
3150
|
+
pos = clone(pos0);
|
3151
|
+
}
|
2586
3152
|
return result0;
|
2587
3153
|
}
|
2588
3154
|
|
2589
3155
|
function parse_comment() {
|
2590
|
-
var
|
2591
|
-
var
|
2592
|
-
|
2593
|
-
|
2594
|
-
|
2595
|
-
|
2596
|
-
|
2597
|
-
|
2598
|
-
|
2599
|
-
var savedPos0 = pos;
|
2600
|
-
if (input.substr(pos, 2) === "{!") {
|
2601
|
-
var result2 = "{!";
|
2602
|
-
pos += 2;
|
3156
|
+
var result0, result1, result2, result3;
|
3157
|
+
var pos0, pos1, pos2, pos3, pos4;
|
3158
|
+
|
3159
|
+
reportFailures++;
|
3160
|
+
pos0 = clone(pos);
|
3161
|
+
pos1 = clone(pos);
|
3162
|
+
if (input.substr(pos.offset, 2) === "{!") {
|
3163
|
+
result0 = "{!";
|
3164
|
+
advance(pos, 2);
|
2603
3165
|
} else {
|
2604
|
-
|
2605
|
-
if (
|
3166
|
+
result0 = null;
|
3167
|
+
if (reportFailures === 0) {
|
2606
3168
|
matchFailed("\"{!\"");
|
2607
3169
|
}
|
2608
3170
|
}
|
2609
|
-
if (
|
2610
|
-
|
2611
|
-
|
2612
|
-
|
2613
|
-
|
2614
|
-
|
2615
|
-
if (input.substr(pos, 2) === "!}") {
|
2616
|
-
|
2617
|
-
pos
|
3171
|
+
if (result0 !== null) {
|
3172
|
+
result1 = [];
|
3173
|
+
pos2 = clone(pos);
|
3174
|
+
pos3 = clone(pos);
|
3175
|
+
pos4 = clone(pos);
|
3176
|
+
reportFailures++;
|
3177
|
+
if (input.substr(pos.offset, 2) === "!}") {
|
3178
|
+
result2 = "!}";
|
3179
|
+
advance(pos, 2);
|
2618
3180
|
} else {
|
2619
|
-
|
2620
|
-
if (
|
3181
|
+
result2 = null;
|
3182
|
+
if (reportFailures === 0) {
|
2621
3183
|
matchFailed("\"!}\"");
|
2622
3184
|
}
|
2623
3185
|
}
|
2624
|
-
|
2625
|
-
if (
|
2626
|
-
|
3186
|
+
reportFailures--;
|
3187
|
+
if (result2 === null) {
|
3188
|
+
result2 = "";
|
2627
3189
|
} else {
|
2628
|
-
|
2629
|
-
pos =
|
3190
|
+
result2 = null;
|
3191
|
+
pos = clone(pos4);
|
2630
3192
|
}
|
2631
|
-
if (
|
2632
|
-
if (input.length > pos) {
|
2633
|
-
|
2634
|
-
pos
|
3193
|
+
if (result2 !== null) {
|
3194
|
+
if (input.length > pos.offset) {
|
3195
|
+
result3 = input.charAt(pos.offset);
|
3196
|
+
advance(pos, 1);
|
2635
3197
|
} else {
|
2636
|
-
|
2637
|
-
if (
|
2638
|
-
matchFailed(
|
3198
|
+
result3 = null;
|
3199
|
+
if (reportFailures === 0) {
|
3200
|
+
matchFailed("any character");
|
2639
3201
|
}
|
2640
3202
|
}
|
2641
|
-
if (
|
2642
|
-
|
3203
|
+
if (result3 !== null) {
|
3204
|
+
result2 = [result2, result3];
|
2643
3205
|
} else {
|
2644
|
-
|
2645
|
-
pos =
|
3206
|
+
result2 = null;
|
3207
|
+
pos = clone(pos3);
|
2646
3208
|
}
|
2647
3209
|
} else {
|
2648
|
-
|
2649
|
-
pos =
|
2650
|
-
}
|
2651
|
-
|
2652
|
-
|
2653
|
-
|
2654
|
-
|
2655
|
-
|
2656
|
-
|
2657
|
-
|
2658
|
-
|
2659
|
-
|
2660
|
-
|
2661
|
-
|
2662
|
-
|
3210
|
+
result2 = null;
|
3211
|
+
pos = clone(pos3);
|
3212
|
+
}
|
3213
|
+
if (result2 !== null) {
|
3214
|
+
result2 = (function(offset, line, column, c) {return c})(pos2.offset, pos2.line, pos2.column, result2[1]);
|
3215
|
+
}
|
3216
|
+
if (result2 === null) {
|
3217
|
+
pos = clone(pos2);
|
3218
|
+
}
|
3219
|
+
while (result2 !== null) {
|
3220
|
+
result1.push(result2);
|
3221
|
+
pos2 = clone(pos);
|
3222
|
+
pos3 = clone(pos);
|
3223
|
+
pos4 = clone(pos);
|
3224
|
+
reportFailures++;
|
3225
|
+
if (input.substr(pos.offset, 2) === "!}") {
|
3226
|
+
result2 = "!}";
|
3227
|
+
advance(pos, 2);
|
2663
3228
|
} else {
|
2664
|
-
|
2665
|
-
if (
|
3229
|
+
result2 = null;
|
3230
|
+
if (reportFailures === 0) {
|
2666
3231
|
matchFailed("\"!}\"");
|
2667
3232
|
}
|
2668
3233
|
}
|
2669
|
-
|
2670
|
-
if (
|
2671
|
-
|
3234
|
+
reportFailures--;
|
3235
|
+
if (result2 === null) {
|
3236
|
+
result2 = "";
|
2672
3237
|
} else {
|
2673
|
-
|
2674
|
-
pos =
|
3238
|
+
result2 = null;
|
3239
|
+
pos = clone(pos4);
|
2675
3240
|
}
|
2676
|
-
if (
|
2677
|
-
if (input.length > pos) {
|
2678
|
-
|
2679
|
-
pos
|
3241
|
+
if (result2 !== null) {
|
3242
|
+
if (input.length > pos.offset) {
|
3243
|
+
result3 = input.charAt(pos.offset);
|
3244
|
+
advance(pos, 1);
|
2680
3245
|
} else {
|
2681
|
-
|
2682
|
-
if (
|
2683
|
-
matchFailed(
|
3246
|
+
result3 = null;
|
3247
|
+
if (reportFailures === 0) {
|
3248
|
+
matchFailed("any character");
|
2684
3249
|
}
|
2685
3250
|
}
|
2686
|
-
if (
|
2687
|
-
|
3251
|
+
if (result3 !== null) {
|
3252
|
+
result2 = [result2, result3];
|
2688
3253
|
} else {
|
2689
|
-
|
2690
|
-
pos =
|
3254
|
+
result2 = null;
|
3255
|
+
pos = clone(pos3);
|
2691
3256
|
}
|
2692
3257
|
} else {
|
2693
|
-
|
2694
|
-
pos =
|
3258
|
+
result2 = null;
|
3259
|
+
pos = clone(pos3);
|
3260
|
+
}
|
3261
|
+
if (result2 !== null) {
|
3262
|
+
result2 = (function(offset, line, column, c) {return c})(pos2.offset, pos2.line, pos2.column, result2[1]);
|
3263
|
+
}
|
3264
|
+
if (result2 === null) {
|
3265
|
+
pos = clone(pos2);
|
2695
3266
|
}
|
2696
|
-
var result5 = result6 !== null
|
2697
|
-
? (function(c) {return c})(result6[1])
|
2698
|
-
: null;
|
2699
3267
|
}
|
2700
|
-
if (
|
2701
|
-
if (input.substr(pos, 2) === "!}") {
|
2702
|
-
|
2703
|
-
pos
|
3268
|
+
if (result1 !== null) {
|
3269
|
+
if (input.substr(pos.offset, 2) === "!}") {
|
3270
|
+
result2 = "!}";
|
3271
|
+
advance(pos, 2);
|
2704
3272
|
} else {
|
2705
|
-
|
2706
|
-
if (
|
3273
|
+
result2 = null;
|
3274
|
+
if (reportFailures === 0) {
|
2707
3275
|
matchFailed("\"!}\"");
|
2708
3276
|
}
|
2709
3277
|
}
|
2710
|
-
if (
|
2711
|
-
|
3278
|
+
if (result2 !== null) {
|
3279
|
+
result0 = [result0, result1, result2];
|
2712
3280
|
} else {
|
2713
|
-
|
2714
|
-
pos =
|
3281
|
+
result0 = null;
|
3282
|
+
pos = clone(pos1);
|
2715
3283
|
}
|
2716
3284
|
} else {
|
2717
|
-
|
2718
|
-
pos =
|
3285
|
+
result0 = null;
|
3286
|
+
pos = clone(pos1);
|
2719
3287
|
}
|
2720
3288
|
} else {
|
2721
|
-
|
2722
|
-
pos =
|
2723
|
-
}
|
2724
|
-
|
2725
|
-
|
2726
|
-
|
2727
|
-
|
2728
|
-
|
3289
|
+
result0 = null;
|
3290
|
+
pos = clone(pos1);
|
3291
|
+
}
|
3292
|
+
if (result0 !== null) {
|
3293
|
+
result0 = (function(offset, line, column, c) { return ["comment", c.join('')] })(pos0.offset, pos0.line, pos0.column, result0[1]);
|
3294
|
+
}
|
3295
|
+
if (result0 === null) {
|
3296
|
+
pos = clone(pos0);
|
3297
|
+
}
|
3298
|
+
reportFailures--;
|
3299
|
+
if (reportFailures === 0 && result0 === null) {
|
2729
3300
|
matchFailed("comment");
|
2730
3301
|
}
|
2731
|
-
|
2732
|
-
cache[cacheKey] = {
|
2733
|
-
nextPos: pos,
|
2734
|
-
result: result0
|
2735
|
-
};
|
2736
3302
|
return result0;
|
2737
3303
|
}
|
2738
3304
|
|
2739
3305
|
function parse_tag() {
|
2740
|
-
var
|
2741
|
-
var
|
2742
|
-
|
2743
|
-
|
2744
|
-
|
2745
|
-
|
2746
|
-
|
2747
|
-
|
2748
|
-
|
2749
|
-
var result3 = parse_ld();
|
2750
|
-
if (result3 !== null) {
|
2751
|
-
if (input.substr(pos).match(/^[#?^><+%:@\/~%]/) !== null) {
|
2752
|
-
var result4 = input.charAt(pos);
|
2753
|
-
pos++;
|
3306
|
+
var result0, result1, result2, result3, result4, result5, result6;
|
3307
|
+
var pos0, pos1, pos2;
|
3308
|
+
|
3309
|
+
pos0 = clone(pos);
|
3310
|
+
result0 = parse_ld();
|
3311
|
+
if (result0 !== null) {
|
3312
|
+
if (/^[#?^><+%:@\/~%]/.test(input.charAt(pos.offset))) {
|
3313
|
+
result1 = input.charAt(pos.offset);
|
3314
|
+
advance(pos, 1);
|
2754
3315
|
} else {
|
2755
|
-
|
2756
|
-
if (
|
3316
|
+
result1 = null;
|
3317
|
+
if (reportFailures === 0) {
|
2757
3318
|
matchFailed("[#?^><+%:@\\/~%]");
|
2758
3319
|
}
|
2759
3320
|
}
|
2760
|
-
if (
|
2761
|
-
|
2762
|
-
|
2763
|
-
|
2764
|
-
|
2765
|
-
|
2766
|
-
|
2767
|
-
if (
|
2768
|
-
|
2769
|
-
|
2770
|
-
|
2771
|
-
|
2772
|
-
|
2773
|
-
|
2774
|
-
|
2775
|
-
var savedReportMatchFailuresVar0 = reportMatchFailures;
|
2776
|
-
reportMatchFailures = false;
|
2777
|
-
var result11 = parse_eol();
|
2778
|
-
reportMatchFailures = savedReportMatchFailuresVar0;
|
2779
|
-
if (result11 === null) {
|
2780
|
-
var result9 = '';
|
3321
|
+
if (result1 !== null) {
|
3322
|
+
result2 = [];
|
3323
|
+
result3 = parse_ws();
|
3324
|
+
while (result3 !== null) {
|
3325
|
+
result2.push(result3);
|
3326
|
+
result3 = parse_ws();
|
3327
|
+
}
|
3328
|
+
if (result2 !== null) {
|
3329
|
+
pos1 = clone(pos);
|
3330
|
+
pos2 = clone(pos);
|
3331
|
+
reportFailures++;
|
3332
|
+
result4 = parse_rd();
|
3333
|
+
reportFailures--;
|
3334
|
+
if (result4 === null) {
|
3335
|
+
result4 = "";
|
2781
3336
|
} else {
|
2782
|
-
|
2783
|
-
pos =
|
3337
|
+
result4 = null;
|
3338
|
+
pos = clone(pos2);
|
2784
3339
|
}
|
2785
|
-
if (
|
2786
|
-
|
2787
|
-
|
2788
|
-
|
3340
|
+
if (result4 !== null) {
|
3341
|
+
pos2 = clone(pos);
|
3342
|
+
reportFailures++;
|
3343
|
+
result5 = parse_eol();
|
3344
|
+
reportFailures--;
|
3345
|
+
if (result5 === null) {
|
3346
|
+
result5 = "";
|
2789
3347
|
} else {
|
2790
|
-
|
2791
|
-
|
2792
|
-
matchFailed('any character');
|
2793
|
-
}
|
3348
|
+
result5 = null;
|
3349
|
+
pos = clone(pos2);
|
2794
3350
|
}
|
2795
|
-
if (
|
2796
|
-
|
3351
|
+
if (result5 !== null) {
|
3352
|
+
if (input.length > pos.offset) {
|
3353
|
+
result6 = input.charAt(pos.offset);
|
3354
|
+
advance(pos, 1);
|
3355
|
+
} else {
|
3356
|
+
result6 = null;
|
3357
|
+
if (reportFailures === 0) {
|
3358
|
+
matchFailed("any character");
|
3359
|
+
}
|
3360
|
+
}
|
3361
|
+
if (result6 !== null) {
|
3362
|
+
result4 = [result4, result5, result6];
|
3363
|
+
} else {
|
3364
|
+
result4 = null;
|
3365
|
+
pos = clone(pos1);
|
3366
|
+
}
|
2797
3367
|
} else {
|
2798
|
-
|
2799
|
-
pos =
|
3368
|
+
result4 = null;
|
3369
|
+
pos = clone(pos1);
|
2800
3370
|
}
|
2801
3371
|
} else {
|
2802
|
-
|
2803
|
-
pos =
|
3372
|
+
result4 = null;
|
3373
|
+
pos = clone(pos1);
|
2804
3374
|
}
|
2805
|
-
|
2806
|
-
|
2807
|
-
|
2808
|
-
|
2809
|
-
|
2810
|
-
|
2811
|
-
|
2812
|
-
|
2813
|
-
|
2814
|
-
|
2815
|
-
|
2816
|
-
reportMatchFailures = false;
|
2817
|
-
var result12 = parse_rd();
|
2818
|
-
reportMatchFailures = savedReportMatchFailuresVar1;
|
2819
|
-
if (result12 === null) {
|
2820
|
-
var result8 = '';
|
2821
|
-
} else {
|
2822
|
-
var result8 = null;
|
2823
|
-
pos = savedPos3;
|
2824
|
-
}
|
2825
|
-
if (result8 !== null) {
|
2826
|
-
var savedPos2 = pos;
|
2827
|
-
var savedReportMatchFailuresVar0 = reportMatchFailures;
|
2828
|
-
reportMatchFailures = false;
|
2829
|
-
var result11 = parse_eol();
|
2830
|
-
reportMatchFailures = savedReportMatchFailuresVar0;
|
2831
|
-
if (result11 === null) {
|
2832
|
-
var result9 = '';
|
3375
|
+
if (result4 !== null) {
|
3376
|
+
result3 = [];
|
3377
|
+
while (result4 !== null) {
|
3378
|
+
result3.push(result4);
|
3379
|
+
pos1 = clone(pos);
|
3380
|
+
pos2 = clone(pos);
|
3381
|
+
reportFailures++;
|
3382
|
+
result4 = parse_rd();
|
3383
|
+
reportFailures--;
|
3384
|
+
if (result4 === null) {
|
3385
|
+
result4 = "";
|
2833
3386
|
} else {
|
2834
|
-
|
2835
|
-
pos =
|
3387
|
+
result4 = null;
|
3388
|
+
pos = clone(pos2);
|
2836
3389
|
}
|
2837
|
-
if (
|
2838
|
-
|
2839
|
-
|
2840
|
-
|
3390
|
+
if (result4 !== null) {
|
3391
|
+
pos2 = clone(pos);
|
3392
|
+
reportFailures++;
|
3393
|
+
result5 = parse_eol();
|
3394
|
+
reportFailures--;
|
3395
|
+
if (result5 === null) {
|
3396
|
+
result5 = "";
|
2841
3397
|
} else {
|
2842
|
-
|
2843
|
-
|
2844
|
-
matchFailed('any character');
|
2845
|
-
}
|
3398
|
+
result5 = null;
|
3399
|
+
pos = clone(pos2);
|
2846
3400
|
}
|
2847
|
-
if (
|
2848
|
-
|
3401
|
+
if (result5 !== null) {
|
3402
|
+
if (input.length > pos.offset) {
|
3403
|
+
result6 = input.charAt(pos.offset);
|
3404
|
+
advance(pos, 1);
|
3405
|
+
} else {
|
3406
|
+
result6 = null;
|
3407
|
+
if (reportFailures === 0) {
|
3408
|
+
matchFailed("any character");
|
3409
|
+
}
|
3410
|
+
}
|
3411
|
+
if (result6 !== null) {
|
3412
|
+
result4 = [result4, result5, result6];
|
3413
|
+
} else {
|
3414
|
+
result4 = null;
|
3415
|
+
pos = clone(pos1);
|
3416
|
+
}
|
2849
3417
|
} else {
|
2850
|
-
|
2851
|
-
pos =
|
3418
|
+
result4 = null;
|
3419
|
+
pos = clone(pos1);
|
2852
3420
|
}
|
2853
3421
|
} else {
|
2854
|
-
|
2855
|
-
pos =
|
3422
|
+
result4 = null;
|
3423
|
+
pos = clone(pos1);
|
2856
3424
|
}
|
2857
|
-
} else {
|
2858
|
-
var result7 = null;
|
2859
|
-
pos = savedPos1;
|
2860
3425
|
}
|
3426
|
+
} else {
|
3427
|
+
result3 = null;
|
2861
3428
|
}
|
2862
|
-
|
2863
|
-
|
2864
|
-
|
2865
|
-
|
2866
|
-
|
2867
|
-
|
2868
|
-
|
3429
|
+
if (result3 !== null) {
|
3430
|
+
result4 = [];
|
3431
|
+
result5 = parse_ws();
|
3432
|
+
while (result5 !== null) {
|
3433
|
+
result4.push(result5);
|
3434
|
+
result5 = parse_ws();
|
3435
|
+
}
|
3436
|
+
if (result4 !== null) {
|
3437
|
+
result5 = parse_rd();
|
3438
|
+
if (result5 !== null) {
|
3439
|
+
result0 = [result0, result1, result2, result3, result4, result5];
|
3440
|
+
} else {
|
3441
|
+
result0 = null;
|
3442
|
+
pos = clone(pos0);
|
3443
|
+
}
|
3444
|
+
} else {
|
3445
|
+
result0 = null;
|
3446
|
+
pos = clone(pos0);
|
3447
|
+
}
|
2869
3448
|
} else {
|
2870
|
-
|
2871
|
-
pos =
|
3449
|
+
result0 = null;
|
3450
|
+
pos = clone(pos0);
|
2872
3451
|
}
|
2873
3452
|
} else {
|
2874
|
-
|
2875
|
-
pos =
|
3453
|
+
result0 = null;
|
3454
|
+
pos = clone(pos0);
|
2876
3455
|
}
|
2877
3456
|
} else {
|
2878
|
-
|
2879
|
-
pos =
|
3457
|
+
result0 = null;
|
3458
|
+
pos = clone(pos0);
|
2880
3459
|
}
|
2881
3460
|
} else {
|
2882
|
-
|
2883
|
-
pos =
|
3461
|
+
result0 = null;
|
3462
|
+
pos = clone(pos0);
|
2884
3463
|
}
|
2885
|
-
if (
|
2886
|
-
|
2887
|
-
} else {
|
2888
|
-
var result1 = parse_reference();
|
2889
|
-
if (result1 !== null) {
|
2890
|
-
var result0 = result1;
|
2891
|
-
} else {
|
2892
|
-
var result0 = null;;
|
2893
|
-
};
|
3464
|
+
if (result0 === null) {
|
3465
|
+
result0 = parse_reference();
|
2894
3466
|
}
|
2895
|
-
|
2896
|
-
|
2897
|
-
|
2898
|
-
cache[cacheKey] = {
|
2899
|
-
nextPos: pos,
|
2900
|
-
result: result0
|
2901
|
-
};
|
2902
3467
|
return result0;
|
2903
3468
|
}
|
2904
3469
|
|
2905
3470
|
function parse_ld() {
|
2906
|
-
var
|
2907
|
-
var cachedResult = cache[cacheKey];
|
2908
|
-
if (cachedResult) {
|
2909
|
-
pos = cachedResult.nextPos;
|
2910
|
-
return cachedResult.result;
|
2911
|
-
}
|
3471
|
+
var result0;
|
2912
3472
|
|
2913
|
-
|
2914
|
-
|
2915
|
-
|
2916
|
-
pos += 1;
|
3473
|
+
if (input.charCodeAt(pos.offset) === 123) {
|
3474
|
+
result0 = "{";
|
3475
|
+
advance(pos, 1);
|
2917
3476
|
} else {
|
2918
|
-
|
2919
|
-
if (
|
3477
|
+
result0 = null;
|
3478
|
+
if (reportFailures === 0) {
|
2920
3479
|
matchFailed("\"{\"");
|
2921
3480
|
}
|
2922
3481
|
}
|
2923
|
-
|
2924
|
-
|
2925
|
-
|
2926
|
-
cache[cacheKey] = {
|
2927
|
-
nextPos: pos,
|
2928
|
-
result: result0
|
2929
|
-
};
|
2930
3482
|
return result0;
|
2931
3483
|
}
|
2932
3484
|
|
2933
3485
|
function parse_rd() {
|
2934
|
-
var
|
2935
|
-
var cachedResult = cache[cacheKey];
|
2936
|
-
if (cachedResult) {
|
2937
|
-
pos = cachedResult.nextPos;
|
2938
|
-
return cachedResult.result;
|
2939
|
-
}
|
3486
|
+
var result0;
|
2940
3487
|
|
2941
|
-
|
2942
|
-
|
2943
|
-
|
2944
|
-
pos += 1;
|
3488
|
+
if (input.charCodeAt(pos.offset) === 125) {
|
3489
|
+
result0 = "}";
|
3490
|
+
advance(pos, 1);
|
2945
3491
|
} else {
|
2946
|
-
|
2947
|
-
if (
|
3492
|
+
result0 = null;
|
3493
|
+
if (reportFailures === 0) {
|
2948
3494
|
matchFailed("\"}\"");
|
2949
3495
|
}
|
2950
3496
|
}
|
2951
|
-
|
2952
|
-
|
2953
|
-
|
2954
|
-
cache[cacheKey] = {
|
2955
|
-
nextPos: pos,
|
2956
|
-
result: result0
|
2957
|
-
};
|
2958
3497
|
return result0;
|
2959
3498
|
}
|
2960
3499
|
|
2961
3500
|
function parse_eol() {
|
2962
|
-
var
|
2963
|
-
var cachedResult = cache[cacheKey];
|
2964
|
-
if (cachedResult) {
|
2965
|
-
pos = cachedResult.nextPos;
|
2966
|
-
return cachedResult.result;
|
2967
|
-
}
|
3501
|
+
var result0;
|
2968
3502
|
|
2969
|
-
|
2970
|
-
|
2971
|
-
|
2972
|
-
pos += 1;
|
3503
|
+
if (input.charCodeAt(pos.offset) === 10) {
|
3504
|
+
result0 = "\n";
|
3505
|
+
advance(pos, 1);
|
2973
3506
|
} else {
|
2974
|
-
|
2975
|
-
if (
|
3507
|
+
result0 = null;
|
3508
|
+
if (reportFailures === 0) {
|
2976
3509
|
matchFailed("\"\\n\"");
|
2977
3510
|
}
|
2978
3511
|
}
|
2979
|
-
if (
|
2980
|
-
|
2981
|
-
|
2982
|
-
|
2983
|
-
var result4 = "\r\n";
|
2984
|
-
pos += 2;
|
3512
|
+
if (result0 === null) {
|
3513
|
+
if (input.substr(pos.offset, 2) === "\r\n") {
|
3514
|
+
result0 = "\r\n";
|
3515
|
+
advance(pos, 2);
|
2985
3516
|
} else {
|
2986
|
-
|
2987
|
-
if (
|
3517
|
+
result0 = null;
|
3518
|
+
if (reportFailures === 0) {
|
2988
3519
|
matchFailed("\"\\r\\n\"");
|
2989
3520
|
}
|
2990
3521
|
}
|
2991
|
-
if (
|
2992
|
-
|
2993
|
-
|
2994
|
-
|
2995
|
-
var result3 = "\r";
|
2996
|
-
pos += 1;
|
3522
|
+
if (result0 === null) {
|
3523
|
+
if (input.charCodeAt(pos.offset) === 13) {
|
3524
|
+
result0 = "\r";
|
3525
|
+
advance(pos, 1);
|
2997
3526
|
} else {
|
2998
|
-
|
2999
|
-
if (
|
3527
|
+
result0 = null;
|
3528
|
+
if (reportFailures === 0) {
|
3000
3529
|
matchFailed("\"\\r\"");
|
3001
3530
|
}
|
3002
3531
|
}
|
3003
|
-
if (
|
3004
|
-
|
3005
|
-
|
3006
|
-
|
3007
|
-
var result2 = "\u2028";
|
3008
|
-
pos += 1;
|
3532
|
+
if (result0 === null) {
|
3533
|
+
if (input.charCodeAt(pos.offset) === 8232) {
|
3534
|
+
result0 = "\u2028";
|
3535
|
+
advance(pos, 1);
|
3009
3536
|
} else {
|
3010
|
-
|
3011
|
-
if (
|
3537
|
+
result0 = null;
|
3538
|
+
if (reportFailures === 0) {
|
3012
3539
|
matchFailed("\"\\u2028\"");
|
3013
3540
|
}
|
3014
3541
|
}
|
3015
|
-
if (
|
3016
|
-
|
3017
|
-
|
3018
|
-
|
3019
|
-
var result1 = "\u2029";
|
3020
|
-
pos += 1;
|
3542
|
+
if (result0 === null) {
|
3543
|
+
if (input.charCodeAt(pos.offset) === 8233) {
|
3544
|
+
result0 = "\u2029";
|
3545
|
+
advance(pos, 1);
|
3021
3546
|
} else {
|
3022
|
-
|
3023
|
-
if (
|
3547
|
+
result0 = null;
|
3548
|
+
if (reportFailures === 0) {
|
3024
3549
|
matchFailed("\"\\u2029\"");
|
3025
3550
|
}
|
3026
3551
|
}
|
3027
|
-
|
3028
|
-
|
3029
|
-
|
3030
|
-
var result0 = null;;
|
3031
|
-
};
|
3032
|
-
};
|
3033
|
-
};
|
3034
|
-
};
|
3552
|
+
}
|
3553
|
+
}
|
3554
|
+
}
|
3035
3555
|
}
|
3036
|
-
|
3037
|
-
|
3038
|
-
|
3039
|
-
cache[cacheKey] = {
|
3040
|
-
nextPos: pos,
|
3041
|
-
result: result0
|
3042
|
-
};
|
3043
3556
|
return result0;
|
3044
3557
|
}
|
3045
3558
|
|
3046
3559
|
function parse_ws() {
|
3047
|
-
var
|
3048
|
-
var cachedResult = cache[cacheKey];
|
3049
|
-
if (cachedResult) {
|
3050
|
-
pos = cachedResult.nextPos;
|
3051
|
-
return cachedResult.result;
|
3052
|
-
}
|
3053
|
-
|
3560
|
+
var result0;
|
3054
3561
|
|
3055
|
-
if (
|
3056
|
-
|
3057
|
-
pos
|
3562
|
+
if (/^[\t\x0B\f \xA0\uFEFF]/.test(input.charAt(pos.offset))) {
|
3563
|
+
result0 = input.charAt(pos.offset);
|
3564
|
+
advance(pos, 1);
|
3058
3565
|
} else {
|
3059
|
-
|
3060
|
-
if (
|
3061
|
-
matchFailed("[
|
3566
|
+
result0 = null;
|
3567
|
+
if (reportFailures === 0) {
|
3568
|
+
matchFailed("[\\t\\x0B\\f \\xA0\\uFEFF]");
|
3062
3569
|
}
|
3063
3570
|
}
|
3064
|
-
|
3065
|
-
|
3066
|
-
|
3067
|
-
cache[cacheKey] = {
|
3068
|
-
nextPos: pos,
|
3069
|
-
result: result0
|
3070
|
-
};
|
3571
|
+
if (result0 === null) {
|
3572
|
+
result0 = parse_eol();
|
3573
|
+
}
|
3071
3574
|
return result0;
|
3072
3575
|
}
|
3073
3576
|
|
3074
|
-
function buildErrorMessage() {
|
3075
|
-
function buildExpected(failuresExpected) {
|
3076
|
-
failuresExpected.sort();
|
3077
|
-
|
3078
|
-
var lastFailure = null;
|
3079
|
-
var failuresExpectedUnique = [];
|
3080
|
-
for (var i = 0; i < failuresExpected.length; i++) {
|
3081
|
-
if (failuresExpected[i] !== lastFailure) {
|
3082
|
-
failuresExpectedUnique.push(failuresExpected[i]);
|
3083
|
-
lastFailure = failuresExpected[i];
|
3084
|
-
}
|
3085
|
-
}
|
3086
|
-
|
3087
|
-
switch (failuresExpectedUnique.length) {
|
3088
|
-
case 0:
|
3089
|
-
return 'end of input';
|
3090
|
-
case 1:
|
3091
|
-
return failuresExpectedUnique[0];
|
3092
|
-
default:
|
3093
|
-
return failuresExpectedUnique.slice(0, failuresExpectedUnique.length - 1).join(', ')
|
3094
|
-
+ ' or '
|
3095
|
-
+ failuresExpectedUnique[failuresExpectedUnique.length - 1];
|
3096
|
-
}
|
3097
|
-
}
|
3098
|
-
|
3099
|
-
var expected = buildExpected(rightmostMatchFailuresExpected);
|
3100
|
-
var actualPos = Math.max(pos, rightmostMatchFailuresPos);
|
3101
|
-
var actual = actualPos < input.length
|
3102
|
-
? quote(input.charAt(actualPos))
|
3103
|
-
: 'end of input';
|
3104
|
-
|
3105
|
-
return 'Expected ' + expected + ' but ' + actual + ' found.';
|
3106
|
-
}
|
3107
3577
|
|
3108
|
-
function
|
3109
|
-
|
3110
|
-
|
3111
|
-
|
3112
|
-
|
3113
|
-
|
3114
|
-
|
3115
|
-
|
3116
|
-
|
3117
|
-
var column = 1;
|
3118
|
-
var seenCR = false;
|
3119
|
-
|
3120
|
-
for (var i = 0; i < rightmostMatchFailuresPos; i++) {
|
3121
|
-
var ch = input.charAt(i);
|
3122
|
-
if (ch === '\n') {
|
3123
|
-
if (!seenCR) { line++; }
|
3124
|
-
column = 1;
|
3125
|
-
seenCR = false;
|
3126
|
-
} else if (ch === '\r' | ch === '\u2028' || ch === '\u2029') {
|
3127
|
-
line++;
|
3128
|
-
column = 1;
|
3129
|
-
seenCR = true;
|
3130
|
-
} else {
|
3131
|
-
column++;
|
3132
|
-
seenCR = false;
|
3578
|
+
function cleanupExpected(expected) {
|
3579
|
+
expected.sort();
|
3580
|
+
|
3581
|
+
var lastExpected = null;
|
3582
|
+
var cleanExpected = [];
|
3583
|
+
for (var i = 0; i < expected.length; i++) {
|
3584
|
+
if (expected[i] !== lastExpected) {
|
3585
|
+
cleanExpected.push(expected[i]);
|
3586
|
+
lastExpected = expected[i];
|
3133
3587
|
}
|
3134
3588
|
}
|
3135
|
-
|
3136
|
-
return { line: line, column: column };
|
3589
|
+
return cleanExpected;
|
3137
3590
|
}
|
3138
3591
|
|
3139
3592
|
|
3140
3593
|
|
3141
|
-
|
3142
|
-
|
3143
|
-
node['text'] = input.substring(ck.split('@')[1], pos);
|
3144
|
-
|
3145
|
-
return node;
|
3146
|
-
|
3147
|
-
}
|
3148
|
-
|
3149
|
-
|
3150
|
-
|
3151
|
-
var result = parse_body();
|
3594
|
+
var result = parseFunctions[startRule]();
|
3152
3595
|
|
3153
3596
|
/*
|
3154
3597
|
* The parser is now in one of the following three states:
|
@@ -3156,28 +3599,33 @@ var parser = (function(){
|
|
3156
3599
|
* 1. The parser successfully parsed the whole input.
|
3157
3600
|
*
|
3158
3601
|
* - |result !== null|
|
3159
|
-
* - |pos === input.length|
|
3160
|
-
* - |
|
3602
|
+
* - |pos.offset === input.length|
|
3603
|
+
* - |rightmostFailuresExpected| may or may not contain something
|
3161
3604
|
*
|
3162
3605
|
* 2. The parser successfully parsed only a part of the input.
|
3163
3606
|
*
|
3164
3607
|
* - |result !== null|
|
3165
|
-
* - |pos < input.length|
|
3166
|
-
* - |
|
3608
|
+
* - |pos.offset < input.length|
|
3609
|
+
* - |rightmostFailuresExpected| may or may not contain something
|
3167
3610
|
*
|
3168
3611
|
* 3. The parser did not successfully parse any part of the input.
|
3169
3612
|
*
|
3170
3613
|
* - |result === null|
|
3171
|
-
* - |pos === 0|
|
3172
|
-
* - |
|
3614
|
+
* - |pos.offset === 0|
|
3615
|
+
* - |rightmostFailuresExpected| contains at least one failure
|
3173
3616
|
*
|
3174
3617
|
* All code following this comment (including called functions) must
|
3175
3618
|
* handle these states.
|
3176
3619
|
*/
|
3177
|
-
if (result === null || pos !== input.length) {
|
3178
|
-
var
|
3179
|
-
|
3180
|
-
|
3620
|
+
if (result === null || pos.offset !== input.length) {
|
3621
|
+
var offset = Math.max(pos.offset, rightmostFailuresPos.offset);
|
3622
|
+
var found = offset < input.length ? input.charAt(offset) : null;
|
3623
|
+
var errorPosition = pos.offset > rightmostFailuresPos.offset ? pos : rightmostFailuresPos;
|
3624
|
+
|
3625
|
+
throw new parser.SyntaxError(
|
3626
|
+
cleanupExpected(rightmostFailuresExpected),
|
3627
|
+
found,
|
3628
|
+
offset,
|
3181
3629
|
errorPosition.line,
|
3182
3630
|
errorPosition.column
|
3183
3631
|
);
|
@@ -3192,9 +3640,33 @@ var parser = (function(){
|
|
3192
3640
|
|
3193
3641
|
/* Thrown when a parser encounters a syntax error. */
|
3194
3642
|
|
3195
|
-
result.SyntaxError = function(
|
3196
|
-
|
3197
|
-
|
3643
|
+
result.SyntaxError = function(expected, found, offset, line, column) {
|
3644
|
+
function buildMessage(expected, found) {
|
3645
|
+
var expectedHumanized, foundHumanized;
|
3646
|
+
|
3647
|
+
switch (expected.length) {
|
3648
|
+
case 0:
|
3649
|
+
expectedHumanized = "end of input";
|
3650
|
+
break;
|
3651
|
+
case 1:
|
3652
|
+
expectedHumanized = expected[0];
|
3653
|
+
break;
|
3654
|
+
default:
|
3655
|
+
expectedHumanized = expected.slice(0, expected.length - 1).join(", ")
|
3656
|
+
+ " or "
|
3657
|
+
+ expected[expected.length - 1];
|
3658
|
+
}
|
3659
|
+
|
3660
|
+
foundHumanized = found ? quote(found) : "end of input";
|
3661
|
+
|
3662
|
+
return "Expected " + expectedHumanized + " but " + foundHumanized + " found.";
|
3663
|
+
}
|
3664
|
+
|
3665
|
+
this.name = "SyntaxError";
|
3666
|
+
this.expected = expected;
|
3667
|
+
this.found = found;
|
3668
|
+
this.message = buildMessage(expected, found);
|
3669
|
+
this.offset = offset;
|
3198
3670
|
this.line = line;
|
3199
3671
|
this.column = column;
|
3200
3672
|
};
|
@@ -3206,4 +3678,4 @@ var parser = (function(){
|
|
3206
3678
|
|
3207
3679
|
dust.parse = parser.parse;
|
3208
3680
|
|
3209
|
-
})(typeof exports !== 'undefined' ? exports :
|
3681
|
+
})(typeof exports !== 'undefined' ? exports : getGlobal());
|