trenni 1.7.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +7 -3
- data/Gemfile +4 -0
- data/README.md +72 -10
- data/Rakefile +85 -0
- data/benchmark/call_vs_yield.rb +51 -0
- data/benchmark/interpolation_vs_concat.rb +29 -0
- data/benchmark/io_vs_string.rb +14 -4
- data/entities.json +2233 -0
- data/ext/trenni/extconf.rb +13 -0
- data/ext/trenni/markup.c +1981 -0
- data/ext/trenni/markup.h +6 -0
- data/ext/trenni/markup.rl +223 -0
- data/ext/trenni/template.c +1113 -0
- data/ext/trenni/template.h +6 -0
- data/ext/trenni/template.rl +77 -0
- data/ext/trenni/trenni.c +64 -0
- data/ext/trenni/trenni.h +28 -0
- data/lib/trenni.rb +1 -0
- data/lib/trenni/buffer.rb +13 -2
- data/lib/trenni/builder.rb +54 -47
- data/lib/trenni/entities.rb +2154 -0
- data/lib/trenni/entities.trenni +34 -0
- data/lib/trenni/fallback/markup.rb +1648 -0
- data/lib/trenni/fallback/markup.rl +236 -0
- data/lib/trenni/fallback/template.rb +843 -0
- data/lib/trenni/fallback/template.rl +97 -0
- data/lib/trenni/markup.rb +76 -0
- data/lib/trenni/native.rb +28 -0
- data/lib/trenni/parse_delegate.rb +34 -0
- data/lib/trenni/{scanner.rb → parse_error.rb} +9 -54
- data/lib/trenni/parsers.rb +12 -0
- data/lib/trenni/substitutions.rb +45 -0
- data/lib/trenni/template.rb +52 -135
- data/lib/trenni/version.rb +1 -1
- data/parsers/trenni/entities.rl +11 -0
- data/parsers/trenni/markup.rl +43 -0
- data/parsers/trenni/template.rl +60 -0
- data/spec/trenni/builder_spec.rb +37 -62
- data/spec/trenni/corpus/large.rb +4605 -0
- data/spec/trenni/corpus/large.xhtml +726 -0
- data/spec/trenni/markup_parser_spec.rb +233 -0
- data/spec/trenni/markup_spec.rb +48 -0
- data/spec/trenni/parsers_performance_spec.rb +44 -0
- data/spec/trenni/template_error_spec.rb +36 -0
- data/spec/trenni/template_performance_spec.rb +102 -0
- data/spec/trenni/template_spec.rb +90 -64
- data/spec/trenni/template_spec/basic.trenni +1 -0
- data/spec/trenni/template_spec/capture.trenni +2 -2
- data/spec/trenni/template_spec/error.trenni +4 -0
- data/trenni.gemspec +9 -6
- metadata +57 -15
- data/lib/trenni/parser.rb +0 -153
- data/spec/trenni/parser_spec.rb +0 -144
@@ -0,0 +1,236 @@
|
|
1
|
+
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
%%{
|
22
|
+
machine markup;
|
23
|
+
|
24
|
+
action identifier_begin {
|
25
|
+
identifier_begin = p
|
26
|
+
}
|
27
|
+
|
28
|
+
action identifier_end {
|
29
|
+
identifier_end = p
|
30
|
+
}
|
31
|
+
|
32
|
+
action pcdata_begin {
|
33
|
+
pcdata = ""
|
34
|
+
}
|
35
|
+
|
36
|
+
action pcdata_end {
|
37
|
+
}
|
38
|
+
|
39
|
+
action characters_begin {
|
40
|
+
characters_begin = p
|
41
|
+
}
|
42
|
+
|
43
|
+
action characters_end {
|
44
|
+
characters_end = p
|
45
|
+
|
46
|
+
pcdata << data.byteslice(characters_begin...characters_end)
|
47
|
+
}
|
48
|
+
|
49
|
+
action entity_error {
|
50
|
+
raise ParseError.new("could not parse entity", buffer, p)
|
51
|
+
}
|
52
|
+
|
53
|
+
action entity_begin {
|
54
|
+
entity_begin = p
|
55
|
+
}
|
56
|
+
|
57
|
+
action entity_name {
|
58
|
+
entity_end = p
|
59
|
+
|
60
|
+
name = data.byteslice(entity_begin...entity_end)
|
61
|
+
|
62
|
+
pcdata << entities[name]
|
63
|
+
}
|
64
|
+
|
65
|
+
action entity_hex {
|
66
|
+
entity_end = p
|
67
|
+
|
68
|
+
pcdata << data.byteslice(entity_begin...entity_end).to_i(16)
|
69
|
+
}
|
70
|
+
|
71
|
+
action entity_number {
|
72
|
+
entity_end = p
|
73
|
+
|
74
|
+
pcdata << data.byteslice(entity_begin...entity_end).to_i(10)
|
75
|
+
}
|
76
|
+
|
77
|
+
action doctype_begin {
|
78
|
+
doctype_begin = p
|
79
|
+
}
|
80
|
+
|
81
|
+
action doctype_end {
|
82
|
+
doctype_end = p
|
83
|
+
|
84
|
+
delegate.doctype(data.byteslice(doctype_begin...doctype_end))
|
85
|
+
}
|
86
|
+
|
87
|
+
action doctype_error {
|
88
|
+
raise ParseError.new("could not parse doctype", buffer, p)
|
89
|
+
}
|
90
|
+
|
91
|
+
action comment_begin {
|
92
|
+
comment_begin = p
|
93
|
+
}
|
94
|
+
|
95
|
+
action comment_end {
|
96
|
+
comment_end = p
|
97
|
+
|
98
|
+
delegate.comment(data.byteslice(comment_begin...comment_end))
|
99
|
+
}
|
100
|
+
|
101
|
+
action comment_error {
|
102
|
+
raise ParseError.new("could not parse comment", buffer, p)
|
103
|
+
}
|
104
|
+
|
105
|
+
action instruction_begin {
|
106
|
+
instruction_begin = p
|
107
|
+
}
|
108
|
+
|
109
|
+
action instruction_text_begin {
|
110
|
+
}
|
111
|
+
|
112
|
+
action instruction_text_end {
|
113
|
+
}
|
114
|
+
|
115
|
+
action instruction_end {
|
116
|
+
delegate.instruction(data.byteslice(instruction_begin, p-instruction_begin))
|
117
|
+
}
|
118
|
+
|
119
|
+
action instruction_error {
|
120
|
+
raise ParseError.new("could not parse instruction", buffer, p)
|
121
|
+
}
|
122
|
+
|
123
|
+
action tag_name {
|
124
|
+
self_closing = false
|
125
|
+
|
126
|
+
delegate.open_tag_begin(data.byteslice(identifier_begin...identifier_end), identifier_begin)
|
127
|
+
}
|
128
|
+
|
129
|
+
action tag_opening_begin {
|
130
|
+
}
|
131
|
+
|
132
|
+
action tag_self_closing {
|
133
|
+
self_closing = true
|
134
|
+
}
|
135
|
+
|
136
|
+
action attribute_begin {
|
137
|
+
has_value = false
|
138
|
+
pcdata = ""
|
139
|
+
}
|
140
|
+
|
141
|
+
action attribute_value {
|
142
|
+
has_value = true
|
143
|
+
}
|
144
|
+
|
145
|
+
action attribute_empty {
|
146
|
+
has_value = true
|
147
|
+
}
|
148
|
+
|
149
|
+
action attribute {
|
150
|
+
if has_value
|
151
|
+
value = pcdata
|
152
|
+
else
|
153
|
+
value = true
|
154
|
+
end
|
155
|
+
|
156
|
+
delegate.attribute(data.byteslice(identifier_begin...identifier_end), value)
|
157
|
+
}
|
158
|
+
|
159
|
+
action tag_opening_end {
|
160
|
+
delegate.open_tag_end(self_closing)
|
161
|
+
}
|
162
|
+
|
163
|
+
action tag_closing_begin {
|
164
|
+
}
|
165
|
+
|
166
|
+
action tag_closing_end {
|
167
|
+
delegate.close_tag(data.byteslice(identifier_begin...identifier_end), identifier_begin)
|
168
|
+
}
|
169
|
+
|
170
|
+
action tag_error {
|
171
|
+
raise ParseError.new("could not parse tag", buffer, p)
|
172
|
+
}
|
173
|
+
|
174
|
+
action cdata_begin {
|
175
|
+
cdata_begin = p
|
176
|
+
}
|
177
|
+
|
178
|
+
action cdata_end {
|
179
|
+
cdata_end = p
|
180
|
+
|
181
|
+
delegate.cdata(data.byteslice(cdata_begin...cdata_end))
|
182
|
+
}
|
183
|
+
|
184
|
+
action cdata_error {
|
185
|
+
raise ParseError.new("could not parse cdata", buffer, p)
|
186
|
+
}
|
187
|
+
|
188
|
+
action text_begin {
|
189
|
+
}
|
190
|
+
|
191
|
+
action text_end {
|
192
|
+
delegate.text(pcdata)
|
193
|
+
}
|
194
|
+
|
195
|
+
# This magic ensures that we process bytes.
|
196
|
+
getkey bytes[p];
|
197
|
+
|
198
|
+
include markup "trenni/markup.rl";
|
199
|
+
}%%
|
200
|
+
|
201
|
+
require_relative '../parse_error'
|
202
|
+
|
203
|
+
module Trenni
|
204
|
+
module Fallback
|
205
|
+
%% write data;
|
206
|
+
|
207
|
+
def self.parse_markup(buffer, delegate, entities)
|
208
|
+
data = buffer.read
|
209
|
+
bytes = data.bytes
|
210
|
+
|
211
|
+
p = 0
|
212
|
+
# Must set pe here or it gets incorrectly set to data.length
|
213
|
+
pe = eof = data.bytesize
|
214
|
+
stack = []
|
215
|
+
|
216
|
+
pcdata = nil
|
217
|
+
characters_begin = characters_end = nil
|
218
|
+
entity_begin = entity_end = nil
|
219
|
+
identifier_begin = identifier_end = nil
|
220
|
+
doctype_begin = doctype_end = nil
|
221
|
+
comment_begin = comment_end = nil
|
222
|
+
instruction_begin = instruction_end = nil
|
223
|
+
cdata_begin = cdata_end = nil
|
224
|
+
has_value = false
|
225
|
+
|
226
|
+
%% write init;
|
227
|
+
%% write exec;
|
228
|
+
|
229
|
+
if p != eof
|
230
|
+
raise ParseError.new("could not consume all input", buffer, p)
|
231
|
+
end
|
232
|
+
|
233
|
+
return nil
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|
@@ -0,0 +1,843 @@
|
|
1
|
+
|
2
|
+
# line 1 "template.rl"
|
3
|
+
# Copyright, 2016, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
# of this software and associated documentation files (the "Software"), to deal
|
7
|
+
# in the Software without restriction, including without limitation the rights
|
8
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
# copies of the Software, and to permit persons to whom the Software is
|
10
|
+
# furnished to do so, subject to the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be included in
|
13
|
+
# all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
# THE SOFTWARE.
|
22
|
+
|
23
|
+
|
24
|
+
# line 68 "template.rl"
|
25
|
+
|
26
|
+
|
27
|
+
require_relative '../parse_error'
|
28
|
+
|
29
|
+
module Trenni
|
30
|
+
module Fallback
|
31
|
+
|
32
|
+
# line 33 "template.rb"
|
33
|
+
class << self
|
34
|
+
attr_accessor :_template_trans_keys
|
35
|
+
private :_template_trans_keys, :_template_trans_keys=
|
36
|
+
end
|
37
|
+
self._template_trans_keys = [
|
38
|
+
0, 0, 10, 60, 123, 123,
|
39
|
+
63, 63, 123, 123, 63,
|
40
|
+
63, 63, 63, 114, 114,
|
41
|
+
9, 32, 63, 63, 62, 62,
|
42
|
+
9, 32, 123, 123, 63,
|
43
|
+
63, 0, 127, 0, 127,
|
44
|
+
63, 63, 62, 62, 0, 127,
|
45
|
+
63, 63, 62, 62, 34,
|
46
|
+
125, 34, 35, 35, 125,
|
47
|
+
35, 125, 34, 39, 35, 125,
|
48
|
+
35, 125, 34, 123, 34,
|
49
|
+
123, 39, 39, 34, 125,
|
50
|
+
34, 125, 34, 35, 35, 125,
|
51
|
+
35, 125, 34, 39, 35,
|
52
|
+
125, 35, 125, 34, 123,
|
53
|
+
34, 123, 39, 39, 34, 125,
|
54
|
+
9, 60, 10, 60, 10,
|
55
|
+
60, 9, 60, 9, 32,
|
56
|
+
0, 0, 34, 39, 34, 35,
|
57
|
+
39, 39, 0, 0, 34,
|
58
|
+
39, 34, 35, 39, 39,
|
59
|
+
0, 0, 0
|
60
|
+
]
|
61
|
+
|
62
|
+
class << self
|
63
|
+
attr_accessor :_template_key_spans
|
64
|
+
private :_template_key_spans, :_template_key_spans=
|
65
|
+
end
|
66
|
+
self._template_key_spans = [
|
67
|
+
0, 51, 1, 1, 1, 1, 1, 1,
|
68
|
+
24, 1, 1, 24, 1, 1, 128, 128,
|
69
|
+
1, 1, 128, 1, 1, 92, 2, 91,
|
70
|
+
91, 6, 91, 91, 90, 90, 1, 92,
|
71
|
+
92, 2, 91, 91, 6, 91, 91, 90,
|
72
|
+
90, 1, 92, 52, 51, 51, 52, 24,
|
73
|
+
0, 6, 2, 1, 0, 6, 2, 1,
|
74
|
+
0
|
75
|
+
]
|
76
|
+
|
77
|
+
class << self
|
78
|
+
attr_accessor :_template_index_offsets
|
79
|
+
private :_template_index_offsets, :_template_index_offsets=
|
80
|
+
end
|
81
|
+
self._template_index_offsets = [
|
82
|
+
0, 0, 52, 54, 56, 58, 60, 62,
|
83
|
+
64, 89, 91, 93, 118, 120, 122, 251,
|
84
|
+
380, 382, 384, 513, 515, 517, 610, 613,
|
85
|
+
705, 797, 804, 896, 988, 1079, 1170, 1172,
|
86
|
+
1265, 1358, 1361, 1453, 1545, 1552, 1644, 1736,
|
87
|
+
1827, 1918, 1920, 2013, 2066, 2118, 2170, 2223,
|
88
|
+
2248, 2249, 2256, 2259, 2261, 2262, 2269, 2272,
|
89
|
+
2274
|
90
|
+
]
|
91
|
+
|
92
|
+
class << self
|
93
|
+
attr_accessor :_template_indicies
|
94
|
+
private :_template_indicies, :_template_indicies=
|
95
|
+
end
|
96
|
+
self._template_indicies = [
|
97
|
+
2, 1, 1, 1, 1, 1, 1, 1,
|
98
|
+
1, 1, 1, 1, 1, 1, 1, 1,
|
99
|
+
1, 1, 1, 1, 1, 1, 1, 1,
|
100
|
+
1, 3, 1, 1, 1, 1, 1, 1,
|
101
|
+
1, 1, 1, 1, 1, 1, 1, 1,
|
102
|
+
1, 1, 1, 1, 1, 1, 1, 1,
|
103
|
+
1, 1, 4, 1, 0, 1, 0, 1,
|
104
|
+
5, 6, 5, 6, 7, 6, 8, 5,
|
105
|
+
10, 10, 10, 10, 10, 5, 5, 5,
|
106
|
+
5, 5, 5, 5, 5, 5, 5, 5,
|
107
|
+
5, 5, 5, 5, 5, 5, 5, 10,
|
108
|
+
5, 12, 11, 13, 11, 13, 15, 13,
|
109
|
+
13, 13, 14, 14, 14, 14, 14, 14,
|
110
|
+
14, 14, 14, 14, 14, 14, 14, 14,
|
111
|
+
14, 14, 14, 14, 13, 14, 16, 6,
|
112
|
+
17, 6, 19, 19, 19, 19, 19, 19,
|
113
|
+
19, 19, 19, 19, 19, 19, 19, 19,
|
114
|
+
19, 19, 19, 19, 19, 19, 19, 19,
|
115
|
+
19, 19, 19, 19, 19, 19, 19, 19,
|
116
|
+
19, 19, 19, 19, 19, 19, 19, 19,
|
117
|
+
19, 19, 19, 19, 19, 19, 19, 18,
|
118
|
+
18, 19, 18, 18, 18, 18, 18, 18,
|
119
|
+
18, 18, 18, 18, 18, 19, 19, 19,
|
120
|
+
19, 19, 19, 18, 18, 18, 18, 18,
|
121
|
+
18, 18, 18, 18, 18, 18, 18, 18,
|
122
|
+
18, 18, 18, 18, 18, 18, 18, 18,
|
123
|
+
18, 18, 18, 18, 18, 19, 19, 19,
|
124
|
+
19, 18, 19, 18, 18, 18, 18, 18,
|
125
|
+
18, 18, 18, 18, 18, 18, 18, 18,
|
126
|
+
18, 18, 18, 18, 20, 18, 18, 18,
|
127
|
+
18, 18, 18, 18, 18, 19, 19, 19,
|
128
|
+
19, 19, 18, 19, 19, 19, 19, 19,
|
129
|
+
19, 19, 19, 19, 21, 21, 21, 21,
|
130
|
+
21, 19, 19, 19, 19, 19, 19, 19,
|
131
|
+
19, 19, 19, 19, 19, 19, 19, 19,
|
132
|
+
19, 19, 19, 21, 19, 19, 19, 19,
|
133
|
+
19, 19, 19, 19, 19, 19, 19, 19,
|
134
|
+
18, 18, 19, 18, 18, 18, 18, 18,
|
135
|
+
18, 18, 18, 18, 18, 18, 19, 19,
|
136
|
+
19, 19, 19, 19, 18, 18, 18, 18,
|
137
|
+
18, 18, 18, 18, 18, 18, 18, 18,
|
138
|
+
18, 18, 18, 18, 18, 18, 18, 18,
|
139
|
+
18, 18, 18, 18, 18, 18, 19, 19,
|
140
|
+
19, 19, 18, 19, 18, 18, 18, 18,
|
141
|
+
18, 18, 18, 18, 18, 18, 18, 18,
|
142
|
+
18, 18, 18, 18, 18, 18, 18, 18,
|
143
|
+
18, 18, 18, 18, 18, 18, 19, 19,
|
144
|
+
19, 19, 19, 18, 22, 21, 23, 21,
|
145
|
+
19, 19, 19, 19, 19, 19, 19, 19,
|
146
|
+
19, 24, 24, 24, 24, 24, 19, 19,
|
147
|
+
19, 19, 19, 19, 19, 19, 19, 19,
|
148
|
+
19, 19, 19, 19, 19, 19, 19, 19,
|
149
|
+
24, 19, 19, 19, 19, 19, 19, 19,
|
150
|
+
19, 19, 19, 19, 19, 18, 18, 19,
|
151
|
+
18, 18, 18, 18, 18, 18, 18, 18,
|
152
|
+
18, 18, 18, 19, 19, 19, 19, 19,
|
153
|
+
19, 18, 18, 18, 18, 18, 18, 18,
|
154
|
+
18, 18, 18, 18, 18, 18, 18, 18,
|
155
|
+
18, 18, 18, 18, 18, 18, 18, 18,
|
156
|
+
18, 18, 18, 19, 19, 19, 19, 18,
|
157
|
+
19, 18, 18, 18, 18, 18, 18, 18,
|
158
|
+
18, 18, 18, 18, 18, 18, 18, 18,
|
159
|
+
18, 18, 18, 18, 18, 18, 18, 18,
|
160
|
+
18, 18, 18, 19, 19, 19, 19, 19,
|
161
|
+
18, 26, 25, 27, 25, 29, 28, 28,
|
162
|
+
28, 28, 30, 28, 28, 28, 28, 28,
|
163
|
+
28, 28, 28, 28, 28, 28, 28, 28,
|
164
|
+
28, 28, 28, 28, 28, 28, 28, 28,
|
165
|
+
28, 28, 28, 28, 28, 28, 28, 28,
|
166
|
+
28, 28, 28, 28, 28, 28, 28, 28,
|
167
|
+
28, 28, 28, 28, 28, 28, 28, 28,
|
168
|
+
28, 28, 28, 28, 28, 28, 28, 28,
|
169
|
+
28, 28, 28, 28, 28, 28, 28, 28,
|
170
|
+
28, 28, 28, 28, 28, 28, 28, 28,
|
171
|
+
28, 28, 28, 28, 28, 28, 28, 28,
|
172
|
+
28, 28, 28, 28, 28, 28, 31, 28,
|
173
|
+
32, 28, 33, 34, 29, 35, 33, 33,
|
174
|
+
33, 36, 33, 33, 33, 33, 33, 33,
|
175
|
+
33, 33, 33, 33, 33, 33, 33, 33,
|
176
|
+
33, 33, 33, 33, 33, 33, 33, 33,
|
177
|
+
33, 33, 33, 33, 33, 33, 33, 33,
|
178
|
+
33, 33, 33, 33, 33, 33, 33, 33,
|
179
|
+
33, 33, 33, 33, 33, 33, 33, 33,
|
180
|
+
33, 33, 33, 33, 33, 33, 33, 33,
|
181
|
+
33, 33, 33, 33, 33, 33, 33, 33,
|
182
|
+
33, 33, 33, 33, 33, 33, 33, 33,
|
183
|
+
33, 33, 33, 33, 33, 33, 33, 33,
|
184
|
+
33, 33, 33, 33, 33, 37, 33, 38,
|
185
|
+
33, 35, 33, 33, 33, 36, 33, 33,
|
186
|
+
33, 33, 33, 33, 33, 33, 33, 33,
|
187
|
+
33, 33, 33, 33, 33, 33, 33, 33,
|
188
|
+
33, 33, 33, 33, 33, 33, 33, 33,
|
189
|
+
33, 33, 33, 33, 33, 33, 33, 33,
|
190
|
+
33, 33, 33, 33, 33, 33, 33, 33,
|
191
|
+
33, 33, 33, 33, 33, 33, 33, 33,
|
192
|
+
33, 33, 33, 33, 33, 33, 33, 33,
|
193
|
+
33, 33, 33, 33, 33, 33, 33, 33,
|
194
|
+
33, 33, 33, 33, 33, 33, 33, 33,
|
195
|
+
33, 33, 33, 33, 33, 33, 33, 33,
|
196
|
+
33, 39, 33, 38, 33, 40, 41, 36,
|
197
|
+
36, 36, 40, 36, 42, 40, 40, 40,
|
198
|
+
40, 40, 40, 40, 40, 40, 40, 40,
|
199
|
+
40, 40, 40, 40, 40, 40, 40, 40,
|
200
|
+
40, 40, 40, 40, 40, 40, 40, 40,
|
201
|
+
40, 40, 40, 40, 40, 40, 40, 40,
|
202
|
+
40, 40, 40, 40, 40, 40, 40, 40,
|
203
|
+
40, 40, 40, 40, 40, 40, 40, 40,
|
204
|
+
40, 40, 40, 40, 40, 40, 40, 40,
|
205
|
+
40, 40, 40, 40, 40, 40, 40, 40,
|
206
|
+
40, 40, 40, 40, 40, 40, 40, 40,
|
207
|
+
40, 40, 40, 40, 40, 40, 40, 40,
|
208
|
+
40, 40, 40, 40, 43, 40, 44, 40,
|
209
|
+
42, 40, 40, 40, 40, 40, 40, 40,
|
210
|
+
40, 40, 40, 40, 40, 40, 40, 40,
|
211
|
+
40, 40, 40, 40, 40, 40, 40, 40,
|
212
|
+
40, 40, 40, 40, 40, 40, 40, 40,
|
213
|
+
40, 40, 40, 40, 40, 40, 40, 40,
|
214
|
+
40, 40, 40, 40, 40, 40, 40, 40,
|
215
|
+
40, 40, 40, 40, 40, 40, 40, 40,
|
216
|
+
40, 40, 40, 40, 40, 40, 40, 40,
|
217
|
+
40, 40, 40, 40, 40, 40, 40, 40,
|
218
|
+
40, 40, 40, 40, 40, 40, 40, 40,
|
219
|
+
40, 40, 40, 40, 40, 40, 40, 40,
|
220
|
+
45, 40, 44, 40, 40, 41, 36, 36,
|
221
|
+
36, 40, 36, 36, 36, 36, 36, 36,
|
222
|
+
36, 36, 36, 36, 36, 36, 36, 36,
|
223
|
+
36, 36, 36, 36, 36, 36, 36, 36,
|
224
|
+
36, 36, 36, 36, 36, 36, 36, 36,
|
225
|
+
36, 36, 36, 36, 36, 36, 36, 36,
|
226
|
+
36, 36, 36, 36, 36, 36, 36, 36,
|
227
|
+
36, 36, 36, 36, 36, 36, 36, 36,
|
228
|
+
36, 36, 36, 36, 36, 36, 36, 36,
|
229
|
+
36, 36, 36, 36, 36, 36, 36, 36,
|
230
|
+
36, 36, 36, 36, 36, 36, 36, 36,
|
231
|
+
36, 36, 36, 36, 36, 46, 36, 33,
|
232
|
+
34, 29, 29, 29, 29, 29, 29, 29,
|
233
|
+
29, 29, 29, 29, 29, 29, 29, 29,
|
234
|
+
29, 29, 29, 29, 29, 29, 29, 29,
|
235
|
+
29, 29, 29, 29, 29, 29, 29, 29,
|
236
|
+
29, 29, 29, 29, 29, 29, 29, 29,
|
237
|
+
29, 29, 29, 29, 29, 29, 29, 29,
|
238
|
+
29, 29, 29, 29, 29, 29, 29, 29,
|
239
|
+
29, 29, 29, 29, 29, 29, 29, 29,
|
240
|
+
29, 29, 29, 29, 29, 29, 29, 29,
|
241
|
+
29, 29, 29, 29, 29, 29, 29, 29,
|
242
|
+
29, 29, 29, 29, 29, 29, 29, 29,
|
243
|
+
47, 29, 48, 30, 36, 48, 48, 48,
|
244
|
+
48, 48, 48, 48, 48, 48, 48, 48,
|
245
|
+
48, 48, 48, 48, 48, 48, 48, 48,
|
246
|
+
48, 48, 48, 48, 48, 48, 48, 48,
|
247
|
+
48, 48, 48, 48, 48, 48, 48, 48,
|
248
|
+
48, 48, 48, 48, 48, 48, 48, 48,
|
249
|
+
48, 48, 48, 48, 48, 48, 48, 48,
|
250
|
+
48, 48, 48, 48, 48, 48, 48, 48,
|
251
|
+
48, 48, 48, 48, 48, 48, 48, 48,
|
252
|
+
48, 48, 48, 48, 48, 48, 48, 48,
|
253
|
+
48, 48, 48, 48, 48, 48, 48, 48,
|
254
|
+
48, 48, 48, 48, 48, 49, 48, 50,
|
255
|
+
48, 52, 51, 51, 51, 51, 53, 51,
|
256
|
+
51, 51, 51, 51, 51, 51, 51, 51,
|
257
|
+
51, 51, 51, 51, 51, 51, 51, 51,
|
258
|
+
51, 51, 51, 51, 51, 51, 51, 51,
|
259
|
+
51, 51, 51, 51, 51, 51, 51, 51,
|
260
|
+
51, 51, 51, 51, 51, 51, 51, 51,
|
261
|
+
51, 51, 51, 51, 51, 51, 51, 51,
|
262
|
+
51, 51, 51, 51, 51, 51, 51, 51,
|
263
|
+
51, 51, 51, 51, 51, 51, 51, 51,
|
264
|
+
51, 51, 51, 51, 51, 51, 51, 51,
|
265
|
+
51, 51, 51, 51, 51, 51, 51, 51,
|
266
|
+
51, 51, 54, 51, 55, 51, 56, 57,
|
267
|
+
52, 58, 56, 56, 56, 59, 56, 56,
|
268
|
+
56, 56, 56, 56, 56, 56, 56, 56,
|
269
|
+
56, 56, 56, 56, 56, 56, 56, 56,
|
270
|
+
56, 56, 56, 56, 56, 56, 56, 56,
|
271
|
+
56, 56, 56, 56, 56, 56, 56, 56,
|
272
|
+
56, 56, 56, 56, 56, 56, 56, 56,
|
273
|
+
56, 56, 56, 56, 56, 56, 56, 56,
|
274
|
+
56, 56, 56, 56, 56, 56, 56, 56,
|
275
|
+
56, 56, 56, 56, 56, 56, 56, 56,
|
276
|
+
56, 56, 56, 56, 56, 56, 56, 56,
|
277
|
+
56, 56, 56, 56, 56, 56, 56, 56,
|
278
|
+
56, 60, 56, 61, 56, 58, 56, 56,
|
279
|
+
56, 59, 56, 56, 56, 56, 56, 56,
|
280
|
+
56, 56, 56, 56, 56, 56, 56, 56,
|
281
|
+
56, 56, 56, 56, 56, 56, 56, 56,
|
282
|
+
56, 56, 56, 56, 56, 56, 56, 56,
|
283
|
+
56, 56, 56, 56, 56, 56, 56, 56,
|
284
|
+
56, 56, 56, 56, 56, 56, 56, 56,
|
285
|
+
56, 56, 56, 56, 56, 56, 56, 56,
|
286
|
+
56, 56, 56, 56, 56, 56, 56, 56,
|
287
|
+
56, 56, 56, 56, 56, 56, 56, 56,
|
288
|
+
56, 56, 56, 56, 56, 56, 56, 56,
|
289
|
+
56, 56, 56, 56, 56, 62, 56, 61,
|
290
|
+
56, 63, 64, 59, 59, 59, 63, 59,
|
291
|
+
65, 63, 63, 63, 63, 63, 63, 63,
|
292
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
293
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
294
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
295
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
296
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
297
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
298
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
299
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
300
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
301
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
302
|
+
66, 63, 67, 63, 65, 63, 63, 63,
|
303
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
304
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
305
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
306
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
307
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
308
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
309
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
310
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
311
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
312
|
+
63, 63, 63, 63, 63, 63, 63, 63,
|
313
|
+
63, 63, 63, 63, 68, 63, 67, 63,
|
314
|
+
63, 64, 59, 59, 59, 63, 59, 59,
|
315
|
+
59, 59, 59, 59, 59, 59, 59, 59,
|
316
|
+
59, 59, 59, 59, 59, 59, 59, 59,
|
317
|
+
59, 59, 59, 59, 59, 59, 59, 59,
|
318
|
+
59, 59, 59, 59, 59, 59, 59, 59,
|
319
|
+
59, 59, 59, 59, 59, 59, 59, 59,
|
320
|
+
59, 59, 59, 59, 59, 59, 59, 59,
|
321
|
+
59, 59, 59, 59, 59, 59, 59, 59,
|
322
|
+
59, 59, 59, 59, 59, 59, 59, 59,
|
323
|
+
59, 59, 59, 59, 59, 59, 59, 59,
|
324
|
+
59, 59, 59, 59, 59, 59, 59, 59,
|
325
|
+
59, 69, 59, 56, 57, 52, 52, 52,
|
326
|
+
52, 52, 52, 52, 52, 52, 52, 52,
|
327
|
+
52, 52, 52, 52, 52, 52, 52, 52,
|
328
|
+
52, 52, 52, 52, 52, 52, 52, 52,
|
329
|
+
52, 52, 52, 52, 52, 52, 52, 52,
|
330
|
+
52, 52, 52, 52, 52, 52, 52, 52,
|
331
|
+
52, 52, 52, 52, 52, 52, 52, 52,
|
332
|
+
52, 52, 52, 52, 52, 52, 52, 52,
|
333
|
+
52, 52, 52, 52, 52, 52, 52, 52,
|
334
|
+
52, 52, 52, 52, 52, 52, 52, 52,
|
335
|
+
52, 52, 52, 52, 52, 52, 52, 52,
|
336
|
+
52, 52, 52, 52, 70, 52, 71, 53,
|
337
|
+
59, 71, 71, 71, 71, 71, 71, 71,
|
338
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
339
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
340
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
341
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
342
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
343
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
344
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
345
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
346
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
347
|
+
71, 71, 71, 71, 71, 71, 71, 71,
|
348
|
+
71, 72, 71, 73, 71, 74, 2, 74,
|
349
|
+
74, 74, 6, 6, 6, 6, 6, 6,
|
350
|
+
6, 6, 6, 6, 6, 6, 6, 6,
|
351
|
+
6, 6, 6, 6, 74, 6, 6, 75,
|
352
|
+
6, 6, 6, 6, 6, 6, 6, 6,
|
353
|
+
6, 6, 6, 6, 6, 6, 6, 6,
|
354
|
+
6, 6, 6, 6, 6, 6, 6, 6,
|
355
|
+
76, 6, 2, 6, 6, 6, 6, 6,
|
356
|
+
6, 6, 6, 6, 6, 6, 6, 6,
|
357
|
+
6, 6, 6, 6, 6, 6, 6, 6,
|
358
|
+
6, 6, 6, 78, 6, 6, 6, 6,
|
359
|
+
6, 6, 6, 6, 6, 6, 6, 6,
|
360
|
+
6, 6, 6, 6, 6, 6, 6, 6,
|
361
|
+
6, 6, 6, 6, 79, 6, 2, 1,
|
362
|
+
1, 1, 1, 1, 1, 1, 1, 1,
|
363
|
+
1, 1, 1, 1, 1, 1, 1, 1,
|
364
|
+
1, 1, 1, 1, 1, 1, 1, 3,
|
365
|
+
1, 1, 1, 1, 1, 1, 1, 1,
|
366
|
+
1, 1, 1, 1, 1, 1, 1, 1,
|
367
|
+
1, 1, 1, 1, 1, 1, 1, 1,
|
368
|
+
4, 1, 74, 2, 74, 74, 74, 6,
|
369
|
+
6, 6, 6, 6, 6, 6, 6, 6,
|
370
|
+
6, 6, 6, 6, 6, 6, 6, 6,
|
371
|
+
6, 74, 6, 6, 78, 6, 6, 6,
|
372
|
+
6, 6, 6, 6, 6, 6, 6, 6,
|
373
|
+
6, 6, 6, 6, 6, 6, 6, 6,
|
374
|
+
6, 6, 6, 6, 6, 81, 6, 13,
|
375
|
+
15, 13, 13, 13, 14, 14, 14, 14,
|
376
|
+
14, 14, 14, 14, 14, 14, 14, 14,
|
377
|
+
14, 14, 14, 14, 14, 14, 13, 14,
|
378
|
+
82, 40, 41, 36, 36, 36, 40, 36,
|
379
|
+
33, 34, 29, 48, 30, 83, 63, 64,
|
380
|
+
59, 59, 59, 63, 59, 56, 57, 52,
|
381
|
+
71, 53, 83, 0
|
382
|
+
]
|
383
|
+
|
384
|
+
class << self
|
385
|
+
attr_accessor :_template_trans_targs
|
386
|
+
private :_template_trans_targs, :_template_trans_targs=
|
387
|
+
end
|
388
|
+
self._template_trans_targs = [
|
389
|
+
43, 1, 45, 2, 3, 43, 44, 7,
|
390
|
+
8, 43, 9, 9, 10, 11, 43, 47,
|
391
|
+
48, 14, 15, 0, 18, 16, 17, 43,
|
392
|
+
19, 19, 20, 47, 21, 22, 30, 21,
|
393
|
+
52, 23, 29, 24, 25, 23, 50, 23,
|
394
|
+
26, 28, 27, 26, 49, 26, 25, 22,
|
395
|
+
31, 31, 51, 32, 33, 41, 32, 56,
|
396
|
+
34, 40, 35, 36, 34, 54, 34, 37,
|
397
|
+
39, 38, 37, 53, 37, 36, 33, 42,
|
398
|
+
42, 55, 46, 12, 13, 43, 4, 5,
|
399
|
+
43, 6, 43, 0
|
400
|
+
]
|
401
|
+
|
402
|
+
class << self
|
403
|
+
attr_accessor :_template_trans_actions
|
404
|
+
private :_template_trans_actions, :_template_trans_actions=
|
405
|
+
end
|
406
|
+
self._template_trans_actions = [
|
407
|
+
1, 0, 2, 0, 0, 3, 2, 0,
|
408
|
+
0, 4, 5, 0, 6, 0, 7, 8,
|
409
|
+
0, 0, 0, 9, 0, 0, 0, 10,
|
410
|
+
5, 0, 6, 11, 0, 0, 0, 13,
|
411
|
+
14, 0, 0, 0, 0, 13, 14, 15,
|
412
|
+
0, 0, 0, 13, 14, 15, 16, 16,
|
413
|
+
0, 13, 14, 0, 0, 0, 13, 18,
|
414
|
+
0, 0, 0, 0, 13, 18, 15, 0,
|
415
|
+
0, 0, 13, 18, 15, 16, 16, 0,
|
416
|
+
13, 18, 20, 0, 0, 21, 0, 0,
|
417
|
+
22, 0, 23, 0
|
418
|
+
]
|
419
|
+
|
420
|
+
class << self
|
421
|
+
attr_accessor :_template_to_state_actions
|
422
|
+
private :_template_to_state_actions, :_template_to_state_actions=
|
423
|
+
end
|
424
|
+
self._template_to_state_actions = [
|
425
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
426
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
427
|
+
0, 0, 0, 0, 0, 12, 12, 12,
|
428
|
+
0, 12, 12, 0, 0, 0, 0, 12,
|
429
|
+
12, 12, 12, 0, 12, 12, 0, 0,
|
430
|
+
0, 0, 12, 12, 0, 0, 0, 0,
|
431
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
432
|
+
0
|
433
|
+
]
|
434
|
+
|
435
|
+
class << self
|
436
|
+
attr_accessor :_template_from_state_actions
|
437
|
+
private :_template_from_state_actions, :_template_from_state_actions=
|
438
|
+
end
|
439
|
+
self._template_from_state_actions = [
|
440
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
441
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
442
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
443
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
444
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
445
|
+
0, 0, 0, 19, 0, 0, 0, 0,
|
446
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
447
|
+
0
|
448
|
+
]
|
449
|
+
|
450
|
+
class << self
|
451
|
+
attr_accessor :_template_eof_actions
|
452
|
+
private :_template_eof_actions, :_template_eof_actions=
|
453
|
+
end
|
454
|
+
self._template_eof_actions = [
|
455
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
456
|
+
0, 0, 0, 0, 0, 0, 9, 9,
|
457
|
+
9, 9, 9, 9, 9, 0, 0, 0,
|
458
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
459
|
+
17, 17, 17, 17, 17, 17, 17, 17,
|
460
|
+
17, 17, 17, 0, 0, 0, 0, 0,
|
461
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
462
|
+
0
|
463
|
+
]
|
464
|
+
|
465
|
+
class << self
|
466
|
+
attr_accessor :_template_eof_trans
|
467
|
+
private :_template_eof_trans, :_template_eof_trans=
|
468
|
+
end
|
469
|
+
self._template_eof_trans = [
|
470
|
+
0, 1, 1, 1, 6, 6, 6, 6,
|
471
|
+
10, 10, 10, 15, 0, 0, 0, 0,
|
472
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
473
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
474
|
+
0, 0, 0, 0, 0, 0, 0, 0,
|
475
|
+
0, 0, 0, 0, 78, 81, 78, 15,
|
476
|
+
83, 0, 0, 0, 0, 0, 0, 0,
|
477
|
+
0
|
478
|
+
]
|
479
|
+
|
480
|
+
class << self
|
481
|
+
attr_accessor :template_start
|
482
|
+
end
|
483
|
+
self.template_start = 43;
|
484
|
+
class << self
|
485
|
+
attr_accessor :template_first_final
|
486
|
+
end
|
487
|
+
self.template_first_final = 43;
|
488
|
+
class << self
|
489
|
+
attr_accessor :template_error
|
490
|
+
end
|
491
|
+
self.template_error = 0;
|
492
|
+
|
493
|
+
class << self
|
494
|
+
attr_accessor :template_en_parse_nested_expression
|
495
|
+
end
|
496
|
+
self.template_en_parse_nested_expression = 21;
|
497
|
+
class << self
|
498
|
+
attr_accessor :template_en_parse_expression
|
499
|
+
end
|
500
|
+
self.template_en_parse_expression = 32;
|
501
|
+
class << self
|
502
|
+
attr_accessor :template_en_main
|
503
|
+
end
|
504
|
+
self.template_en_main = 43;
|
505
|
+
|
506
|
+
|
507
|
+
# line 75 "template.rl"
|
508
|
+
|
509
|
+
def self.parse_template(buffer, delegate)
|
510
|
+
data = buffer.read
|
511
|
+
bytes = data.bytes
|
512
|
+
|
513
|
+
p = 0
|
514
|
+
pe = eof = data.bytesize
|
515
|
+
stack = []
|
516
|
+
|
517
|
+
expression_begin = expression_end = nil
|
518
|
+
instruction_begin = instruction_end = nil
|
519
|
+
|
520
|
+
|
521
|
+
# line 522 "template.rb"
|
522
|
+
begin
|
523
|
+
p ||= 0
|
524
|
+
pe ||= data.length
|
525
|
+
cs = template_start
|
526
|
+
top = 0
|
527
|
+
ts = nil
|
528
|
+
te = nil
|
529
|
+
act = 0
|
530
|
+
end
|
531
|
+
|
532
|
+
# line 88 "template.rl"
|
533
|
+
|
534
|
+
# line 535 "template.rb"
|
535
|
+
begin
|
536
|
+
testEof = false
|
537
|
+
_slen, _trans, _keys, _inds, _acts, _nacts = nil
|
538
|
+
_goto_level = 0
|
539
|
+
_resume = 10
|
540
|
+
_eof_trans = 15
|
541
|
+
_again = 20
|
542
|
+
_test_eof = 30
|
543
|
+
_out = 40
|
544
|
+
while true
|
545
|
+
if _goto_level <= 0
|
546
|
+
if p == pe
|
547
|
+
_goto_level = _test_eof
|
548
|
+
next
|
549
|
+
end
|
550
|
+
if cs == 0
|
551
|
+
_goto_level = _out
|
552
|
+
next
|
553
|
+
end
|
554
|
+
end
|
555
|
+
if _goto_level <= _resume
|
556
|
+
case _template_from_state_actions[cs]
|
557
|
+
when 19 then
|
558
|
+
# line 1 "NONE"
|
559
|
+
begin
|
560
|
+
ts = p
|
561
|
+
end
|
562
|
+
# line 563 "template.rb"
|
563
|
+
end
|
564
|
+
_keys = cs << 1
|
565
|
+
_inds = _template_index_offsets[cs]
|
566
|
+
_slen = _template_key_spans[cs]
|
567
|
+
_wide = ( bytes[p])
|
568
|
+
_trans = if ( _slen > 0 &&
|
569
|
+
_template_trans_keys[_keys] <= _wide &&
|
570
|
+
_wide <= _template_trans_keys[_keys + 1]
|
571
|
+
) then
|
572
|
+
_template_indicies[ _inds + _wide - _template_trans_keys[_keys] ]
|
573
|
+
else
|
574
|
+
_template_indicies[ _inds + _slen ]
|
575
|
+
end
|
576
|
+
end
|
577
|
+
if _goto_level <= _eof_trans
|
578
|
+
cs = _template_trans_targs[_trans]
|
579
|
+
if _template_trans_actions[_trans] != 0
|
580
|
+
case _template_trans_actions[_trans]
|
581
|
+
when 5 then
|
582
|
+
# line 24 "template.rl"
|
583
|
+
begin
|
584
|
+
|
585
|
+
instruction_begin = p
|
586
|
+
end
|
587
|
+
when 6 then
|
588
|
+
# line 28 "template.rl"
|
589
|
+
begin
|
590
|
+
|
591
|
+
instruction_end = p
|
592
|
+
end
|
593
|
+
when 9 then
|
594
|
+
# line 40 "template.rl"
|
595
|
+
begin
|
596
|
+
|
597
|
+
raise ParseError.new("failed to parse instruction", buffer, p)
|
598
|
+
end
|
599
|
+
when 16 then
|
600
|
+
# line 13 "/Users/samuel/Documents/Programming/ioquatix/trenni/parsers/trenni/template.rl"
|
601
|
+
begin
|
602
|
+
begin
|
603
|
+
stack[top] = cs
|
604
|
+
top+= 1
|
605
|
+
cs = 21
|
606
|
+
_goto_level = _again
|
607
|
+
next
|
608
|
+
end
|
609
|
+
end
|
610
|
+
when 13 then
|
611
|
+
# line 17 "/Users/samuel/Documents/Programming/ioquatix/trenni/parsers/trenni/template.rl"
|
612
|
+
begin
|
613
|
+
begin
|
614
|
+
stack[top] = cs
|
615
|
+
top+= 1
|
616
|
+
cs = 21
|
617
|
+
_goto_level = _again
|
618
|
+
next
|
619
|
+
end
|
620
|
+
end
|
621
|
+
when 14 then
|
622
|
+
# line 20 "/Users/samuel/Documents/Programming/ioquatix/trenni/parsers/trenni/template.rl"
|
623
|
+
begin
|
624
|
+
begin
|
625
|
+
top -= 1
|
626
|
+
cs = stack[top]
|
627
|
+
_goto_level = _again
|
628
|
+
next
|
629
|
+
end
|
630
|
+
end
|
631
|
+
when 2 then
|
632
|
+
# line 1 "NONE"
|
633
|
+
begin
|
634
|
+
te = p+1
|
635
|
+
end
|
636
|
+
when 10 then
|
637
|
+
# line 60 "template.rl"
|
638
|
+
begin
|
639
|
+
te = p+1
|
640
|
+
begin
|
641
|
+
delegate.text(data.byteslice(ts...te))
|
642
|
+
end
|
643
|
+
end
|
644
|
+
when 22 then
|
645
|
+
# line 60 "template.rl"
|
646
|
+
begin
|
647
|
+
te = p
|
648
|
+
p = p - 1; begin
|
649
|
+
delegate.text(data.byteslice(ts...te))
|
650
|
+
end
|
651
|
+
end
|
652
|
+
when 21 then
|
653
|
+
# line 60 "template.rl"
|
654
|
+
begin
|
655
|
+
te = p
|
656
|
+
p = p - 1; begin
|
657
|
+
delegate.text(data.byteslice(ts...te))
|
658
|
+
end
|
659
|
+
end
|
660
|
+
when 1 then
|
661
|
+
# line 60 "template.rl"
|
662
|
+
begin
|
663
|
+
begin p = ((te))-1; end
|
664
|
+
begin
|
665
|
+
delegate.text(data.byteslice(ts...te))
|
666
|
+
end
|
667
|
+
end
|
668
|
+
when 3 then
|
669
|
+
# line 60 "template.rl"
|
670
|
+
begin
|
671
|
+
begin p = ((te))-1; end
|
672
|
+
begin
|
673
|
+
delegate.text(data.byteslice(ts...te))
|
674
|
+
end
|
675
|
+
end
|
676
|
+
when 7 then
|
677
|
+
# line 1 "NONE"
|
678
|
+
begin
|
679
|
+
case act
|
680
|
+
when 1 then
|
681
|
+
begin begin p = ((te))-1; end
|
682
|
+
|
683
|
+
delegate.instruction(data.byteslice(instruction_begin...instruction_end), "\n")
|
684
|
+
end
|
685
|
+
when 3 then
|
686
|
+
begin begin p = ((te))-1; end
|
687
|
+
|
688
|
+
delegate.instruction(data.byteslice(instruction_begin...instruction_end))
|
689
|
+
end
|
690
|
+
when 6 then
|
691
|
+
begin begin p = ((te))-1; end
|
692
|
+
|
693
|
+
delegate.text(data.byteslice(ts...te))
|
694
|
+
end
|
695
|
+
end
|
696
|
+
end
|
697
|
+
when 4 then
|
698
|
+
# line 40 "template.rl"
|
699
|
+
begin
|
700
|
+
|
701
|
+
raise ParseError.new("failed to parse instruction", buffer, p)
|
702
|
+
end
|
703
|
+
# line 60 "template.rl"
|
704
|
+
begin
|
705
|
+
begin p = ((te))-1; end
|
706
|
+
begin
|
707
|
+
delegate.text(data.byteslice(ts...te))
|
708
|
+
end
|
709
|
+
end
|
710
|
+
when 23 then
|
711
|
+
# line 44 "template.rl"
|
712
|
+
begin
|
713
|
+
|
714
|
+
expression_begin = p
|
715
|
+
end
|
716
|
+
# line 53 "/Users/samuel/Documents/Programming/ioquatix/trenni/parsers/trenni/template.rl"
|
717
|
+
begin
|
718
|
+
te = p
|
719
|
+
p = p - 1; begin cs = 32; end
|
720
|
+
end
|
721
|
+
when 15 then
|
722
|
+
# line 13 "/Users/samuel/Documents/Programming/ioquatix/trenni/parsers/trenni/template.rl"
|
723
|
+
begin
|
724
|
+
begin
|
725
|
+
stack[top] = cs
|
726
|
+
top+= 1
|
727
|
+
cs = 21
|
728
|
+
_goto_level = _again
|
729
|
+
next
|
730
|
+
end
|
731
|
+
end
|
732
|
+
# line 17 "/Users/samuel/Documents/Programming/ioquatix/trenni/parsers/trenni/template.rl"
|
733
|
+
begin
|
734
|
+
begin
|
735
|
+
stack[top] = cs
|
736
|
+
top+= 1
|
737
|
+
cs = 21
|
738
|
+
_goto_level = _again
|
739
|
+
next
|
740
|
+
end
|
741
|
+
end
|
742
|
+
when 8 then
|
743
|
+
# line 1 "NONE"
|
744
|
+
begin
|
745
|
+
te = p+1
|
746
|
+
end
|
747
|
+
# line 36 "template.rl"
|
748
|
+
begin
|
749
|
+
act = 1; end
|
750
|
+
when 11 then
|
751
|
+
# line 1 "NONE"
|
752
|
+
begin
|
753
|
+
te = p+1
|
754
|
+
end
|
755
|
+
# line 32 "template.rl"
|
756
|
+
begin
|
757
|
+
act = 3; end
|
758
|
+
when 20 then
|
759
|
+
# line 1 "NONE"
|
760
|
+
begin
|
761
|
+
te = p+1
|
762
|
+
end
|
763
|
+
# line 60 "template.rl"
|
764
|
+
begin
|
765
|
+
act = 6; end
|
766
|
+
when 18 then
|
767
|
+
# line 48 "template.rl"
|
768
|
+
begin
|
769
|
+
|
770
|
+
expression_end = p
|
771
|
+
end
|
772
|
+
# line 52 "template.rl"
|
773
|
+
begin
|
774
|
+
|
775
|
+
delegate.expression(data.byteslice(expression_begin...expression_end))
|
776
|
+
end
|
777
|
+
# line 21 "/Users/samuel/Documents/Programming/ioquatix/trenni/parsers/trenni/template.rl"
|
778
|
+
begin
|
779
|
+
cs = 43; end
|
780
|
+
# line 781 "template.rb"
|
781
|
+
end
|
782
|
+
end
|
783
|
+
end
|
784
|
+
if _goto_level <= _again
|
785
|
+
case _template_to_state_actions[cs]
|
786
|
+
when 12 then
|
787
|
+
# line 1 "NONE"
|
788
|
+
begin
|
789
|
+
ts = nil; end
|
790
|
+
# line 791 "template.rb"
|
791
|
+
end
|
792
|
+
|
793
|
+
if cs == 0
|
794
|
+
_goto_level = _out
|
795
|
+
next
|
796
|
+
end
|
797
|
+
p += 1
|
798
|
+
if p != pe
|
799
|
+
_goto_level = _resume
|
800
|
+
next
|
801
|
+
end
|
802
|
+
end
|
803
|
+
if _goto_level <= _test_eof
|
804
|
+
if p == eof
|
805
|
+
if _template_eof_trans[cs] > 0
|
806
|
+
_trans = _template_eof_trans[cs] - 1;
|
807
|
+
_goto_level = _eof_trans
|
808
|
+
next;
|
809
|
+
end
|
810
|
+
case _template_eof_actions[cs]
|
811
|
+
when 9 then
|
812
|
+
# line 40 "template.rl"
|
813
|
+
begin
|
814
|
+
|
815
|
+
raise ParseError.new("failed to parse instruction", buffer, p)
|
816
|
+
end
|
817
|
+
when 17 then
|
818
|
+
# line 56 "template.rl"
|
819
|
+
begin
|
820
|
+
|
821
|
+
raise ParseError.new("failed to parse expression", buffer, p)
|
822
|
+
end
|
823
|
+
# line 824 "template.rb"
|
824
|
+
end
|
825
|
+
end
|
826
|
+
|
827
|
+
end
|
828
|
+
if _goto_level <= _out
|
829
|
+
break
|
830
|
+
end
|
831
|
+
end
|
832
|
+
end
|
833
|
+
|
834
|
+
# line 89 "template.rl"
|
835
|
+
|
836
|
+
if p != eof
|
837
|
+
raise ParseError.new("could not consume all input", buffer, p)
|
838
|
+
end
|
839
|
+
|
840
|
+
return nil
|
841
|
+
end
|
842
|
+
end
|
843
|
+
end
|