haparanda 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +4 -2
- data/lib/haparanda/compiler.rb +50 -10
- data/lib/haparanda/content_combiner.rb +7 -0
- data/lib/haparanda/handlebars_parser.rb +63 -57
- data/lib/haparanda/handlebars_parser.y +20 -14
- data/lib/haparanda/handlebars_processor.rb +551 -126
- data/lib/haparanda/parser.rb +28 -0
- data/lib/haparanda/standalone_whitespace_handler.rb +223 -0
- data/lib/haparanda/template.rb +34 -3
- data/lib/haparanda/version.rb +1 -1
- data/lib/haparanda/whitespace_stripper.rb +135 -0
- data/lib/haparanda.rb +0 -1
- metadata +19 -4
- data/lib/haparanda/handlebars_compiler.rb +0 -18
- data/lib/haparanda/whitespace_handler.rb +0 -168
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: dac0fe913e8e3d23afb7d2d25b6a74543c95a023502edb2a1dcfb2e38c32d12a
|
|
4
|
+
data.tar.gz: 6e25ca71f28f0893e71f919d79c333f6e144ada574d1943a2fb6a8f17308148e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b8dae9b686c0bd33abadd8c30c794b07d642b196669d0fcb952f344901c2b7418f2c16999e74859ab75d5e5cbaf5a5da4b34b59aa487447cd1a570b6fb093598
|
|
7
|
+
data.tar.gz: f3ad2bceb64be087c3ef5a5b61d37bf35ecf3b01eb4b747f1148f28ddb6eca771e13605107d9a7cf8a24b5dbe0759985a87ec6214230be291100bd9e488ad121
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.0.2 / 2025-11-23
|
|
4
|
+
|
|
5
|
+
This release implements the functionality needed to pass the relevant parts of
|
|
6
|
+
the handlebars spec suite as translated to Ruby, and those parts of the
|
|
7
|
+
mustache spec that handlebars.js also passes.
|
|
8
|
+
|
|
9
|
+
See the [full git log](https://github.com/mvz/haparanda/compare/v0.0.1...v0.0.2)
|
|
10
|
+
for details.
|
|
11
|
+
|
|
3
12
|
## 0.0.1 / 2025-03-31
|
|
4
13
|
|
|
5
14
|
* Initial release
|
data/README.md
CHANGED
|
@@ -13,7 +13,7 @@ require "haparanda"
|
|
|
13
13
|
|
|
14
14
|
hbs = Haparanda::Compiler.new
|
|
15
15
|
hbs.register_partial 'full_name', "{{person.first_name}} {{person.last_name}}"
|
|
16
|
-
hbs.register_helper :foo do
|
|
16
|
+
hbs.register_helper :foo do |context, bar, baz, options|
|
|
17
17
|
...
|
|
18
18
|
end
|
|
19
19
|
template = hbs.compile(template_text) # Returns Haparanda::Template
|
|
@@ -27,7 +27,6 @@ template.call input # or template.call({ foo: "Bar", baz: "Qux" })
|
|
|
27
27
|
|
|
28
28
|
## Compatibility Notes
|
|
29
29
|
|
|
30
|
-
- When using a hash as input, symbols keys and string keys are considered different
|
|
31
30
|
- Currently targets handlebars.js master
|
|
32
31
|
|
|
33
32
|
## Install
|
|
@@ -69,6 +68,9 @@ gem install haparanda
|
|
|
69
68
|
```ruby
|
|
70
69
|
hbs = Handlebars::Handlebars.new
|
|
71
70
|
hbs.register_partial('full_name', "{{person.first_name}} {{person.last_name}}")
|
|
71
|
+
hbs.register_helper(:foo) do |context, bar, baz, block, else_block|
|
|
72
|
+
...
|
|
73
|
+
end
|
|
72
74
|
template = hbs.compile("Hello {{> full_name}}")
|
|
73
75
|
template.call({person: {first_name: 'Pinkie', last_name: 'Pie'}})
|
|
74
76
|
```
|
data/lib/haparanda/compiler.rb
CHANGED
|
@@ -1,29 +1,69 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "logger"
|
|
3
4
|
require_relative "template"
|
|
5
|
+
require_relative "parser"
|
|
4
6
|
|
|
5
7
|
module Haparanda
|
|
6
8
|
# Compile handlebars template to a callable Haparanda::Template object
|
|
7
9
|
class Compiler
|
|
8
|
-
def initialize
|
|
9
|
-
@parser = HandlebarsParser.new
|
|
10
|
-
# TODO: Rename to PostProcessor
|
|
11
|
-
@post_processor = HandlebarsCompiler.new(**compile_options)
|
|
10
|
+
def initialize
|
|
12
11
|
@helpers = {}
|
|
12
|
+
@partials = {}
|
|
13
|
+
@log = nil
|
|
13
14
|
end
|
|
14
15
|
|
|
15
|
-
def compile(text)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
Template.new(compiled_template, @helpers)
|
|
16
|
+
def compile(text, **compile_options)
|
|
17
|
+
ast = template_to_ast text, **compile_options
|
|
18
|
+
Template.new(ast, @helpers, @partials, @log, **compile_options)
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def register_helper(name, &definition)
|
|
22
|
-
@helpers[name] = definition
|
|
22
|
+
@helpers[name.to_sym] = definition
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
def register_helpers(**helpers)
|
|
26
|
+
helpers.each do |name, definition|
|
|
27
|
+
register_helper(name, &definition)
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
def unregister_helper(name)
|
|
32
|
+
@helpers.delete(name.to_sym)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def get_helper(name)
|
|
36
|
+
@helpers[name.to_sym]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def register_partial(name, content)
|
|
40
|
+
unless content
|
|
41
|
+
raise "Attempting to register a partial called \"#{name}\" as #{content.inspect}"
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
@partials[name.to_s] = template_to_ast(content)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def register_partials(**partials)
|
|
48
|
+
partials.each do |name, content|
|
|
49
|
+
register_partial(name, content)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def unregister_partial(name)
|
|
54
|
+
@partials.delete(name.to_s)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def get_partial(name)
|
|
58
|
+
@partials[name.to_s]
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
attr_accessor :log
|
|
62
|
+
|
|
25
63
|
private
|
|
26
64
|
|
|
27
|
-
|
|
65
|
+
def template_to_ast(text, **compile_options)
|
|
66
|
+
Parser.new(**compile_options).parse(text)
|
|
67
|
+
end
|
|
28
68
|
end
|
|
29
69
|
end
|
|
@@ -20,6 +20,11 @@ module Haparanda
|
|
|
20
20
|
s(:statements, *statements)
|
|
21
21
|
end
|
|
22
22
|
|
|
23
|
+
def process(expr)
|
|
24
|
+
line = expr.line
|
|
25
|
+
super.tap { _1.line(line) if line }
|
|
26
|
+
end
|
|
27
|
+
|
|
23
28
|
private
|
|
24
29
|
|
|
25
30
|
def combine_contents(statements)
|
|
@@ -32,6 +37,8 @@ module Haparanda
|
|
|
32
37
|
if prev
|
|
33
38
|
if item.sexp_type == :content
|
|
34
39
|
prev[1] += item[1]
|
|
40
|
+
# TODO: Enable this and make line_max propagate up
|
|
41
|
+
# prev.line_max = item.line
|
|
35
42
|
else
|
|
36
43
|
result << item
|
|
37
44
|
prev = nil
|
|
@@ -12,7 +12,7 @@ require "sexp"
|
|
|
12
12
|
module Haparanda
|
|
13
13
|
class HandlebarsParser < Racc::Parser
|
|
14
14
|
|
|
15
|
-
module_eval(<<'...end handlebars_parser.y/module_eval...', 'handlebars_parser.y',
|
|
15
|
+
module_eval(<<'...end handlebars_parser.y/module_eval...', 'handlebars_parser.y', 235)
|
|
16
16
|
attr_reader :lexer
|
|
17
17
|
|
|
18
18
|
def parse(str)
|
|
@@ -48,8 +48,7 @@ end
|
|
|
48
48
|
|
|
49
49
|
def id(val)
|
|
50
50
|
if (match = /\A\[(.*)\]\Z/.match val)
|
|
51
|
-
|
|
52
|
-
s(:id, match[1])
|
|
51
|
+
s(:id, match[1], true)
|
|
53
52
|
else
|
|
54
53
|
s(:id, val)
|
|
55
54
|
end
|
|
@@ -63,19 +62,19 @@ def interpret_open_token(open)
|
|
|
63
62
|
end
|
|
64
63
|
|
|
65
64
|
def prepare_path(data, sexpr, parts, loc)
|
|
66
|
-
|
|
65
|
+
prefix = []
|
|
67
66
|
parts.each_slice(2) do |part, sep|
|
|
68
67
|
if ["..", ".", "this"].include? part[1]
|
|
69
|
-
unless
|
|
70
|
-
path =
|
|
68
|
+
unless prefix.empty? || part[2]
|
|
69
|
+
path = prefix.map { _1[1] }.join + part[1]
|
|
71
70
|
# TODO: keep track of the position in the line as well
|
|
72
71
|
raise ParseError, "Invalid path: #{path} - #{loc}"
|
|
73
72
|
end
|
|
74
73
|
next
|
|
75
74
|
end
|
|
76
75
|
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
prefix << part
|
|
77
|
+
prefix << sep if sep
|
|
79
78
|
end
|
|
80
79
|
# TODO: Handle sexpr
|
|
81
80
|
s(:path, data, *parts).line loc
|
|
@@ -118,12 +117,15 @@ def prepare_block(open, program, inverse_chain, close, inverted)
|
|
|
118
117
|
|
|
119
118
|
# TODO: Get close_strip from inverse_chain if close is nil
|
|
120
119
|
|
|
120
|
+
program_line = program&.line
|
|
121
121
|
if inverted
|
|
122
122
|
raise NotImplementedError if inverse_chain
|
|
123
123
|
inverse_chain = s(:inverse, block_params, program, open_strip, close_strip)
|
|
124
|
+
inverse_chain.line program_line if program_line
|
|
124
125
|
program = nil
|
|
125
126
|
else
|
|
126
127
|
program = s(:program, block_params, program)
|
|
128
|
+
program.line program_line if program_line
|
|
127
129
|
end
|
|
128
130
|
|
|
129
131
|
type = directive ? :directive_block : :block
|
|
@@ -504,9 +506,11 @@ Racc_debug_parser = false
|
|
|
504
506
|
|
|
505
507
|
# reduce 1 omitted
|
|
506
508
|
|
|
507
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
509
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 23)
|
|
508
510
|
def _reduce_2(val, _values, result)
|
|
509
|
-
|
|
511
|
+
result = s(:root, val[0])
|
|
512
|
+
result.line(val[0].line) if val[0]
|
|
513
|
+
|
|
510
514
|
result
|
|
511
515
|
end
|
|
512
516
|
.,.,
|
|
@@ -515,14 +519,14 @@ module_eval(<<'.,.,', 'handlebars_parser.y', 22)
|
|
|
515
519
|
|
|
516
520
|
# reduce 4 omitted
|
|
517
521
|
|
|
518
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
522
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 34)
|
|
519
523
|
def _reduce_5(val, _values, result)
|
|
520
|
-
result = s(:statements, val[0])
|
|
524
|
+
result = s(:statements, val[0]).line(val[0].line)
|
|
521
525
|
result
|
|
522
526
|
end
|
|
523
527
|
.,.,
|
|
524
528
|
|
|
525
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
529
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 35)
|
|
526
530
|
def _reduce_6(val, _values, result)
|
|
527
531
|
result << val[1]
|
|
528
532
|
result
|
|
@@ -541,7 +545,7 @@ module_eval(<<'.,.,', 'handlebars_parser.y', 33)
|
|
|
541
545
|
|
|
542
546
|
# reduce 12 omitted
|
|
543
547
|
|
|
544
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
548
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 46)
|
|
545
549
|
def _reduce_13(val, _values, result)
|
|
546
550
|
result = s(:comment, strip_comment(val[0]), strip_flags(val[0], val[0]))
|
|
547
551
|
.line(self.lexer.lineno)
|
|
@@ -550,7 +554,7 @@ module_eval(<<'.,.,', 'handlebars_parser.y', 44)
|
|
|
550
554
|
end
|
|
551
555
|
.,.,
|
|
552
556
|
|
|
553
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
557
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 52)
|
|
554
558
|
def _reduce_14(val, _values, result)
|
|
555
559
|
result = s(:content, val[0])
|
|
556
560
|
result.line = self.lexer.lineno
|
|
@@ -559,7 +563,7 @@ module_eval(<<'.,.,', 'handlebars_parser.y', 50)
|
|
|
559
563
|
end
|
|
560
564
|
.,.,
|
|
561
565
|
|
|
562
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
566
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 60)
|
|
563
567
|
def _reduce_15(val, _values, result)
|
|
564
568
|
result = s(:content, "")
|
|
565
569
|
result.line = self.lexer.lineno
|
|
@@ -572,7 +576,7 @@ module_eval(<<'.,.,', 'handlebars_parser.y', 58)
|
|
|
572
576
|
|
|
573
577
|
# reduce 17 omitted
|
|
574
578
|
|
|
575
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
579
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 70)
|
|
576
580
|
def _reduce_18(val, _values, result)
|
|
577
581
|
result[1] += val[1]
|
|
578
582
|
|
|
@@ -580,14 +584,14 @@ module_eval(<<'.,.,', 'handlebars_parser.y', 68)
|
|
|
580
584
|
end
|
|
581
585
|
.,.,
|
|
582
586
|
|
|
583
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
587
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 75)
|
|
584
588
|
def _reduce_19(val, _values, result)
|
|
585
589
|
result = prepare_raw_block(val[0], val[1], val[2])
|
|
586
590
|
result
|
|
587
591
|
end
|
|
588
592
|
.,.,
|
|
589
593
|
|
|
590
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
594
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 80)
|
|
591
595
|
def _reduce_20(val, _values, result)
|
|
592
596
|
result = s(:open_raw, *val[1..3], strip_flags(val[0], val[4])).line(self.lexer.lineno)
|
|
593
597
|
|
|
@@ -595,21 +599,21 @@ module_eval(<<'.,.,', 'handlebars_parser.y', 78)
|
|
|
595
599
|
end
|
|
596
600
|
.,.,
|
|
597
601
|
|
|
598
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
602
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 85)
|
|
599
603
|
def _reduce_21(val, _values, result)
|
|
600
604
|
result = prepare_block(val[0], val[1], val[2], val[3], false)
|
|
601
605
|
result
|
|
602
606
|
end
|
|
603
607
|
.,.,
|
|
604
608
|
|
|
605
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
609
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 86)
|
|
606
610
|
def _reduce_22(val, _values, result)
|
|
607
611
|
result = prepare_block(val[0], val[1], val[2], val[3], true)
|
|
608
612
|
result
|
|
609
613
|
end
|
|
610
614
|
.,.,
|
|
611
615
|
|
|
612
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
616
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 91)
|
|
613
617
|
def _reduce_23(val, _values, result)
|
|
614
618
|
decorator, _escaped = interpret_open_token(val[0])
|
|
615
619
|
type = decorator ? :open_directive : :open
|
|
@@ -619,14 +623,14 @@ module_eval(<<'.,.,', 'handlebars_parser.y', 89)
|
|
|
619
623
|
end
|
|
620
624
|
.,.,
|
|
621
625
|
|
|
622
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
626
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 98)
|
|
623
627
|
def _reduce_24(val, _values, result)
|
|
624
628
|
result = s(:open, val[1], val[2], val[3], val[4], strip_flags(val[0], val[5]))
|
|
625
629
|
result
|
|
626
630
|
end
|
|
627
631
|
.,.,
|
|
628
632
|
|
|
629
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
633
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 102)
|
|
630
634
|
def _reduce_25(val, _values, result)
|
|
631
635
|
result = s(:open, val[1], val[2], val[3], val[4], strip_flags(val[0], val[5]))
|
|
632
636
|
result
|
|
@@ -637,19 +641,21 @@ module_eval(<<'.,.,', 'handlebars_parser.y', 100)
|
|
|
637
641
|
|
|
638
642
|
# reduce 27 omitted
|
|
639
643
|
|
|
640
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
644
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 113)
|
|
641
645
|
def _reduce_28(val, _values, result)
|
|
642
|
-
|
|
646
|
+
result = s(:inverse, nil, val[1], strip_flags(val[0], val[0]), nil)
|
|
647
|
+
result.line(val[1].line) if val[1]
|
|
648
|
+
|
|
643
649
|
result
|
|
644
650
|
end
|
|
645
651
|
.,.,
|
|
646
652
|
|
|
647
653
|
# reduce 29 omitted
|
|
648
654
|
|
|
649
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
655
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 120)
|
|
650
656
|
def _reduce_30(val, _values, result)
|
|
651
657
|
block = prepare_block(val[0], val[1], val[2], nil, false)
|
|
652
|
-
result = s(:inverse, nil, block, nil, nil)
|
|
658
|
+
result = s(:inverse, nil, block, nil, nil).line(block.line)
|
|
653
659
|
|
|
654
660
|
result
|
|
655
661
|
end
|
|
@@ -657,44 +663,44 @@ module_eval(<<'.,.,', 'handlebars_parser.y', 116)
|
|
|
657
663
|
|
|
658
664
|
# reduce 31 omitted
|
|
659
665
|
|
|
660
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
666
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 127)
|
|
661
667
|
def _reduce_32(val, _values, result)
|
|
662
668
|
result = s(:close, val[1], strip_flags(val[0], val[2]))
|
|
663
669
|
result
|
|
664
670
|
end
|
|
665
671
|
.,.,
|
|
666
672
|
|
|
667
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
673
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 131)
|
|
668
674
|
def _reduce_33(val, _values, result)
|
|
669
675
|
result = prepare_mustache(*val)
|
|
670
676
|
result
|
|
671
677
|
end
|
|
672
678
|
.,.,
|
|
673
679
|
|
|
674
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
680
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 132)
|
|
675
681
|
def _reduce_34(val, _values, result)
|
|
676
682
|
result = prepare_mustache(*val)
|
|
677
683
|
result
|
|
678
684
|
end
|
|
679
685
|
.,.,
|
|
680
686
|
|
|
681
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
687
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 137)
|
|
682
688
|
def _reduce_35(val, _values, result)
|
|
683
|
-
result = s(:partial, val[1], val[2], val[3], strip_flags(val[0], val[4]))
|
|
689
|
+
result = s(:partial, val[1], val[2], val[3], nil, strip_flags(val[0], val[4]))
|
|
684
690
|
.line(self.lexer.lineno)
|
|
685
691
|
|
|
686
692
|
result
|
|
687
693
|
end
|
|
688
694
|
.,.,
|
|
689
695
|
|
|
690
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
696
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 143)
|
|
691
697
|
def _reduce_36(val, _values, result)
|
|
692
698
|
result = prepare_partial_block(*val)
|
|
693
699
|
result
|
|
694
700
|
end
|
|
695
701
|
.,.,
|
|
696
702
|
|
|
697
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
703
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 147)
|
|
698
704
|
def _reduce_37(val, _values, result)
|
|
699
705
|
result = s(:open_partial, val[1], val[2], val[3], strip_flags(val[0], val[4]))
|
|
700
706
|
result
|
|
@@ -705,7 +711,7 @@ module_eval(<<'.,.,', 'handlebars_parser.y', 143)
|
|
|
705
711
|
|
|
706
712
|
# reduce 39 omitted
|
|
707
713
|
|
|
708
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
714
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 157)
|
|
709
715
|
def _reduce_40(val, _values, result)
|
|
710
716
|
result = s(:exprs)
|
|
711
717
|
result
|
|
@@ -714,21 +720,21 @@ module_eval(<<'.,.,', 'handlebars_parser.y', 153)
|
|
|
714
720
|
|
|
715
721
|
# reduce 41 omitted
|
|
716
722
|
|
|
717
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
723
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 163)
|
|
718
724
|
def _reduce_42(val, _values, result)
|
|
719
725
|
result = s(:exprs, val[0])
|
|
720
726
|
result
|
|
721
727
|
end
|
|
722
728
|
.,.,
|
|
723
729
|
|
|
724
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
730
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 164)
|
|
725
731
|
def _reduce_43(val, _values, result)
|
|
726
732
|
result.push(val[1])
|
|
727
733
|
result
|
|
728
734
|
end
|
|
729
735
|
.,.,
|
|
730
736
|
|
|
731
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
737
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 169)
|
|
732
738
|
def _reduce_44(val, _values, result)
|
|
733
739
|
result = s(:sub_expression, val[1], val[2], val[3]).line self.lexer.lineno
|
|
734
740
|
|
|
@@ -738,28 +744,28 @@ module_eval(<<'.,.,', 'handlebars_parser.y', 165)
|
|
|
738
744
|
|
|
739
745
|
# reduce 45 omitted
|
|
740
746
|
|
|
741
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
747
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 174)
|
|
742
748
|
def _reduce_46(val, _values, result)
|
|
743
749
|
result = result.line(self.lexer.lineno)
|
|
744
750
|
result
|
|
745
751
|
end
|
|
746
752
|
.,.,
|
|
747
753
|
|
|
748
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
754
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 179)
|
|
749
755
|
def _reduce_47(val, _values, result)
|
|
750
756
|
result = s(:hash, val[0])
|
|
751
757
|
result
|
|
752
758
|
end
|
|
753
759
|
.,.,
|
|
754
760
|
|
|
755
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
761
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 180)
|
|
756
762
|
def _reduce_48(val, _values, result)
|
|
757
763
|
result.push(val[1])
|
|
758
764
|
result
|
|
759
765
|
end
|
|
760
766
|
.,.,
|
|
761
767
|
|
|
762
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
768
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 184)
|
|
763
769
|
def _reduce_49(val, _values, result)
|
|
764
770
|
result = s(:hash_pair, val[0], val[1]).line(self.lexer.lineno)
|
|
765
771
|
result
|
|
@@ -768,21 +774,21 @@ module_eval(<<'.,.,', 'handlebars_parser.y', 180)
|
|
|
768
774
|
|
|
769
775
|
# reduce 50 omitted
|
|
770
776
|
|
|
771
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
777
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 189)
|
|
772
778
|
def _reduce_51(val, _values, result)
|
|
773
779
|
result = s(:block_params, *val[1])
|
|
774
780
|
result
|
|
775
781
|
end
|
|
776
782
|
.,.,
|
|
777
783
|
|
|
778
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
784
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 194)
|
|
779
785
|
def _reduce_52(val, _values, result)
|
|
780
786
|
result = [id(val[0])]
|
|
781
787
|
result
|
|
782
788
|
end
|
|
783
789
|
.,.,
|
|
784
790
|
|
|
785
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
791
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 195)
|
|
786
792
|
def _reduce_53(val, _values, result)
|
|
787
793
|
result << id(val[1])
|
|
788
794
|
result
|
|
@@ -793,49 +799,49 @@ module_eval(<<'.,.,', 'handlebars_parser.y', 191)
|
|
|
793
799
|
|
|
794
800
|
# reduce 55 omitted
|
|
795
801
|
|
|
796
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
802
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 201)
|
|
797
803
|
def _reduce_56(val, _values, result)
|
|
798
804
|
result = s(:string, val[0]).line(self.lexer.lineno)
|
|
799
805
|
result
|
|
800
806
|
end
|
|
801
807
|
.,.,
|
|
802
808
|
|
|
803
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
809
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 202)
|
|
804
810
|
def _reduce_57(val, _values, result)
|
|
805
811
|
result = s(:number, process_number(val[0])).line(self.lexer.lineno)
|
|
806
812
|
result
|
|
807
813
|
end
|
|
808
814
|
.,.,
|
|
809
815
|
|
|
810
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
816
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 203)
|
|
811
817
|
def _reduce_58(val, _values, result)
|
|
812
818
|
result = s(:boolean, val[0] == "true").line(self.lexer.lineno)
|
|
813
819
|
result
|
|
814
820
|
end
|
|
815
821
|
.,.,
|
|
816
822
|
|
|
817
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
823
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 204)
|
|
818
824
|
def _reduce_59(val, _values, result)
|
|
819
825
|
result = s(:undefined).line(self.lexer.lineno)
|
|
820
826
|
result
|
|
821
827
|
end
|
|
822
828
|
.,.,
|
|
823
829
|
|
|
824
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
830
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 205)
|
|
825
831
|
def _reduce_60(val, _values, result)
|
|
826
832
|
result = s(:null).line(self.lexer.lineno)
|
|
827
833
|
result
|
|
828
834
|
end
|
|
829
835
|
.,.,
|
|
830
836
|
|
|
831
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
837
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 209)
|
|
832
838
|
def _reduce_61(val, _values, result)
|
|
833
839
|
result = prepare_path(true, false, val[1], self.lexer.lineno)
|
|
834
840
|
result
|
|
835
841
|
end
|
|
836
842
|
.,.,
|
|
837
843
|
|
|
838
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
844
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 214)
|
|
839
845
|
def _reduce_62(val, _values, result)
|
|
840
846
|
# NOTE: Separator is always parsed as '/'
|
|
841
847
|
result = prepare_path(false, false, [val[0], s(:sep, "/"), *val[2]], self.lexer.lineno)
|
|
@@ -844,28 +850,28 @@ module_eval(<<'.,.,', 'handlebars_parser.y', 210)
|
|
|
844
850
|
end
|
|
845
851
|
.,.,
|
|
846
852
|
|
|
847
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
853
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 217)
|
|
848
854
|
def _reduce_63(val, _values, result)
|
|
849
855
|
result = prepare_path(false, false, val[0], self.lexer.lineno)
|
|
850
856
|
result
|
|
851
857
|
end
|
|
852
858
|
.,.,
|
|
853
859
|
|
|
854
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
860
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 221)
|
|
855
861
|
def _reduce_64(val, _values, result)
|
|
856
862
|
result.push(s(:sep, val[1]), id(val[2]))
|
|
857
863
|
result
|
|
858
864
|
end
|
|
859
865
|
.,.,
|
|
860
866
|
|
|
861
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
867
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 222)
|
|
862
868
|
def _reduce_65(val, _values, result)
|
|
863
869
|
result = [id(val[0])]
|
|
864
870
|
result
|
|
865
871
|
end
|
|
866
872
|
.,.,
|
|
867
873
|
|
|
868
|
-
module_eval(<<'.,.,', 'handlebars_parser.y',
|
|
874
|
+
module_eval(<<'.,.,', 'handlebars_parser.y', 227)
|
|
869
875
|
def _reduce_66(val, _values, result)
|
|
870
876
|
result = nil
|
|
871
877
|
result
|