handlebars-source 2.0.0 → 3.0.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.

Potentially problematic release.


This version of handlebars-source might be problematic. Click here for more details.

Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/handlebars.js +1476 -861
  3. data/handlebars.runtime.js +151 -137
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2c023c795b44ec907e1084d8be92ba603bcca6e4
4
- data.tar.gz: 4743cf4f42f5dbc7138b86f8c19e30d9b034424d
3
+ metadata.gz: a05bd4e8d4e283dfa01b8e87ea418dae688b97d8
4
+ data.tar.gz: e3c8f225dc98a5a1273549f402978b4d535863e9
5
5
  SHA512:
6
- metadata.gz: 37716ab389d7dc6c3cb2de9d849a244604edc873e24a396dd2a42c7cb17c85f7ceb9e31c57930d549f841edd2575138914b30af7422033eb06529c32f5fd399c
7
- data.tar.gz: ce36d0760074f66e1a9665bacc37378d4c53c7002a6752cf654e1ed13b37458f89cb0a6c75b8688d6ba834fe9d675fbb45ad622e47801a5318fae5caaaf93227
6
+ metadata.gz: 28515b954415c336d6d597fe796664826fa88cdd8e0224c555aa46f0a185d821b89c0a1870c00b5e486a662ff1bf733659ab2b1f7f52bbda10521b57e2b2a9ea
7
+ data.tar.gz: 61af75b008166d74141b8568de60a860e919c230c23cc8e8264042d815d78413608d6457766451db43e01ac4a3e941cb1565bcfb926d3a91b47b3cc5c4f08449
@@ -1,58 +1,6 @@
1
1
  /*!
2
2
 
3
- handlebars v2.0.0
4
-
5
- Copyright (C) 2011-2014 by Yehuda Katz
6
-
7
- Permission is hereby granted, free of charge, to any person obtaining a copy
8
- of this software and associated documentation files (the "Software"), to deal
9
- in the Software without restriction, including without limitation the rights
10
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- copies of the Software, and to permit persons to whom the Software is
12
- furnished to do so, subject to the following conditions:
13
-
14
- The above copyright notice and this permission notice shall be included in
15
- all copies or substantial portions of the Software.
16
-
17
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
- THE SOFTWARE.
24
-
25
- @license
26
- */
27
- /*!
28
-
29
- handlebars v2.0.0
30
-
31
- Copyright (C) 2011-2014 by Yehuda Katz
32
-
33
- Permission is hereby granted, free of charge, to any person obtaining a copy
34
- of this software and associated documentation files (the "Software"), to deal
35
- in the Software without restriction, including without limitation the rights
36
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
37
- copies of the Software, and to permit persons to whom the Software is
38
- furnished to do so, subject to the following conditions:
39
-
40
- The above copyright notice and this permission notice shall be included in
41
- all copies or substantial portions of the Software.
42
-
43
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
44
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
45
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
46
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
47
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
48
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
49
- THE SOFTWARE.
50
-
51
- @license
52
- */
53
- /*!
54
-
55
- handlebars v2.0.0
3
+ handlebars v3.0.0
56
4
 
57
5
  Copyright (C) 2011-2014 by Yehuda Katz
58
6
 
@@ -83,33 +31,14 @@ THE SOFTWARE.
83
31
  } else if (typeof exports === 'object') {
84
32
  module.exports = factory();
85
33
  } else {
86
- root.Handlebars = root.Handlebars || factory();
34
+ root.Handlebars = factory();
87
35
  }
88
36
  }(this, function () {
89
- // handlebars/safe-string.js
90
- var __module4__ = (function() {
91
- "use strict";
92
- var __exports__;
93
- // Build out our basic SafeString type
94
- function SafeString(string) {
95
- this.string = string;
96
- }
97
-
98
- SafeString.prototype.toString = function() {
99
- return "" + this.string;
100
- };
101
-
102
- __exports__ = SafeString;
103
- return __exports__;
104
- })();
105
-
106
37
  // handlebars/utils.js
107
- var __module3__ = (function(__dependency1__) {
38
+ var __module3__ = (function() {
108
39
  "use strict";
109
40
  var __exports__ = {};
110
41
  /*jshint -W004 */
111
- var SafeString = __dependency1__;
112
-
113
42
  var escape = {
114
43
  "&": "&",
115
44
  "<": "&lt;",
@@ -159,11 +88,21 @@ var __module3__ = (function(__dependency1__) {
159
88
  return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false;
160
89
  };
161
90
  __exports__.isArray = isArray;
91
+ // Older IE versions do not directly support indexOf so we must implement our own, sadly.
92
+ function indexOf(array, value) {
93
+ for (var i = 0, len = array.length; i < len; i++) {
94
+ if (array[i] === value) {
95
+ return i;
96
+ }
97
+ }
98
+ return -1;
99
+ }
162
100
 
101
+ __exports__.indexOf = indexOf;
163
102
  function escapeExpression(string) {
164
103
  // don't escape SafeStrings, since they're already safe
165
- if (string instanceof SafeString) {
166
- return string.toString();
104
+ if (string && string.toHTML) {
105
+ return string.toHTML();
167
106
  } else if (string == null) {
168
107
  return "";
169
108
  } else if (!string) {
@@ -189,27 +128,35 @@ var __module3__ = (function(__dependency1__) {
189
128
  }
190
129
  }
191
130
 
192
- __exports__.isEmpty = isEmpty;function appendContextPath(contextPath, id) {
131
+ __exports__.isEmpty = isEmpty;function blockParams(params, ids) {
132
+ params.path = ids;
133
+ return params;
134
+ }
135
+
136
+ __exports__.blockParams = blockParams;function appendContextPath(contextPath, id) {
193
137
  return (contextPath ? contextPath + '.' : '') + id;
194
138
  }
195
139
 
196
140
  __exports__.appendContextPath = appendContextPath;
197
141
  return __exports__;
198
- })(__module4__);
142
+ })();
199
143
 
200
144
  // handlebars/exception.js
201
- var __module5__ = (function() {
145
+ var __module4__ = (function() {
202
146
  "use strict";
203
147
  var __exports__;
204
148
 
205
149
  var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
206
150
 
207
151
  function Exception(message, node) {
208
- var line;
209
- if (node && node.firstLine) {
210
- line = node.firstLine;
211
-
212
- message += ' - ' + line + ':' + node.firstColumn;
152
+ var loc = node && node.loc,
153
+ line,
154
+ column;
155
+ if (loc) {
156
+ line = loc.start.line;
157
+ column = loc.start.column;
158
+
159
+ message += ' - ' + line + ':' + column;
213
160
  }
214
161
 
215
162
  var tmp = Error.prototype.constructor.call(this, message);
@@ -219,9 +166,9 @@ var __module5__ = (function() {
219
166
  this[errorProps[idx]] = tmp[errorProps[idx]];
220
167
  }
221
168
 
222
- if (line) {
169
+ if (loc) {
223
170
  this.lineNumber = line;
224
- this.column = node.firstColumn;
171
+ this.column = column;
225
172
  }
226
173
  }
227
174
 
@@ -238,7 +185,7 @@ var __module2__ = (function(__dependency1__, __dependency2__) {
238
185
  var Utils = __dependency1__;
239
186
  var Exception = __dependency2__;
240
187
 
241
- var VERSION = "2.0.0";
188
+ var VERSION = "3.0.0";
242
189
  __exports__.VERSION = VERSION;var COMPILER_REVISION = 6;
243
190
  __exports__.COMPILER_REVISION = COMPILER_REVISION;
244
191
  var REVISION_CHANGES = {
@@ -284,6 +231,9 @@ var __module2__ = (function(__dependency1__, __dependency2__) {
284
231
  if (toString.call(name) === objectType) {
285
232
  Utils.extend(this.partials, name);
286
233
  } else {
234
+ if (typeof partial === 'undefined') {
235
+ throw new Exception('Attempting to register a partial as undefined');
236
+ }
287
237
  this.partials[name] = partial;
288
238
  }
289
239
  },
@@ -351,36 +301,47 @@ var __module2__ = (function(__dependency1__, __dependency2__) {
351
301
  data = createFrame(options.data);
352
302
  }
353
303
 
304
+ function execIteration(key, i, last) {
305
+ if (data) {
306
+ data.key = key;
307
+ data.index = i;
308
+ data.first = i === 0;
309
+ data.last = !!last;
310
+
311
+ if (contextPath) {
312
+ data.contextPath = contextPath + key;
313
+ }
314
+ }
315
+
316
+ ret = ret + fn(context[key], {
317
+ data: data,
318
+ blockParams: Utils.blockParams([context[key], key], [contextPath + key, null])
319
+ });
320
+ }
321
+
354
322
  if(context && typeof context === 'object') {
355
323
  if (isArray(context)) {
356
324
  for(var j = context.length; i<j; i++) {
357
- if (data) {
358
- data.index = i;
359
- data.first = (i === 0);
360
- data.last = (i === (context.length-1));
361
-
362
- if (contextPath) {
363
- data.contextPath = contextPath + i;
364
- }
365
- }
366
- ret = ret + fn(context[i], { data: data });
325
+ execIteration(i, i, i === context.length-1);
367
326
  }
368
327
  } else {
328
+ var priorKey;
329
+
369
330
  for(var key in context) {
370
331
  if(context.hasOwnProperty(key)) {
371
- if(data) {
372
- data.key = key;
373
- data.index = i;
374
- data.first = (i === 0);
375
-
376
- if (contextPath) {
377
- data.contextPath = contextPath + key;
378
- }
332
+ // We're running the iterations one step out of sync so we can detect
333
+ // the last iteration without have to scan the object twice and create
334
+ // an itermediate keys array.
335
+ if (priorKey) {
336
+ execIteration(priorKey, i-1);
379
337
  }
380
- ret = ret + fn(context[key], {data: data});
338
+ priorKey = key;
381
339
  i++;
382
340
  }
383
341
  }
342
+ if (priorKey) {
343
+ execIteration(priorKey, i-1, true);
344
+ }
384
345
  }
385
346
  }
386
347
 
@@ -444,15 +405,13 @@ var __module2__ = (function(__dependency1__, __dependency2__) {
444
405
  INFO: 1,
445
406
  WARN: 2,
446
407
  ERROR: 3,
447
- level: 3,
408
+ level: 1,
448
409
 
449
- // can be overridden in the host environment
410
+ // Can be overridden in the host environment
450
411
  log: function(level, message) {
451
- if (logger.level <= level) {
412
+ if (typeof console !== 'undefined' && logger.level <= level) {
452
413
  var method = logger.methodMap[level];
453
- if (typeof console !== 'undefined' && console[method]) {
454
- console[method].call(console, message);
455
- }
414
+ (console[method] || console.log).call(console, message);
456
415
  }
457
416
  }
458
417
  };
@@ -466,7 +425,24 @@ var __module2__ = (function(__dependency1__, __dependency2__) {
466
425
  };
467
426
  __exports__.createFrame = createFrame;
468
427
  return __exports__;
469
- })(__module3__, __module5__);
428
+ })(__module3__, __module4__);
429
+
430
+ // handlebars/safe-string.js
431
+ var __module5__ = (function() {
432
+ "use strict";
433
+ var __exports__;
434
+ // Build out our basic SafeString type
435
+ function SafeString(string) {
436
+ this.string = string;
437
+ }
438
+
439
+ SafeString.prototype.toString = SafeString.prototype.toHTML = function() {
440
+ return "" + this.string;
441
+ };
442
+
443
+ __exports__ = SafeString;
444
+ return __exports__;
445
+ })();
470
446
 
471
447
  // handlebars/runtime.js
472
448
  var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) {
@@ -511,38 +487,44 @@ var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) {
511
487
  // for external users to override these as psuedo-supported APIs.
512
488
  env.VM.checkRevision(templateSpec.compiler);
513
489
 
514
- var invokePartialWrapper = function(partial, indent, name, context, hash, helpers, partials, data, depths) {
515
- if (hash) {
516
- context = Utils.extend({}, context, hash);
490
+ var invokePartialWrapper = function(partial, context, options) {
491
+ if (options.hash) {
492
+ context = Utils.extend({}, context, options.hash);
517
493
  }
518
494
 
519
- var result = env.VM.invokePartial.call(this, partial, name, context, helpers, partials, data, depths);
495
+ partial = env.VM.resolvePartial.call(this, partial, context, options);
496
+ var result = env.VM.invokePartial.call(this, partial, context, options);
520
497
 
521
498
  if (result == null && env.compile) {
522
- var options = { helpers: helpers, partials: partials, data: data, depths: depths };
523
- partials[name] = env.compile(partial, { data: data !== undefined, compat: templateSpec.compat }, env);
524
- result = partials[name](context, options);
499
+ options.partials[options.name] = env.compile(partial, templateSpec.compilerOptions, env);
500
+ result = options.partials[options.name](context, options);
525
501
  }
526
502
  if (result != null) {
527
- if (indent) {
503
+ if (options.indent) {
528
504
  var lines = result.split('\n');
529
505
  for (var i = 0, l = lines.length; i < l; i++) {
530
506
  if (!lines[i] && i + 1 === l) {
531
507
  break;
532
508
  }
533
509
 
534
- lines[i] = indent + lines[i];
510
+ lines[i] = options.indent + lines[i];
535
511
  }
536
512
  result = lines.join('\n');
537
513
  }
538
514
  return result;
539
515
  } else {
540
- throw new Exception("The partial " + name + " could not be compiled when running in runtime-only mode");
516
+ throw new Exception("The partial " + options.name + " could not be compiled when running in runtime-only mode");
541
517
  }
542
518
  };
543
519
 
544
520
  // Just add water
545
521
  var container = {
522
+ strict: function(obj, name) {
523
+ if (!(name in obj)) {
524
+ throw new Exception('"' + name + '" not defined in ' + obj);
525
+ }
526
+ return obj[name];
527
+ },
546
528
  lookup: function(depths, name) {
547
529
  var len = depths.length;
548
530
  for (var i = 0; i < len; i++) {
@@ -563,11 +545,11 @@ var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) {
563
545
  },
564
546
 
565
547
  programs: [],
566
- program: function(i, data, depths) {
548
+ program: function(i, data, declaredBlockParams, blockParams, depths) {
567
549
  var programWrapper = this.programs[i],
568
550
  fn = this.fn(i);
569
- if (data || depths) {
570
- programWrapper = program(this, i, fn, data, depths);
551
+ if (data || depths || blockParams || declaredBlockParams) {
552
+ programWrapper = program(this, i, fn, data, declaredBlockParams, blockParams, depths);
571
553
  } else if (!programWrapper) {
572
554
  programWrapper = this.programs[i] = program(this, i, fn);
573
555
  }
@@ -602,12 +584,13 @@ var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) {
602
584
  if (!options.partial && templateSpec.useData) {
603
585
  data = initData(context, data);
604
586
  }
605
- var depths;
587
+ var depths,
588
+ blockParams = templateSpec.useBlockParams ? [] : undefined;
606
589
  if (templateSpec.useDepths) {
607
590
  depths = options.depths ? [context].concat(options.depths) : [context];
608
591
  }
609
592
 
610
- return templateSpec.main.call(container, context, container.helpers, container.partials, data, depths);
593
+ return templateSpec.main.call(container, context, container.helpers, container.partials, data, blockParams, depths);
611
594
  };
612
595
  ret.isTop = true;
613
596
 
@@ -624,32 +607,52 @@ var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) {
624
607
  }
625
608
  };
626
609
 
627
- ret._child = function(i, data, depths) {
610
+ ret._child = function(i, data, blockParams, depths) {
611
+ if (templateSpec.useBlockParams && !blockParams) {
612
+ throw new Exception('must pass block params');
613
+ }
628
614
  if (templateSpec.useDepths && !depths) {
629
615
  throw new Exception('must pass parent depths');
630
616
  }
631
617
 
632
- return program(container, i, templateSpec[i], data, depths);
618
+ return program(container, i, templateSpec[i], data, 0, blockParams, depths);
633
619
  };
634
620
  return ret;
635
621
  }
636
622
 
637
- __exports__.template = template;function program(container, i, fn, data, depths) {
623
+ __exports__.template = template;function program(container, i, fn, data, declaredBlockParams, blockParams, depths) {
638
624
  var prog = function(context, options) {
639
625
  options = options || {};
640
626
 
641
- return fn.call(container, context, container.helpers, container.partials, options.data || data, depths && [context].concat(depths));
627
+ return fn.call(container,
628
+ context,
629
+ container.helpers, container.partials,
630
+ options.data || data,
631
+ blockParams && [options.blockParams].concat(blockParams),
632
+ depths && [context].concat(depths));
642
633
  };
643
634
  prog.program = i;
644
635
  prog.depth = depths ? depths.length : 0;
636
+ prog.blockParams = declaredBlockParams || 0;
645
637
  return prog;
646
638
  }
647
639
 
648
- __exports__.program = program;function invokePartial(partial, name, context, helpers, partials, data, depths) {
649
- var options = { partial: true, helpers: helpers, partials: partials, data: data, depths: depths };
640
+ __exports__.program = program;function resolvePartial(partial, context, options) {
641
+ if (!partial) {
642
+ partial = options.partials[options.name];
643
+ } else if (!partial.call && !options.name) {
644
+ // This is a dynamic partial that returned a string
645
+ options.name = partial;
646
+ partial = options.partials[partial];
647
+ }
648
+ return partial;
649
+ }
650
+
651
+ __exports__.resolvePartial = resolvePartial;function invokePartial(partial, context, options) {
652
+ options.partial = true;
650
653
 
651
654
  if(partial === undefined) {
652
- throw new Exception("The partial " + name + " could not be found");
655
+ throw new Exception("The partial " + options.name + " could not be found");
653
656
  } else if(partial instanceof Function) {
654
657
  return partial(context, options);
655
658
  }
@@ -665,7 +668,7 @@ var __module6__ = (function(__dependency1__, __dependency2__, __dependency3__) {
665
668
  return data;
666
669
  }
667
670
  return __exports__;
668
- })(__module3__, __module5__, __module2__);
671
+ })(__module3__, __module4__, __module2__);
669
672
 
670
673
  // handlebars.runtime.js
671
674
  var __module1__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) {
@@ -702,231 +705,170 @@ var __module1__ = (function(__dependency1__, __dependency2__, __dependency3__, _
702
705
  var Handlebars = create();
703
706
  Handlebars.create = create;
704
707
 
708
+ /*jshint -W040 */
709
+ /* istanbul ignore next */
710
+ var root = typeof global !== 'undefined' ? global : window,
711
+ $Handlebars = root.Handlebars;
712
+ /* istanbul ignore next */
713
+ Handlebars.noConflict = function() {
714
+ if (root.Handlebars === Handlebars) {
715
+ root.Handlebars = $Handlebars;
716
+ }
717
+ };
718
+
705
719
  Handlebars['default'] = Handlebars;
706
720
 
707
721
  __exports__ = Handlebars;
708
722
  return __exports__;
709
- })(__module2__, __module4__, __module5__, __module3__, __module6__);
723
+ })(__module2__, __module5__, __module4__, __module3__, __module6__);
710
724
 
711
725
  // handlebars/compiler/ast.js
712
- var __module7__ = (function(__dependency1__) {
726
+ var __module7__ = (function() {
713
727
  "use strict";
714
728
  var __exports__;
715
- var Exception = __dependency1__;
716
-
717
- function LocationInfo(locInfo) {
718
- locInfo = locInfo || {};
719
- this.firstLine = locInfo.first_line;
720
- this.firstColumn = locInfo.first_column;
721
- this.lastColumn = locInfo.last_column;
722
- this.lastLine = locInfo.last_line;
723
- }
724
-
725
729
  var AST = {
726
- ProgramNode: function(statements, strip, locInfo) {
727
- LocationInfo.call(this, locInfo);
728
- this.type = "program";
729
- this.statements = statements;
730
- this.strip = strip;
731
- },
730
+ Program: function(statements, blockParams, strip, locInfo) {
731
+ this.loc = locInfo;
732
+ this.type = 'Program';
733
+ this.body = statements;
732
734
 
733
- MustacheNode: function(rawParams, hash, open, strip, locInfo) {
734
- LocationInfo.call(this, locInfo);
735
- this.type = "mustache";
735
+ this.blockParams = blockParams;
736
736
  this.strip = strip;
737
-
738
- // Open may be a string parsed from the parser or a passed boolean flag
739
- if (open != null && open.charAt) {
740
- // Must use charAt to support IE pre-10
741
- var escapeFlag = open.charAt(3) || open.charAt(2);
742
- this.escaped = escapeFlag !== '{' && escapeFlag !== '&';
743
- } else {
744
- this.escaped = !!open;
745
- }
746
-
747
- if (rawParams instanceof AST.SexprNode) {
748
- this.sexpr = rawParams;
749
- } else {
750
- // Support old AST API
751
- this.sexpr = new AST.SexprNode(rawParams, hash);
752
- }
753
-
754
- // Support old AST API that stored this info in MustacheNode
755
- this.id = this.sexpr.id;
756
- this.params = this.sexpr.params;
757
- this.hash = this.sexpr.hash;
758
- this.eligibleHelper = this.sexpr.eligibleHelper;
759
- this.isHelper = this.sexpr.isHelper;
760
737
  },
761
738
 
762
- SexprNode: function(rawParams, hash, locInfo) {
763
- LocationInfo.call(this, locInfo);
739
+ MustacheStatement: function(path, params, hash, escaped, strip, locInfo) {
740
+ this.loc = locInfo;
741
+ this.type = 'MustacheStatement';
764
742
 
765
- this.type = "sexpr";
743
+ this.path = path;
744
+ this.params = params || [];
766
745
  this.hash = hash;
746
+ this.escaped = escaped;
767
747
 
768
- var id = this.id = rawParams[0];
769
- var params = this.params = rawParams.slice(1);
770
-
771
- // a mustache is definitely a helper if:
772
- // * it is an eligible helper, and
773
- // * it has at least one parameter or hash segment
774
- this.isHelper = !!(params.length || hash);
775
-
776
- // a mustache is an eligible helper if:
777
- // * its id is simple (a single part, not `this` or `..`)
778
- this.eligibleHelper = this.isHelper || id.isSimple;
779
-
780
- // if a mustache is an eligible helper but not a definite
781
- // helper, it is ambiguous, and will be resolved in a later
782
- // pass or at runtime.
783
- },
784
-
785
- PartialNode: function(partialName, context, hash, strip, locInfo) {
786
- LocationInfo.call(this, locInfo);
787
- this.type = "partial";
788
- this.partialName = partialName;
789
- this.context = context;
790
- this.hash = hash;
791
748
  this.strip = strip;
792
-
793
- this.strip.inlineStandalone = true;
794
749
  },
795
750
 
796
- BlockNode: function(mustache, program, inverse, strip, locInfo) {
797
- LocationInfo.call(this, locInfo);
751
+ BlockStatement: function(path, params, hash, program, inverse, openStrip, inverseStrip, closeStrip, locInfo) {
752
+ this.loc = locInfo;
753
+ this.type = 'BlockStatement';
798
754
 
799
- this.type = 'block';
800
- this.mustache = mustache;
755
+ this.path = path;
756
+ this.params = params || [];
757
+ this.hash = hash;
801
758
  this.program = program;
802
759
  this.inverse = inverse;
803
- this.strip = strip;
804
760
 
805
- if (inverse && !program) {
806
- this.isInverse = true;
807
- }
761
+ this.openStrip = openStrip;
762
+ this.inverseStrip = inverseStrip;
763
+ this.closeStrip = closeStrip;
808
764
  },
809
765
 
810
- RawBlockNode: function(mustache, content, close, locInfo) {
811
- LocationInfo.call(this, locInfo);
812
-
813
- if (mustache.sexpr.id.original !== close) {
814
- throw new Exception(mustache.sexpr.id.original + " doesn't match " + close, this);
815
- }
766
+ PartialStatement: function(name, params, hash, strip, locInfo) {
767
+ this.loc = locInfo;
768
+ this.type = 'PartialStatement';
816
769
 
817
- content = new AST.ContentNode(content, locInfo);
770
+ this.name = name;
771
+ this.params = params || [];
772
+ this.hash = hash;
818
773
 
819
- this.type = 'block';
820
- this.mustache = mustache;
821
- this.program = new AST.ProgramNode([content], {}, locInfo);
774
+ this.indent = '';
775
+ this.strip = strip;
822
776
  },
823
777
 
824
- ContentNode: function(string, locInfo) {
825
- LocationInfo.call(this, locInfo);
826
- this.type = "content";
827
- this.original = this.string = string;
778
+ ContentStatement: function(string, locInfo) {
779
+ this.loc = locInfo;
780
+ this.type = 'ContentStatement';
781
+ this.original = this.value = string;
828
782
  },
829
783
 
830
- HashNode: function(pairs, locInfo) {
831
- LocationInfo.call(this, locInfo);
832
- this.type = "hash";
833
- this.pairs = pairs;
834
- },
784
+ CommentStatement: function(comment, strip, locInfo) {
785
+ this.loc = locInfo;
786
+ this.type = 'CommentStatement';
787
+ this.value = comment;
835
788
 
836
- IdNode: function(parts, locInfo) {
837
- LocationInfo.call(this, locInfo);
838
- this.type = "ID";
789
+ this.strip = strip;
790
+ },
839
791
 
840
- var original = "",
841
- dig = [],
842
- depth = 0,
843
- depthString = '';
792
+ SubExpression: function(path, params, hash, locInfo) {
793
+ this.loc = locInfo;
844
794
 
845
- for(var i=0,l=parts.length; i<l; i++) {
846
- var part = parts[i].part;
847
- original += (parts[i].separator || '') + part;
795
+ this.type = 'SubExpression';
796
+ this.path = path;
797
+ this.params = params || [];
798
+ this.hash = hash;
799
+ },
848
800
 
849
- if (part === ".." || part === "." || part === "this") {
850
- if (dig.length > 0) {
851
- throw new Exception("Invalid path: " + original, this);
852
- } else if (part === "..") {
853
- depth++;
854
- depthString += '../';
855
- } else {
856
- this.isScoped = true;
857
- }
858
- } else {
859
- dig.push(part);
860
- }
861
- }
801
+ PathExpression: function(data, depth, parts, original, locInfo) {
802
+ this.loc = locInfo;
803
+ this.type = 'PathExpression';
862
804
 
805
+ this.data = data;
863
806
  this.original = original;
864
- this.parts = dig;
865
- this.string = dig.join('.');
807
+ this.parts = parts;
866
808
  this.depth = depth;
867
- this.idName = depthString + this.string;
868
-
869
- // an ID is simple if it only has one part, and that part is not
870
- // `..` or `this`.
871
- this.isSimple = parts.length === 1 && !this.isScoped && depth === 0;
872
-
873
- this.stringModeValue = this.string;
874
- },
875
-
876
- PartialNameNode: function(name, locInfo) {
877
- LocationInfo.call(this, locInfo);
878
- this.type = "PARTIAL_NAME";
879
- this.name = name.original;
880
809
  },
881
810
 
882
- DataNode: function(id, locInfo) {
883
- LocationInfo.call(this, locInfo);
884
- this.type = "DATA";
885
- this.id = id;
886
- this.stringModeValue = id.stringModeValue;
887
- this.idName = '@' + id.stringModeValue;
811
+ StringLiteral: function(string, locInfo) {
812
+ this.loc = locInfo;
813
+ this.type = 'StringLiteral';
814
+ this.original =
815
+ this.value = string;
888
816
  },
889
817
 
890
- StringNode: function(string, locInfo) {
891
- LocationInfo.call(this, locInfo);
892
- this.type = "STRING";
818
+ NumberLiteral: function(number, locInfo) {
819
+ this.loc = locInfo;
820
+ this.type = 'NumberLiteral';
893
821
  this.original =
894
- this.string =
895
- this.stringModeValue = string;
822
+ this.value = Number(number);
896
823
  },
897
824
 
898
- NumberNode: function(number, locInfo) {
899
- LocationInfo.call(this, locInfo);
900
- this.type = "NUMBER";
825
+ BooleanLiteral: function(bool, locInfo) {
826
+ this.loc = locInfo;
827
+ this.type = 'BooleanLiteral';
901
828
  this.original =
902
- this.number = number;
903
- this.stringModeValue = Number(number);
829
+ this.value = bool === 'true';
904
830
  },
905
831
 
906
- BooleanNode: function(bool, locInfo) {
907
- LocationInfo.call(this, locInfo);
908
- this.type = "BOOLEAN";
909
- this.bool = bool;
910
- this.stringModeValue = bool === "true";
832
+ Hash: function(pairs, locInfo) {
833
+ this.loc = locInfo;
834
+ this.type = 'Hash';
835
+ this.pairs = pairs;
836
+ },
837
+ HashPair: function(key, value, locInfo) {
838
+ this.loc = locInfo;
839
+ this.type = 'HashPair';
840
+ this.key = key;
841
+ this.value = value;
911
842
  },
912
843
 
913
- CommentNode: function(comment, locInfo) {
914
- LocationInfo.call(this, locInfo);
915
- this.type = "comment";
916
- this.comment = comment;
844
+ // Public API used to evaluate derived attributes regarding AST nodes
845
+ helpers: {
846
+ // a mustache is definitely a helper if:
847
+ // * it is an eligible helper, and
848
+ // * it has at least one parameter or hash segment
849
+ // TODO: Make these public utility methods
850
+ helperExpression: function(node) {
851
+ return !!(node.type === 'SubExpression' || node.params.length || node.hash);
852
+ },
853
+
854
+ scopedId: function(path) {
855
+ return (/^\.|this\b/).test(path.original);
856
+ },
917
857
 
918
- this.strip = {
919
- inlineStandalone: true
920
- };
858
+ // an ID is simple if it only has one part, and that part is not
859
+ // `..` or `this`.
860
+ simpleId: function(path) {
861
+ return path.parts.length === 1 && !AST.helpers.scopedId(path) && !path.depth;
862
+ }
921
863
  }
922
864
  };
923
865
 
924
866
 
925
867
  // Must be exported as an object rather than the root of the module as the jison lexer
926
- // most modify the object to operate properly.
868
+ // must modify the object to operate properly.
927
869
  __exports__ = AST;
928
870
  return __exports__;
929
- })(__module5__);
871
+ })();
930
872
 
931
873
  // handlebars/compiler/parser.js
932
874
  var __module9__ = (function() {
@@ -938,16 +880,16 @@ var __module9__ = (function() {
938
880
  var handlebars = (function(){
939
881
  var parser = {trace: function trace() { },
940
882
  yy: {},
941
- symbols_: {"error":2,"root":3,"program":4,"EOF":5,"program_repetition0":6,"statement":7,"mustache":8,"block":9,"rawBlock":10,"partial":11,"CONTENT":12,"COMMENT":13,"openRawBlock":14,"END_RAW_BLOCK":15,"OPEN_RAW_BLOCK":16,"sexpr":17,"CLOSE_RAW_BLOCK":18,"openBlock":19,"block_option0":20,"closeBlock":21,"openInverse":22,"block_option1":23,"OPEN_BLOCK":24,"CLOSE":25,"OPEN_INVERSE":26,"inverseAndProgram":27,"INVERSE":28,"OPEN_ENDBLOCK":29,"path":30,"OPEN":31,"OPEN_UNESCAPED":32,"CLOSE_UNESCAPED":33,"OPEN_PARTIAL":34,"partialName":35,"param":36,"partial_option0":37,"partial_option1":38,"sexpr_repetition0":39,"sexpr_option0":40,"dataName":41,"STRING":42,"NUMBER":43,"BOOLEAN":44,"OPEN_SEXPR":45,"CLOSE_SEXPR":46,"hash":47,"hash_repetition_plus0":48,"hashSegment":49,"ID":50,"EQUALS":51,"DATA":52,"pathSegments":53,"SEP":54,"$accept":0,"$end":1},
942
- terminals_: {2:"error",5:"EOF",12:"CONTENT",13:"COMMENT",15:"END_RAW_BLOCK",16:"OPEN_RAW_BLOCK",18:"CLOSE_RAW_BLOCK",24:"OPEN_BLOCK",25:"CLOSE",26:"OPEN_INVERSE",28:"INVERSE",29:"OPEN_ENDBLOCK",31:"OPEN",32:"OPEN_UNESCAPED",33:"CLOSE_UNESCAPED",34:"OPEN_PARTIAL",42:"STRING",43:"NUMBER",44:"BOOLEAN",45:"OPEN_SEXPR",46:"CLOSE_SEXPR",50:"ID",51:"EQUALS",52:"DATA",54:"SEP"},
943
- productions_: [0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[10,3],[14,3],[9,4],[9,4],[19,3],[22,3],[27,2],[21,3],[8,3],[8,3],[11,5],[11,4],[17,3],[17,1],[36,1],[36,1],[36,1],[36,1],[36,1],[36,3],[47,1],[49,3],[35,1],[35,1],[35,1],[41,2],[30,1],[53,3],[53,1],[6,0],[6,2],[20,0],[20,1],[23,0],[23,1],[37,0],[37,1],[38,0],[38,1],[39,0],[39,2],[40,0],[40,1],[48,1],[48,2]],
883
+ symbols_: {"error":2,"root":3,"program":4,"EOF":5,"program_repetition0":6,"statement":7,"mustache":8,"block":9,"rawBlock":10,"partial":11,"content":12,"COMMENT":13,"CONTENT":14,"openRawBlock":15,"END_RAW_BLOCK":16,"OPEN_RAW_BLOCK":17,"helperName":18,"openRawBlock_repetition0":19,"openRawBlock_option0":20,"CLOSE_RAW_BLOCK":21,"openBlock":22,"block_option0":23,"closeBlock":24,"openInverse":25,"block_option1":26,"OPEN_BLOCK":27,"openBlock_repetition0":28,"openBlock_option0":29,"openBlock_option1":30,"CLOSE":31,"OPEN_INVERSE":32,"openInverse_repetition0":33,"openInverse_option0":34,"openInverse_option1":35,"openInverseChain":36,"OPEN_INVERSE_CHAIN":37,"openInverseChain_repetition0":38,"openInverseChain_option0":39,"openInverseChain_option1":40,"inverseAndProgram":41,"INVERSE":42,"inverseChain":43,"inverseChain_option0":44,"OPEN_ENDBLOCK":45,"OPEN":46,"mustache_repetition0":47,"mustache_option0":48,"OPEN_UNESCAPED":49,"mustache_repetition1":50,"mustache_option1":51,"CLOSE_UNESCAPED":52,"OPEN_PARTIAL":53,"partialName":54,"partial_repetition0":55,"partial_option0":56,"param":57,"sexpr":58,"OPEN_SEXPR":59,"sexpr_repetition0":60,"sexpr_option0":61,"CLOSE_SEXPR":62,"hash":63,"hash_repetition_plus0":64,"hashSegment":65,"ID":66,"EQUALS":67,"blockParams":68,"OPEN_BLOCK_PARAMS":69,"blockParams_repetition_plus0":70,"CLOSE_BLOCK_PARAMS":71,"path":72,"dataName":73,"STRING":74,"NUMBER":75,"BOOLEAN":76,"DATA":77,"pathSegments":78,"SEP":79,"$accept":0,"$end":1},
884
+ terminals_: {2:"error",5:"EOF",13:"COMMENT",14:"CONTENT",16:"END_RAW_BLOCK",17:"OPEN_RAW_BLOCK",21:"CLOSE_RAW_BLOCK",27:"OPEN_BLOCK",31:"CLOSE",32:"OPEN_INVERSE",37:"OPEN_INVERSE_CHAIN",42:"INVERSE",45:"OPEN_ENDBLOCK",46:"OPEN",49:"OPEN_UNESCAPED",52:"CLOSE_UNESCAPED",53:"OPEN_PARTIAL",59:"OPEN_SEXPR",62:"CLOSE_SEXPR",66:"ID",67:"EQUALS",69:"OPEN_BLOCK_PARAMS",71:"CLOSE_BLOCK_PARAMS",74:"STRING",75:"NUMBER",76:"BOOLEAN",77:"DATA",79:"SEP"},
885
+ productions_: [0,[3,2],[4,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[12,1],[10,3],[15,5],[9,4],[9,4],[22,6],[25,6],[36,6],[41,2],[43,3],[43,1],[24,3],[8,5],[8,5],[11,5],[57,1],[57,1],[58,5],[63,1],[65,3],[68,3],[18,1],[18,1],[18,1],[18,1],[18,1],[54,1],[54,1],[73,2],[72,1],[78,3],[78,1],[6,0],[6,2],[19,0],[19,2],[20,0],[20,1],[23,0],[23,1],[26,0],[26,1],[28,0],[28,2],[29,0],[29,1],[30,0],[30,1],[33,0],[33,2],[34,0],[34,1],[35,0],[35,1],[38,0],[38,2],[39,0],[39,1],[40,0],[40,1],[44,0],[44,1],[47,0],[47,2],[48,0],[48,1],[50,0],[50,2],[51,0],[51,1],[55,0],[55,2],[56,0],[56,1],[60,0],[60,2],[61,0],[61,1],[64,1],[64,2],[70,1],[70,2]],
944
886
  performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
945
887
 
946
888
  var $0 = $$.length - 1;
947
889
  switch (yystate) {
948
- case 1: yy.prepareProgram($$[$0-1].statements, true); return $$[$0-1];
890
+ case 1: return $$[$0-1];
949
891
  break;
950
- case 2:this.$ = new yy.ProgramNode(yy.prepareProgram($$[$0]), {}, this._$);
892
+ case 2:this.$ = new yy.Program($$[$0], null, {}, yy.locInfo(this._$));
951
893
  break;
952
894
  case 3:this.$ = $$[$0];
953
895
  break;
@@ -957,84 +899,128 @@ var __module9__ = (function() {
957
899
  break;
958
900
  case 6:this.$ = $$[$0];
959
901
  break;
960
- case 7:this.$ = new yy.ContentNode($$[$0], this._$);
902
+ case 7:this.$ = $$[$0];
903
+ break;
904
+ case 8:this.$ = new yy.CommentStatement(yy.stripComment($$[$0]), yy.stripFlags($$[$0], $$[$0]), yy.locInfo(this._$));
905
+ break;
906
+ case 9:this.$ = new yy.ContentStatement($$[$0], yy.locInfo(this._$));
907
+ break;
908
+ case 10:this.$ = yy.prepareRawBlock($$[$0-2], $$[$0-1], $$[$0], this._$);
909
+ break;
910
+ case 11:this.$ = { path: $$[$0-3], params: $$[$0-2], hash: $$[$0-1] };
911
+ break;
912
+ case 12:this.$ = yy.prepareBlock($$[$0-3], $$[$0-2], $$[$0-1], $$[$0], false, this._$);
913
+ break;
914
+ case 13:this.$ = yy.prepareBlock($$[$0-3], $$[$0-2], $$[$0-1], $$[$0], true, this._$);
915
+ break;
916
+ case 14:this.$ = { path: $$[$0-4], params: $$[$0-3], hash: $$[$0-2], blockParams: $$[$0-1], strip: yy.stripFlags($$[$0-5], $$[$0]) };
961
917
  break;
962
- case 8:this.$ = new yy.CommentNode($$[$0], this._$);
918
+ case 15:this.$ = { path: $$[$0-4], params: $$[$0-3], hash: $$[$0-2], blockParams: $$[$0-1], strip: yy.stripFlags($$[$0-5], $$[$0]) };
963
919
  break;
964
- case 9:this.$ = new yy.RawBlockNode($$[$0-2], $$[$0-1], $$[$0], this._$);
920
+ case 16:this.$ = { path: $$[$0-4], params: $$[$0-3], hash: $$[$0-2], blockParams: $$[$0-1], strip: yy.stripFlags($$[$0-5], $$[$0]) };
965
921
  break;
966
- case 10:this.$ = new yy.MustacheNode($$[$0-1], null, '', '', this._$);
922
+ case 17:this.$ = { strip: yy.stripFlags($$[$0-1], $$[$0-1]), program: $$[$0] };
967
923
  break;
968
- case 11:this.$ = yy.prepareBlock($$[$0-3], $$[$0-2], $$[$0-1], $$[$0], false, this._$);
924
+ case 18:
925
+ var inverse = yy.prepareBlock($$[$0-2], $$[$0-1], $$[$0], $$[$0], false, this._$),
926
+ program = new yy.Program([inverse], null, {}, yy.locInfo(this._$));
927
+ program.chained = true;
928
+
929
+ this.$ = { strip: $$[$0-2].strip, program: program, chain: true };
930
+
931
+ break;
932
+ case 19:this.$ = $$[$0];
933
+ break;
934
+ case 20:this.$ = {path: $$[$0-1], strip: yy.stripFlags($$[$0-2], $$[$0])};
935
+ break;
936
+ case 21:this.$ = yy.prepareMustache($$[$0-3], $$[$0-2], $$[$0-1], $$[$0-4], yy.stripFlags($$[$0-4], $$[$0]), this._$);
937
+ break;
938
+ case 22:this.$ = yy.prepareMustache($$[$0-3], $$[$0-2], $$[$0-1], $$[$0-4], yy.stripFlags($$[$0-4], $$[$0]), this._$);
939
+ break;
940
+ case 23:this.$ = new yy.PartialStatement($$[$0-3], $$[$0-2], $$[$0-1], yy.stripFlags($$[$0-4], $$[$0]), yy.locInfo(this._$));
941
+ break;
942
+ case 24:this.$ = $$[$0];
943
+ break;
944
+ case 25:this.$ = $$[$0];
969
945
  break;
970
- case 12:this.$ = yy.prepareBlock($$[$0-3], $$[$0-2], $$[$0-1], $$[$0], true, this._$);
946
+ case 26:this.$ = new yy.SubExpression($$[$0-3], $$[$0-2], $$[$0-1], yy.locInfo(this._$));
971
947
  break;
972
- case 13:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], yy.stripFlags($$[$0-2], $$[$0]), this._$);
948
+ case 27:this.$ = new yy.Hash($$[$0], yy.locInfo(this._$));
973
949
  break;
974
- case 14:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], yy.stripFlags($$[$0-2], $$[$0]), this._$);
950
+ case 28:this.$ = new yy.HashPair($$[$0-2], $$[$0], yy.locInfo(this._$));
975
951
  break;
976
- case 15:this.$ = { strip: yy.stripFlags($$[$0-1], $$[$0-1]), program: $$[$0] };
952
+ case 29:this.$ = $$[$0-1];
977
953
  break;
978
- case 16:this.$ = {path: $$[$0-1], strip: yy.stripFlags($$[$0-2], $$[$0])};
954
+ case 30:this.$ = $$[$0];
979
955
  break;
980
- case 17:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], yy.stripFlags($$[$0-2], $$[$0]), this._$);
956
+ case 31:this.$ = $$[$0];
981
957
  break;
982
- case 18:this.$ = new yy.MustacheNode($$[$0-1], null, $$[$0-2], yy.stripFlags($$[$0-2], $$[$0]), this._$);
958
+ case 32:this.$ = new yy.StringLiteral($$[$0], yy.locInfo(this._$));
983
959
  break;
984
- case 19:this.$ = new yy.PartialNode($$[$0-3], $$[$0-2], $$[$0-1], yy.stripFlags($$[$0-4], $$[$0]), this._$);
960
+ case 33:this.$ = new yy.NumberLiteral($$[$0], yy.locInfo(this._$));
985
961
  break;
986
- case 20:this.$ = new yy.PartialNode($$[$0-2], undefined, $$[$0-1], yy.stripFlags($$[$0-3], $$[$0]), this._$);
962
+ case 34:this.$ = new yy.BooleanLiteral($$[$0], yy.locInfo(this._$));
987
963
  break;
988
- case 21:this.$ = new yy.SexprNode([$$[$0-2]].concat($$[$0-1]), $$[$0], this._$);
964
+ case 35:this.$ = $$[$0];
989
965
  break;
990
- case 22:this.$ = new yy.SexprNode([$$[$0]], null, this._$);
966
+ case 36:this.$ = $$[$0];
991
967
  break;
992
- case 23:this.$ = $$[$0];
968
+ case 37:this.$ = yy.preparePath(true, $$[$0], this._$);
993
969
  break;
994
- case 24:this.$ = new yy.StringNode($$[$0], this._$);
970
+ case 38:this.$ = yy.preparePath(false, $$[$0], this._$);
995
971
  break;
996
- case 25:this.$ = new yy.NumberNode($$[$0], this._$);
972
+ case 39: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2];
997
973
  break;
998
- case 26:this.$ = new yy.BooleanNode($$[$0], this._$);
974
+ case 40:this.$ = [{part: $$[$0]}];
999
975
  break;
1000
- case 27:this.$ = $$[$0];
976
+ case 41:this.$ = [];
1001
977
  break;
1002
- case 28:$$[$0-1].isHelper = true; this.$ = $$[$0-1];
978
+ case 42:$$[$0-1].push($$[$0]);
1003
979
  break;
1004
- case 29:this.$ = new yy.HashNode($$[$0], this._$);
980
+ case 43:this.$ = [];
1005
981
  break;
1006
- case 30:this.$ = [$$[$0-2], $$[$0]];
982
+ case 44:$$[$0-1].push($$[$0]);
1007
983
  break;
1008
- case 31:this.$ = new yy.PartialNameNode($$[$0], this._$);
984
+ case 51:this.$ = [];
1009
985
  break;
1010
- case 32:this.$ = new yy.PartialNameNode(new yy.StringNode($$[$0], this._$), this._$);
986
+ case 52:$$[$0-1].push($$[$0]);
1011
987
  break;
1012
- case 33:this.$ = new yy.PartialNameNode(new yy.NumberNode($$[$0], this._$));
988
+ case 57:this.$ = [];
1013
989
  break;
1014
- case 34:this.$ = new yy.DataNode($$[$0], this._$);
990
+ case 58:$$[$0-1].push($$[$0]);
1015
991
  break;
1016
- case 35:this.$ = new yy.IdNode($$[$0], this._$);
992
+ case 63:this.$ = [];
1017
993
  break;
1018
- case 36: $$[$0-2].push({part: $$[$0], separator: $$[$0-1]}); this.$ = $$[$0-2];
994
+ case 64:$$[$0-1].push($$[$0]);
1019
995
  break;
1020
- case 37:this.$ = [{part: $$[$0]}];
996
+ case 71:this.$ = [];
1021
997
  break;
1022
- case 38:this.$ = [];
998
+ case 72:$$[$0-1].push($$[$0]);
1023
999
  break;
1024
- case 39:$$[$0-1].push($$[$0]);
1000
+ case 75:this.$ = [];
1025
1001
  break;
1026
- case 48:this.$ = [];
1002
+ case 76:$$[$0-1].push($$[$0]);
1027
1003
  break;
1028
- case 49:$$[$0-1].push($$[$0]);
1004
+ case 79:this.$ = [];
1029
1005
  break;
1030
- case 52:this.$ = [$$[$0]];
1006
+ case 80:$$[$0-1].push($$[$0]);
1031
1007
  break;
1032
- case 53:$$[$0-1].push($$[$0]);
1008
+ case 83:this.$ = [];
1009
+ break;
1010
+ case 84:$$[$0-1].push($$[$0]);
1011
+ break;
1012
+ case 87:this.$ = [$$[$0]];
1013
+ break;
1014
+ case 88:$$[$0-1].push($$[$0]);
1015
+ break;
1016
+ case 89:this.$ = [$$[$0]];
1017
+ break;
1018
+ case 90:$$[$0-1].push($$[$0]);
1033
1019
  break;
1034
1020
  }
1035
1021
  },
1036
- table: [{3:1,4:2,5:[2,38],6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],31:[2,38],32:[2,38],34:[2,38]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:[1,10],13:[1,11],14:16,16:[1,20],19:14,22:15,24:[1,18],26:[1,19],28:[2,2],29:[2,2],31:[1,12],32:[1,13],34:[1,17]},{1:[2,1]},{5:[2,39],12:[2,39],13:[2,39],16:[2,39],24:[2,39],26:[2,39],28:[2,39],29:[2,39],31:[2,39],32:[2,39],34:[2,39]},{5:[2,3],12:[2,3],13:[2,3],16:[2,3],24:[2,3],26:[2,3],28:[2,3],29:[2,3],31:[2,3],32:[2,3],34:[2,3]},{5:[2,4],12:[2,4],13:[2,4],16:[2,4],24:[2,4],26:[2,4],28:[2,4],29:[2,4],31:[2,4],32:[2,4],34:[2,4]},{5:[2,5],12:[2,5],13:[2,5],16:[2,5],24:[2,5],26:[2,5],28:[2,5],29:[2,5],31:[2,5],32:[2,5],34:[2,5]},{5:[2,6],12:[2,6],13:[2,6],16:[2,6],24:[2,6],26:[2,6],28:[2,6],29:[2,6],31:[2,6],32:[2,6],34:[2,6]},{5:[2,7],12:[2,7],13:[2,7],16:[2,7],24:[2,7],26:[2,7],28:[2,7],29:[2,7],31:[2,7],32:[2,7],34:[2,7]},{5:[2,8],12:[2,8],13:[2,8],16:[2,8],24:[2,8],26:[2,8],28:[2,8],29:[2,8],31:[2,8],32:[2,8],34:[2,8]},{17:21,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:27,30:22,41:23,50:[1,26],52:[1,25],53:24},{4:28,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],28:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{4:29,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],28:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{12:[1,30]},{30:32,35:31,42:[1,33],43:[1,34],50:[1,26],53:24},{17:35,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:36,30:22,41:23,50:[1,26],52:[1,25],53:24},{17:37,30:22,41:23,50:[1,26],52:[1,25],53:24},{25:[1,38]},{18:[2,48],25:[2,48],33:[2,48],39:39,42:[2,48],43:[2,48],44:[2,48],45:[2,48],46:[2,48],50:[2,48],52:[2,48]},{18:[2,22],25:[2,22],33:[2,22],46:[2,22]},{18:[2,35],25:[2,35],33:[2,35],42:[2,35],43:[2,35],44:[2,35],45:[2,35],46:[2,35],50:[2,35],52:[2,35],54:[1,40]},{30:41,50:[1,26],53:24},{18:[2,37],25:[2,37],33:[2,37],42:[2,37],43:[2,37],44:[2,37],45:[2,37],46:[2,37],50:[2,37],52:[2,37],54:[2,37]},{33:[1,42]},{20:43,27:44,28:[1,45],29:[2,40]},{23:46,27:47,28:[1,45],29:[2,42]},{15:[1,48]},{25:[2,46],30:51,36:49,38:50,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],47:57,48:58,49:60,50:[1,59],52:[1,25],53:24},{25:[2,31],42:[2,31],43:[2,31],44:[2,31],45:[2,31],50:[2,31],52:[2,31]},{25:[2,32],42:[2,32],43:[2,32],44:[2,32],45:[2,32],50:[2,32],52:[2,32]},{25:[2,33],42:[2,33],43:[2,33],44:[2,33],45:[2,33],50:[2,33],52:[2,33]},{25:[1,61]},{25:[1,62]},{18:[1,63]},{5:[2,17],12:[2,17],13:[2,17],16:[2,17],24:[2,17],26:[2,17],28:[2,17],29:[2,17],31:[2,17],32:[2,17],34:[2,17]},{18:[2,50],25:[2,50],30:51,33:[2,50],36:65,40:64,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],46:[2,50],47:66,48:58,49:60,50:[1,59],52:[1,25],53:24},{50:[1,67]},{18:[2,34],25:[2,34],33:[2,34],42:[2,34],43:[2,34],44:[2,34],45:[2,34],46:[2,34],50:[2,34],52:[2,34]},{5:[2,18],12:[2,18],13:[2,18],16:[2,18],24:[2,18],26:[2,18],28:[2,18],29:[2,18],31:[2,18],32:[2,18],34:[2,18]},{21:68,29:[1,69]},{29:[2,41]},{4:70,6:3,12:[2,38],13:[2,38],16:[2,38],24:[2,38],26:[2,38],29:[2,38],31:[2,38],32:[2,38],34:[2,38]},{21:71,29:[1,69]},{29:[2,43]},{5:[2,9],12:[2,9],13:[2,9],16:[2,9],24:[2,9],26:[2,9],28:[2,9],29:[2,9],31:[2,9],32:[2,9],34:[2,9]},{25:[2,44],37:72,47:73,48:58,49:60,50:[1,74]},{25:[1,75]},{18:[2,23],25:[2,23],33:[2,23],42:[2,23],43:[2,23],44:[2,23],45:[2,23],46:[2,23],50:[2,23],52:[2,23]},{18:[2,24],25:[2,24],33:[2,24],42:[2,24],43:[2,24],44:[2,24],45:[2,24],46:[2,24],50:[2,24],52:[2,24]},{18:[2,25],25:[2,25],33:[2,25],42:[2,25],43:[2,25],44:[2,25],45:[2,25],46:[2,25],50:[2,25],52:[2,25]},{18:[2,26],25:[2,26],33:[2,26],42:[2,26],43:[2,26],44:[2,26],45:[2,26],46:[2,26],50:[2,26],52:[2,26]},{18:[2,27],25:[2,27],33:[2,27],42:[2,27],43:[2,27],44:[2,27],45:[2,27],46:[2,27],50:[2,27],52:[2,27]},{17:76,30:22,41:23,50:[1,26],52:[1,25],53:24},{25:[2,47]},{18:[2,29],25:[2,29],33:[2,29],46:[2,29],49:77,50:[1,74]},{18:[2,37],25:[2,37],33:[2,37],42:[2,37],43:[2,37],44:[2,37],45:[2,37],46:[2,37],50:[2,37],51:[1,78],52:[2,37],54:[2,37]},{18:[2,52],25:[2,52],33:[2,52],46:[2,52],50:[2,52]},{12:[2,13],13:[2,13],16:[2,13],24:[2,13],26:[2,13],28:[2,13],29:[2,13],31:[2,13],32:[2,13],34:[2,13]},{12:[2,14],13:[2,14],16:[2,14],24:[2,14],26:[2,14],28:[2,14],29:[2,14],31:[2,14],32:[2,14],34:[2,14]},{12:[2,10]},{18:[2,21],25:[2,21],33:[2,21],46:[2,21]},{18:[2,49],25:[2,49],33:[2,49],42:[2,49],43:[2,49],44:[2,49],45:[2,49],46:[2,49],50:[2,49],52:[2,49]},{18:[2,51],25:[2,51],33:[2,51],46:[2,51]},{18:[2,36],25:[2,36],33:[2,36],42:[2,36],43:[2,36],44:[2,36],45:[2,36],46:[2,36],50:[2,36],52:[2,36],54:[2,36]},{5:[2,11],12:[2,11],13:[2,11],16:[2,11],24:[2,11],26:[2,11],28:[2,11],29:[2,11],31:[2,11],32:[2,11],34:[2,11]},{30:79,50:[1,26],53:24},{29:[2,15]},{5:[2,12],12:[2,12],13:[2,12],16:[2,12],24:[2,12],26:[2,12],28:[2,12],29:[2,12],31:[2,12],32:[2,12],34:[2,12]},{25:[1,80]},{25:[2,45]},{51:[1,78]},{5:[2,20],12:[2,20],13:[2,20],16:[2,20],24:[2,20],26:[2,20],28:[2,20],29:[2,20],31:[2,20],32:[2,20],34:[2,20]},{46:[1,81]},{18:[2,53],25:[2,53],33:[2,53],46:[2,53],50:[2,53]},{30:51,36:82,41:55,42:[1,52],43:[1,53],44:[1,54],45:[1,56],50:[1,26],52:[1,25],53:24},{25:[1,83]},{5:[2,19],12:[2,19],13:[2,19],16:[2,19],24:[2,19],26:[2,19],28:[2,19],29:[2,19],31:[2,19],32:[2,19],34:[2,19]},{18:[2,28],25:[2,28],33:[2,28],42:[2,28],43:[2,28],44:[2,28],45:[2,28],46:[2,28],50:[2,28],52:[2,28]},{18:[2,30],25:[2,30],33:[2,30],46:[2,30],50:[2,30]},{5:[2,16],12:[2,16],13:[2,16],16:[2,16],24:[2,16],26:[2,16],28:[2,16],29:[2,16],31:[2,16],32:[2,16],34:[2,16]}],
1037
- defaultActions: {4:[2,1],44:[2,41],47:[2,43],57:[2,47],63:[2,10],70:[2,15],73:[2,45]},
1022
+ table: [{3:1,4:2,5:[2,41],6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],46:[2,41],49:[2,41],53:[2,41]},{1:[3]},{5:[1,4]},{5:[2,2],7:5,8:6,9:7,10:8,11:9,12:10,13:[1,11],14:[1,18],15:16,17:[1,21],22:14,25:15,27:[1,19],32:[1,20],37:[2,2],42:[2,2],45:[2,2],46:[1,12],49:[1,13],53:[1,17]},{1:[2,1]},{5:[2,42],13:[2,42],14:[2,42],17:[2,42],27:[2,42],32:[2,42],37:[2,42],42:[2,42],45:[2,42],46:[2,42],49:[2,42],53:[2,42]},{5:[2,3],13:[2,3],14:[2,3],17:[2,3],27:[2,3],32:[2,3],37:[2,3],42:[2,3],45:[2,3],46:[2,3],49:[2,3],53:[2,3]},{5:[2,4],13:[2,4],14:[2,4],17:[2,4],27:[2,4],32:[2,4],37:[2,4],42:[2,4],45:[2,4],46:[2,4],49:[2,4],53:[2,4]},{5:[2,5],13:[2,5],14:[2,5],17:[2,5],27:[2,5],32:[2,5],37:[2,5],42:[2,5],45:[2,5],46:[2,5],49:[2,5],53:[2,5]},{5:[2,6],13:[2,6],14:[2,6],17:[2,6],27:[2,6],32:[2,6],37:[2,6],42:[2,6],45:[2,6],46:[2,6],49:[2,6],53:[2,6]},{5:[2,7],13:[2,7],14:[2,7],17:[2,7],27:[2,7],32:[2,7],37:[2,7],42:[2,7],45:[2,7],46:[2,7],49:[2,7],53:[2,7]},{5:[2,8],13:[2,8],14:[2,8],17:[2,8],27:[2,8],32:[2,8],37:[2,8],42:[2,8],45:[2,8],46:[2,8],49:[2,8],53:[2,8]},{18:22,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:31,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{4:32,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],37:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{4:33,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{12:34,14:[1,18]},{18:36,54:35,58:37,59:[1,38],66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,9],13:[2,9],14:[2,9],16:[2,9],17:[2,9],27:[2,9],32:[2,9],37:[2,9],42:[2,9],45:[2,9],46:[2,9],49:[2,9],53:[2,9]},{18:39,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:40,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:41,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{31:[2,71],47:42,59:[2,71],66:[2,71],74:[2,71],75:[2,71],76:[2,71],77:[2,71]},{21:[2,30],31:[2,30],52:[2,30],59:[2,30],62:[2,30],66:[2,30],69:[2,30],74:[2,30],75:[2,30],76:[2,30],77:[2,30]},{21:[2,31],31:[2,31],52:[2,31],59:[2,31],62:[2,31],66:[2,31],69:[2,31],74:[2,31],75:[2,31],76:[2,31],77:[2,31]},{21:[2,32],31:[2,32],52:[2,32],59:[2,32],62:[2,32],66:[2,32],69:[2,32],74:[2,32],75:[2,32],76:[2,32],77:[2,32]},{21:[2,33],31:[2,33],52:[2,33],59:[2,33],62:[2,33],66:[2,33],69:[2,33],74:[2,33],75:[2,33],76:[2,33],77:[2,33]},{21:[2,34],31:[2,34],52:[2,34],59:[2,34],62:[2,34],66:[2,34],69:[2,34],74:[2,34],75:[2,34],76:[2,34],77:[2,34]},{21:[2,38],31:[2,38],52:[2,38],59:[2,38],62:[2,38],66:[2,38],69:[2,38],74:[2,38],75:[2,38],76:[2,38],77:[2,38],79:[1,43]},{66:[1,30],78:44},{21:[2,40],31:[2,40],52:[2,40],59:[2,40],62:[2,40],66:[2,40],69:[2,40],74:[2,40],75:[2,40],76:[2,40],77:[2,40],79:[2,40]},{50:45,52:[2,75],59:[2,75],66:[2,75],74:[2,75],75:[2,75],76:[2,75],77:[2,75]},{23:46,36:48,37:[1,50],41:49,42:[1,51],43:47,45:[2,47]},{26:52,41:53,42:[1,51],45:[2,49]},{16:[1,54]},{31:[2,79],55:55,59:[2,79],66:[2,79],74:[2,79],75:[2,79],76:[2,79],77:[2,79]},{31:[2,35],59:[2,35],66:[2,35],74:[2,35],75:[2,35],76:[2,35],77:[2,35]},{31:[2,36],59:[2,36],66:[2,36],74:[2,36],75:[2,36],76:[2,36],77:[2,36]},{18:56,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{28:57,31:[2,51],59:[2,51],66:[2,51],69:[2,51],74:[2,51],75:[2,51],76:[2,51],77:[2,51]},{31:[2,57],33:58,59:[2,57],66:[2,57],69:[2,57],74:[2,57],75:[2,57],76:[2,57],77:[2,57]},{19:59,21:[2,43],59:[2,43],66:[2,43],74:[2,43],75:[2,43],76:[2,43],77:[2,43]},{18:63,31:[2,73],48:60,57:61,58:64,59:[1,38],63:62,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{66:[1,68]},{21:[2,37],31:[2,37],52:[2,37],59:[2,37],62:[2,37],66:[2,37],69:[2,37],74:[2,37],75:[2,37],76:[2,37],77:[2,37],79:[1,43]},{18:63,51:69,52:[2,77],57:70,58:64,59:[1,38],63:71,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{24:72,45:[1,73]},{45:[2,48]},{4:74,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],37:[2,41],42:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{45:[2,19]},{18:75,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{4:76,6:3,13:[2,41],14:[2,41],17:[2,41],27:[2,41],32:[2,41],45:[2,41],46:[2,41],49:[2,41],53:[2,41]},{24:77,45:[1,73]},{45:[2,50]},{5:[2,10],13:[2,10],14:[2,10],17:[2,10],27:[2,10],32:[2,10],37:[2,10],42:[2,10],45:[2,10],46:[2,10],49:[2,10],53:[2,10]},{18:63,31:[2,81],56:78,57:79,58:64,59:[1,38],63:80,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{59:[2,83],60:81,62:[2,83],66:[2,83],74:[2,83],75:[2,83],76:[2,83],77:[2,83]},{18:63,29:82,31:[2,53],57:83,58:64,59:[1,38],63:84,64:65,65:66,66:[1,67],69:[2,53],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:63,31:[2,59],34:85,57:86,58:64,59:[1,38],63:87,64:65,65:66,66:[1,67],69:[2,59],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{18:63,20:88,21:[2,45],57:89,58:64,59:[1,38],63:90,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{31:[1,91]},{31:[2,72],59:[2,72],66:[2,72],74:[2,72],75:[2,72],76:[2,72],77:[2,72]},{31:[2,74]},{21:[2,24],31:[2,24],52:[2,24],59:[2,24],62:[2,24],66:[2,24],69:[2,24],74:[2,24],75:[2,24],76:[2,24],77:[2,24]},{21:[2,25],31:[2,25],52:[2,25],59:[2,25],62:[2,25],66:[2,25],69:[2,25],74:[2,25],75:[2,25],76:[2,25],77:[2,25]},{21:[2,27],31:[2,27],52:[2,27],62:[2,27],65:92,66:[1,93],69:[2,27]},{21:[2,87],31:[2,87],52:[2,87],62:[2,87],66:[2,87],69:[2,87]},{21:[2,40],31:[2,40],52:[2,40],59:[2,40],62:[2,40],66:[2,40],67:[1,94],69:[2,40],74:[2,40],75:[2,40],76:[2,40],77:[2,40],79:[2,40]},{21:[2,39],31:[2,39],52:[2,39],59:[2,39],62:[2,39],66:[2,39],69:[2,39],74:[2,39],75:[2,39],76:[2,39],77:[2,39],79:[2,39]},{52:[1,95]},{52:[2,76],59:[2,76],66:[2,76],74:[2,76],75:[2,76],76:[2,76],77:[2,76]},{52:[2,78]},{5:[2,12],13:[2,12],14:[2,12],17:[2,12],27:[2,12],32:[2,12],37:[2,12],42:[2,12],45:[2,12],46:[2,12],49:[2,12],53:[2,12]},{18:96,66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{36:48,37:[1,50],41:49,42:[1,51],43:98,44:97,45:[2,69]},{31:[2,63],38:99,59:[2,63],66:[2,63],69:[2,63],74:[2,63],75:[2,63],76:[2,63],77:[2,63]},{45:[2,17]},{5:[2,13],13:[2,13],14:[2,13],17:[2,13],27:[2,13],32:[2,13],37:[2,13],42:[2,13],45:[2,13],46:[2,13],49:[2,13],53:[2,13]},{31:[1,100]},{31:[2,80],59:[2,80],66:[2,80],74:[2,80],75:[2,80],76:[2,80],77:[2,80]},{31:[2,82]},{18:63,57:102,58:64,59:[1,38],61:101,62:[2,85],63:103,64:65,65:66,66:[1,67],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{30:104,31:[2,55],68:105,69:[1,106]},{31:[2,52],59:[2,52],66:[2,52],69:[2,52],74:[2,52],75:[2,52],76:[2,52],77:[2,52]},{31:[2,54],69:[2,54]},{31:[2,61],35:107,68:108,69:[1,106]},{31:[2,58],59:[2,58],66:[2,58],69:[2,58],74:[2,58],75:[2,58],76:[2,58],77:[2,58]},{31:[2,60],69:[2,60]},{21:[1,109]},{21:[2,44],59:[2,44],66:[2,44],74:[2,44],75:[2,44],76:[2,44],77:[2,44]},{21:[2,46]},{5:[2,21],13:[2,21],14:[2,21],17:[2,21],27:[2,21],32:[2,21],37:[2,21],42:[2,21],45:[2,21],46:[2,21],49:[2,21],53:[2,21]},{21:[2,88],31:[2,88],52:[2,88],62:[2,88],66:[2,88],69:[2,88]},{67:[1,94]},{18:63,57:110,58:64,59:[1,38],66:[1,30],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,22],13:[2,22],14:[2,22],17:[2,22],27:[2,22],32:[2,22],37:[2,22],42:[2,22],45:[2,22],46:[2,22],49:[2,22],53:[2,22]},{31:[1,111]},{45:[2,18]},{45:[2,70]},{18:63,31:[2,65],39:112,57:113,58:64,59:[1,38],63:114,64:65,65:66,66:[1,67],69:[2,65],72:23,73:24,74:[1,25],75:[1,26],76:[1,27],77:[1,29],78:28},{5:[2,23],13:[2,23],14:[2,23],17:[2,23],27:[2,23],32:[2,23],37:[2,23],42:[2,23],45:[2,23],46:[2,23],49:[2,23],53:[2,23]},{62:[1,115]},{59:[2,84],62:[2,84],66:[2,84],74:[2,84],75:[2,84],76:[2,84],77:[2,84]},{62:[2,86]},{31:[1,116]},{31:[2,56]},{66:[1,118],70:117},{31:[1,119]},{31:[2,62]},{14:[2,11]},{21:[2,28],31:[2,28],52:[2,28],62:[2,28],66:[2,28],69:[2,28]},{5:[2,20],13:[2,20],14:[2,20],17:[2,20],27:[2,20],32:[2,20],37:[2,20],42:[2,20],45:[2,20],46:[2,20],49:[2,20],53:[2,20]},{31:[2,67],40:120,68:121,69:[1,106]},{31:[2,64],59:[2,64],66:[2,64],69:[2,64],74:[2,64],75:[2,64],76:[2,64],77:[2,64]},{31:[2,66],69:[2,66]},{21:[2,26],31:[2,26],52:[2,26],59:[2,26],62:[2,26],66:[2,26],69:[2,26],74:[2,26],75:[2,26],76:[2,26],77:[2,26]},{13:[2,14],14:[2,14],17:[2,14],27:[2,14],32:[2,14],37:[2,14],42:[2,14],45:[2,14],46:[2,14],49:[2,14],53:[2,14]},{66:[1,123],71:[1,122]},{66:[2,89],71:[2,89]},{13:[2,15],14:[2,15],17:[2,15],27:[2,15],32:[2,15],42:[2,15],45:[2,15],46:[2,15],49:[2,15],53:[2,15]},{31:[1,124]},{31:[2,68]},{31:[2,29]},{66:[2,90],71:[2,90]},{13:[2,16],14:[2,16],17:[2,16],27:[2,16],32:[2,16],37:[2,16],42:[2,16],45:[2,16],46:[2,16],49:[2,16],53:[2,16]}],
1023
+ defaultActions: {4:[2,1],47:[2,48],49:[2,19],53:[2,50],62:[2,74],71:[2,78],76:[2,17],80:[2,82],90:[2,46],97:[2,18],98:[2,70],103:[2,86],105:[2,56],108:[2,62],109:[2,11],121:[2,68],122:[2,29]},
1038
1024
  parseError: function parseError(str, hash) {
1039
1025
  throw new Error(str);
1040
1026
  },
@@ -1331,100 +1317,114 @@ var __module9__ = (function() {
1331
1317
  } else {
1332
1318
  this.begin("mu");
1333
1319
  }
1334
- if(yy_.yytext) return 12;
1320
+ if(yy_.yytext) return 14;
1335
1321
 
1336
1322
  break;
1337
- case 1:return 12;
1323
+ case 1:return 14;
1338
1324
  break;
1339
1325
  case 2:
1340
1326
  this.popState();
1341
- return 12;
1327
+ return 14;
1342
1328
 
1343
1329
  break;
1344
1330
  case 3:
1345
1331
  yy_.yytext = yy_.yytext.substr(5, yy_.yyleng-9);
1346
1332
  this.popState();
1347
- return 15;
1333
+ return 16;
1348
1334
 
1349
1335
  break;
1350
- case 4: return 12;
1336
+ case 4: return 14;
1351
1337
  break;
1352
- case 5:strip(0,4); this.popState(); return 13;
1338
+ case 5:
1339
+ this.popState();
1340
+ return 13;
1341
+
1353
1342
  break;
1354
- case 6:return 45;
1343
+ case 6:return 59;
1355
1344
  break;
1356
- case 7:return 46;
1345
+ case 7:return 62;
1357
1346
  break;
1358
- case 8: return 16;
1347
+ case 8: return 17;
1359
1348
  break;
1360
1349
  case 9:
1361
1350
  this.popState();
1362
1351
  this.begin('raw');
1363
- return 18;
1352
+ return 21;
1364
1353
 
1365
1354
  break;
1366
- case 10:return 34;
1355
+ case 10:return 53;
1367
1356
  break;
1368
- case 11:return 24;
1357
+ case 11:return 27;
1369
1358
  break;
1370
- case 12:return 29;
1359
+ case 12:return 45;
1371
1360
  break;
1372
- case 13:this.popState(); return 28;
1361
+ case 13:this.popState(); return 42;
1373
1362
  break;
1374
- case 14:this.popState(); return 28;
1363
+ case 14:this.popState(); return 42;
1375
1364
  break;
1376
- case 15:return 26;
1365
+ case 15:return 32;
1377
1366
  break;
1378
- case 16:return 26;
1367
+ case 16:return 37;
1379
1368
  break;
1380
- case 17:return 32;
1369
+ case 17:return 49;
1381
1370
  break;
1382
- case 18:return 31;
1371
+ case 18:return 46;
1383
1372
  break;
1384
- case 19:this.popState(); this.begin('com');
1373
+ case 19:
1374
+ this.unput(yy_.yytext);
1375
+ this.popState();
1376
+ this.begin('com');
1377
+
1385
1378
  break;
1386
- case 20:strip(3,5); this.popState(); return 13;
1379
+ case 20:
1380
+ this.popState();
1381
+ return 13;
1382
+
1387
1383
  break;
1388
- case 21:return 31;
1384
+ case 21:return 46;
1389
1385
  break;
1390
- case 22:return 51;
1386
+ case 22:return 67;
1391
1387
  break;
1392
- case 23:return 50;
1388
+ case 23:return 66;
1393
1389
  break;
1394
- case 24:return 50;
1390
+ case 24:return 66;
1395
1391
  break;
1396
- case 25:return 54;
1392
+ case 25:return 79;
1397
1393
  break;
1398
1394
  case 26:// ignore whitespace
1399
1395
  break;
1400
- case 27:this.popState(); return 33;
1396
+ case 27:this.popState(); return 52;
1401
1397
  break;
1402
- case 28:this.popState(); return 25;
1398
+ case 28:this.popState(); return 31;
1403
1399
  break;
1404
- case 29:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 42;
1400
+ case 29:yy_.yytext = strip(1,2).replace(/\\"/g,'"'); return 74;
1405
1401
  break;
1406
- case 30:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 42;
1402
+ case 30:yy_.yytext = strip(1,2).replace(/\\'/g,"'"); return 74;
1407
1403
  break;
1408
- case 31:return 52;
1404
+ case 31:return 77;
1409
1405
  break;
1410
- case 32:return 44;
1406
+ case 32:return 76;
1411
1407
  break;
1412
- case 33:return 44;
1408
+ case 33:return 76;
1413
1409
  break;
1414
- case 34:return 43;
1410
+ case 34:return 75;
1415
1411
  break;
1416
- case 35:return 50;
1412
+ case 35:return 69;
1417
1413
  break;
1418
- case 36:yy_.yytext = strip(1,2); return 50;
1414
+ case 36:return 71;
1419
1415
  break;
1420
- case 37:return 'INVALID';
1416
+ case 37:return 66;
1421
1417
  break;
1422
- case 38:return 5;
1418
+ case 38:yy_.yytext = strip(1,2); return 66;
1419
+ break;
1420
+ case 39:return 'INVALID';
1421
+ break;
1422
+ case 40:return 5;
1423
1423
  break;
1424
1424
  }
1425
1425
  };
1426
- lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{!--)/,/^(?:\{\{![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/];
1427
- lexer.conditions = {"mu":{"rules":[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[5],"inclusive":false},"raw":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,1,38],"inclusive":true}};
1426
+ lexer.rules = [/^(?:[^\x00]*?(?=(\{\{)))/,/^(?:[^\x00]+)/,/^(?:[^\x00]{2,}?(?=(\{\{|\\\{\{|\\\\\{\{|$)))/,/^(?:\{\{\{\{\/[^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=[=}\s\/.])\}\}\}\})/,/^(?:[^\x00]*?(?=(\{\{\{\{\/)))/,/^(?:[\s\S]*?--(~)?\}\})/,/^(?:\()/,/^(?:\))/,/^(?:\{\{\{\{)/,/^(?:\}\}\}\})/,/^(?:\{\{(~)?>)/,/^(?:\{\{(~)?#)/,/^(?:\{\{(~)?\/)/,/^(?:\{\{(~)?\^\s*(~)?\}\})/,/^(?:\{\{(~)?\s*else\s*(~)?\}\})/,/^(?:\{\{(~)?\^)/,/^(?:\{\{(~)?\s*else\b)/,/^(?:\{\{(~)?\{)/,/^(?:\{\{(~)?&)/,/^(?:\{\{(~)?!--)/,/^(?:\{\{(~)?![\s\S]*?\}\})/,/^(?:\{\{(~)?)/,/^(?:=)/,/^(?:\.\.)/,/^(?:\.(?=([=~}\s\/.)|])))/,/^(?:[\/.])/,/^(?:\s+)/,/^(?:\}(~)?\}\})/,/^(?:(~)?\}\})/,/^(?:"(\\["]|[^"])*")/,/^(?:'(\\[']|[^'])*')/,/^(?:@)/,/^(?:true(?=([~}\s)])))/,/^(?:false(?=([~}\s)])))/,/^(?:-?[0-9]+(?:\.[0-9]+)?(?=([~}\s)])))/,/^(?:as\s+\|)/,/^(?:\|)/,/^(?:([^\s!"#%-,\.\/;->@\[-\^`\{-~]+(?=([=~}\s\/.)|]))))/,/^(?:\[[^\]]*\])/,/^(?:.)/,/^(?:$)/];
1427
+ lexer.conditions = {"mu":{"rules":[6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40],"inclusive":false},"emu":{"rules":[2],"inclusive":false},"com":{"rules":[5],"inclusive":false},"raw":{"rules":[3,4],"inclusive":false},"INITIAL":{"rules":[0,1,40],"inclusive":true}};
1428
1428
  return lexer;})()
1429
1429
  parser.lexer = lexer;
1430
1430
  function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser;
@@ -1434,155 +1434,307 @@ var __module9__ = (function() {
1434
1434
  return __exports__;
1435
1435
  })();
1436
1436
 
1437
- // handlebars/compiler/helpers.js
1438
- var __module10__ = (function(__dependency1__) {
1437
+ // handlebars/compiler/visitor.js
1438
+ var __module11__ = (function(__dependency1__, __dependency2__) {
1439
1439
  "use strict";
1440
- var __exports__ = {};
1440
+ var __exports__;
1441
1441
  var Exception = __dependency1__;
1442
+ var AST = __dependency2__;
1442
1443
 
1443
- function stripFlags(open, close) {
1444
- return {
1445
- left: open.charAt(2) === '~',
1446
- right: close.charAt(close.length-3) === '~'
1447
- };
1444
+ function Visitor() {
1445
+ this.parents = [];
1448
1446
  }
1449
1447
 
1450
- __exports__.stripFlags = stripFlags;
1451
- function prepareBlock(mustache, program, inverseAndProgram, close, inverted, locInfo) {
1452
- /*jshint -W040 */
1453
- if (mustache.sexpr.id.original !== close.path.original) {
1454
- throw new Exception(mustache.sexpr.id.original + ' doesn\'t match ' + close.path.original, mustache);
1455
- }
1456
-
1457
- var inverse = inverseAndProgram && inverseAndProgram.program;
1458
-
1459
- var strip = {
1460
- left: mustache.strip.left,
1461
- right: close.strip.right,
1448
+ Visitor.prototype = {
1449
+ constructor: Visitor,
1450
+ mutating: false,
1451
+
1452
+ // Visits a given value. If mutating, will replace the value if necessary.
1453
+ acceptKey: function(node, name) {
1454
+ var value = this.accept(node[name]);
1455
+ if (this.mutating) {
1456
+ // Hacky sanity check:
1457
+ if (value && (!value.type || !AST[value.type])) {
1458
+ throw new Exception('Unexpected node type "' + value.type + '" found when accepting ' + name + ' on ' + node.type);
1459
+ }
1460
+ node[name] = value;
1461
+ }
1462
+ },
1462
1463
 
1463
- // Determine the standalone candiacy. Basically flag our content as being possibly standalone
1464
- // so our parent can determine if we actually are standalone
1465
- openStandalone: isNextWhitespace(program.statements),
1466
- closeStandalone: isPrevWhitespace((inverse || program).statements)
1467
- };
1464
+ // Performs an accept operation with added sanity check to ensure
1465
+ // required keys are not removed.
1466
+ acceptRequired: function(node, name) {
1467
+ this.acceptKey(node, name);
1468
1468
 
1469
- if (mustache.strip.right) {
1470
- omitRight(program.statements, null, true);
1471
- }
1469
+ if (!node[name]) {
1470
+ throw new Exception(node.type + ' requires ' + name);
1471
+ }
1472
+ },
1472
1473
 
1473
- if (inverse) {
1474
- var inverseStrip = inverseAndProgram.strip;
1474
+ // Traverses a given array. If mutating, empty respnses will be removed
1475
+ // for child elements.
1476
+ acceptArray: function(array) {
1477
+ for (var i = 0, l = array.length; i < l; i++) {
1478
+ this.acceptKey(array, i);
1475
1479
 
1476
- if (inverseStrip.left) {
1477
- omitLeft(program.statements, null, true);
1478
- }
1479
- if (inverseStrip.right) {
1480
- omitRight(inverse.statements, null, true);
1481
- }
1482
- if (close.strip.left) {
1483
- omitLeft(inverse.statements, null, true);
1480
+ if (!array[i]) {
1481
+ array.splice(i, 1);
1482
+ i--;
1483
+ l--;
1484
+ }
1484
1485
  }
1486
+ },
1485
1487
 
1486
- // Find standalone else statments
1487
- if (isPrevWhitespace(program.statements)
1488
- && isNextWhitespace(inverse.statements)) {
1489
-
1490
- omitLeft(program.statements);
1491
- omitRight(inverse.statements);
1488
+ accept: function(object) {
1489
+ if (!object) {
1490
+ return;
1492
1491
  }
1493
- } else {
1494
- if (close.strip.left) {
1495
- omitLeft(program.statements, null, true);
1492
+
1493
+ if (this.current) {
1494
+ this.parents.unshift(this.current);
1496
1495
  }
1497
- }
1496
+ this.current = object;
1498
1497
 
1499
- if (inverted) {
1500
- return new this.BlockNode(mustache, inverse, program, strip, locInfo);
1501
- } else {
1502
- return new this.BlockNode(mustache, program, inverse, strip, locInfo);
1503
- }
1504
- }
1498
+ var ret = this[object.type](object);
1505
1499
 
1506
- __exports__.prepareBlock = prepareBlock;
1507
- function prepareProgram(statements, isRoot) {
1508
- for (var i = 0, l = statements.length; i < l; i++) {
1509
- var current = statements[i],
1510
- strip = current.strip;
1500
+ this.current = this.parents.shift();
1511
1501
 
1512
- if (!strip) {
1513
- continue;
1502
+ if (!this.mutating || ret) {
1503
+ return ret;
1504
+ } else if (ret !== false) {
1505
+ return object;
1514
1506
  }
1507
+ },
1515
1508
 
1516
- var _isPrevWhitespace = isPrevWhitespace(statements, i, isRoot, current.type === 'partial'),
1517
- _isNextWhitespace = isNextWhitespace(statements, i, isRoot),
1509
+ Program: function(program) {
1510
+ this.acceptArray(program.body);
1511
+ },
1518
1512
 
1519
- openStandalone = strip.openStandalone && _isPrevWhitespace,
1520
- closeStandalone = strip.closeStandalone && _isNextWhitespace,
1521
- inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace;
1513
+ MustacheStatement: function(mustache) {
1514
+ this.acceptRequired(mustache, 'path');
1515
+ this.acceptArray(mustache.params);
1516
+ this.acceptKey(mustache, 'hash');
1517
+ },
1522
1518
 
1523
- if (strip.right) {
1524
- omitRight(statements, i, true);
1519
+ BlockStatement: function(block) {
1520
+ this.acceptRequired(block, 'path');
1521
+ this.acceptArray(block.params);
1522
+ this.acceptKey(block, 'hash');
1523
+
1524
+ this.acceptKey(block, 'program');
1525
+ this.acceptKey(block, 'inverse');
1526
+ },
1527
+
1528
+ PartialStatement: function(partial) {
1529
+ this.acceptRequired(partial, 'name');
1530
+ this.acceptArray(partial.params);
1531
+ this.acceptKey(partial, 'hash');
1532
+ },
1533
+
1534
+ ContentStatement: function(/* content */) {},
1535
+ CommentStatement: function(/* comment */) {},
1536
+
1537
+ SubExpression: function(sexpr) {
1538
+ this.acceptRequired(sexpr, 'path');
1539
+ this.acceptArray(sexpr.params);
1540
+ this.acceptKey(sexpr, 'hash');
1541
+ },
1542
+ PartialExpression: function(partial) {
1543
+ this.acceptRequired(partial, 'name');
1544
+ this.acceptArray(partial.params);
1545
+ this.acceptKey(partial, 'hash');
1546
+ },
1547
+
1548
+ PathExpression: function(/* path */) {},
1549
+
1550
+ StringLiteral: function(/* string */) {},
1551
+ NumberLiteral: function(/* number */) {},
1552
+ BooleanLiteral: function(/* bool */) {},
1553
+
1554
+ Hash: function(hash) {
1555
+ this.acceptArray(hash.pairs);
1556
+ },
1557
+ HashPair: function(pair) {
1558
+ this.acceptRequired(pair, 'value');
1559
+ }
1560
+ };
1561
+
1562
+ __exports__ = Visitor;
1563
+ return __exports__;
1564
+ })(__module4__, __module7__);
1565
+
1566
+ // handlebars/compiler/whitespace-control.js
1567
+ var __module10__ = (function(__dependency1__) {
1568
+ "use strict";
1569
+ var __exports__;
1570
+ var Visitor = __dependency1__;
1571
+
1572
+ function WhitespaceControl() {
1573
+ }
1574
+ WhitespaceControl.prototype = new Visitor();
1575
+
1576
+ WhitespaceControl.prototype.Program = function(program) {
1577
+ var isRoot = !this.isRootSeen;
1578
+ this.isRootSeen = true;
1579
+
1580
+ var body = program.body;
1581
+ for (var i = 0, l = body.length; i < l; i++) {
1582
+ var current = body[i],
1583
+ strip = this.accept(current);
1584
+
1585
+ if (!strip) {
1586
+ continue;
1587
+ }
1588
+
1589
+ var _isPrevWhitespace = isPrevWhitespace(body, i, isRoot),
1590
+ _isNextWhitespace = isNextWhitespace(body, i, isRoot),
1591
+
1592
+ openStandalone = strip.openStandalone && _isPrevWhitespace,
1593
+ closeStandalone = strip.closeStandalone && _isNextWhitespace,
1594
+ inlineStandalone = strip.inlineStandalone && _isPrevWhitespace && _isNextWhitespace;
1595
+
1596
+ if (strip.close) {
1597
+ omitRight(body, i, true);
1525
1598
  }
1526
- if (strip.left) {
1527
- omitLeft(statements, i, true);
1599
+ if (strip.open) {
1600
+ omitLeft(body, i, true);
1528
1601
  }
1529
1602
 
1530
1603
  if (inlineStandalone) {
1531
- omitRight(statements, i);
1604
+ omitRight(body, i);
1532
1605
 
1533
- if (omitLeft(statements, i)) {
1606
+ if (omitLeft(body, i)) {
1534
1607
  // If we are on a standalone node, save the indent info for partials
1535
- if (current.type === 'partial') {
1536
- current.indent = (/([ \t]+$)/).exec(statements[i-1].original) ? RegExp.$1 : '';
1608
+ if (current.type === 'PartialStatement') {
1609
+ // Pull out the whitespace from the final line
1610
+ current.indent = (/([ \t]+$)/).exec(body[i-1].original)[1];
1537
1611
  }
1538
1612
  }
1539
1613
  }
1540
1614
  if (openStandalone) {
1541
- omitRight((current.program || current.inverse).statements);
1615
+ omitRight((current.program || current.inverse).body);
1542
1616
 
1543
1617
  // Strip out the previous content node if it's whitespace only
1544
- omitLeft(statements, i);
1618
+ omitLeft(body, i);
1545
1619
  }
1546
1620
  if (closeStandalone) {
1547
1621
  // Always strip the next node
1548
- omitRight(statements, i);
1622
+ omitRight(body, i);
1549
1623
 
1550
- omitLeft((current.inverse || current.program).statements);
1624
+ omitLeft((current.inverse || current.program).body);
1551
1625
  }
1552
1626
  }
1553
1627
 
1554
- return statements;
1555
- }
1628
+ return program;
1629
+ };
1630
+ WhitespaceControl.prototype.BlockStatement = function(block) {
1631
+ this.accept(block.program);
1632
+ this.accept(block.inverse);
1633
+
1634
+ // Find the inverse program that is involed with whitespace stripping.
1635
+ var program = block.program || block.inverse,
1636
+ inverse = block.program && block.inverse,
1637
+ firstInverse = inverse,
1638
+ lastInverse = inverse;
1639
+
1640
+ if (inverse && inverse.chained) {
1641
+ firstInverse = inverse.body[0].program;
1642
+
1643
+ // Walk the inverse chain to find the last inverse that is actually in the chain.
1644
+ while (lastInverse.chained) {
1645
+ lastInverse = lastInverse.body[lastInverse.body.length-1].program;
1646
+ }
1647
+ }
1648
+
1649
+ var strip = {
1650
+ open: block.openStrip.open,
1651
+ close: block.closeStrip.close,
1652
+
1653
+ // Determine the standalone candiacy. Basically flag our content as being possibly standalone
1654
+ // so our parent can determine if we actually are standalone
1655
+ openStandalone: isNextWhitespace(program.body),
1656
+ closeStandalone: isPrevWhitespace((firstInverse || program).body)
1657
+ };
1658
+
1659
+ if (block.openStrip.close) {
1660
+ omitRight(program.body, null, true);
1661
+ }
1662
+
1663
+ if (inverse) {
1664
+ var inverseStrip = block.inverseStrip;
1665
+
1666
+ if (inverseStrip.open) {
1667
+ omitLeft(program.body, null, true);
1668
+ }
1669
+
1670
+ if (inverseStrip.close) {
1671
+ omitRight(firstInverse.body, null, true);
1672
+ }
1673
+ if (block.closeStrip.open) {
1674
+ omitLeft(lastInverse.body, null, true);
1675
+ }
1676
+
1677
+ // Find standalone else statments
1678
+ if (isPrevWhitespace(program.body)
1679
+ && isNextWhitespace(firstInverse.body)) {
1556
1680
 
1557
- __exports__.prepareProgram = prepareProgram;function isPrevWhitespace(statements, i, isRoot) {
1681
+ omitLeft(program.body);
1682
+ omitRight(firstInverse.body);
1683
+ }
1684
+ } else {
1685
+ if (block.closeStrip.open) {
1686
+ omitLeft(program.body, null, true);
1687
+ }
1688
+ }
1689
+
1690
+ return strip;
1691
+ };
1692
+
1693
+ WhitespaceControl.prototype.MustacheStatement = function(mustache) {
1694
+ return mustache.strip;
1695
+ };
1696
+
1697
+ WhitespaceControl.prototype.PartialStatement =
1698
+ WhitespaceControl.prototype.CommentStatement = function(node) {
1699
+ /* istanbul ignore next */
1700
+ var strip = node.strip || {};
1701
+ return {
1702
+ inlineStandalone: true,
1703
+ open: strip.open,
1704
+ close: strip.close
1705
+ };
1706
+ };
1707
+
1708
+
1709
+ function isPrevWhitespace(body, i, isRoot) {
1558
1710
  if (i === undefined) {
1559
- i = statements.length;
1711
+ i = body.length;
1560
1712
  }
1561
1713
 
1562
1714
  // Nodes that end with newlines are considered whitespace (but are special
1563
1715
  // cased for strip operations)
1564
- var prev = statements[i-1],
1565
- sibling = statements[i-2];
1716
+ var prev = body[i-1],
1717
+ sibling = body[i-2];
1566
1718
  if (!prev) {
1567
1719
  return isRoot;
1568
1720
  }
1569
1721
 
1570
- if (prev.type === 'content') {
1722
+ if (prev.type === 'ContentStatement') {
1571
1723
  return (sibling || !isRoot ? (/\r?\n\s*?$/) : (/(^|\r?\n)\s*?$/)).test(prev.original);
1572
1724
  }
1573
1725
  }
1574
- function isNextWhitespace(statements, i, isRoot) {
1726
+ function isNextWhitespace(body, i, isRoot) {
1575
1727
  if (i === undefined) {
1576
1728
  i = -1;
1577
1729
  }
1578
1730
 
1579
- var next = statements[i+1],
1580
- sibling = statements[i+2];
1731
+ var next = body[i+1],
1732
+ sibling = body[i+2];
1581
1733
  if (!next) {
1582
1734
  return isRoot;
1583
1735
  }
1584
1736
 
1585
- if (next.type === 'content') {
1737
+ if (next.type === 'ContentStatement') {
1586
1738
  return (sibling || !isRoot ? (/^\s*?\r?\n/) : (/^\s*?(\r?\n|$)/)).test(next.original);
1587
1739
  }
1588
1740
  }
@@ -1594,15 +1746,15 @@ var __module10__ = (function(__dependency1__) {
1594
1746
  //
1595
1747
  // If mulitple is truthy then all whitespace will be stripped out until non-whitespace
1596
1748
  // content is met.
1597
- function omitRight(statements, i, multiple) {
1598
- var current = statements[i == null ? 0 : i + 1];
1599
- if (!current || current.type !== 'content' || (!multiple && current.rightStripped)) {
1749
+ function omitRight(body, i, multiple) {
1750
+ var current = body[i == null ? 0 : i + 1];
1751
+ if (!current || current.type !== 'ContentStatement' || (!multiple && current.rightStripped)) {
1600
1752
  return;
1601
1753
  }
1602
1754
 
1603
- var original = current.string;
1604
- current.string = current.string.replace(multiple ? (/^\s+/) : (/^[ \t]*\r?\n?/), '');
1605
- current.rightStripped = current.string !== original;
1755
+ var original = current.value;
1756
+ current.value = current.value.replace(multiple ? (/^\s+/) : (/^[ \t]*\r?\n?/), '');
1757
+ current.rightStripped = current.value !== original;
1606
1758
  }
1607
1759
 
1608
1760
  // Marks the node to the left of the position as omitted.
@@ -1612,57 +1764,194 @@ var __module10__ = (function(__dependency1__) {
1612
1764
  //
1613
1765
  // If mulitple is truthy then all whitespace will be stripped out until non-whitespace
1614
1766
  // content is met.
1615
- function omitLeft(statements, i, multiple) {
1616
- var current = statements[i == null ? statements.length - 1 : i - 1];
1617
- if (!current || current.type !== 'content' || (!multiple && current.leftStripped)) {
1767
+ function omitLeft(body, i, multiple) {
1768
+ var current = body[i == null ? body.length - 1 : i - 1];
1769
+ if (!current || current.type !== 'ContentStatement' || (!multiple && current.leftStripped)) {
1618
1770
  return;
1619
1771
  }
1620
1772
 
1621
1773
  // We omit the last node if it's whitespace only and not preceeded by a non-content node.
1622
- var original = current.string;
1623
- current.string = current.string.replace(multiple ? (/\s+$/) : (/[ \t]+$/), '');
1624
- current.leftStripped = current.string !== original;
1774
+ var original = current.value;
1775
+ current.value = current.value.replace(multiple ? (/\s+$/) : (/[ \t]+$/), '');
1776
+ current.leftStripped = current.value !== original;
1625
1777
  return current.leftStripped;
1626
1778
  }
1779
+
1780
+ __exports__ = WhitespaceControl;
1627
1781
  return __exports__;
1628
- })(__module5__);
1782
+ })(__module11__);
1783
+
1784
+ // handlebars/compiler/helpers.js
1785
+ var __module12__ = (function(__dependency1__) {
1786
+ "use strict";
1787
+ var __exports__ = {};
1788
+ var Exception = __dependency1__;
1789
+
1790
+ function SourceLocation(source, locInfo) {
1791
+ this.source = source;
1792
+ this.start = {
1793
+ line: locInfo.first_line,
1794
+ column: locInfo.first_column
1795
+ };
1796
+ this.end = {
1797
+ line: locInfo.last_line,
1798
+ column: locInfo.last_column
1799
+ };
1800
+ }
1801
+
1802
+ __exports__.SourceLocation = SourceLocation;function stripFlags(open, close) {
1803
+ return {
1804
+ open: open.charAt(2) === '~',
1805
+ close: close.charAt(close.length-3) === '~'
1806
+ };
1807
+ }
1808
+
1809
+ __exports__.stripFlags = stripFlags;function stripComment(comment) {
1810
+ return comment.replace(/^\{\{~?\!-?-?/, '')
1811
+ .replace(/-?-?~?\}\}$/, '');
1812
+ }
1813
+
1814
+ __exports__.stripComment = stripComment;function preparePath(data, parts, locInfo) {
1815
+ /*jshint -W040 */
1816
+ locInfo = this.locInfo(locInfo);
1817
+
1818
+ var original = data ? '@' : '',
1819
+ dig = [],
1820
+ depth = 0,
1821
+ depthString = '';
1822
+
1823
+ for(var i=0,l=parts.length; i<l; i++) {
1824
+ var part = parts[i].part;
1825
+ original += (parts[i].separator || '') + part;
1826
+
1827
+ if (part === '..' || part === '.' || part === 'this') {
1828
+ if (dig.length > 0) {
1829
+ throw new Exception('Invalid path: ' + original, {loc: locInfo});
1830
+ } else if (part === '..') {
1831
+ depth++;
1832
+ depthString += '../';
1833
+ }
1834
+ } else {
1835
+ dig.push(part);
1836
+ }
1837
+ }
1838
+
1839
+ return new this.PathExpression(data, depth, dig, original, locInfo);
1840
+ }
1841
+
1842
+ __exports__.preparePath = preparePath;function prepareMustache(path, params, hash, open, strip, locInfo) {
1843
+ /*jshint -W040 */
1844
+ // Must use charAt to support IE pre-10
1845
+ var escapeFlag = open.charAt(3) || open.charAt(2),
1846
+ escaped = escapeFlag !== '{' && escapeFlag !== '&';
1847
+
1848
+ return new this.MustacheStatement(path, params, hash, escaped, strip, this.locInfo(locInfo));
1849
+ }
1850
+
1851
+ __exports__.prepareMustache = prepareMustache;function prepareRawBlock(openRawBlock, content, close, locInfo) {
1852
+ /*jshint -W040 */
1853
+ if (openRawBlock.path.original !== close) {
1854
+ var errorNode = {loc: openRawBlock.path.loc};
1855
+
1856
+ throw new Exception(openRawBlock.path.original + " doesn't match " + close, errorNode);
1857
+ }
1858
+
1859
+ locInfo = this.locInfo(locInfo);
1860
+ var program = new this.Program([content], null, {}, locInfo);
1861
+
1862
+ return new this.BlockStatement(
1863
+ openRawBlock.path, openRawBlock.params, openRawBlock.hash,
1864
+ program, undefined,
1865
+ {}, {}, {},
1866
+ locInfo);
1867
+ }
1868
+
1869
+ __exports__.prepareRawBlock = prepareRawBlock;function prepareBlock(openBlock, program, inverseAndProgram, close, inverted, locInfo) {
1870
+ /*jshint -W040 */
1871
+ // When we are chaining inverse calls, we will not have a close path
1872
+ if (close && close.path && openBlock.path.original !== close.path.original) {
1873
+ var errorNode = {loc: openBlock.path.loc};
1874
+
1875
+ throw new Exception(openBlock.path.original + ' doesn\'t match ' + close.path.original, errorNode);
1876
+ }
1877
+
1878
+ program.blockParams = openBlock.blockParams;
1879
+
1880
+ var inverse,
1881
+ inverseStrip;
1882
+
1883
+ if (inverseAndProgram) {
1884
+ if (inverseAndProgram.chain) {
1885
+ inverseAndProgram.program.body[0].closeStrip = close.strip;
1886
+ }
1887
+
1888
+ inverseStrip = inverseAndProgram.strip;
1889
+ inverse = inverseAndProgram.program;
1890
+ }
1891
+
1892
+ if (inverted) {
1893
+ inverted = inverse;
1894
+ inverse = program;
1895
+ program = inverted;
1896
+ }
1897
+
1898
+ return new this.BlockStatement(
1899
+ openBlock.path, openBlock.params, openBlock.hash,
1900
+ program, inverse,
1901
+ openBlock.strip, inverseStrip, close && close.strip,
1902
+ this.locInfo(locInfo));
1903
+ }
1904
+
1905
+ __exports__.prepareBlock = prepareBlock;
1906
+ return __exports__;
1907
+ })(__module4__);
1629
1908
 
1630
1909
  // handlebars/compiler/base.js
1631
- var __module8__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__) {
1910
+ var __module8__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) {
1632
1911
  "use strict";
1633
1912
  var __exports__ = {};
1634
1913
  var parser = __dependency1__;
1635
1914
  var AST = __dependency2__;
1636
- var Helpers = __dependency3__;
1637
- var extend = __dependency4__.extend;
1915
+ var WhitespaceControl = __dependency3__;
1916
+ var Helpers = __dependency4__;
1917
+ var extend = __dependency5__.extend;
1638
1918
 
1639
1919
  __exports__.parser = parser;
1640
1920
 
1641
1921
  var yy = {};
1642
1922
  extend(yy, Helpers, AST);
1643
1923
 
1644
- function parse(input) {
1645
- // Just return if an already-compile AST was passed in.
1646
- if (input.constructor === AST.ProgramNode) { return input; }
1924
+ function parse(input, options) {
1925
+ // Just return if an already-compiled AST was passed in.
1926
+ if (input.type === 'Program') { return input; }
1647
1927
 
1648
1928
  parser.yy = yy;
1649
1929
 
1650
- return parser.parse(input);
1930
+ // Altering the shared object here, but this is ok as parser is a sync operation
1931
+ yy.locInfo = function(locInfo) {
1932
+ return new yy.SourceLocation(options && options.srcName, locInfo);
1933
+ };
1934
+
1935
+ var strip = new WhitespaceControl();
1936
+ return strip.accept(parser.parse(input));
1651
1937
  }
1652
1938
 
1653
1939
  __exports__.parse = parse;
1654
1940
  return __exports__;
1655
- })(__module9__, __module7__, __module10__, __module3__);
1941
+ })(__module9__, __module7__, __module10__, __module12__, __module3__);
1656
1942
 
1657
1943
  // handlebars/compiler/compiler.js
1658
- var __module11__ = (function(__dependency1__, __dependency2__) {
1944
+ var __module13__ = (function(__dependency1__, __dependency2__, __dependency3__) {
1659
1945
  "use strict";
1660
1946
  var __exports__ = {};
1661
1947
  var Exception = __dependency1__;
1662
1948
  var isArray = __dependency2__.isArray;
1949
+ var indexOf = __dependency2__.indexOf;
1950
+ var AST = __dependency3__;
1663
1951
 
1664
1952
  var slice = [].slice;
1665
1953
 
1954
+
1666
1955
  function Compiler() {}
1667
1956
 
1668
1957
  __exports__.Compiler = Compiler;// the foundHelper register will disambiguate helper lookup from finding a
@@ -1702,16 +1991,18 @@ var __module11__ = (function(__dependency1__, __dependency2__) {
1702
1991
  guid: 0,
1703
1992
 
1704
1993
  compile: function(program, options) {
1994
+ this.sourceNode = [];
1705
1995
  this.opcodes = [];
1706
1996
  this.children = [];
1707
- this.depths = {list: []};
1708
1997
  this.options = options;
1709
1998
  this.stringParams = options.stringParams;
1710
1999
  this.trackIds = options.trackIds;
1711
2000
 
2001
+ options.blockParams = options.blockParams || [];
2002
+
1712
2003
  // These changes will propagate to the other compiler components
1713
- var knownHelpers = this.options.knownHelpers;
1714
- this.options.knownHelpers = {
2004
+ var knownHelpers = options.knownHelpers;
2005
+ options.knownHelpers = {
1715
2006
  'helperMissing': true,
1716
2007
  'blockHelperMissing': true,
1717
2008
  'each': true,
@@ -1723,79 +2014,72 @@ var __module11__ = (function(__dependency1__, __dependency2__) {
1723
2014
  };
1724
2015
  if (knownHelpers) {
1725
2016
  for (var name in knownHelpers) {
1726
- this.options.knownHelpers[name] = knownHelpers[name];
2017
+ options.knownHelpers[name] = knownHelpers[name];
1727
2018
  }
1728
2019
  }
1729
2020
 
1730
2021
  return this.accept(program);
1731
2022
  },
1732
2023
 
1733
- accept: function(node) {
1734
- return this[node.type](node);
1735
- },
1736
-
1737
- program: function(program) {
1738
- var statements = program.statements;
1739
-
1740
- for(var i=0, l=statements.length; i<l; i++) {
1741
- this.accept(statements[i]);
1742
- }
1743
- this.isSimple = l === 1;
1744
-
1745
- this.depths.list = this.depths.list.sort(function(a, b) {
1746
- return a - b;
1747
- });
1748
-
1749
- return this;
1750
- },
1751
-
1752
2024
  compileProgram: function(program) {
1753
2025
  var result = new this.compiler().compile(program, this.options);
1754
- var guid = this.guid++, depth;
2026
+ var guid = this.guid++;
1755
2027
 
1756
2028
  this.usePartial = this.usePartial || result.usePartial;
1757
2029
 
1758
2030
  this.children[guid] = result;
2031
+ this.useDepths = this.useDepths || result.useDepths;
2032
+
2033
+ return guid;
2034
+ },
2035
+
2036
+ accept: function(node) {
2037
+ this.sourceNode.unshift(node);
2038
+ var ret = this[node.type](node);
2039
+ this.sourceNode.shift();
2040
+ return ret;
2041
+ },
1759
2042
 
1760
- for(var i=0, l=result.depths.list.length; i<l; i++) {
1761
- depth = result.depths.list[i];
2043
+ Program: function(program) {
2044
+ this.options.blockParams.unshift(program.blockParams);
1762
2045
 
1763
- if(depth < 2) { continue; }
1764
- else { this.addDepth(depth - 1); }
2046
+ var body = program.body;
2047
+ for(var i=0, l=body.length; i<l; i++) {
2048
+ this.accept(body[i]);
1765
2049
  }
1766
2050
 
1767
- return guid;
2051
+ this.options.blockParams.shift();
2052
+
2053
+ this.isSimple = l === 1;
2054
+ this.blockParams = program.blockParams ? program.blockParams.length : 0;
2055
+
2056
+ return this;
1768
2057
  },
1769
2058
 
1770
- block: function(block) {
1771
- var mustache = block.mustache,
1772
- program = block.program,
2059
+ BlockStatement: function(block) {
2060
+ transformLiteralToPath(block);
2061
+
2062
+ var program = block.program,
1773
2063
  inverse = block.inverse;
1774
2064
 
1775
- if (program) {
1776
- program = this.compileProgram(program);
1777
- }
2065
+ program = program && this.compileProgram(program);
2066
+ inverse = inverse && this.compileProgram(inverse);
1778
2067
 
1779
- if (inverse) {
1780
- inverse = this.compileProgram(inverse);
1781
- }
2068
+ var type = this.classifySexpr(block);
1782
2069
 
1783
- var sexpr = mustache.sexpr;
1784
- var type = this.classifySexpr(sexpr);
1785
-
1786
- if (type === "helper") {
1787
- this.helperSexpr(sexpr, program, inverse);
1788
- } else if (type === "simple") {
1789
- this.simpleSexpr(sexpr);
2070
+ if (type === 'helper') {
2071
+ this.helperSexpr(block, program, inverse);
2072
+ } else if (type === 'simple') {
2073
+ this.simpleSexpr(block);
1790
2074
 
1791
2075
  // now that the simple mustache is resolved, we need to
1792
2076
  // evaluate it by executing `blockHelperMissing`
1793
2077
  this.opcode('pushProgram', program);
1794
2078
  this.opcode('pushProgram', inverse);
1795
2079
  this.opcode('emptyHash');
1796
- this.opcode('blockValue', sexpr.id.original);
2080
+ this.opcode('blockValue', block.path.original);
1797
2081
  } else {
1798
- this.ambiguousSexpr(sexpr, program, inverse);
2082
+ this.ambiguousSexpr(block, program, inverse);
1799
2083
 
1800
2084
  // now that the simple mustache is resolved, we need to
1801
2085
  // evaluate it by executing `blockHelperMissing`
@@ -1808,49 +2092,36 @@ var __module11__ = (function(__dependency1__, __dependency2__) {
1808
2092
  this.opcode('append');
1809
2093
  },
1810
2094
 
1811
- hash: function(hash) {
1812
- var pairs = hash.pairs, i, l;
1813
-
1814
- this.opcode('pushHash');
1815
-
1816
- for(i=0, l=pairs.length; i<l; i++) {
1817
- this.pushParam(pairs[i][1]);
1818
- }
1819
- while(i--) {
1820
- this.opcode('assignToHash', pairs[i][0]);
1821
- }
1822
- this.opcode('popHash');
1823
- },
1824
-
1825
- partial: function(partial) {
1826
- var partialName = partial.partialName;
2095
+ PartialStatement: function(partial) {
1827
2096
  this.usePartial = true;
1828
2097
 
1829
- if (partial.hash) {
1830
- this.accept(partial.hash);
1831
- } else {
1832
- this.opcode('push', 'undefined');
2098
+ var params = partial.params;
2099
+ if (params.length > 1) {
2100
+ throw new Exception('Unsupported number of partial arguments: ' + params.length, partial);
2101
+ } else if (!params.length) {
2102
+ params.push({type: 'PathExpression', parts: [], depth: 0});
1833
2103
  }
1834
2104
 
1835
- if (partial.context) {
1836
- this.accept(partial.context);
1837
- } else {
1838
- this.opcode('getContext', 0);
1839
- this.opcode('pushContext');
2105
+ var partialName = partial.name.original,
2106
+ isDynamic = partial.name.type === 'SubExpression';
2107
+ if (isDynamic) {
2108
+ this.accept(partial.name);
1840
2109
  }
1841
2110
 
1842
- this.opcode('invokePartial', partialName.name, partial.indent || '');
1843
- this.opcode('append');
1844
- },
2111
+ this.setupFullMustacheParams(partial, undefined, undefined, true);
1845
2112
 
1846
- content: function(content) {
1847
- if (content.string) {
1848
- this.opcode('appendContent', content.string);
2113
+ var indent = partial.indent || '';
2114
+ if (this.options.preventIndent && indent) {
2115
+ this.opcode('appendContent', indent);
2116
+ indent = '';
1849
2117
  }
2118
+
2119
+ this.opcode('invokePartial', isDynamic, partialName, indent);
2120
+ this.opcode('append');
1850
2121
  },
1851
2122
 
1852
- mustache: function(mustache) {
1853
- this.sexpr(mustache.sexpr);
2123
+ MustacheStatement: function(mustache) {
2124
+ this.SubExpression(mustache);
1854
2125
 
1855
2126
  if(mustache.escaped && !this.options.noEscape) {
1856
2127
  this.opcode('appendEscaped');
@@ -1859,122 +2130,143 @@ var __module11__ = (function(__dependency1__, __dependency2__) {
1859
2130
  }
1860
2131
  },
1861
2132
 
2133
+ ContentStatement: function(content) {
2134
+ if (content.value) {
2135
+ this.opcode('appendContent', content.value);
2136
+ }
2137
+ },
2138
+
2139
+ CommentStatement: function() {},
2140
+
2141
+ SubExpression: function(sexpr) {
2142
+ transformLiteralToPath(sexpr);
2143
+ var type = this.classifySexpr(sexpr);
2144
+
2145
+ if (type === 'simple') {
2146
+ this.simpleSexpr(sexpr);
2147
+ } else if (type === 'helper') {
2148
+ this.helperSexpr(sexpr);
2149
+ } else {
2150
+ this.ambiguousSexpr(sexpr);
2151
+ }
2152
+ },
1862
2153
  ambiguousSexpr: function(sexpr, program, inverse) {
1863
- var id = sexpr.id,
1864
- name = id.parts[0],
2154
+ var path = sexpr.path,
2155
+ name = path.parts[0],
1865
2156
  isBlock = program != null || inverse != null;
1866
2157
 
1867
- this.opcode('getContext', id.depth);
2158
+ this.opcode('getContext', path.depth);
1868
2159
 
1869
2160
  this.opcode('pushProgram', program);
1870
2161
  this.opcode('pushProgram', inverse);
1871
2162
 
1872
- this.ID(id);
2163
+ this.accept(path);
1873
2164
 
1874
2165
  this.opcode('invokeAmbiguous', name, isBlock);
1875
2166
  },
1876
2167
 
1877
2168
  simpleSexpr: function(sexpr) {
1878
- var id = sexpr.id;
1879
-
1880
- if (id.type === 'DATA') {
1881
- this.DATA(id);
1882
- } else if (id.parts.length) {
1883
- this.ID(id);
1884
- } else {
1885
- // Simplified ID for `this`
1886
- this.addDepth(id.depth);
1887
- this.opcode('getContext', id.depth);
1888
- this.opcode('pushContext');
1889
- }
1890
-
2169
+ this.accept(sexpr.path);
1891
2170
  this.opcode('resolvePossibleLambda');
1892
2171
  },
1893
2172
 
1894
2173
  helperSexpr: function(sexpr, program, inverse) {
1895
2174
  var params = this.setupFullMustacheParams(sexpr, program, inverse),
1896
- id = sexpr.id,
1897
- name = id.parts[0];
2175
+ path = sexpr.path,
2176
+ name = path.parts[0];
1898
2177
 
1899
2178
  if (this.options.knownHelpers[name]) {
1900
2179
  this.opcode('invokeKnownHelper', params.length, name);
1901
2180
  } else if (this.options.knownHelpersOnly) {
1902
2181
  throw new Exception("You specified knownHelpersOnly, but used the unknown helper " + name, sexpr);
1903
2182
  } else {
1904
- id.falsy = true;
2183
+ path.falsy = true;
1905
2184
 
1906
- this.ID(id);
1907
- this.opcode('invokeHelper', params.length, id.original, id.isSimple);
2185
+ this.accept(path);
2186
+ this.opcode('invokeHelper', params.length, path.original, AST.helpers.simpleId(path));
1908
2187
  }
1909
2188
  },
1910
2189
 
1911
- sexpr: function(sexpr) {
1912
- var type = this.classifySexpr(sexpr);
1913
-
1914
- if (type === "simple") {
1915
- this.simpleSexpr(sexpr);
1916
- } else if (type === "helper") {
1917
- this.helperSexpr(sexpr);
1918
- } else {
1919
- this.ambiguousSexpr(sexpr);
1920
- }
1921
- },
2190
+ PathExpression: function(path) {
2191
+ this.addDepth(path.depth);
2192
+ this.opcode('getContext', path.depth);
1922
2193
 
1923
- ID: function(id) {
1924
- this.addDepth(id.depth);
1925
- this.opcode('getContext', id.depth);
2194
+ var name = path.parts[0],
2195
+ scoped = AST.helpers.scopedId(path),
2196
+ blockParamId = !path.depth && !scoped && this.blockParamIndex(name);
1926
2197
 
1927
- var name = id.parts[0];
1928
- if (!name) {
2198
+ if (blockParamId) {
2199
+ this.opcode('lookupBlockParam', blockParamId, path.parts);
2200
+ } else if (!name) {
1929
2201
  // Context reference, i.e. `{{foo .}}` or `{{foo ..}}`
1930
2202
  this.opcode('pushContext');
2203
+ } else if (path.data) {
2204
+ this.options.data = true;
2205
+ this.opcode('lookupData', path.depth, path.parts);
1931
2206
  } else {
1932
- this.opcode('lookupOnContext', id.parts, id.falsy, id.isScoped);
2207
+ this.opcode('lookupOnContext', path.parts, path.falsy, scoped);
1933
2208
  }
1934
2209
  },
1935
2210
 
1936
- DATA: function(data) {
1937
- this.options.data = true;
1938
- this.opcode('lookupData', data.id.depth, data.id.parts);
2211
+ StringLiteral: function(string) {
2212
+ this.opcode('pushString', string.value);
1939
2213
  },
1940
2214
 
1941
- STRING: function(string) {
1942
- this.opcode('pushString', string.string);
2215
+ NumberLiteral: function(number) {
2216
+ this.opcode('pushLiteral', number.value);
1943
2217
  },
1944
2218
 
1945
- NUMBER: function(number) {
1946
- this.opcode('pushLiteral', number.number);
2219
+ BooleanLiteral: function(bool) {
2220
+ this.opcode('pushLiteral', bool.value);
1947
2221
  },
1948
2222
 
1949
- BOOLEAN: function(bool) {
1950
- this.opcode('pushLiteral', bool.bool);
1951
- },
2223
+ Hash: function(hash) {
2224
+ var pairs = hash.pairs, i, l;
2225
+
2226
+ this.opcode('pushHash');
1952
2227
 
1953
- comment: function() {},
2228
+ for (i=0, l=pairs.length; i<l; i++) {
2229
+ this.pushParam(pairs[i].value);
2230
+ }
2231
+ while (i--) {
2232
+ this.opcode('assignToHash', pairs[i].key);
2233
+ }
2234
+ this.opcode('popHash');
2235
+ },
1954
2236
 
1955
2237
  // HELPERS
1956
2238
  opcode: function(name) {
1957
- this.opcodes.push({ opcode: name, args: slice.call(arguments, 1) });
2239
+ this.opcodes.push({ opcode: name, args: slice.call(arguments, 1), loc: this.sourceNode[0].loc });
1958
2240
  },
1959
2241
 
1960
2242
  addDepth: function(depth) {
1961
- if(depth === 0) { return; }
1962
-
1963
- if(!this.depths[depth]) {
1964
- this.depths[depth] = true;
1965
- this.depths.list.push(depth);
2243
+ if (!depth) {
2244
+ return;
1966
2245
  }
2246
+
2247
+ this.useDepths = true;
1967
2248
  },
1968
2249
 
1969
2250
  classifySexpr: function(sexpr) {
1970
- var isHelper = sexpr.isHelper;
1971
- var isEligible = sexpr.eligibleHelper;
1972
- var options = this.options;
2251
+ var isSimple = AST.helpers.simpleId(sexpr.path);
2252
+
2253
+ var isBlockParam = isSimple && !!this.blockParamIndex(sexpr.path.parts[0]);
2254
+
2255
+ // a mustache is an eligible helper if:
2256
+ // * its id is simple (a single part, not `this` or `..`)
2257
+ var isHelper = !isBlockParam && AST.helpers.helperExpression(sexpr);
2258
+
2259
+ // if a mustache is an eligible helper but not a definite
2260
+ // helper, it is ambiguous, and will be resolved in a later
2261
+ // pass or at runtime.
2262
+ var isEligible = !isBlockParam && (isHelper || isSimple);
2263
+
2264
+ var options = this.options;
1973
2265
 
1974
2266
  // if ambiguous, we can possibly resolve the ambiguity now
1975
2267
  // An eligible helper is one that does not have a complex path, i.e. `this.foo`, `../foo` etc.
1976
2268
  if (isEligible && !isHelper) {
1977
- var name = sexpr.id.parts[0];
2269
+ var name = sexpr.path.parts[0];
1978
2270
 
1979
2271
  if (options.knownHelpers[name]) {
1980
2272
  isHelper = true;
@@ -1983,9 +2275,9 @@ var __module11__ = (function(__dependency1__, __dependency2__) {
1983
2275
  }
1984
2276
  }
1985
2277
 
1986
- if (isHelper) { return "helper"; }
1987
- else if (isEligible) { return "ambiguous"; }
1988
- else { return "simple"; }
2278
+ if (isHelper) { return 'helper'; }
2279
+ else if (isEligible) { return 'ambiguous'; }
2280
+ else { return 'simple'; }
1989
2281
  },
1990
2282
 
1991
2283
  pushParams: function(params) {
@@ -1995,27 +2287,51 @@ var __module11__ = (function(__dependency1__, __dependency2__) {
1995
2287
  },
1996
2288
 
1997
2289
  pushParam: function(val) {
2290
+ var value = val.value != null ? val.value : val.original || '';
2291
+
1998
2292
  if (this.stringParams) {
2293
+ if (value.replace) {
2294
+ value = value
2295
+ .replace(/^(\.?\.\/)*/g, '')
2296
+ .replace(/\//g, '.');
2297
+ }
2298
+
1999
2299
  if(val.depth) {
2000
2300
  this.addDepth(val.depth);
2001
2301
  }
2002
2302
  this.opcode('getContext', val.depth || 0);
2003
- this.opcode('pushStringParam', val.stringModeValue, val.type);
2303
+ this.opcode('pushStringParam', value, val.type);
2004
2304
 
2005
- if (val.type === 'sexpr') {
2006
- // Subexpressions get evaluated and passed in
2305
+ if (val.type === 'SubExpression') {
2306
+ // SubExpressions get evaluated and passed in
2007
2307
  // in string params mode.
2008
- this.sexpr(val);
2308
+ this.accept(val);
2009
2309
  }
2010
2310
  } else {
2011
2311
  if (this.trackIds) {
2012
- this.opcode('pushId', val.type, val.idName || val.stringModeValue);
2312
+ var blockParamIndex;
2313
+ if (val.parts && !AST.helpers.scopedId(val) && !val.depth) {
2314
+ blockParamIndex = this.blockParamIndex(val.parts[0]);
2315
+ }
2316
+ if (blockParamIndex) {
2317
+ var blockParamChild = val.parts.slice(1).join('.');
2318
+ this.opcode('pushId', 'BlockParam', blockParamIndex, blockParamChild);
2319
+ } else {
2320
+ value = val.original || value;
2321
+ if (value.replace) {
2322
+ value = value
2323
+ .replace(/^\.\//g, '')
2324
+ .replace(/^\.$/g, '');
2325
+ }
2326
+
2327
+ this.opcode('pushId', val.type, value);
2328
+ }
2013
2329
  }
2014
2330
  this.accept(val);
2015
2331
  }
2016
2332
  },
2017
2333
 
2018
- setupFullMustacheParams: function(sexpr, program, inverse) {
2334
+ setupFullMustacheParams: function(sexpr, program, inverse, omitEmpty) {
2019
2335
  var params = sexpr.params;
2020
2336
  this.pushParams(params);
2021
2337
 
@@ -2023,17 +2339,27 @@ var __module11__ = (function(__dependency1__, __dependency2__) {
2023
2339
  this.opcode('pushProgram', inverse);
2024
2340
 
2025
2341
  if (sexpr.hash) {
2026
- this.hash(sexpr.hash);
2342
+ this.accept(sexpr.hash);
2027
2343
  } else {
2028
- this.opcode('emptyHash');
2344
+ this.opcode('emptyHash', omitEmpty);
2029
2345
  }
2030
2346
 
2031
2347
  return params;
2348
+ },
2349
+
2350
+ blockParamIndex: function(name) {
2351
+ for (var depth = 0, len = this.options.blockParams.length; depth < len; depth++) {
2352
+ var blockParams = this.options.blockParams[depth],
2353
+ param = blockParams && indexOf(blockParams, name);
2354
+ if (blockParams && param >= 0) {
2355
+ return [depth, param];
2356
+ }
2357
+ }
2032
2358
  }
2033
2359
  };
2034
2360
 
2035
2361
  function precompile(input, options, env) {
2036
- if (input == null || (typeof input !== 'string' && input.constructor !== env.AST.ProgramNode)) {
2362
+ if (input == null || (typeof input !== 'string' && input.type !== 'Program')) {
2037
2363
  throw new Exception("You must pass a string or Handlebars AST to Handlebars.precompile. You passed " + input);
2038
2364
  }
2039
2365
 
@@ -2045,13 +2371,13 @@ var __module11__ = (function(__dependency1__, __dependency2__) {
2045
2371
  options.useDepths = true;
2046
2372
  }
2047
2373
 
2048
- var ast = env.parse(input);
2374
+ var ast = env.parse(input, options);
2049
2375
  var environment = new env.Compiler().compile(ast, options);
2050
2376
  return new env.JavaScriptCompiler().compile(environment, options);
2051
2377
  }
2052
2378
 
2053
2379
  __exports__.precompile = precompile;function compile(input, options, env) {
2054
- if (input == null || (typeof input !== 'string' && input.constructor !== env.AST.ProgramNode)) {
2380
+ if (input == null || (typeof input !== 'string' && input.type !== 'Program')) {
2055
2381
  throw new Exception("You must pass a string or Handlebars AST to Handlebars.compile. You passed " + input);
2056
2382
  }
2057
2383
 
@@ -2067,7 +2393,7 @@ var __module11__ = (function(__dependency1__, __dependency2__) {
2067
2393
  var compiled;
2068
2394
 
2069
2395
  function compileInput() {
2070
- var ast = env.parse(input);
2396
+ var ast = env.parse(input, options);
2071
2397
  var environment = new env.Compiler().compile(ast, options);
2072
2398
  var templateSpec = new env.JavaScriptCompiler().compile(environment, options, undefined, true);
2073
2399
  return env.template(templateSpec);
@@ -2086,11 +2412,11 @@ var __module11__ = (function(__dependency1__, __dependency2__) {
2086
2412
  }
2087
2413
  return compiled._setup(options);
2088
2414
  };
2089
- ret._child = function(i, data, depths) {
2415
+ ret._child = function(i, data, blockParams, depths) {
2090
2416
  if (!compiled) {
2091
2417
  compiled = compileInput();
2092
2418
  }
2093
- return compiled._child(i, data, depths);
2419
+ return compiled._child(i, data, blockParams, depths);
2094
2420
  };
2095
2421
  return ret;
2096
2422
  }
@@ -2109,16 +2435,187 @@ var __module11__ = (function(__dependency1__, __dependency2__) {
2109
2435
  return true;
2110
2436
  }
2111
2437
  }
2438
+
2439
+ function transformLiteralToPath(sexpr) {
2440
+ if (!sexpr.path.parts) {
2441
+ var literal = sexpr.path;
2442
+ // Casting to string here to make false and 0 literal values play nicely with the rest
2443
+ // of the system.
2444
+ sexpr.path = new AST.PathExpression(false, 0, [literal.original+''], literal.original+'', literal.log);
2445
+ }
2446
+ }
2447
+ return __exports__;
2448
+ })(__module4__, __module3__, __module7__);
2449
+
2450
+ // handlebars/compiler/code-gen.js
2451
+ var __module15__ = (function(__dependency1__) {
2452
+ "use strict";
2453
+ var __exports__;
2454
+ var isArray = __dependency1__.isArray;
2455
+
2456
+ try {
2457
+ var SourceMap = require('source-map'),
2458
+ SourceNode = SourceMap.SourceNode;
2459
+ } catch (err) {
2460
+ /* istanbul ignore next: tested but not covered in istanbul due to dist build */
2461
+ SourceNode = function(line, column, srcFile, chunks) {
2462
+ this.src = '';
2463
+ if (chunks) {
2464
+ this.add(chunks);
2465
+ }
2466
+ };
2467
+ /* istanbul ignore next */
2468
+ SourceNode.prototype = {
2469
+ add: function(chunks) {
2470
+ if (isArray(chunks)) {
2471
+ chunks = chunks.join('');
2472
+ }
2473
+ this.src += chunks;
2474
+ },
2475
+ prepend: function(chunks) {
2476
+ if (isArray(chunks)) {
2477
+ chunks = chunks.join('');
2478
+ }
2479
+ this.src = chunks + this.src;
2480
+ },
2481
+ toStringWithSourceMap: function() {
2482
+ return {code: this.toString()};
2483
+ },
2484
+ toString: function() {
2485
+ return this.src;
2486
+ }
2487
+ };
2488
+ }
2489
+
2490
+
2491
+ function castChunk(chunk, codeGen, loc) {
2492
+ if (isArray(chunk)) {
2493
+ var ret = [];
2494
+
2495
+ for (var i = 0, len = chunk.length; i < len; i++) {
2496
+ ret.push(codeGen.wrap(chunk[i], loc));
2497
+ }
2498
+ return ret;
2499
+ } else if (typeof chunk === 'boolean' || typeof chunk === 'number') {
2500
+ // Handle primitives that the SourceNode will throw up on
2501
+ return chunk+'';
2502
+ }
2503
+ return chunk;
2504
+ }
2505
+
2506
+
2507
+ function CodeGen(srcFile) {
2508
+ this.srcFile = srcFile;
2509
+ this.source = [];
2510
+ }
2511
+
2512
+ CodeGen.prototype = {
2513
+ prepend: function(source, loc) {
2514
+ this.source.unshift(this.wrap(source, loc));
2515
+ },
2516
+ push: function(source, loc) {
2517
+ this.source.push(this.wrap(source, loc));
2518
+ },
2519
+
2520
+ merge: function() {
2521
+ var source = this.empty();
2522
+ this.each(function(line) {
2523
+ source.add([' ', line, '\n']);
2524
+ });
2525
+ return source;
2526
+ },
2527
+
2528
+ each: function(iter) {
2529
+ for (var i = 0, len = this.source.length; i < len; i++) {
2530
+ iter(this.source[i]);
2531
+ }
2532
+ },
2533
+
2534
+ empty: function(loc) {
2535
+ loc = loc || this.currentLocation || {start:{}};
2536
+ return new SourceNode(loc.start.line, loc.start.column, this.srcFile);
2537
+ },
2538
+ wrap: function(chunk, loc) {
2539
+ if (chunk instanceof SourceNode) {
2540
+ return chunk;
2541
+ }
2542
+
2543
+ loc = loc || this.currentLocation || {start:{}};
2544
+ chunk = castChunk(chunk, this, loc);
2545
+
2546
+ return new SourceNode(loc.start.line, loc.start.column, this.srcFile, chunk);
2547
+ },
2548
+
2549
+ functionCall: function(fn, type, params) {
2550
+ params = this.generateList(params);
2551
+ return this.wrap([fn, type ? '.' + type + '(' : '(', params, ')']);
2552
+ },
2553
+
2554
+ quotedString: function(str) {
2555
+ return '"' + (str + '')
2556
+ .replace(/\\/g, '\\\\')
2557
+ .replace(/"/g, '\\"')
2558
+ .replace(/\n/g, '\\n')
2559
+ .replace(/\r/g, '\\r')
2560
+ .replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4
2561
+ .replace(/\u2029/g, '\\u2029') + '"';
2562
+ },
2563
+
2564
+ objectLiteral: function(obj) {
2565
+ var pairs = [];
2566
+
2567
+ for (var key in obj) {
2568
+ if (obj.hasOwnProperty(key)) {
2569
+ var value = castChunk(obj[key], this);
2570
+ if (value !== 'undefined') {
2571
+ pairs.push([this.quotedString(key), ':', value]);
2572
+ }
2573
+ }
2574
+ }
2575
+
2576
+ var ret = this.generateList(pairs);
2577
+ ret.prepend('{');
2578
+ ret.add('}');
2579
+ return ret;
2580
+ },
2581
+
2582
+
2583
+ generateList: function(entries, loc) {
2584
+ var ret = this.empty(loc);
2585
+
2586
+ for (var i = 0, len = entries.length; i < len; i++) {
2587
+ if (i) {
2588
+ ret.add(',');
2589
+ }
2590
+
2591
+ ret.add(castChunk(entries[i], this, loc));
2592
+ }
2593
+
2594
+ return ret;
2595
+ },
2596
+
2597
+ generateArray: function(entries, loc) {
2598
+ var ret = this.generateList(entries, loc);
2599
+ ret.prepend('[');
2600
+ ret.add(']');
2601
+
2602
+ return ret;
2603
+ }
2604
+ };
2605
+
2606
+ __exports__ = CodeGen;
2112
2607
  return __exports__;
2113
- })(__module5__, __module3__);
2608
+ })(__module3__);
2114
2609
 
2115
2610
  // handlebars/compiler/javascript-compiler.js
2116
- var __module12__ = (function(__dependency1__, __dependency2__) {
2611
+ var __module14__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__) {
2117
2612
  "use strict";
2118
2613
  var __exports__;
2119
2614
  var COMPILER_REVISION = __dependency1__.COMPILER_REVISION;
2120
2615
  var REVISION_CHANGES = __dependency1__.REVISION_CHANGES;
2121
2616
  var Exception = __dependency2__;
2617
+ var isArray = __dependency3__.isArray;
2618
+ var CodeGen = __dependency4__;
2122
2619
 
2123
2620
  function Literal(value) {
2124
2621
  this.value = value;
@@ -2131,15 +2628,13 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2131
2628
  // alternative compiled forms for name lookup and buffering semantics
2132
2629
  nameLookup: function(parent, name /* , type*/) {
2133
2630
  if (JavaScriptCompiler.isValidJavaScriptVariableName(name)) {
2134
- return parent + "." + name;
2631
+ return [parent, ".", name];
2135
2632
  } else {
2136
- return parent + "['" + name + "']";
2633
+ return [parent, "['", name, "']"];
2137
2634
  }
2138
2635
  },
2139
2636
  depthedLookup: function(name) {
2140
- this.aliases.lookup = 'this.lookup';
2141
-
2142
- return 'lookup(depths, "' + name + '")';
2637
+ return [this.aliasable('this.lookup'), '(depths, "', name, '")'];
2143
2638
  },
2144
2639
 
2145
2640
  compilerInfo: function() {
@@ -2148,23 +2643,29 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2148
2643
  return [revision, versions];
2149
2644
  },
2150
2645
 
2151
- appendToBuffer: function(string) {
2646
+ appendToBuffer: function(source, location, explicit) {
2647
+ // Force a source as this simplifies the merge logic.
2648
+ if (!isArray(source)) {
2649
+ source = [source];
2650
+ }
2651
+ source = this.source.wrap(source, location);
2652
+
2152
2653
  if (this.environment.isSimple) {
2153
- return "return " + string + ";";
2654
+ return ['return ', source, ';'];
2655
+ } else if (explicit) {
2656
+ // This is a case where the buffer operation occurs as a child of another
2657
+ // construct, generally braces. We have to explicitly output these buffer
2658
+ // operations to ensure that the emitted code goes in the correct location.
2659
+ return ['buffer += ', source, ';'];
2154
2660
  } else {
2155
- return {
2156
- appendToBuffer: true,
2157
- content: string,
2158
- toString: function() { return "buffer += " + string + ";"; }
2159
- };
2661
+ source.appendToBuffer = true;
2662
+ return source;
2160
2663
  }
2161
2664
  },
2162
2665
 
2163
2666
  initializeBuffer: function() {
2164
2667
  return this.quotedString("");
2165
2668
  },
2166
-
2167
- namespace: "Handlebars",
2168
2669
  // END PUBLIC API
2169
2670
 
2170
2671
  compile: function(environment, options, context, asObject) {
@@ -2190,23 +2691,29 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2190
2691
  this.hashes = [];
2191
2692
  this.compileStack = [];
2192
2693
  this.inlineStack = [];
2694
+ this.blockParams = [];
2193
2695
 
2194
2696
  this.compileChildren(environment, options);
2195
2697
 
2196
- this.useDepths = this.useDepths || environment.depths.list.length || this.options.compat;
2698
+ this.useDepths = this.useDepths || environment.useDepths || this.options.compat;
2699
+ this.useBlockParams = this.useBlockParams || environment.useBlockParams;
2197
2700
 
2198
2701
  var opcodes = environment.opcodes,
2199
2702
  opcode,
2703
+ firstLoc,
2200
2704
  i,
2201
2705
  l;
2202
2706
 
2203
2707
  for (i = 0, l = opcodes.length; i < l; i++) {
2204
2708
  opcode = opcodes[i];
2205
2709
 
2710
+ this.source.currentLocation = opcode.loc;
2711
+ firstLoc = firstLoc || opcode.loc;
2206
2712
  this[opcode.opcode].apply(this, opcode.args);
2207
2713
  }
2208
2714
 
2209
2715
  // Flush any trailing content that might be pending.
2716
+ this.source.currentLocation = firstLoc;
2210
2717
  this.pushSource('');
2211
2718
 
2212
2719
  /* istanbul ignore next */
@@ -2236,13 +2743,27 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2236
2743
  if (this.useDepths) {
2237
2744
  ret.useDepths = true;
2238
2745
  }
2746
+ if (this.useBlockParams) {
2747
+ ret.useBlockParams = true;
2748
+ }
2239
2749
  if (this.options.compat) {
2240
2750
  ret.compat = true;
2241
2751
  }
2242
2752
 
2243
2753
  if (!asObject) {
2244
2754
  ret.compiler = JSON.stringify(ret.compiler);
2755
+
2756
+ this.source.currentLocation = {start: {line: 1, column: 0}};
2245
2757
  ret = this.objectLiteral(ret);
2758
+
2759
+ if (options.srcName) {
2760
+ ret = ret.toStringWithSourceMap({file: options.destName});
2761
+ ret.map = ret.map && ret.map.toString();
2762
+ } else {
2763
+ ret = ret.toString();
2764
+ }
2765
+ } else {
2766
+ ret.compilerOptions = this.options;
2246
2767
  }
2247
2768
 
2248
2769
  return ret;
@@ -2255,7 +2776,7 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2255
2776
  // track the last context pushed into place to allow skipping the
2256
2777
  // getContext opcode when it would be a noop
2257
2778
  this.lastContext = 0;
2258
- this.source = [];
2779
+ this.source = new CodeGen(this.options.srcName);
2259
2780
  },
2260
2781
 
2261
2782
  createFunctionContext: function(asObject) {
@@ -2267,14 +2788,26 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2267
2788
  }
2268
2789
 
2269
2790
  // Generate minimizer alias mappings
2791
+ //
2792
+ // When using true SourceNodes, this will update all references to the given alias
2793
+ // as the source nodes are reused in situ. For the non-source node compilation mode,
2794
+ // aliases will not be used, but this case is already being run on the client and
2795
+ // we aren't concern about minimizing the template size.
2796
+ var aliasCount = 0;
2270
2797
  for (var alias in this.aliases) {
2271
- if (this.aliases.hasOwnProperty(alias)) {
2272
- varDeclarations += ', ' + alias + '=' + this.aliases[alias];
2798
+ var node = this.aliases[alias];
2799
+
2800
+ if (this.aliases.hasOwnProperty(alias) && node.children && node.referenceCount > 1) {
2801
+ varDeclarations += ', alias' + (++aliasCount) + '=' + alias;
2802
+ node.children[0] = 'alias' + aliasCount;
2273
2803
  }
2274
2804
  }
2275
2805
 
2276
2806
  var params = ["depth0", "helpers", "partials", "data"];
2277
2807
 
2808
+ if (this.useBlockParams || this.useDepths) {
2809
+ params.push('blockParams');
2810
+ }
2278
2811
  if (this.useDepths) {
2279
2812
  params.push('depths');
2280
2813
  }
@@ -2287,59 +2820,67 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2287
2820
 
2288
2821
  return Function.apply(this, params);
2289
2822
  } else {
2290
- return 'function(' + params.join(',') + ') {\n ' + source + '}';
2823
+ return this.source.wrap(['function(', params.join(','), ') {\n ', source, '}']);
2291
2824
  }
2292
2825
  },
2293
2826
  mergeSource: function(varDeclarations) {
2294
- var source = '',
2295
- buffer,
2827
+ var isSimple = this.environment.isSimple,
2296
2828
  appendOnly = !this.forceBuffer,
2297
- appendFirst;
2829
+ appendFirst,
2298
2830
 
2299
- for (var i = 0, len = this.source.length; i < len; i++) {
2300
- var line = this.source[i];
2831
+ sourceSeen,
2832
+ bufferStart,
2833
+ bufferEnd;
2834
+ this.source.each(function(line) {
2301
2835
  if (line.appendToBuffer) {
2302
- if (buffer) {
2303
- buffer = buffer + '\n + ' + line.content;
2836
+ if (bufferStart) {
2837
+ line.prepend(' + ');
2304
2838
  } else {
2305
- buffer = line.content;
2839
+ bufferStart = line;
2306
2840
  }
2841
+ bufferEnd = line;
2307
2842
  } else {
2308
- if (buffer) {
2309
- if (!source) {
2843
+ if (bufferStart) {
2844
+ if (!sourceSeen) {
2310
2845
  appendFirst = true;
2311
- source = buffer + ';\n ';
2312
2846
  } else {
2313
- source += 'buffer += ' + buffer + ';\n ';
2847
+ bufferStart.prepend('buffer += ');
2314
2848
  }
2315
- buffer = undefined;
2849
+ bufferEnd.add(';');
2850
+ bufferStart = bufferEnd = undefined;
2316
2851
  }
2317
- source += line + '\n ';
2318
2852
 
2319
- if (!this.environment.isSimple) {
2853
+ sourceSeen = true;
2854
+ if (!isSimple) {
2320
2855
  appendOnly = false;
2321
2856
  }
2322
2857
  }
2323
- }
2858
+ });
2859
+
2324
2860
 
2325
2861
  if (appendOnly) {
2326
- if (buffer || !source) {
2327
- source += 'return ' + (buffer || '""') + ';\n';
2862
+ if (bufferStart) {
2863
+ bufferStart.prepend('return ');
2864
+ bufferEnd.add(';');
2865
+ } else if (!sourceSeen) {
2866
+ this.source.push('return "";');
2328
2867
  }
2329
2868
  } else {
2330
2869
  varDeclarations += ", buffer = " + (appendFirst ? '' : this.initializeBuffer());
2331
- if (buffer) {
2332
- source += 'return buffer + ' + buffer + ';\n';
2870
+
2871
+ if (bufferStart) {
2872
+ bufferStart.prepend('return buffer + ');
2873
+ bufferEnd.add(';');
2333
2874
  } else {
2334
- source += 'return buffer;\n';
2875
+ this.source.push('return buffer;');
2335
2876
  }
2336
2877
  }
2337
2878
 
2338
2879
  if (varDeclarations) {
2339
- source = 'var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n ') + source;
2880
+ this.source.prepend('var ' + varDeclarations.substring(2) + (appendFirst ? '' : ';\n'));
2340
2881
  }
2341
2882
 
2342
- return source;
2883
+ return this.source.merge();
2343
2884
  },
2344
2885
 
2345
2886
  // [blockValue]
@@ -2352,15 +2893,14 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2352
2893
  // replace it on the stack with the result of properly
2353
2894
  // invoking blockHelperMissing.
2354
2895
  blockValue: function(name) {
2355
- this.aliases.blockHelperMissing = 'helpers.blockHelperMissing';
2356
-
2357
- var params = [this.contextName(0)];
2358
- this.setupParams(name, 0, params);
2896
+ var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'),
2897
+ params = [this.contextName(0)];
2898
+ this.setupHelperArgs(name, 0, params);
2359
2899
 
2360
2900
  var blockName = this.popStack();
2361
2901
  params.splice(1, 0, blockName);
2362
2902
 
2363
- this.push('blockHelperMissing.call(' + params.join(', ') + ')');
2903
+ this.push(this.source.functionCall(blockHelperMissing, 'call', params));
2364
2904
  },
2365
2905
 
2366
2906
  // [ambiguousBlockValue]
@@ -2370,18 +2910,20 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2370
2910
  // On stack, after, if no lastHelper: same as [blockValue]
2371
2911
  // On stack, after, if lastHelper: value
2372
2912
  ambiguousBlockValue: function() {
2373
- this.aliases.blockHelperMissing = 'helpers.blockHelperMissing';
2374
-
2375
2913
  // We're being a bit cheeky and reusing the options value from the prior exec
2376
- var params = [this.contextName(0)];
2377
- this.setupParams('', 0, params, true);
2914
+ var blockHelperMissing = this.aliasable('helpers.blockHelperMissing'),
2915
+ params = [this.contextName(0)];
2916
+ this.setupHelperArgs('', 0, params, true);
2378
2917
 
2379
2918
  this.flushInline();
2380
2919
 
2381
2920
  var current = this.topStack();
2382
2921
  params.splice(1, 0, current);
2383
2922
 
2384
- this.pushSource("if (!" + this.lastHelper + ") { " + current + " = blockHelperMissing.call(" + params.join(", ") + "); }");
2923
+ this.pushSource([
2924
+ 'if (!', this.lastHelper, ') { ',
2925
+ current, ' = ', this.source.functionCall(blockHelperMissing, 'call', params),
2926
+ '}']);
2385
2927
  },
2386
2928
 
2387
2929
  // [appendContent]
@@ -2393,6 +2935,8 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2393
2935
  appendContent: function(content) {
2394
2936
  if (this.pendingContent) {
2395
2937
  content = this.pendingContent + content;
2938
+ } else {
2939
+ this.pendingLocation = this.source.currentLocation;
2396
2940
  }
2397
2941
 
2398
2942
  this.pendingContent = content;
@@ -2408,13 +2952,18 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2408
2952
  // If `value` is truthy, or 0, it is coerced into a string and appended
2409
2953
  // Otherwise, the empty string is appended
2410
2954
  append: function() {
2411
- // Force anything that is inlined onto the stack so we don't have duplication
2412
- // when we examine local
2413
- this.flushInline();
2414
- var local = this.popStack();
2415
- this.pushSource('if (' + local + ' != null) { ' + this.appendToBuffer(local) + ' }');
2416
- if (this.environment.isSimple) {
2417
- this.pushSource("else { " + this.appendToBuffer("''") + " }");
2955
+ if (this.isInline()) {
2956
+ this.replaceStack(function(current) {
2957
+ return [' != null ? ', current, ' : ""'];
2958
+ });
2959
+
2960
+ this.pushSource(this.appendToBuffer(this.popStack()));
2961
+ } else {
2962
+ var local = this.popStack();
2963
+ this.pushSource(['if (', local, ' != null) { ', this.appendToBuffer(local, undefined, true), ' }']);
2964
+ if (this.environment.isSimple) {
2965
+ this.pushSource(['else { ', this.appendToBuffer("''", undefined, true), ' }']);
2966
+ }
2418
2967
  }
2419
2968
  },
2420
2969
 
@@ -2425,9 +2974,8 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2425
2974
  //
2426
2975
  // Escape `value` and append it to the buffer
2427
2976
  appendEscaped: function() {
2428
- this.aliases.escapeExpression = 'this.escapeExpression';
2429
-
2430
- this.pushSource(this.appendToBuffer("escapeExpression(" + this.popStack() + ")"));
2977
+ this.pushSource(this.appendToBuffer(
2978
+ [this.aliasable('this.escapeExpression'), '(', this.popStack(), ')']));
2431
2979
  },
2432
2980
 
2433
2981
  // [getContext]
@@ -2459,9 +3007,7 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2459
3007
  // Looks up the value of `name` on the current context and pushes
2460
3008
  // it onto the stack.
2461
3009
  lookupOnContext: function(parts, falsy, scoped) {
2462
- /*jshint -W083 */
2463
- var i = 0,
2464
- len = parts.length;
3010
+ var i = 0;
2465
3011
 
2466
3012
  if (!scoped && this.options.compat && !this.lastContext) {
2467
3013
  // The depthed query is expected to handle the undefined logic for the root level that
@@ -2471,19 +3017,21 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2471
3017
  this.pushContext();
2472
3018
  }
2473
3019
 
2474
- for (; i < len; i++) {
2475
- this.replaceStack(function(current) {
2476
- var lookup = this.nameLookup(current, parts[i], 'context');
2477
- // We want to ensure that zero and false are handled properly if the context (falsy flag)
2478
- // needs to have the special handling for these values.
2479
- if (!falsy) {
2480
- return ' != null ? ' + lookup + ' : ' + current;
2481
- } else {
2482
- // Otherwise we can use generic falsy handling
2483
- return ' && ' + lookup;
2484
- }
2485
- });
2486
- }
3020
+ this.resolvePath('context', parts, i, falsy);
3021
+ },
3022
+
3023
+ // [lookupBlockParam]
3024
+ //
3025
+ // On stack, before: ...
3026
+ // On stack, after: blockParam[name], ...
3027
+ //
3028
+ // Looks up the value of `parts` on the given block param and pushes
3029
+ // it onto the stack.
3030
+ lookupBlockParam: function(blockParamId, parts) {
3031
+ this.useBlockParams = true;
3032
+
3033
+ this.push(['blockParams[', blockParamId[0], '][', blockParamId[1], ']']);
3034
+ this.resolvePath('context', parts, 1);
2487
3035
  },
2488
3036
 
2489
3037
  // [lookupData]
@@ -2500,10 +3048,28 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2500
3048
  this.pushStackLiteral('this.data(data, ' + depth + ')');
2501
3049
  }
2502
3050
 
3051
+ this.resolvePath('data', parts, 0, true);
3052
+ },
3053
+
3054
+ resolvePath: function(type, parts, i, falsy) {
3055
+ /*jshint -W083 */
3056
+ if (this.options.strict || this.options.assumeObjects) {
3057
+ this.push(strictLookup(this.options.strict, this, parts, type));
3058
+ return;
3059
+ }
3060
+
2503
3061
  var len = parts.length;
2504
- for (var i = 0; i < len; i++) {
3062
+ for (; i < len; i++) {
2505
3063
  this.replaceStack(function(current) {
2506
- return ' && ' + this.nameLookup(current, parts[i], 'data');
3064
+ var lookup = this.nameLookup(current, parts[i], type);
3065
+ // We want to ensure that zero and false are handled properly if the context (falsy flag)
3066
+ // needs to have the special handling for these values.
3067
+ if (!falsy) {
3068
+ return [' != null ? ', lookup, ' : ', current];
3069
+ } else {
3070
+ // Otherwise we can use generic falsy handling
3071
+ return [' && ', lookup];
3072
+ }
2507
3073
  });
2508
3074
  }
2509
3075
  },
@@ -2516,9 +3082,7 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2516
3082
  // If the `value` is a lambda, replace it on the stack by
2517
3083
  // the return value of the lambda
2518
3084
  resolvePossibleLambda: function() {
2519
- this.aliases.lambda = 'this.lambda';
2520
-
2521
- this.push('lambda(' + this.popStack() + ', ' + this.contextName(0) + ')');
3085
+ this.push([this.aliasable('this.lambda'), '(', this.popStack(), ', ', this.contextName(0), ')']);
2522
3086
  },
2523
3087
 
2524
3088
  // [pushStringParam]
@@ -2535,7 +3099,7 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2535
3099
 
2536
3100
  // If it's a subexpression, the string result
2537
3101
  // will be pushed after this opcode.
2538
- if (type !== 'sexpr') {
3102
+ if (type !== 'SubExpression') {
2539
3103
  if (typeof string === 'string') {
2540
3104
  this.pushString(string);
2541
3105
  } else {
@@ -2544,9 +3108,7 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2544
3108
  }
2545
3109
  },
2546
3110
 
2547
- emptyHash: function() {
2548
- this.pushStackLiteral('{}');
2549
-
3111
+ emptyHash: function(omitEmpty) {
2550
3112
  if (this.trackIds) {
2551
3113
  this.push('{}'); // hashIds
2552
3114
  }
@@ -2554,6 +3116,7 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2554
3116
  this.push('{}'); // hashContexts
2555
3117
  this.push('{}'); // hashTypes
2556
3118
  }
3119
+ this.pushStackLiteral(omitEmpty ? 'undefined' : '{}');
2557
3120
  },
2558
3121
  pushHash: function() {
2559
3122
  if (this.hash) {
@@ -2566,14 +3129,14 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2566
3129
  this.hash = this.hashes.pop();
2567
3130
 
2568
3131
  if (this.trackIds) {
2569
- this.push('{' + hash.ids.join(',') + '}');
3132
+ this.push(this.objectLiteral(hash.ids));
2570
3133
  }
2571
3134
  if (this.stringParams) {
2572
- this.push('{' + hash.contexts.join(',') + '}');
2573
- this.push('{' + hash.types.join(',') + '}');
3135
+ this.push(this.objectLiteral(hash.contexts));
3136
+ this.push(this.objectLiteral(hash.types));
2574
3137
  }
2575
3138
 
2576
- this.push('{\n ' + hash.values.join(',\n ') + '\n }');
3139
+ this.push(this.objectLiteral(hash.values));
2577
3140
  },
2578
3141
 
2579
3142
  // [pushString]
@@ -2586,17 +3149,6 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2586
3149
  this.pushStackLiteral(this.quotedString(string));
2587
3150
  },
2588
3151
 
2589
- // [push]
2590
- //
2591
- // On stack, before: ...
2592
- // On stack, after: expr, ...
2593
- //
2594
- // Push an expression onto the stack
2595
- push: function(expr) {
2596
- this.inlineStack.push(expr);
2597
- return expr;
2598
- },
2599
-
2600
3152
  // [pushLiteral]
2601
3153
  //
2602
3154
  // On stack, before: ...
@@ -2635,13 +3187,17 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2635
3187
  //
2636
3188
  // If the helper is not found, `helperMissing` is called.
2637
3189
  invokeHelper: function(paramSize, name, isSimple) {
2638
- this.aliases.helperMissing = 'helpers.helperMissing';
2639
-
2640
3190
  var nonHelper = this.popStack();
2641
3191
  var helper = this.setupHelper(paramSize, name);
3192
+ var simple = isSimple ? [helper.name, ' || '] : '';
3193
+
3194
+ var lookup = ['('].concat(simple, nonHelper);
3195
+ if (!this.options.strict) {
3196
+ lookup.push(' || ', this.aliasable('helpers.helperMissing'));
3197
+ }
3198
+ lookup.push(')');
2642
3199
 
2643
- var lookup = (isSimple ? helper.name + ' || ' : '') + nonHelper + ' || helperMissing';
2644
- this.push('((' + lookup + ').call(' + helper.callParams + '))');
3200
+ this.push(this.source.functionCall(lookup, 'call', helper.callParams));
2645
3201
  },
2646
3202
 
2647
3203
  // [invokeKnownHelper]
@@ -2653,7 +3209,7 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2653
3209
  // so a `helperMissing` fallback is not required.
2654
3210
  invokeKnownHelper: function(paramSize, name) {
2655
3211
  var helper = this.setupHelper(paramSize, name);
2656
- this.push(helper.name + ".call(" + helper.callParams + ")");
3212
+ this.push(this.source.functionCall(helper.name, 'call', helper.callParams));
2657
3213
  },
2658
3214
 
2659
3215
  // [invokeAmbiguous]
@@ -2669,8 +3225,6 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2669
3225
  // and can be avoided by passing the `knownHelpers` and
2670
3226
  // `knownHelpersOnly` flags at compile-time.
2671
3227
  invokeAmbiguous: function(name, helperCall) {
2672
- this.aliases.functionType = '"function"';
2673
- this.aliases.helperMissing = 'helpers.helperMissing';
2674
3228
  this.useRegister('helper');
2675
3229
 
2676
3230
  var nonHelper = this.popStack();
@@ -2680,10 +3234,21 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2680
3234
 
2681
3235
  var helperName = this.lastHelper = this.nameLookup('helpers', name, 'helper');
2682
3236
 
2683
- this.push(
2684
- '((helper = (helper = ' + helperName + ' || ' + nonHelper + ') != null ? helper : helperMissing'
2685
- + (helper.paramsInit ? '),(' + helper.paramsInit : '') + '),'
2686
- + '(typeof helper === functionType ? helper.call(' + helper.callParams + ') : helper))');
3237
+ var lookup = ['(', '(helper = ', helperName, ' || ', nonHelper, ')'];
3238
+ if (!this.options.strict) {
3239
+ lookup[0] = '(helper = ';
3240
+ lookup.push(
3241
+ ' != null ? helper : ',
3242
+ this.aliasable('helpers.helperMissing')
3243
+ );
3244
+ }
3245
+
3246
+ this.push([
3247
+ '(', lookup,
3248
+ (helper.paramsInit ? ['),(', helper.paramsInit] : []), '),',
3249
+ '(typeof helper === ', this.aliasable('"function"'), ' ? ',
3250
+ this.source.functionCall('helper','call', helper.callParams), ' : helper))'
3251
+ ]);
2687
3252
  },
2688
3253
 
2689
3254
  // [invokePartial]
@@ -2693,19 +3258,34 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2693
3258
  //
2694
3259
  // This operation pops off a context, invokes a partial with that context,
2695
3260
  // and pushes the result of the invocation back.
2696
- invokePartial: function(name, indent) {
2697
- var params = [this.nameLookup('partials', name, 'partial'), "'" + indent + "'", "'" + name + "'", this.popStack(), this.popStack(), "helpers", "partials"];
3261
+ invokePartial: function(isDynamic, name, indent) {
3262
+ var params = [],
3263
+ options = this.setupParams(name, 1, params, false);
2698
3264
 
2699
- if (this.options.data) {
2700
- params.push("data");
2701
- } else if (this.options.compat) {
2702
- params.push('undefined');
3265
+ if (isDynamic) {
3266
+ name = this.popStack();
3267
+ delete options.name;
2703
3268
  }
3269
+
3270
+ if (indent) {
3271
+ options.indent = JSON.stringify(indent);
3272
+ }
3273
+ options.helpers = 'helpers';
3274
+ options.partials = 'partials';
3275
+
3276
+ if (!isDynamic) {
3277
+ params.unshift(this.nameLookup('partials', name, 'partial'));
3278
+ } else {
3279
+ params.unshift(name);
3280
+ }
3281
+
2704
3282
  if (this.options.compat) {
2705
- params.push('depths');
3283
+ options.depths = 'depths';
2706
3284
  }
3285
+ options = this.objectLiteral(options);
3286
+ params.push(options);
2707
3287
 
2708
- this.push("this.invokePartial(" + params.join(", ") + ")");
3288
+ this.push(this.source.functionCall('this.invokePartial', '', params));
2709
3289
  },
2710
3290
 
2711
3291
  // [assignToHash]
@@ -2730,21 +3310,25 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2730
3310
 
2731
3311
  var hash = this.hash;
2732
3312
  if (context) {
2733
- hash.contexts.push("'" + key + "': " + context);
3313
+ hash.contexts[key] = context;
2734
3314
  }
2735
3315
  if (type) {
2736
- hash.types.push("'" + key + "': " + type);
3316
+ hash.types[key] = type;
2737
3317
  }
2738
3318
  if (id) {
2739
- hash.ids.push("'" + key + "': " + id);
3319
+ hash.ids[key] = id;
2740
3320
  }
2741
- hash.values.push("'" + key + "': (" + value + ")");
3321
+ hash.values[key] = value;
2742
3322
  },
2743
3323
 
2744
- pushId: function(type, name) {
2745
- if (type === 'ID' || type === 'DATA') {
3324
+ pushId: function(type, name, child) {
3325
+ if (type === 'BlockParam') {
3326
+ this.pushStackLiteral(
3327
+ 'blockParams[' + name[0] + '].path[' + name[1] + ']'
3328
+ + (child ? ' + ' + JSON.stringify('.' + child) : ''));
3329
+ } else if (type === 'PathExpression') {
2746
3330
  this.pushString(name);
2747
- } else if (type === 'sexpr') {
3331
+ } else if (type === 'SubExpression') {
2748
3332
  this.pushStackLiteral('true');
2749
3333
  } else {
2750
3334
  this.pushStackLiteral('null');
@@ -2773,9 +3357,13 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2773
3357
  this.context.environments[index] = child;
2774
3358
 
2775
3359
  this.useDepths = this.useDepths || compiler.useDepths;
3360
+ this.useBlockParams = this.useBlockParams || compiler.useBlockParams;
2776
3361
  } else {
2777
3362
  child.index = index;
2778
3363
  child.name = 'program' + index;
3364
+
3365
+ this.useDepths = this.useDepths || child.useDepths;
3366
+ this.useBlockParams = this.useBlockParams || child.useBlockParams;
2779
3367
  }
2780
3368
  }
2781
3369
  },
@@ -2790,13 +3378,12 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2790
3378
 
2791
3379
  programExpression: function(guid) {
2792
3380
  var child = this.environment.children[guid],
2793
- depths = child.depths.list,
2794
- useDepths = this.useDepths,
2795
- depth;
2796
-
2797
- var programParams = [child.index, 'data'];
3381
+ programParams = [child.index, 'data', child.blockParams];
2798
3382
 
2799
- if (useDepths) {
3383
+ if (this.useBlockParams || this.useDepths) {
3384
+ programParams.push('blockParams');
3385
+ }
3386
+ if (this.useDepths) {
2800
3387
  programParams.push('depths');
2801
3388
  }
2802
3389
 
@@ -2810,13 +3397,23 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2810
3397
  }
2811
3398
  },
2812
3399
 
3400
+ push: function(expr) {
3401
+ if (!(expr instanceof Literal)) {
3402
+ expr = this.source.wrap(expr);
3403
+ }
3404
+
3405
+ this.inlineStack.push(expr);
3406
+ return expr;
3407
+ },
3408
+
2813
3409
  pushStackLiteral: function(item) {
2814
- return this.push(new Literal(item));
3410
+ this.push(new Literal(item));
2815
3411
  },
2816
3412
 
2817
3413
  pushSource: function(source) {
2818
3414
  if (this.pendingContent) {
2819
- this.source.push(this.appendToBuffer(this.quotedString(this.pendingContent)));
3415
+ this.source.push(
3416
+ this.appendToBuffer(this.source.quotedString(this.pendingContent), this.pendingLocation));
2820
3417
  this.pendingContent = undefined;
2821
3418
  }
2822
3419
 
@@ -2825,18 +3422,8 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2825
3422
  }
2826
3423
  },
2827
3424
 
2828
- pushStack: function(item) {
2829
- this.flushInline();
2830
-
2831
- var stack = this.incrStack();
2832
- this.pushSource(stack + " = " + item + ";");
2833
- this.compileStack.push(stack);
2834
- return stack;
2835
- },
2836
-
2837
3425
  replaceStack: function(callback) {
2838
- var prefix = '',
2839
- inline = this.isInline(),
3426
+ var prefix = ['('],
2840
3427
  stack,
2841
3428
  createdStack,
2842
3429
  usedLiteral;
@@ -2851,14 +3438,15 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2851
3438
 
2852
3439
  if (top instanceof Literal) {
2853
3440
  // Literals do not need to be inlined
2854
- prefix = stack = top.value;
3441
+ stack = [top.value];
3442
+ prefix = ['(', stack];
2855
3443
  usedLiteral = true;
2856
3444
  } else {
2857
3445
  // Get or create the current stack name for use by the inline
2858
- createdStack = !this.stackSlot;
2859
- var name = !createdStack ? this.topStackName() : this.incrStack();
3446
+ createdStack = true;
3447
+ var name = this.incrStack();
2860
3448
 
2861
- prefix = '(' + this.push(name) + ' = ' + top + ')';
3449
+ prefix = ['((', this.push(name), ' = ', top, ')'];
2862
3450
  stack = this.topStack();
2863
3451
  }
2864
3452
 
@@ -2870,7 +3458,7 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2870
3458
  if (createdStack) {
2871
3459
  this.stackSlot--;
2872
3460
  }
2873
- this.push('(' + prefix + item + ')');
3461
+ this.push(prefix.concat(item, ')'));
2874
3462
  },
2875
3463
 
2876
3464
  incrStack: function() {
@@ -2883,15 +3471,16 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2883
3471
  },
2884
3472
  flushInline: function() {
2885
3473
  var inlineStack = this.inlineStack;
2886
- if (inlineStack.length) {
2887
- this.inlineStack = [];
2888
- for (var i = 0, len = inlineStack.length; i < len; i++) {
2889
- var entry = inlineStack[i];
2890
- if (entry instanceof Literal) {
2891
- this.compileStack.push(entry);
2892
- } else {
2893
- this.pushStack(entry);
2894
- }
3474
+ this.inlineStack = [];
3475
+ for (var i = 0, len = inlineStack.length; i < len; i++) {
3476
+ var entry = inlineStack[i];
3477
+ /* istanbul ignore if */
3478
+ if (entry instanceof Literal) {
3479
+ this.compileStack.push(entry);
3480
+ } else {
3481
+ var stack = this.incrStack();
3482
+ this.pushSource([stack, ' = ', entry, ';']);
3483
+ this.compileStack.push(stack);
2895
3484
  }
2896
3485
  }
2897
3486
  },
@@ -2921,6 +3510,7 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2921
3510
  var stack = (this.isInline() ? this.inlineStack : this.compileStack),
2922
3511
  item = stack[stack.length - 1];
2923
3512
 
3513
+ /* istanbul ignore if */
2924
3514
  if (item instanceof Literal) {
2925
3515
  return item.value;
2926
3516
  } else {
@@ -2937,42 +3527,42 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2937
3527
  },
2938
3528
 
2939
3529
  quotedString: function(str) {
2940
- return '"' + str
2941
- .replace(/\\/g, '\\\\')
2942
- .replace(/"/g, '\\"')
2943
- .replace(/\n/g, '\\n')
2944
- .replace(/\r/g, '\\r')
2945
- .replace(/\u2028/g, '\\u2028') // Per Ecma-262 7.3 + 7.8.4
2946
- .replace(/\u2029/g, '\\u2029') + '"';
3530
+ return this.source.quotedString(str);
2947
3531
  },
2948
3532
 
2949
3533
  objectLiteral: function(obj) {
2950
- var pairs = [];
3534
+ return this.source.objectLiteral(obj);
3535
+ },
2951
3536
 
2952
- for (var key in obj) {
2953
- if (obj.hasOwnProperty(key)) {
2954
- pairs.push(this.quotedString(key) + ':' + obj[key]);
2955
- }
3537
+ aliasable: function(name) {
3538
+ var ret = this.aliases[name];
3539
+ if (ret) {
3540
+ ret.referenceCount++;
3541
+ return ret;
2956
3542
  }
2957
3543
 
2958
- return '{' + pairs.join(',') + '}';
3544
+ ret = this.aliases[name] = this.source.wrap(name);
3545
+ ret.aliasable = true;
3546
+ ret.referenceCount = 1;
3547
+
3548
+ return ret;
2959
3549
  },
2960
3550
 
2961
3551
  setupHelper: function(paramSize, name, blockHelper) {
2962
3552
  var params = [],
2963
- paramsInit = this.setupParams(name, paramSize, params, blockHelper);
3553
+ paramsInit = this.setupHelperArgs(name, paramSize, params, blockHelper);
2964
3554
  var foundHelper = this.nameLookup('helpers', name, 'helper');
2965
3555
 
2966
3556
  return {
2967
3557
  params: params,
2968
3558
  paramsInit: paramsInit,
2969
3559
  name: foundHelper,
2970
- callParams: [this.contextName(0)].concat(params).join(", ")
3560
+ callParams: [this.contextName(0)].concat(params)
2971
3561
  };
2972
3562
  },
2973
3563
 
2974
- setupOptions: function(helper, paramSize, params) {
2975
- var options = {}, contexts = [], types = [], ids = [], param, inverse, program;
3564
+ setupParams: function(helper, paramSize, params) {
3565
+ var options = {}, contexts = [], types = [], ids = [], param;
2976
3566
 
2977
3567
  options.name = this.quotedString(helper);
2978
3568
  options.hash = this.popStack();
@@ -2985,22 +3575,14 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
2985
3575
  options.hashContexts = this.popStack();
2986
3576
  }
2987
3577
 
2988
- inverse = this.popStack();
2989
- program = this.popStack();
3578
+ var inverse = this.popStack(),
3579
+ program = this.popStack();
2990
3580
 
2991
3581
  // Avoid setting fn and inverse if neither are set. This allows
2992
3582
  // helpers to do a check for `if (options.fn)`
2993
3583
  if (program || inverse) {
2994
- if (!program) {
2995
- program = 'this.noop';
2996
- }
2997
-
2998
- if (!inverse) {
2999
- inverse = 'this.noop';
3000
- }
3001
-
3002
- options.fn = program;
3003
- options.inverse = inverse;
3584
+ options.fn = program || 'this.noop';
3585
+ options.inverse = inverse || 'this.noop';
3004
3586
  }
3005
3587
 
3006
3588
  // The parameters go on to the stack in order (making sure that they are evaluated in order)
@@ -3020,29 +3602,29 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
3020
3602
  }
3021
3603
 
3022
3604
  if (this.trackIds) {
3023
- options.ids = "[" + ids.join(",") + "]";
3605
+ options.ids = this.source.generateArray(ids);
3024
3606
  }
3025
3607
  if (this.stringParams) {
3026
- options.types = "[" + types.join(",") + "]";
3027
- options.contexts = "[" + contexts.join(",") + "]";
3608
+ options.types = this.source.generateArray(types);
3609
+ options.contexts = this.source.generateArray(contexts);
3028
3610
  }
3029
3611
 
3030
3612
  if (this.options.data) {
3031
- options.data = "data";
3613
+ options.data = 'data';
3614
+ }
3615
+ if (this.useBlockParams) {
3616
+ options.blockParams = 'blockParams';
3032
3617
  }
3033
-
3034
3618
  return options;
3035
3619
  },
3036
3620
 
3037
- // the params and contexts arguments are passed in arrays
3038
- // to fill in
3039
- setupParams: function(helperName, paramSize, params, useRegister) {
3040
- var options = this.objectLiteral(this.setupOptions(helperName, paramSize, params));
3041
-
3621
+ setupHelperArgs: function(helper, paramSize, params, useRegister) {
3622
+ var options = this.setupParams(helper, paramSize, params, true);
3623
+ options = this.objectLiteral(options);
3042
3624
  if (useRegister) {
3043
3625
  this.useRegister('options');
3044
3626
  params.push('options');
3045
- return 'options=' + options;
3627
+ return ['options=', options];
3046
3628
  } else {
3047
3629
  params.push(options);
3048
3630
  return '';
@@ -3050,6 +3632,7 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
3050
3632
  }
3051
3633
  };
3052
3634
 
3635
+
3053
3636
  var reservedWords = (
3054
3637
  "break else new var" +
3055
3638
  " case finally return void" +
@@ -3065,7 +3648,8 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
3065
3648
  " class float package throws" +
3066
3649
  " const goto private transient" +
3067
3650
  " debugger implements protected volatile" +
3068
- " double import public let yield"
3651
+ " double import public let yield await" +
3652
+ " null true false"
3069
3653
  ).split(" ");
3070
3654
 
3071
3655
  var compilerWords = JavaScriptCompiler.RESERVED_WORDS = {};
@@ -3078,9 +3662,29 @@ var __module12__ = (function(__dependency1__, __dependency2__) {
3078
3662
  return !JavaScriptCompiler.RESERVED_WORDS[name] && /^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(name);
3079
3663
  };
3080
3664
 
3665
+ function strictLookup(requireTerminal, compiler, parts, type) {
3666
+ var stack = compiler.popStack();
3667
+
3668
+ var i = 0,
3669
+ len = parts.length;
3670
+ if (requireTerminal) {
3671
+ len--;
3672
+ }
3673
+
3674
+ for (; i < len; i++) {
3675
+ stack = compiler.nameLookup(stack, parts[i], type);
3676
+ }
3677
+
3678
+ if (requireTerminal) {
3679
+ return [compiler.aliasable('this.strict'), '(', stack, ', ', compiler.quotedString(parts[i]), ')'];
3680
+ } else {
3681
+ return stack;
3682
+ }
3683
+ }
3684
+
3081
3685
  __exports__ = JavaScriptCompiler;
3082
3686
  return __exports__;
3083
- })(__module2__, __module5__);
3687
+ })(__module2__, __module4__, __module3__, __module15__);
3084
3688
 
3085
3689
  // handlebars.js
3086
3690
  var __module0__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) {
@@ -3121,11 +3725,22 @@ var __module0__ = (function(__dependency1__, __dependency2__, __dependency3__, _
3121
3725
  Handlebars = create();
3122
3726
  Handlebars.create = create;
3123
3727
 
3728
+ /*jshint -W040 */
3729
+ /* istanbul ignore next */
3730
+ var root = typeof global !== 'undefined' ? global : window,
3731
+ $Handlebars = root.Handlebars;
3732
+ /* istanbul ignore next */
3733
+ Handlebars.noConflict = function() {
3734
+ if (root.Handlebars === Handlebars) {
3735
+ root.Handlebars = $Handlebars;
3736
+ }
3737
+ };
3738
+
3124
3739
  Handlebars['default'] = Handlebars;
3125
3740
 
3126
3741
  __exports__ = Handlebars;
3127
3742
  return __exports__;
3128
- })(__module1__, __module7__, __module8__, __module11__, __module12__);
3743
+ })(__module1__, __module7__, __module8__, __module13__, __module14__);
3129
3744
 
3130
3745
  return __module0__;
3131
3746
  }));