aslakhellesoy-cucumber 0.1.16.4 → 0.1.16.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +75 -1
- data/Manifest.txt +58 -65
- data/examples/cs/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/Rakefile +3 -3
- data/examples/i18n/ar/features/step_definitons/calculator_steps.rb +1 -6
- data/examples/i18n/da/features/step_definitons/kalkulator_steps.rb +1 -1
- data/examples/i18n/de/features/addition.feature +6 -6
- data/examples/i18n/de/features/step_definitons/calculator_steps.rb +2 -2
- data/examples/i18n/en/features/addition.feature +6 -6
- data/examples/i18n/en/features/step_definitons/calculator_steps.rb +2 -2
- data/examples/i18n/es/features/step_definitons/calculador_steps.rb +1 -1
- data/examples/i18n/et/features/liitmine.feature +7 -6
- data/examples/i18n/et/features/step_definitions/kalkulaator_steps.rb +1 -1
- data/examples/i18n/fi/features/step_definitons/laskin_steps.rb +1 -1
- data/examples/i18n/fi/features/yhteenlasku.feature +2 -2
- data/examples/i18n/fr/features/addition.feature +2 -2
- data/examples/i18n/fr/features/step_definitions/calculatrice_steps.rb +1 -1
- data/examples/i18n/id/features/addition.feature +6 -6
- data/examples/i18n/id/features/step_definitons/calculator_steps.rb +2 -2
- data/examples/i18n/it/features/step_definitons/calcolatrice_steps.rb +1 -1
- data/examples/i18n/ja/features/step_definitons/calculator_steps.rb +2 -3
- data/examples/i18n/ko/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/lt/features/addition.feature +7 -6
- data/examples/i18n/lt/features/step_definitons/calculator_steps.rb +2 -2
- data/examples/i18n/no/features/step_definitons/kalkulator_steps.rb +7 -7
- data/examples/i18n/no/features/summering.feature +1 -0
- data/examples/i18n/pt/features/step_definitions/calculadora_steps.rb +1 -1
- data/examples/i18n/ro/features/step_definitons/calculator_steps.rb +1 -1
- data/examples/i18n/se/features/step_definitons/kalkulator_steps.rb +1 -1
- data/examples/i18n/zh-CN/features/step_definitons/calculator_steps.rb +2 -2
- data/examples/jbehave/README.textile +17 -0
- data/examples/jbehave/features/support/env.rb +7 -0
- data/examples/jbehave/features/trading.feature +24 -0
- data/examples/jbehave/pom.xml +48 -0
- data/examples/self_test/README.textile +4 -1
- data/examples/self_test/features/call_undefined_step_from_step_def.feature +7 -0
- data/examples/self_test/features/lots_of_undefined.feature +8 -0
- data/examples/self_test/features/outline_sample.feature +8 -5
- data/examples/self_test/features/sample.feature +5 -3
- data/examples/self_test/features/step_definitions/sample_steps.rb +15 -3
- data/features/cucumber_cli.feature +199 -97
- data/features/cucumber_cli_outlines.feature +46 -38
- data/features/report_called_undefined_steps.feature +31 -0
- data/features/step_definitions/cucumber_steps.rb +7 -3
- data/features/step_definitions/extra_steps.rb +1 -1
- data/features/support/env.rb +1 -1
- data/gem_tasks/features.rake +1 -1
- data/gem_tasks/flog.rake +1 -1
- data/lib/autotest/cucumber_mixin.rb +16 -23
- data/lib/cucumber/ast/comment.rb +26 -0
- data/lib/cucumber/ast/examples.rb +22 -0
- data/lib/cucumber/ast/feature.rb +60 -0
- data/lib/cucumber/ast/features.rb +39 -0
- data/lib/cucumber/ast/filter.rb +22 -0
- data/lib/cucumber/ast/outline_table.rb +49 -0
- data/lib/cucumber/ast/py_string.rb +52 -0
- data/lib/cucumber/ast/scenario.rb +91 -0
- data/lib/cucumber/ast/scenario_outline.rb +83 -0
- data/lib/cucumber/ast/step.rb +130 -0
- data/lib/cucumber/ast/table.rb +214 -0
- data/lib/cucumber/ast/tags.rb +33 -0
- data/lib/cucumber/ast/visitor.rb +93 -0
- data/lib/cucumber/ast.rb +27 -0
- data/lib/cucumber/broadcaster.rb +1 -6
- data/lib/cucumber/cli.rb +178 -128
- data/lib/cucumber/core_ext/exception.rb +41 -8
- data/lib/cucumber/core_ext/instance_exec.rb +54 -0
- data/lib/cucumber/core_ext/proc.rb +29 -65
- data/lib/cucumber/core_ext/string.rb +19 -0
- data/lib/cucumber/{formatters → formatter}/ansicolor.rb +11 -10
- data/lib/cucumber/formatter/console.rb +116 -0
- data/lib/cucumber/formatter/pretty.rb +158 -0
- data/lib/cucumber/formatter/profile.rb +77 -0
- data/lib/cucumber/formatter/progress.rb +68 -0
- data/lib/cucumber/formatter.rb +1 -0
- data/lib/cucumber/formatters/autotest_formatter.rb +0 -2
- data/lib/cucumber/formatters/html_formatter.rb +4 -3
- data/lib/cucumber/formatters/pretty_formatter.rb +1 -1
- data/lib/cucumber/formatters/unicode.rb +3 -3
- data/lib/cucumber/jbehave.rb +104 -0
- data/lib/cucumber/languages.yml +100 -73
- data/lib/cucumber/parser/basic.rb +0 -0
- data/lib/cucumber/parser/feature.rb +1694 -0
- data/lib/cucumber/parser/feature.tt +206 -0
- data/lib/cucumber/parser/file_parser.rb +50 -0
- data/lib/cucumber/parser/i18n.tt +26 -0
- data/lib/cucumber/parser/treetop_ext.rb +9 -0
- data/lib/cucumber/parser.rb +27 -0
- data/lib/cucumber/platform.rb +3 -17
- data/lib/cucumber/step_definition.rb +83 -0
- data/lib/cucumber/step_mother.rb +128 -72
- data/lib/cucumber/version.rb +1 -1
- data/lib/cucumber.rb +56 -9
- data/spec/cucumber/ast/feature_factory.rb +54 -0
- data/spec/cucumber/ast/feature_spec.rb +60 -0
- data/spec/cucumber/ast/py_string_spec.rb +40 -0
- data/spec/cucumber/ast/scenario_outline_spec.rb +64 -0
- data/spec/cucumber/ast/scenario_spec.rb +82 -0
- data/spec/cucumber/ast/step_spec.rb +45 -0
- data/spec/cucumber/ast/table_spec.rb +81 -0
- data/spec/cucumber/broadcaster_spec.rb +4 -17
- data/spec/cucumber/cli_spec.rb +43 -148
- data/spec/cucumber/core_ext/proc_spec.rb +27 -35
- data/spec/cucumber/core_ext/string_spec.rb +8 -0
- data/spec/cucumber/{formatters → formatter}/ansicolor_spec.rb +2 -2
- data/spec/cucumber/formatter/html/cucumber.css +37 -0
- data/spec/cucumber/formatter/html/cucumber.js +11 -0
- data/spec/cucumber/formatter/html/index.html +45 -0
- data/spec/cucumber/formatter/html/jquery-1.3.min.js +19 -0
- data/spec/cucumber/formatter/html/jquery.uitableedit.js +100 -0
- data/spec/cucumber/formatters/autotest_formatter_spec.rb +1 -0
- data/spec/cucumber/formatters/profile_formatter_spec.rb +17 -16
- data/spec/cucumber/parser/feature_parser_spec.rb +247 -0
- data/spec/cucumber/parser/table_parser_spec.rb +48 -0
- data/spec/cucumber/step_definition_spec.rb +62 -0
- data/spec/cucumber/step_mom_spec.rb +49 -0
- data/spec/cucumber/treetop_parser/empty_feature.feature +1 -1
- data/spec/cucumber/treetop_parser/spaces.feature +3 -1
- data/spec/cucumber/treetop_parser/with_comments.feature +1 -1
- data/spec/cucumber/treetop_parser/with_tags.feature +18 -0
- data/spec/cucumber/world/pending_spec.rb +13 -12
- data/spec/spec_helper.rb +1 -1
- metadata +59 -67
- data/examples/calculator_ruby_features/Rakefile +0 -6
- data/examples/calculator_ruby_features/features/addition.rb +0 -39
- data/examples/calculator_ruby_features/features/step_definitons/calculator_steps.rb +0 -43
- data/gem_tasks/treetop.rake +0 -41
- data/lib/cucumber/executor.rb +0 -205
- data/lib/cucumber/formatters/profile_formatter.rb +0 -92
- data/lib/cucumber/formatters/progress_formatter.rb +0 -61
- data/lib/cucumber/formatters.rb +0 -1
- data/lib/cucumber/model/table.rb +0 -32
- data/lib/cucumber/model.rb +0 -1
- data/lib/cucumber/step_methods.rb +0 -49
- data/lib/cucumber/tree/feature.rb +0 -105
- data/lib/cucumber/tree/features.rb +0 -21
- data/lib/cucumber/tree/given_scenario.rb +0 -13
- data/lib/cucumber/tree/scenario.rb +0 -240
- data/lib/cucumber/tree/step.rb +0 -173
- data/lib/cucumber/tree/table.rb +0 -26
- data/lib/cucumber/tree/top_down_visitor.rb +0 -23
- data/lib/cucumber/tree.rb +0 -16
- data/lib/cucumber/treetop_parser/feature.treetop.erb +0 -254
- data/lib/cucumber/treetop_parser/feature_ar.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_cy.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_da.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_de.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_en-lol.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_en-tx.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_en.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_es.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_et.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_fr.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_id.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_it.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_ja.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_ko.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_lt.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_nl.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_no.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_parser.rb +0 -36
- data/lib/cucumber/treetop_parser/feature_pl.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_pt.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_ro.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_ro2.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_ru.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_se.rb +0 -1951
- data/lib/cucumber/treetop_parser/feature_zh-CN.rb +0 -1951
- data/lib/cucumber/world/pending.rb +0 -22
- data/lib/cucumber/world.rb +0 -1
- data/setup.rb +0 -1585
- data/spec/cucumber/executor_spec.rb +0 -382
- data/spec/cucumber/formatters/html_formatter_spec.rb +0 -104
- data/spec/cucumber/formatters/pretty_formatter_spec.rb +0 -410
- data/spec/cucumber/formatters/progress_formatter_spec.rb +0 -81
- data/spec/cucumber/model/table_spec.rb +0 -32
- data/spec/cucumber/step_mother_spec.rb +0 -74
- data/spec/cucumber/tree/feature_spec.rb +0 -122
- data/spec/cucumber/tree/row_scenario_outline_spec.rb +0 -73
- data/spec/cucumber/tree/row_scenario_spec.rb +0 -55
- data/spec/cucumber/tree/row_step_outline_spec.rb +0 -38
- data/spec/cucumber/tree/scenario_outline_spec.rb +0 -50
- data/spec/cucumber/tree/scenario_spec.rb +0 -134
- data/spec/cucumber/tree/step_outline_spec.rb +0 -17
- data/spec/cucumber/tree/step_spec.rb +0 -59
- data/spec/cucumber/treetop_parser/feature_parser_spec.rb +0 -120
@@ -0,0 +1,1694 @@
|
|
1
|
+
module Cucumber
|
2
|
+
module Parser
|
3
|
+
# TIP: When you hack on the grammar, just delete feature.rb in this directory.
|
4
|
+
# Treetop will then generate the parser in-memory. When you're happy, just generate
|
5
|
+
# the rb file with tt feature.tt
|
6
|
+
module Feature
|
7
|
+
include Treetop::Runtime
|
8
|
+
|
9
|
+
def root
|
10
|
+
@root || :feature
|
11
|
+
end
|
12
|
+
|
13
|
+
include FileParser
|
14
|
+
|
15
|
+
include I18n
|
16
|
+
|
17
|
+
module Feature0
|
18
|
+
end
|
19
|
+
|
20
|
+
module Feature1
|
21
|
+
def white
|
22
|
+
elements[0]
|
23
|
+
end
|
24
|
+
|
25
|
+
def comment
|
26
|
+
elements[1]
|
27
|
+
end
|
28
|
+
|
29
|
+
def white
|
30
|
+
elements[2]
|
31
|
+
end
|
32
|
+
|
33
|
+
def tags
|
34
|
+
elements[3]
|
35
|
+
end
|
36
|
+
|
37
|
+
def white
|
38
|
+
elements[4]
|
39
|
+
end
|
40
|
+
|
41
|
+
def header
|
42
|
+
elements[5]
|
43
|
+
end
|
44
|
+
|
45
|
+
def feature_elements
|
46
|
+
elements[6]
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
module Feature2
|
51
|
+
def build
|
52
|
+
Ast::Feature.new(comment.build, tags.build, header.text_value, feature_elements.build)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def _nt_feature
|
57
|
+
start_index = index
|
58
|
+
if node_cache[:feature].has_key?(index)
|
59
|
+
cached = node_cache[:feature][index]
|
60
|
+
@index = cached.interval.end if cached
|
61
|
+
return cached
|
62
|
+
end
|
63
|
+
|
64
|
+
i0, s0 = index, []
|
65
|
+
r1 = _nt_white
|
66
|
+
s0 << r1
|
67
|
+
if r1
|
68
|
+
r2 = _nt_comment
|
69
|
+
s0 << r2
|
70
|
+
if r2
|
71
|
+
r3 = _nt_white
|
72
|
+
s0 << r3
|
73
|
+
if r3
|
74
|
+
r4 = _nt_tags
|
75
|
+
s0 << r4
|
76
|
+
if r4
|
77
|
+
r5 = _nt_white
|
78
|
+
s0 << r5
|
79
|
+
if r5
|
80
|
+
s6, i6 = [], index
|
81
|
+
loop do
|
82
|
+
i7, s7 = index, []
|
83
|
+
i8 = index
|
84
|
+
i9 = index
|
85
|
+
r10 = _nt_scenario_outline
|
86
|
+
if r10
|
87
|
+
r9 = r10
|
88
|
+
else
|
89
|
+
r11 = _nt_scenario
|
90
|
+
if r11
|
91
|
+
r9 = r11
|
92
|
+
else
|
93
|
+
self.index = i9
|
94
|
+
r9 = nil
|
95
|
+
end
|
96
|
+
end
|
97
|
+
if r9
|
98
|
+
r8 = nil
|
99
|
+
else
|
100
|
+
self.index = i8
|
101
|
+
r8 = SyntaxNode.new(input, index...index)
|
102
|
+
end
|
103
|
+
s7 << r8
|
104
|
+
if r8
|
105
|
+
if index < input_length
|
106
|
+
r12 = (SyntaxNode).new(input, index...(index + 1))
|
107
|
+
@index += 1
|
108
|
+
else
|
109
|
+
terminal_parse_failure("any character")
|
110
|
+
r12 = nil
|
111
|
+
end
|
112
|
+
s7 << r12
|
113
|
+
end
|
114
|
+
if s7.last
|
115
|
+
r7 = (SyntaxNode).new(input, i7...index, s7)
|
116
|
+
r7.extend(Feature0)
|
117
|
+
else
|
118
|
+
self.index = i7
|
119
|
+
r7 = nil
|
120
|
+
end
|
121
|
+
if r7
|
122
|
+
s6 << r7
|
123
|
+
else
|
124
|
+
break
|
125
|
+
end
|
126
|
+
end
|
127
|
+
r6 = SyntaxNode.new(input, i6...index, s6)
|
128
|
+
s0 << r6
|
129
|
+
if r6
|
130
|
+
r13 = _nt_feature_elements
|
131
|
+
s0 << r13
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
138
|
+
if s0.last
|
139
|
+
r0 = (SyntaxNode).new(input, i0...index, s0)
|
140
|
+
r0.extend(Feature1)
|
141
|
+
r0.extend(Feature2)
|
142
|
+
else
|
143
|
+
self.index = i0
|
144
|
+
r0 = nil
|
145
|
+
end
|
146
|
+
|
147
|
+
node_cache[:feature][start_index] = r0
|
148
|
+
|
149
|
+
return r0
|
150
|
+
end
|
151
|
+
|
152
|
+
module Tags0
|
153
|
+
def tag
|
154
|
+
elements[0]
|
155
|
+
end
|
156
|
+
|
157
|
+
end
|
158
|
+
|
159
|
+
module Tags1
|
160
|
+
def white
|
161
|
+
elements[0]
|
162
|
+
end
|
163
|
+
|
164
|
+
def ts
|
165
|
+
elements[1]
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
module Tags2
|
170
|
+
def build
|
171
|
+
tag_names = ts.elements.map{|e| e.tag.tag_name.text_value}
|
172
|
+
Ast::Tags.new(ts.line, tag_names)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
def _nt_tags
|
177
|
+
start_index = index
|
178
|
+
if node_cache[:tags].has_key?(index)
|
179
|
+
cached = node_cache[:tags][index]
|
180
|
+
@index = cached.interval.end if cached
|
181
|
+
return cached
|
182
|
+
end
|
183
|
+
|
184
|
+
i0, s0 = index, []
|
185
|
+
r1 = _nt_white
|
186
|
+
s0 << r1
|
187
|
+
if r1
|
188
|
+
s2, i2 = [], index
|
189
|
+
loop do
|
190
|
+
i3, s3 = index, []
|
191
|
+
r4 = _nt_tag
|
192
|
+
s3 << r4
|
193
|
+
if r4
|
194
|
+
s5, i5 = [], index
|
195
|
+
loop do
|
196
|
+
i6 = index
|
197
|
+
r7 = _nt_space
|
198
|
+
if r7
|
199
|
+
r6 = r7
|
200
|
+
else
|
201
|
+
r8 = _nt_eol
|
202
|
+
if r8
|
203
|
+
r6 = r8
|
204
|
+
else
|
205
|
+
self.index = i6
|
206
|
+
r6 = nil
|
207
|
+
end
|
208
|
+
end
|
209
|
+
if r6
|
210
|
+
s5 << r6
|
211
|
+
else
|
212
|
+
break
|
213
|
+
end
|
214
|
+
end
|
215
|
+
if s5.empty?
|
216
|
+
self.index = i5
|
217
|
+
r5 = nil
|
218
|
+
else
|
219
|
+
r5 = SyntaxNode.new(input, i5...index, s5)
|
220
|
+
end
|
221
|
+
s3 << r5
|
222
|
+
end
|
223
|
+
if s3.last
|
224
|
+
r3 = (SyntaxNode).new(input, i3...index, s3)
|
225
|
+
r3.extend(Tags0)
|
226
|
+
else
|
227
|
+
self.index = i3
|
228
|
+
r3 = nil
|
229
|
+
end
|
230
|
+
if r3
|
231
|
+
s2 << r3
|
232
|
+
else
|
233
|
+
break
|
234
|
+
end
|
235
|
+
end
|
236
|
+
r2 = SyntaxNode.new(input, i2...index, s2)
|
237
|
+
s0 << r2
|
238
|
+
end
|
239
|
+
if s0.last
|
240
|
+
r0 = (SyntaxNode).new(input, i0...index, s0)
|
241
|
+
r0.extend(Tags1)
|
242
|
+
r0.extend(Tags2)
|
243
|
+
else
|
244
|
+
self.index = i0
|
245
|
+
r0 = nil
|
246
|
+
end
|
247
|
+
|
248
|
+
node_cache[:tags][start_index] = r0
|
249
|
+
|
250
|
+
return r0
|
251
|
+
end
|
252
|
+
|
253
|
+
module Tag0
|
254
|
+
def tag_name
|
255
|
+
elements[1]
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
def _nt_tag
|
260
|
+
start_index = index
|
261
|
+
if node_cache[:tag].has_key?(index)
|
262
|
+
cached = node_cache[:tag][index]
|
263
|
+
@index = cached.interval.end if cached
|
264
|
+
return cached
|
265
|
+
end
|
266
|
+
|
267
|
+
i0, s0 = index, []
|
268
|
+
if input.index('@', index) == index
|
269
|
+
r1 = (SyntaxNode).new(input, index...(index + 1))
|
270
|
+
@index += 1
|
271
|
+
else
|
272
|
+
terminal_parse_failure('@')
|
273
|
+
r1 = nil
|
274
|
+
end
|
275
|
+
s0 << r1
|
276
|
+
if r1
|
277
|
+
s2, i2 = [], index
|
278
|
+
loop do
|
279
|
+
if input.index(Regexp.new('[a-z0-9]'), index) == index
|
280
|
+
r3 = (SyntaxNode).new(input, index...(index + 1))
|
281
|
+
@index += 1
|
282
|
+
else
|
283
|
+
r3 = nil
|
284
|
+
end
|
285
|
+
if r3
|
286
|
+
s2 << r3
|
287
|
+
else
|
288
|
+
break
|
289
|
+
end
|
290
|
+
end
|
291
|
+
if s2.empty?
|
292
|
+
self.index = i2
|
293
|
+
r2 = nil
|
294
|
+
else
|
295
|
+
r2 = SyntaxNode.new(input, i2...index, s2)
|
296
|
+
end
|
297
|
+
s0 << r2
|
298
|
+
end
|
299
|
+
if s0.last
|
300
|
+
r0 = (SyntaxNode).new(input, i0...index, s0)
|
301
|
+
r0.extend(Tag0)
|
302
|
+
else
|
303
|
+
self.index = i0
|
304
|
+
r0 = nil
|
305
|
+
end
|
306
|
+
|
307
|
+
node_cache[:tag][start_index] = r0
|
308
|
+
|
309
|
+
return r0
|
310
|
+
end
|
311
|
+
|
312
|
+
module Comment0
|
313
|
+
def comment_line
|
314
|
+
elements[0]
|
315
|
+
end
|
316
|
+
|
317
|
+
end
|
318
|
+
|
319
|
+
module Comment1
|
320
|
+
def build
|
321
|
+
Ast::Comment.new(text_value)
|
322
|
+
end
|
323
|
+
end
|
324
|
+
|
325
|
+
def _nt_comment
|
326
|
+
start_index = index
|
327
|
+
if node_cache[:comment].has_key?(index)
|
328
|
+
cached = node_cache[:comment][index]
|
329
|
+
@index = cached.interval.end if cached
|
330
|
+
return cached
|
331
|
+
end
|
332
|
+
|
333
|
+
s0, i0 = [], index
|
334
|
+
loop do
|
335
|
+
i1, s1 = index, []
|
336
|
+
r2 = _nt_comment_line
|
337
|
+
s1 << r2
|
338
|
+
if r2
|
339
|
+
s3, i3 = [], index
|
340
|
+
loop do
|
341
|
+
r4 = _nt_eol
|
342
|
+
if r4
|
343
|
+
s3 << r4
|
344
|
+
else
|
345
|
+
break
|
346
|
+
end
|
347
|
+
end
|
348
|
+
if s3.empty?
|
349
|
+
self.index = i3
|
350
|
+
r3 = nil
|
351
|
+
else
|
352
|
+
r3 = SyntaxNode.new(input, i3...index, s3)
|
353
|
+
end
|
354
|
+
s1 << r3
|
355
|
+
end
|
356
|
+
if s1.last
|
357
|
+
r1 = (SyntaxNode).new(input, i1...index, s1)
|
358
|
+
r1.extend(Comment0)
|
359
|
+
else
|
360
|
+
self.index = i1
|
361
|
+
r1 = nil
|
362
|
+
end
|
363
|
+
if r1
|
364
|
+
s0 << r1
|
365
|
+
else
|
366
|
+
break
|
367
|
+
end
|
368
|
+
end
|
369
|
+
r0 = SyntaxNode.new(input, i0...index, s0)
|
370
|
+
r0.extend(Comment1)
|
371
|
+
|
372
|
+
node_cache[:comment][start_index] = r0
|
373
|
+
|
374
|
+
return r0
|
375
|
+
end
|
376
|
+
|
377
|
+
module CommentLine0
|
378
|
+
def line_to_eol
|
379
|
+
elements[1]
|
380
|
+
end
|
381
|
+
end
|
382
|
+
|
383
|
+
def _nt_comment_line
|
384
|
+
start_index = index
|
385
|
+
if node_cache[:comment_line].has_key?(index)
|
386
|
+
cached = node_cache[:comment_line][index]
|
387
|
+
@index = cached.interval.end if cached
|
388
|
+
return cached
|
389
|
+
end
|
390
|
+
|
391
|
+
i0, s0 = index, []
|
392
|
+
if input.index('#', index) == index
|
393
|
+
r1 = (SyntaxNode).new(input, index...(index + 1))
|
394
|
+
@index += 1
|
395
|
+
else
|
396
|
+
terminal_parse_failure('#')
|
397
|
+
r1 = nil
|
398
|
+
end
|
399
|
+
s0 << r1
|
400
|
+
if r1
|
401
|
+
r2 = _nt_line_to_eol
|
402
|
+
s0 << r2
|
403
|
+
end
|
404
|
+
if s0.last
|
405
|
+
r0 = (SyntaxNode).new(input, i0...index, s0)
|
406
|
+
r0.extend(CommentLine0)
|
407
|
+
else
|
408
|
+
self.index = i0
|
409
|
+
r0 = nil
|
410
|
+
end
|
411
|
+
|
412
|
+
node_cache[:comment_line][start_index] = r0
|
413
|
+
|
414
|
+
return r0
|
415
|
+
end
|
416
|
+
|
417
|
+
module FeatureElements0
|
418
|
+
def build
|
419
|
+
elements.map{|s| s.build}
|
420
|
+
end
|
421
|
+
end
|
422
|
+
|
423
|
+
def _nt_feature_elements
|
424
|
+
start_index = index
|
425
|
+
if node_cache[:feature_elements].has_key?(index)
|
426
|
+
cached = node_cache[:feature_elements][index]
|
427
|
+
@index = cached.interval.end if cached
|
428
|
+
return cached
|
429
|
+
end
|
430
|
+
|
431
|
+
s0, i0 = [], index
|
432
|
+
loop do
|
433
|
+
i1 = index
|
434
|
+
r2 = _nt_scenario
|
435
|
+
if r2
|
436
|
+
r1 = r2
|
437
|
+
else
|
438
|
+
r3 = _nt_scenario_outline
|
439
|
+
if r3
|
440
|
+
r1 = r3
|
441
|
+
else
|
442
|
+
self.index = i1
|
443
|
+
r1 = nil
|
444
|
+
end
|
445
|
+
end
|
446
|
+
if r1
|
447
|
+
s0 << r1
|
448
|
+
else
|
449
|
+
break
|
450
|
+
end
|
451
|
+
end
|
452
|
+
r0 = SyntaxNode.new(input, i0...index, s0)
|
453
|
+
r0.extend(FeatureElements0)
|
454
|
+
|
455
|
+
node_cache[:feature_elements][start_index] = r0
|
456
|
+
|
457
|
+
return r0
|
458
|
+
end
|
459
|
+
|
460
|
+
module Scenario0
|
461
|
+
def comment
|
462
|
+
elements[0]
|
463
|
+
end
|
464
|
+
|
465
|
+
def tags
|
466
|
+
elements[1]
|
467
|
+
end
|
468
|
+
|
469
|
+
def white
|
470
|
+
elements[2]
|
471
|
+
end
|
472
|
+
|
473
|
+
def scenario_keyword
|
474
|
+
elements[3]
|
475
|
+
end
|
476
|
+
|
477
|
+
def name
|
478
|
+
elements[5]
|
479
|
+
end
|
480
|
+
|
481
|
+
def steps
|
482
|
+
elements[7]
|
483
|
+
end
|
484
|
+
end
|
485
|
+
|
486
|
+
module Scenario1
|
487
|
+
def build
|
488
|
+
Ast::Scenario.new(
|
489
|
+
comment.build,
|
490
|
+
tags.build,
|
491
|
+
scenario_keyword.line,
|
492
|
+
scenario_keyword.text_value,
|
493
|
+
name.text_value,
|
494
|
+
steps.build
|
495
|
+
)
|
496
|
+
end
|
497
|
+
end
|
498
|
+
|
499
|
+
def _nt_scenario
|
500
|
+
start_index = index
|
501
|
+
if node_cache[:scenario].has_key?(index)
|
502
|
+
cached = node_cache[:scenario][index]
|
503
|
+
@index = cached.interval.end if cached
|
504
|
+
return cached
|
505
|
+
end
|
506
|
+
|
507
|
+
i0, s0 = index, []
|
508
|
+
r1 = _nt_comment
|
509
|
+
s0 << r1
|
510
|
+
if r1
|
511
|
+
r2 = _nt_tags
|
512
|
+
s0 << r2
|
513
|
+
if r2
|
514
|
+
r3 = _nt_white
|
515
|
+
s0 << r3
|
516
|
+
if r3
|
517
|
+
r4 = _nt_scenario_keyword
|
518
|
+
s0 << r4
|
519
|
+
if r4
|
520
|
+
s5, i5 = [], index
|
521
|
+
loop do
|
522
|
+
r6 = _nt_space
|
523
|
+
if r6
|
524
|
+
s5 << r6
|
525
|
+
else
|
526
|
+
break
|
527
|
+
end
|
528
|
+
end
|
529
|
+
r5 = SyntaxNode.new(input, i5...index, s5)
|
530
|
+
s0 << r5
|
531
|
+
if r5
|
532
|
+
r7 = _nt_line_to_eol
|
533
|
+
s0 << r7
|
534
|
+
if r7
|
535
|
+
i8 = index
|
536
|
+
s9, i9 = [], index
|
537
|
+
loop do
|
538
|
+
r10 = _nt_eol
|
539
|
+
if r10
|
540
|
+
s9 << r10
|
541
|
+
else
|
542
|
+
break
|
543
|
+
end
|
544
|
+
end
|
545
|
+
if s9.empty?
|
546
|
+
self.index = i9
|
547
|
+
r9 = nil
|
548
|
+
else
|
549
|
+
r9 = SyntaxNode.new(input, i9...index, s9)
|
550
|
+
end
|
551
|
+
if r9
|
552
|
+
r8 = r9
|
553
|
+
else
|
554
|
+
r11 = _nt_eof
|
555
|
+
if r11
|
556
|
+
r8 = r11
|
557
|
+
else
|
558
|
+
self.index = i8
|
559
|
+
r8 = nil
|
560
|
+
end
|
561
|
+
end
|
562
|
+
s0 << r8
|
563
|
+
if r8
|
564
|
+
r12 = _nt_steps
|
565
|
+
s0 << r12
|
566
|
+
end
|
567
|
+
end
|
568
|
+
end
|
569
|
+
end
|
570
|
+
end
|
571
|
+
end
|
572
|
+
end
|
573
|
+
if s0.last
|
574
|
+
r0 = (SyntaxNode).new(input, i0...index, s0)
|
575
|
+
r0.extend(Scenario0)
|
576
|
+
r0.extend(Scenario1)
|
577
|
+
else
|
578
|
+
self.index = i0
|
579
|
+
r0 = nil
|
580
|
+
end
|
581
|
+
|
582
|
+
node_cache[:scenario][start_index] = r0
|
583
|
+
|
584
|
+
return r0
|
585
|
+
end
|
586
|
+
|
587
|
+
module ScenarioOutline0
|
588
|
+
def comment
|
589
|
+
elements[0]
|
590
|
+
end
|
591
|
+
|
592
|
+
def tags
|
593
|
+
elements[1]
|
594
|
+
end
|
595
|
+
|
596
|
+
def white
|
597
|
+
elements[2]
|
598
|
+
end
|
599
|
+
|
600
|
+
def scenario_outline_keyword
|
601
|
+
elements[3]
|
602
|
+
end
|
603
|
+
|
604
|
+
def name
|
605
|
+
elements[5]
|
606
|
+
end
|
607
|
+
|
608
|
+
def white
|
609
|
+
elements[6]
|
610
|
+
end
|
611
|
+
|
612
|
+
def steps
|
613
|
+
elements[7]
|
614
|
+
end
|
615
|
+
|
616
|
+
def examples_sections
|
617
|
+
elements[8]
|
618
|
+
end
|
619
|
+
end
|
620
|
+
|
621
|
+
module ScenarioOutline1
|
622
|
+
def build
|
623
|
+
Ast::ScenarioOutline.new(
|
624
|
+
comment.build,
|
625
|
+
tags.build,
|
626
|
+
scenario_outline_keyword.line,
|
627
|
+
scenario_outline_keyword.text_value,
|
628
|
+
name.text_value,
|
629
|
+
steps.build,
|
630
|
+
examples_sections.build
|
631
|
+
)
|
632
|
+
end
|
633
|
+
end
|
634
|
+
|
635
|
+
def _nt_scenario_outline
|
636
|
+
start_index = index
|
637
|
+
if node_cache[:scenario_outline].has_key?(index)
|
638
|
+
cached = node_cache[:scenario_outline][index]
|
639
|
+
@index = cached.interval.end if cached
|
640
|
+
return cached
|
641
|
+
end
|
642
|
+
|
643
|
+
i0, s0 = index, []
|
644
|
+
r1 = _nt_comment
|
645
|
+
s0 << r1
|
646
|
+
if r1
|
647
|
+
r2 = _nt_tags
|
648
|
+
s0 << r2
|
649
|
+
if r2
|
650
|
+
r3 = _nt_white
|
651
|
+
s0 << r3
|
652
|
+
if r3
|
653
|
+
r4 = _nt_scenario_outline_keyword
|
654
|
+
s0 << r4
|
655
|
+
if r4
|
656
|
+
s5, i5 = [], index
|
657
|
+
loop do
|
658
|
+
r6 = _nt_space
|
659
|
+
if r6
|
660
|
+
s5 << r6
|
661
|
+
else
|
662
|
+
break
|
663
|
+
end
|
664
|
+
end
|
665
|
+
r5 = SyntaxNode.new(input, i5...index, s5)
|
666
|
+
s0 << r5
|
667
|
+
if r5
|
668
|
+
r7 = _nt_line_to_eol
|
669
|
+
s0 << r7
|
670
|
+
if r7
|
671
|
+
r8 = _nt_white
|
672
|
+
s0 << r8
|
673
|
+
if r8
|
674
|
+
r9 = _nt_steps
|
675
|
+
s0 << r9
|
676
|
+
if r9
|
677
|
+
r10 = _nt_examples_sections
|
678
|
+
s0 << r10
|
679
|
+
end
|
680
|
+
end
|
681
|
+
end
|
682
|
+
end
|
683
|
+
end
|
684
|
+
end
|
685
|
+
end
|
686
|
+
end
|
687
|
+
if s0.last
|
688
|
+
r0 = (SyntaxNode).new(input, i0...index, s0)
|
689
|
+
r0.extend(ScenarioOutline0)
|
690
|
+
r0.extend(ScenarioOutline1)
|
691
|
+
else
|
692
|
+
self.index = i0
|
693
|
+
r0 = nil
|
694
|
+
end
|
695
|
+
|
696
|
+
node_cache[:scenario_outline][start_index] = r0
|
697
|
+
|
698
|
+
return r0
|
699
|
+
end
|
700
|
+
|
701
|
+
module Steps0
|
702
|
+
def build
|
703
|
+
elements.map{|e| e.build}
|
704
|
+
end
|
705
|
+
end
|
706
|
+
|
707
|
+
def _nt_steps
|
708
|
+
start_index = index
|
709
|
+
if node_cache[:steps].has_key?(index)
|
710
|
+
cached = node_cache[:steps][index]
|
711
|
+
@index = cached.interval.end if cached
|
712
|
+
return cached
|
713
|
+
end
|
714
|
+
|
715
|
+
s0, i0 = [], index
|
716
|
+
loop do
|
717
|
+
r1 = _nt_step
|
718
|
+
if r1
|
719
|
+
s0 << r1
|
720
|
+
else
|
721
|
+
break
|
722
|
+
end
|
723
|
+
end
|
724
|
+
r0 = SyntaxNode.new(input, i0...index, s0)
|
725
|
+
r0.extend(Steps0)
|
726
|
+
|
727
|
+
node_cache[:steps][start_index] = r0
|
728
|
+
|
729
|
+
return r0
|
730
|
+
end
|
731
|
+
|
732
|
+
module Step0
|
733
|
+
def step_keyword
|
734
|
+
elements[1]
|
735
|
+
end
|
736
|
+
|
737
|
+
def name
|
738
|
+
elements[3]
|
739
|
+
end
|
740
|
+
|
741
|
+
def multi
|
742
|
+
elements[5]
|
743
|
+
end
|
744
|
+
end
|
745
|
+
|
746
|
+
module Step1
|
747
|
+
def build
|
748
|
+
if multi.respond_to?(:build)
|
749
|
+
Ast::Step.new(step_keyword.line, step_keyword.text_value, name.text_value, multi.build)
|
750
|
+
else
|
751
|
+
Ast::Step.new(step_keyword.line, step_keyword.text_value, name.text_value)
|
752
|
+
end
|
753
|
+
end
|
754
|
+
end
|
755
|
+
|
756
|
+
def _nt_step
|
757
|
+
start_index = index
|
758
|
+
if node_cache[:step].has_key?(index)
|
759
|
+
cached = node_cache[:step][index]
|
760
|
+
@index = cached.interval.end if cached
|
761
|
+
return cached
|
762
|
+
end
|
763
|
+
|
764
|
+
i0, s0 = index, []
|
765
|
+
s1, i1 = [], index
|
766
|
+
loop do
|
767
|
+
r2 = _nt_space
|
768
|
+
if r2
|
769
|
+
s1 << r2
|
770
|
+
else
|
771
|
+
break
|
772
|
+
end
|
773
|
+
end
|
774
|
+
r1 = SyntaxNode.new(input, i1...index, s1)
|
775
|
+
s0 << r1
|
776
|
+
if r1
|
777
|
+
r3 = _nt_step_keyword
|
778
|
+
s0 << r3
|
779
|
+
if r3
|
780
|
+
s4, i4 = [], index
|
781
|
+
loop do
|
782
|
+
r5 = _nt_space
|
783
|
+
if r5
|
784
|
+
s4 << r5
|
785
|
+
else
|
786
|
+
break
|
787
|
+
end
|
788
|
+
end
|
789
|
+
r4 = SyntaxNode.new(input, i4...index, s4)
|
790
|
+
s0 << r4
|
791
|
+
if r4
|
792
|
+
r6 = _nt_line_to_eol
|
793
|
+
s0 << r6
|
794
|
+
if r6
|
795
|
+
i7 = index
|
796
|
+
s8, i8 = [], index
|
797
|
+
loop do
|
798
|
+
r9 = _nt_eol
|
799
|
+
if r9
|
800
|
+
s8 << r9
|
801
|
+
else
|
802
|
+
break
|
803
|
+
end
|
804
|
+
end
|
805
|
+
if s8.empty?
|
806
|
+
self.index = i8
|
807
|
+
r8 = nil
|
808
|
+
else
|
809
|
+
r8 = SyntaxNode.new(input, i8...index, s8)
|
810
|
+
end
|
811
|
+
if r8
|
812
|
+
r7 = r8
|
813
|
+
else
|
814
|
+
r10 = _nt_eof
|
815
|
+
if r10
|
816
|
+
r7 = r10
|
817
|
+
else
|
818
|
+
self.index = i7
|
819
|
+
r7 = nil
|
820
|
+
end
|
821
|
+
end
|
822
|
+
s0 << r7
|
823
|
+
if r7
|
824
|
+
r12 = _nt_multiline_arg
|
825
|
+
if r12
|
826
|
+
r11 = r12
|
827
|
+
else
|
828
|
+
r11 = SyntaxNode.new(input, index...index)
|
829
|
+
end
|
830
|
+
s0 << r11
|
831
|
+
end
|
832
|
+
end
|
833
|
+
end
|
834
|
+
end
|
835
|
+
end
|
836
|
+
if s0.last
|
837
|
+
r0 = (SyntaxNode).new(input, i0...index, s0)
|
838
|
+
r0.extend(Step0)
|
839
|
+
r0.extend(Step1)
|
840
|
+
else
|
841
|
+
self.index = i0
|
842
|
+
r0 = nil
|
843
|
+
end
|
844
|
+
|
845
|
+
node_cache[:step][start_index] = r0
|
846
|
+
|
847
|
+
return r0
|
848
|
+
end
|
849
|
+
|
850
|
+
module ExamplesSections0
|
851
|
+
def build
|
852
|
+
elements.map{|e| e.build}
|
853
|
+
end
|
854
|
+
end
|
855
|
+
|
856
|
+
def _nt_examples_sections
|
857
|
+
start_index = index
|
858
|
+
if node_cache[:examples_sections].has_key?(index)
|
859
|
+
cached = node_cache[:examples_sections][index]
|
860
|
+
@index = cached.interval.end if cached
|
861
|
+
return cached
|
862
|
+
end
|
863
|
+
|
864
|
+
s0, i0 = [], index
|
865
|
+
loop do
|
866
|
+
r1 = _nt_examples
|
867
|
+
if r1
|
868
|
+
s0 << r1
|
869
|
+
else
|
870
|
+
break
|
871
|
+
end
|
872
|
+
end
|
873
|
+
if s0.empty?
|
874
|
+
self.index = i0
|
875
|
+
r0 = nil
|
876
|
+
else
|
877
|
+
r0 = SyntaxNode.new(input, i0...index, s0)
|
878
|
+
r0.extend(ExamplesSections0)
|
879
|
+
end
|
880
|
+
|
881
|
+
node_cache[:examples_sections][start_index] = r0
|
882
|
+
|
883
|
+
return r0
|
884
|
+
end
|
885
|
+
|
886
|
+
module Examples0
|
887
|
+
def examples_keyword
|
888
|
+
elements[1]
|
889
|
+
end
|
890
|
+
|
891
|
+
def white
|
892
|
+
elements[2]
|
893
|
+
end
|
894
|
+
|
895
|
+
def table
|
896
|
+
elements[3]
|
897
|
+
end
|
898
|
+
end
|
899
|
+
|
900
|
+
module Examples1
|
901
|
+
def build
|
902
|
+
[examples_keyword.line, examples_keyword.text_value, "", table.raw]
|
903
|
+
end
|
904
|
+
end
|
905
|
+
|
906
|
+
def _nt_examples
|
907
|
+
start_index = index
|
908
|
+
if node_cache[:examples].has_key?(index)
|
909
|
+
cached = node_cache[:examples][index]
|
910
|
+
@index = cached.interval.end if cached
|
911
|
+
return cached
|
912
|
+
end
|
913
|
+
|
914
|
+
i0, s0 = index, []
|
915
|
+
s1, i1 = [], index
|
916
|
+
loop do
|
917
|
+
r2 = _nt_space
|
918
|
+
if r2
|
919
|
+
s1 << r2
|
920
|
+
else
|
921
|
+
break
|
922
|
+
end
|
923
|
+
end
|
924
|
+
r1 = SyntaxNode.new(input, i1...index, s1)
|
925
|
+
s0 << r1
|
926
|
+
if r1
|
927
|
+
r3 = _nt_examples_keyword
|
928
|
+
s0 << r3
|
929
|
+
if r3
|
930
|
+
r4 = _nt_white
|
931
|
+
s0 << r4
|
932
|
+
if r4
|
933
|
+
r5 = _nt_table
|
934
|
+
s0 << r5
|
935
|
+
end
|
936
|
+
end
|
937
|
+
end
|
938
|
+
if s0.last
|
939
|
+
r0 = (SyntaxNode).new(input, i0...index, s0)
|
940
|
+
r0.extend(Examples0)
|
941
|
+
r0.extend(Examples1)
|
942
|
+
else
|
943
|
+
self.index = i0
|
944
|
+
r0 = nil
|
945
|
+
end
|
946
|
+
|
947
|
+
node_cache[:examples][start_index] = r0
|
948
|
+
|
949
|
+
return r0
|
950
|
+
end
|
951
|
+
|
952
|
+
def _nt_multiline_arg
|
953
|
+
start_index = index
|
954
|
+
if node_cache[:multiline_arg].has_key?(index)
|
955
|
+
cached = node_cache[:multiline_arg][index]
|
956
|
+
@index = cached.interval.end if cached
|
957
|
+
return cached
|
958
|
+
end
|
959
|
+
|
960
|
+
i0 = index
|
961
|
+
r1 = _nt_table
|
962
|
+
if r1
|
963
|
+
r0 = r1
|
964
|
+
else
|
965
|
+
r2 = _nt_py_string
|
966
|
+
if r2
|
967
|
+
r0 = r2
|
968
|
+
else
|
969
|
+
self.index = i0
|
970
|
+
r0 = nil
|
971
|
+
end
|
972
|
+
end
|
973
|
+
|
974
|
+
node_cache[:multiline_arg][start_index] = r0
|
975
|
+
|
976
|
+
return r0
|
977
|
+
end
|
978
|
+
|
979
|
+
module Table0
|
980
|
+
def build
|
981
|
+
Ast::Table.new(raw)
|
982
|
+
end
|
983
|
+
|
984
|
+
def raw
|
985
|
+
elements.map{|e| e.build}
|
986
|
+
end
|
987
|
+
end
|
988
|
+
|
989
|
+
def _nt_table
|
990
|
+
start_index = index
|
991
|
+
if node_cache[:table].has_key?(index)
|
992
|
+
cached = node_cache[:table][index]
|
993
|
+
@index = cached.interval.end if cached
|
994
|
+
return cached
|
995
|
+
end
|
996
|
+
|
997
|
+
s0, i0 = [], index
|
998
|
+
loop do
|
999
|
+
r1 = _nt_table_row
|
1000
|
+
if r1
|
1001
|
+
s0 << r1
|
1002
|
+
else
|
1003
|
+
break
|
1004
|
+
end
|
1005
|
+
end
|
1006
|
+
if s0.empty?
|
1007
|
+
self.index = i0
|
1008
|
+
r0 = nil
|
1009
|
+
else
|
1010
|
+
r0 = SyntaxNode.new(input, i0...index, s0)
|
1011
|
+
r0.extend(Table0)
|
1012
|
+
end
|
1013
|
+
|
1014
|
+
node_cache[:table][start_index] = r0
|
1015
|
+
|
1016
|
+
return r0
|
1017
|
+
end
|
1018
|
+
|
1019
|
+
module TableRow0
|
1020
|
+
def cell
|
1021
|
+
elements[0]
|
1022
|
+
end
|
1023
|
+
|
1024
|
+
end
|
1025
|
+
|
1026
|
+
module TableRow1
|
1027
|
+
def cells
|
1028
|
+
elements[2]
|
1029
|
+
end
|
1030
|
+
|
1031
|
+
end
|
1032
|
+
|
1033
|
+
module TableRow2
|
1034
|
+
def build
|
1035
|
+
row = cells.elements.map do |elt|
|
1036
|
+
value = elt.cell.text_value.strip
|
1037
|
+
value.empty? ? nil : value
|
1038
|
+
end
|
1039
|
+
|
1040
|
+
class << row
|
1041
|
+
attr_accessor :line
|
1042
|
+
end
|
1043
|
+
row.line = cells.line
|
1044
|
+
|
1045
|
+
row
|
1046
|
+
end
|
1047
|
+
end
|
1048
|
+
|
1049
|
+
def _nt_table_row
|
1050
|
+
start_index = index
|
1051
|
+
if node_cache[:table_row].has_key?(index)
|
1052
|
+
cached = node_cache[:table_row][index]
|
1053
|
+
@index = cached.interval.end if cached
|
1054
|
+
return cached
|
1055
|
+
end
|
1056
|
+
|
1057
|
+
i0, s0 = index, []
|
1058
|
+
s1, i1 = [], index
|
1059
|
+
loop do
|
1060
|
+
r2 = _nt_space
|
1061
|
+
if r2
|
1062
|
+
s1 << r2
|
1063
|
+
else
|
1064
|
+
break
|
1065
|
+
end
|
1066
|
+
end
|
1067
|
+
r1 = SyntaxNode.new(input, i1...index, s1)
|
1068
|
+
s0 << r1
|
1069
|
+
if r1
|
1070
|
+
if input.index('|', index) == index
|
1071
|
+
r3 = (SyntaxNode).new(input, index...(index + 1))
|
1072
|
+
@index += 1
|
1073
|
+
else
|
1074
|
+
terminal_parse_failure('|')
|
1075
|
+
r3 = nil
|
1076
|
+
end
|
1077
|
+
s0 << r3
|
1078
|
+
if r3
|
1079
|
+
s4, i4 = [], index
|
1080
|
+
loop do
|
1081
|
+
i5, s5 = index, []
|
1082
|
+
r6 = _nt_cell
|
1083
|
+
s5 << r6
|
1084
|
+
if r6
|
1085
|
+
if input.index('|', index) == index
|
1086
|
+
r7 = (SyntaxNode).new(input, index...(index + 1))
|
1087
|
+
@index += 1
|
1088
|
+
else
|
1089
|
+
terminal_parse_failure('|')
|
1090
|
+
r7 = nil
|
1091
|
+
end
|
1092
|
+
s5 << r7
|
1093
|
+
end
|
1094
|
+
if s5.last
|
1095
|
+
r5 = (SyntaxNode).new(input, i5...index, s5)
|
1096
|
+
r5.extend(TableRow0)
|
1097
|
+
else
|
1098
|
+
self.index = i5
|
1099
|
+
r5 = nil
|
1100
|
+
end
|
1101
|
+
if r5
|
1102
|
+
s4 << r5
|
1103
|
+
else
|
1104
|
+
break
|
1105
|
+
end
|
1106
|
+
end
|
1107
|
+
if s4.empty?
|
1108
|
+
self.index = i4
|
1109
|
+
r4 = nil
|
1110
|
+
else
|
1111
|
+
r4 = SyntaxNode.new(input, i4...index, s4)
|
1112
|
+
end
|
1113
|
+
s0 << r4
|
1114
|
+
if r4
|
1115
|
+
s8, i8 = [], index
|
1116
|
+
loop do
|
1117
|
+
r9 = _nt_space
|
1118
|
+
if r9
|
1119
|
+
s8 << r9
|
1120
|
+
else
|
1121
|
+
break
|
1122
|
+
end
|
1123
|
+
end
|
1124
|
+
r8 = SyntaxNode.new(input, i8...index, s8)
|
1125
|
+
s0 << r8
|
1126
|
+
if r8
|
1127
|
+
i10 = index
|
1128
|
+
s11, i11 = [], index
|
1129
|
+
loop do
|
1130
|
+
r12 = _nt_eol
|
1131
|
+
if r12
|
1132
|
+
s11 << r12
|
1133
|
+
else
|
1134
|
+
break
|
1135
|
+
end
|
1136
|
+
end
|
1137
|
+
if s11.empty?
|
1138
|
+
self.index = i11
|
1139
|
+
r11 = nil
|
1140
|
+
else
|
1141
|
+
r11 = SyntaxNode.new(input, i11...index, s11)
|
1142
|
+
end
|
1143
|
+
if r11
|
1144
|
+
r10 = r11
|
1145
|
+
else
|
1146
|
+
r13 = _nt_eof
|
1147
|
+
if r13
|
1148
|
+
r10 = r13
|
1149
|
+
else
|
1150
|
+
self.index = i10
|
1151
|
+
r10 = nil
|
1152
|
+
end
|
1153
|
+
end
|
1154
|
+
s0 << r10
|
1155
|
+
end
|
1156
|
+
end
|
1157
|
+
end
|
1158
|
+
end
|
1159
|
+
if s0.last
|
1160
|
+
r0 = (SyntaxNode).new(input, i0...index, s0)
|
1161
|
+
r0.extend(TableRow1)
|
1162
|
+
r0.extend(TableRow2)
|
1163
|
+
else
|
1164
|
+
self.index = i0
|
1165
|
+
r0 = nil
|
1166
|
+
end
|
1167
|
+
|
1168
|
+
node_cache[:table_row][start_index] = r0
|
1169
|
+
|
1170
|
+
return r0
|
1171
|
+
end
|
1172
|
+
|
1173
|
+
module Cell0
|
1174
|
+
end
|
1175
|
+
|
1176
|
+
def _nt_cell
|
1177
|
+
start_index = index
|
1178
|
+
if node_cache[:cell].has_key?(index)
|
1179
|
+
cached = node_cache[:cell][index]
|
1180
|
+
@index = cached.interval.end if cached
|
1181
|
+
return cached
|
1182
|
+
end
|
1183
|
+
|
1184
|
+
s0, i0 = [], index
|
1185
|
+
loop do
|
1186
|
+
i1, s1 = index, []
|
1187
|
+
i2 = index
|
1188
|
+
i3 = index
|
1189
|
+
if input.index('|', index) == index
|
1190
|
+
r4 = (SyntaxNode).new(input, index...(index + 1))
|
1191
|
+
@index += 1
|
1192
|
+
else
|
1193
|
+
terminal_parse_failure('|')
|
1194
|
+
r4 = nil
|
1195
|
+
end
|
1196
|
+
if r4
|
1197
|
+
r3 = r4
|
1198
|
+
else
|
1199
|
+
r5 = _nt_eol
|
1200
|
+
if r5
|
1201
|
+
r3 = r5
|
1202
|
+
else
|
1203
|
+
self.index = i3
|
1204
|
+
r3 = nil
|
1205
|
+
end
|
1206
|
+
end
|
1207
|
+
if r3
|
1208
|
+
r2 = nil
|
1209
|
+
else
|
1210
|
+
self.index = i2
|
1211
|
+
r2 = SyntaxNode.new(input, index...index)
|
1212
|
+
end
|
1213
|
+
s1 << r2
|
1214
|
+
if r2
|
1215
|
+
if index < input_length
|
1216
|
+
r6 = (SyntaxNode).new(input, index...(index + 1))
|
1217
|
+
@index += 1
|
1218
|
+
else
|
1219
|
+
terminal_parse_failure("any character")
|
1220
|
+
r6 = nil
|
1221
|
+
end
|
1222
|
+
s1 << r6
|
1223
|
+
end
|
1224
|
+
if s1.last
|
1225
|
+
r1 = (SyntaxNode).new(input, i1...index, s1)
|
1226
|
+
r1.extend(Cell0)
|
1227
|
+
else
|
1228
|
+
self.index = i1
|
1229
|
+
r1 = nil
|
1230
|
+
end
|
1231
|
+
if r1
|
1232
|
+
s0 << r1
|
1233
|
+
else
|
1234
|
+
break
|
1235
|
+
end
|
1236
|
+
end
|
1237
|
+
r0 = SyntaxNode.new(input, i0...index, s0)
|
1238
|
+
|
1239
|
+
node_cache[:cell][start_index] = r0
|
1240
|
+
|
1241
|
+
return r0
|
1242
|
+
end
|
1243
|
+
|
1244
|
+
module LineToEol0
|
1245
|
+
end
|
1246
|
+
|
1247
|
+
def _nt_line_to_eol
|
1248
|
+
start_index = index
|
1249
|
+
if node_cache[:line_to_eol].has_key?(index)
|
1250
|
+
cached = node_cache[:line_to_eol][index]
|
1251
|
+
@index = cached.interval.end if cached
|
1252
|
+
return cached
|
1253
|
+
end
|
1254
|
+
|
1255
|
+
s0, i0 = [], index
|
1256
|
+
loop do
|
1257
|
+
i1, s1 = index, []
|
1258
|
+
i2 = index
|
1259
|
+
r3 = _nt_eol
|
1260
|
+
if r3
|
1261
|
+
r2 = nil
|
1262
|
+
else
|
1263
|
+
self.index = i2
|
1264
|
+
r2 = SyntaxNode.new(input, index...index)
|
1265
|
+
end
|
1266
|
+
s1 << r2
|
1267
|
+
if r2
|
1268
|
+
if index < input_length
|
1269
|
+
r4 = (SyntaxNode).new(input, index...(index + 1))
|
1270
|
+
@index += 1
|
1271
|
+
else
|
1272
|
+
terminal_parse_failure("any character")
|
1273
|
+
r4 = nil
|
1274
|
+
end
|
1275
|
+
s1 << r4
|
1276
|
+
end
|
1277
|
+
if s1.last
|
1278
|
+
r1 = (SyntaxNode).new(input, i1...index, s1)
|
1279
|
+
r1.extend(LineToEol0)
|
1280
|
+
else
|
1281
|
+
self.index = i1
|
1282
|
+
r1 = nil
|
1283
|
+
end
|
1284
|
+
if r1
|
1285
|
+
s0 << r1
|
1286
|
+
else
|
1287
|
+
break
|
1288
|
+
end
|
1289
|
+
end
|
1290
|
+
if s0.empty?
|
1291
|
+
self.index = i0
|
1292
|
+
r0 = nil
|
1293
|
+
else
|
1294
|
+
r0 = SyntaxNode.new(input, i0...index, s0)
|
1295
|
+
end
|
1296
|
+
|
1297
|
+
node_cache[:line_to_eol][start_index] = r0
|
1298
|
+
|
1299
|
+
return r0
|
1300
|
+
end
|
1301
|
+
|
1302
|
+
module PyString0
|
1303
|
+
end
|
1304
|
+
|
1305
|
+
module PyString1
|
1306
|
+
def open_py_string
|
1307
|
+
elements[0]
|
1308
|
+
end
|
1309
|
+
|
1310
|
+
def s
|
1311
|
+
elements[1]
|
1312
|
+
end
|
1313
|
+
|
1314
|
+
def close_py_string
|
1315
|
+
elements[2]
|
1316
|
+
end
|
1317
|
+
end
|
1318
|
+
|
1319
|
+
module PyString2
|
1320
|
+
def build
|
1321
|
+
Ast::PyString.new(open_py_string.line, close_py_string.line, s.text_value, open_py_string.indentation)
|
1322
|
+
end
|
1323
|
+
end
|
1324
|
+
|
1325
|
+
def _nt_py_string
|
1326
|
+
start_index = index
|
1327
|
+
if node_cache[:py_string].has_key?(index)
|
1328
|
+
cached = node_cache[:py_string][index]
|
1329
|
+
@index = cached.interval.end if cached
|
1330
|
+
return cached
|
1331
|
+
end
|
1332
|
+
|
1333
|
+
i0, s0 = index, []
|
1334
|
+
r1 = _nt_open_py_string
|
1335
|
+
s0 << r1
|
1336
|
+
if r1
|
1337
|
+
s2, i2 = [], index
|
1338
|
+
loop do
|
1339
|
+
i3, s3 = index, []
|
1340
|
+
i4 = index
|
1341
|
+
r5 = _nt_close_py_string
|
1342
|
+
if r5
|
1343
|
+
r4 = nil
|
1344
|
+
else
|
1345
|
+
self.index = i4
|
1346
|
+
r4 = SyntaxNode.new(input, index...index)
|
1347
|
+
end
|
1348
|
+
s3 << r4
|
1349
|
+
if r4
|
1350
|
+
if index < input_length
|
1351
|
+
r6 = (SyntaxNode).new(input, index...(index + 1))
|
1352
|
+
@index += 1
|
1353
|
+
else
|
1354
|
+
terminal_parse_failure("any character")
|
1355
|
+
r6 = nil
|
1356
|
+
end
|
1357
|
+
s3 << r6
|
1358
|
+
end
|
1359
|
+
if s3.last
|
1360
|
+
r3 = (SyntaxNode).new(input, i3...index, s3)
|
1361
|
+
r3.extend(PyString0)
|
1362
|
+
else
|
1363
|
+
self.index = i3
|
1364
|
+
r3 = nil
|
1365
|
+
end
|
1366
|
+
if r3
|
1367
|
+
s2 << r3
|
1368
|
+
else
|
1369
|
+
break
|
1370
|
+
end
|
1371
|
+
end
|
1372
|
+
r2 = SyntaxNode.new(input, i2...index, s2)
|
1373
|
+
s0 << r2
|
1374
|
+
if r2
|
1375
|
+
r7 = _nt_close_py_string
|
1376
|
+
s0 << r7
|
1377
|
+
end
|
1378
|
+
end
|
1379
|
+
if s0.last
|
1380
|
+
r0 = (SyntaxNode).new(input, i0...index, s0)
|
1381
|
+
r0.extend(PyString1)
|
1382
|
+
r0.extend(PyString2)
|
1383
|
+
else
|
1384
|
+
self.index = i0
|
1385
|
+
r0 = nil
|
1386
|
+
end
|
1387
|
+
|
1388
|
+
node_cache[:py_string][start_index] = r0
|
1389
|
+
|
1390
|
+
return r0
|
1391
|
+
end
|
1392
|
+
|
1393
|
+
module OpenPyString0
|
1394
|
+
def white
|
1395
|
+
elements[0]
|
1396
|
+
end
|
1397
|
+
|
1398
|
+
def eol
|
1399
|
+
elements[3]
|
1400
|
+
end
|
1401
|
+
end
|
1402
|
+
|
1403
|
+
module OpenPyString1
|
1404
|
+
def indentation
|
1405
|
+
white.text_value.length
|
1406
|
+
end
|
1407
|
+
|
1408
|
+
def line
|
1409
|
+
white.line
|
1410
|
+
end
|
1411
|
+
end
|
1412
|
+
|
1413
|
+
def _nt_open_py_string
|
1414
|
+
start_index = index
|
1415
|
+
if node_cache[:open_py_string].has_key?(index)
|
1416
|
+
cached = node_cache[:open_py_string][index]
|
1417
|
+
@index = cached.interval.end if cached
|
1418
|
+
return cached
|
1419
|
+
end
|
1420
|
+
|
1421
|
+
i0, s0 = index, []
|
1422
|
+
r1 = _nt_white
|
1423
|
+
s0 << r1
|
1424
|
+
if r1
|
1425
|
+
if input.index('"""', index) == index
|
1426
|
+
r2 = (SyntaxNode).new(input, index...(index + 3))
|
1427
|
+
@index += 3
|
1428
|
+
else
|
1429
|
+
terminal_parse_failure('"""')
|
1430
|
+
r2 = nil
|
1431
|
+
end
|
1432
|
+
s0 << r2
|
1433
|
+
if r2
|
1434
|
+
s3, i3 = [], index
|
1435
|
+
loop do
|
1436
|
+
r4 = _nt_space
|
1437
|
+
if r4
|
1438
|
+
s3 << r4
|
1439
|
+
else
|
1440
|
+
break
|
1441
|
+
end
|
1442
|
+
end
|
1443
|
+
r3 = SyntaxNode.new(input, i3...index, s3)
|
1444
|
+
s0 << r3
|
1445
|
+
if r3
|
1446
|
+
r5 = _nt_eol
|
1447
|
+
s0 << r5
|
1448
|
+
end
|
1449
|
+
end
|
1450
|
+
end
|
1451
|
+
if s0.last
|
1452
|
+
r0 = (SyntaxNode).new(input, i0...index, s0)
|
1453
|
+
r0.extend(OpenPyString0)
|
1454
|
+
r0.extend(OpenPyString1)
|
1455
|
+
else
|
1456
|
+
self.index = i0
|
1457
|
+
r0 = nil
|
1458
|
+
end
|
1459
|
+
|
1460
|
+
node_cache[:open_py_string][start_index] = r0
|
1461
|
+
|
1462
|
+
return r0
|
1463
|
+
end
|
1464
|
+
|
1465
|
+
module ClosePyString0
|
1466
|
+
def eol
|
1467
|
+
elements[0]
|
1468
|
+
end
|
1469
|
+
|
1470
|
+
def quotes
|
1471
|
+
elements[2]
|
1472
|
+
end
|
1473
|
+
|
1474
|
+
def white
|
1475
|
+
elements[3]
|
1476
|
+
end
|
1477
|
+
end
|
1478
|
+
|
1479
|
+
module ClosePyString1
|
1480
|
+
def line
|
1481
|
+
quotes.line
|
1482
|
+
end
|
1483
|
+
end
|
1484
|
+
|
1485
|
+
def _nt_close_py_string
|
1486
|
+
start_index = index
|
1487
|
+
if node_cache[:close_py_string].has_key?(index)
|
1488
|
+
cached = node_cache[:close_py_string][index]
|
1489
|
+
@index = cached.interval.end if cached
|
1490
|
+
return cached
|
1491
|
+
end
|
1492
|
+
|
1493
|
+
i0, s0 = index, []
|
1494
|
+
r1 = _nt_eol
|
1495
|
+
s0 << r1
|
1496
|
+
if r1
|
1497
|
+
s2, i2 = [], index
|
1498
|
+
loop do
|
1499
|
+
r3 = _nt_space
|
1500
|
+
if r3
|
1501
|
+
s2 << r3
|
1502
|
+
else
|
1503
|
+
break
|
1504
|
+
end
|
1505
|
+
end
|
1506
|
+
r2 = SyntaxNode.new(input, i2...index, s2)
|
1507
|
+
s0 << r2
|
1508
|
+
if r2
|
1509
|
+
if input.index('"""', index) == index
|
1510
|
+
r4 = (SyntaxNode).new(input, index...(index + 3))
|
1511
|
+
@index += 3
|
1512
|
+
else
|
1513
|
+
terminal_parse_failure('"""')
|
1514
|
+
r4 = nil
|
1515
|
+
end
|
1516
|
+
s0 << r4
|
1517
|
+
if r4
|
1518
|
+
r5 = _nt_white
|
1519
|
+
s0 << r5
|
1520
|
+
end
|
1521
|
+
end
|
1522
|
+
end
|
1523
|
+
if s0.last
|
1524
|
+
r0 = (SyntaxNode).new(input, i0...index, s0)
|
1525
|
+
r0.extend(ClosePyString0)
|
1526
|
+
r0.extend(ClosePyString1)
|
1527
|
+
else
|
1528
|
+
self.index = i0
|
1529
|
+
r0 = nil
|
1530
|
+
end
|
1531
|
+
|
1532
|
+
node_cache[:close_py_string][start_index] = r0
|
1533
|
+
|
1534
|
+
return r0
|
1535
|
+
end
|
1536
|
+
|
1537
|
+
def _nt_white
|
1538
|
+
start_index = index
|
1539
|
+
if node_cache[:white].has_key?(index)
|
1540
|
+
cached = node_cache[:white][index]
|
1541
|
+
@index = cached.interval.end if cached
|
1542
|
+
return cached
|
1543
|
+
end
|
1544
|
+
|
1545
|
+
s0, i0 = [], index
|
1546
|
+
loop do
|
1547
|
+
i1 = index
|
1548
|
+
r2 = _nt_space
|
1549
|
+
if r2
|
1550
|
+
r1 = r2
|
1551
|
+
else
|
1552
|
+
r3 = _nt_eol
|
1553
|
+
if r3
|
1554
|
+
r1 = r3
|
1555
|
+
else
|
1556
|
+
self.index = i1
|
1557
|
+
r1 = nil
|
1558
|
+
end
|
1559
|
+
end
|
1560
|
+
if r1
|
1561
|
+
s0 << r1
|
1562
|
+
else
|
1563
|
+
break
|
1564
|
+
end
|
1565
|
+
end
|
1566
|
+
r0 = SyntaxNode.new(input, i0...index, s0)
|
1567
|
+
|
1568
|
+
node_cache[:white][start_index] = r0
|
1569
|
+
|
1570
|
+
return r0
|
1571
|
+
end
|
1572
|
+
|
1573
|
+
def _nt_space
|
1574
|
+
start_index = index
|
1575
|
+
if node_cache[:space].has_key?(index)
|
1576
|
+
cached = node_cache[:space][index]
|
1577
|
+
@index = cached.interval.end if cached
|
1578
|
+
return cached
|
1579
|
+
end
|
1580
|
+
|
1581
|
+
if input.index(Regexp.new('[ \\t]'), index) == index
|
1582
|
+
r0 = (SyntaxNode).new(input, index...(index + 1))
|
1583
|
+
@index += 1
|
1584
|
+
else
|
1585
|
+
r0 = nil
|
1586
|
+
end
|
1587
|
+
|
1588
|
+
node_cache[:space][start_index] = r0
|
1589
|
+
|
1590
|
+
return r0
|
1591
|
+
end
|
1592
|
+
|
1593
|
+
module Eol0
|
1594
|
+
end
|
1595
|
+
|
1596
|
+
def _nt_eol
|
1597
|
+
start_index = index
|
1598
|
+
if node_cache[:eol].has_key?(index)
|
1599
|
+
cached = node_cache[:eol][index]
|
1600
|
+
@index = cached.interval.end if cached
|
1601
|
+
return cached
|
1602
|
+
end
|
1603
|
+
|
1604
|
+
i0 = index
|
1605
|
+
if input.index("\n", index) == index
|
1606
|
+
r1 = (SyntaxNode).new(input, index...(index + 1))
|
1607
|
+
@index += 1
|
1608
|
+
else
|
1609
|
+
terminal_parse_failure("\n")
|
1610
|
+
r1 = nil
|
1611
|
+
end
|
1612
|
+
if r1
|
1613
|
+
r0 = r1
|
1614
|
+
else
|
1615
|
+
i2, s2 = index, []
|
1616
|
+
if input.index("\r", index) == index
|
1617
|
+
r3 = (SyntaxNode).new(input, index...(index + 1))
|
1618
|
+
@index += 1
|
1619
|
+
else
|
1620
|
+
terminal_parse_failure("\r")
|
1621
|
+
r3 = nil
|
1622
|
+
end
|
1623
|
+
s2 << r3
|
1624
|
+
if r3
|
1625
|
+
if input.index("\n", index) == index
|
1626
|
+
r5 = (SyntaxNode).new(input, index...(index + 1))
|
1627
|
+
@index += 1
|
1628
|
+
else
|
1629
|
+
terminal_parse_failure("\n")
|
1630
|
+
r5 = nil
|
1631
|
+
end
|
1632
|
+
if r5
|
1633
|
+
r4 = r5
|
1634
|
+
else
|
1635
|
+
r4 = SyntaxNode.new(input, index...index)
|
1636
|
+
end
|
1637
|
+
s2 << r4
|
1638
|
+
end
|
1639
|
+
if s2.last
|
1640
|
+
r2 = (SyntaxNode).new(input, i2...index, s2)
|
1641
|
+
r2.extend(Eol0)
|
1642
|
+
else
|
1643
|
+
self.index = i2
|
1644
|
+
r2 = nil
|
1645
|
+
end
|
1646
|
+
if r2
|
1647
|
+
r0 = r2
|
1648
|
+
else
|
1649
|
+
self.index = i0
|
1650
|
+
r0 = nil
|
1651
|
+
end
|
1652
|
+
end
|
1653
|
+
|
1654
|
+
node_cache[:eol][start_index] = r0
|
1655
|
+
|
1656
|
+
return r0
|
1657
|
+
end
|
1658
|
+
|
1659
|
+
def _nt_eof
|
1660
|
+
start_index = index
|
1661
|
+
if node_cache[:eof].has_key?(index)
|
1662
|
+
cached = node_cache[:eof][index]
|
1663
|
+
@index = cached.interval.end if cached
|
1664
|
+
return cached
|
1665
|
+
end
|
1666
|
+
|
1667
|
+
i0 = index
|
1668
|
+
if index < input_length
|
1669
|
+
r1 = (SyntaxNode).new(input, index...(index + 1))
|
1670
|
+
@index += 1
|
1671
|
+
else
|
1672
|
+
terminal_parse_failure("any character")
|
1673
|
+
r1 = nil
|
1674
|
+
end
|
1675
|
+
if r1
|
1676
|
+
r0 = nil
|
1677
|
+
else
|
1678
|
+
self.index = i0
|
1679
|
+
r0 = SyntaxNode.new(input, index...index)
|
1680
|
+
end
|
1681
|
+
|
1682
|
+
node_cache[:eof][start_index] = r0
|
1683
|
+
|
1684
|
+
return r0
|
1685
|
+
end
|
1686
|
+
|
1687
|
+
end
|
1688
|
+
|
1689
|
+
class FeatureParser < Treetop::Runtime::CompiledParser
|
1690
|
+
include Feature
|
1691
|
+
end
|
1692
|
+
|
1693
|
+
end
|
1694
|
+
end
|