aslakhellesoy-cucumber 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +22 -10
- data/README.textile +147 -17
- data/README.txt +41 -0
- data/config/hoe.rb +1 -1
- data/examples/calculator/features/addition.feature +7 -7
- data/examples/calculator/features/division.feature +3 -4
- data/examples/calculator/features/steps/{addition_steps.rb → calculator_steps.rb} +0 -1
- data/examples/calculator/lib/calculator.rb +2 -4
- data/examples/{pure_ruby → calculator_ruby_features}/Rakefile +0 -0
- data/examples/{pure_ruby → calculator_ruby_features}/features/addition.rb +2 -2
- data/examples/{pure_ruby/features/steps/addition_steps.rb → calculator_ruby_features/features/steps/calculator_steps.rb} +0 -0
- data/examples/java/src/cucumber/demo/Hello.java +1 -1
- data/examples/{simple_norwegian → norwegian_calculator}/Rakefile +0 -0
- data/examples/{simple_norwegian/features/steps/matte_steg.rb.rb → norwegian_calculator/features/kalkulator_steps.rb} +2 -2
- data/examples/{simple_norwegian → norwegian_calculator}/features/summering.feature +4 -4
- data/examples/{web → watir}/Rakefile +0 -0
- data/examples/{web → watir}/features/search.feature +1 -1
- data/examples/{web → watir}/features/steps/stories_steps.rb +4 -4
- data/gem_tasks/gemspec.rake +6 -0
- data/generators/cucumber/cucumber_generator.rb +20 -0
- data/generators/cucumber/templates/common_webrat.rb +30 -0
- data/generators/cucumber/templates/cucumber.rake +7 -0
- data/generators/cucumber/templates/env.rb +6 -0
- data/generators/feature/feature_generator.rb +17 -0
- data/generators/feature/templates/feature.erb +27 -0
- data/generators/feature/templates/steps.erb +22 -0
- data/lib/cucumber.rb +9 -1
- data/lib/cucumber/cli.rb +13 -8
- data/lib/cucumber/executor.rb +0 -4
- data/lib/cucumber/formatters/html_formatter.rb +1 -0
- data/lib/cucumber/formatters/pretty_formatter.rb +15 -5
- data/lib/cucumber/languages.yml +1 -1
- data/lib/cucumber/rails/rspec.rb +12 -0
- data/lib/cucumber/rails/world.rb +18 -16
- data/lib/cucumber/rake/task.rb +17 -14
- data/lib/cucumber/step_methods.rb +3 -1
- data/lib/cucumber/tree/scenario.rb +6 -0
- data/lib/cucumber/tree/step.rb +8 -0
- data/lib/cucumber/treetop_parser/feature.treetop.erb +10 -6
- data/lib/cucumber/treetop_parser/feature_en.rb +132 -81
- data/lib/cucumber/treetop_parser/feature_fr.rb +136 -85
- data/lib/cucumber/treetop_parser/feature_no.rb +132 -81
- data/lib/cucumber/treetop_parser/feature_pt.rb +132 -81
- data/lib/cucumber/version.rb +1 -1
- data/spec/cucumber/treetop_parser/feature_parser_spec.rb +40 -0
- data/spec/cucumber/treetop_parser/spaces.feature +10 -0
- metadata +25 -12
@@ -1,7 +1,9 @@
|
|
1
1
|
require 'cucumber/step_mother'
|
2
2
|
|
3
3
|
module Cucumber
|
4
|
-
|
4
|
+
# Defines "global" methods that may be used in *_steps.rb files.
|
5
|
+
module StepMethods
|
6
|
+
# Each scenario will execute in the context of what the supplied block returns.
|
5
7
|
def World(&proc)
|
6
8
|
$executor.register_world_proc(&proc)
|
7
9
|
end
|
@@ -14,6 +14,12 @@ module Cucumber
|
|
14
14
|
def at_line?(l)
|
15
15
|
line == l || steps.map{|s| s.line}.index(l)
|
16
16
|
end
|
17
|
+
|
18
|
+
def previous_step(step)
|
19
|
+
i = steps.index(step)
|
20
|
+
raise "Couldn't find #{step} among #{steps}" if i.nil?
|
21
|
+
steps[i-1]
|
22
|
+
end
|
17
23
|
end
|
18
24
|
|
19
25
|
class Scenario < BaseScenario
|
data/lib/cucumber/tree/step.rb
CHANGED
@@ -88,6 +88,14 @@ module Cucumber
|
|
88
88
|
def id
|
89
89
|
@id ||= self.class.new_id!
|
90
90
|
end
|
91
|
+
|
92
|
+
def actual_keyword
|
93
|
+
keyword == Cucumber.language['and'] ? previous_step.actual_keyword : keyword
|
94
|
+
end
|
95
|
+
|
96
|
+
def previous_step
|
97
|
+
@scenario.previous_step(self)
|
98
|
+
end
|
91
99
|
end
|
92
100
|
|
93
101
|
class Step < BaseStep
|
@@ -3,7 +3,7 @@ module TreetopParser
|
|
3
3
|
|
4
4
|
grammar Feature
|
5
5
|
rule root
|
6
|
-
header scenarios {
|
6
|
+
header whitespace* scenarios {
|
7
7
|
def feature
|
8
8
|
f = Tree::Feature.new(header.text_value.strip)
|
9
9
|
scenarios.populate(f)
|
@@ -26,9 +26,9 @@ grammar Feature
|
|
26
26
|
end
|
27
27
|
|
28
28
|
rule step_scenario
|
29
|
-
|
29
|
+
scenario_keyword ":" whitespace* name:(!newline .)* newline* blanks steps:step+ {
|
30
30
|
def populate(feature)
|
31
|
-
sc = feature.add_scenario(name.text_value)
|
31
|
+
sc = feature.add_scenario(name.text_value.strip)
|
32
32
|
steps.elements.each{|s| s.populate(sc)}
|
33
33
|
Feature.last_scenario = sc
|
34
34
|
end
|
@@ -36,10 +36,10 @@ grammar Feature
|
|
36
36
|
end
|
37
37
|
|
38
38
|
rule step
|
39
|
-
whitespace* step_keyword whitespace* name:(!newline .)* newline* {
|
39
|
+
whitespace* step_keyword whitespace* name:(!newline .)* newline* blanks {
|
40
40
|
def populate(scenario)
|
41
41
|
line = input.line_of(interval.first)
|
42
|
-
scenario.add_step(step_keyword.text_value, name.text_value, line)
|
42
|
+
scenario.add_step(step_keyword.text_value, name.text_value.strip, line)
|
43
43
|
end
|
44
44
|
}
|
45
45
|
end
|
@@ -85,12 +85,16 @@ grammar Feature
|
|
85
85
|
'|'
|
86
86
|
end
|
87
87
|
|
88
|
+
rule blanks
|
89
|
+
(newline / whitespace)*
|
90
|
+
end
|
91
|
+
|
88
92
|
rule newline
|
89
93
|
"\r\n?" / "\n"
|
90
94
|
end
|
91
95
|
|
92
96
|
rule whitespace
|
93
|
-
[ \
|
97
|
+
[ \t]
|
94
98
|
end
|
95
99
|
end
|
96
100
|
|
@@ -14,7 +14,7 @@ module Feature
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def scenarios
|
17
|
-
elements[
|
17
|
+
elements[2]
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -39,8 +39,21 @@ module Feature
|
|
39
39
|
r1 = _nt_header
|
40
40
|
s0 << r1
|
41
41
|
if r1
|
42
|
-
|
42
|
+
s2, i2 = [], index
|
43
|
+
loop do
|
44
|
+
r3 = _nt_whitespace
|
45
|
+
if r3
|
46
|
+
s2 << r3
|
47
|
+
else
|
48
|
+
break
|
49
|
+
end
|
50
|
+
end
|
51
|
+
r2 = SyntaxNode.new(input, i2...index, s2)
|
43
52
|
s0 << r2
|
53
|
+
if r2
|
54
|
+
r4 = _nt_scenarios
|
55
|
+
s0 << r4
|
56
|
+
end
|
44
57
|
end
|
45
58
|
if s0.last
|
46
59
|
r0 = (SyntaxNode).new(input, i0...index, s0)
|
@@ -181,11 +194,15 @@ module Feature
|
|
181
194
|
|
182
195
|
module StepScenario1
|
183
196
|
def scenario_keyword
|
184
|
-
elements[
|
197
|
+
elements[0]
|
185
198
|
end
|
186
199
|
|
187
200
|
def name
|
188
|
-
elements[
|
201
|
+
elements[3]
|
202
|
+
end
|
203
|
+
|
204
|
+
def blanks
|
205
|
+
elements[5]
|
189
206
|
end
|
190
207
|
|
191
208
|
def steps
|
@@ -195,7 +212,7 @@ module Feature
|
|
195
212
|
|
196
213
|
module StepScenario2
|
197
214
|
def populate(feature)
|
198
|
-
sc = feature.add_scenario(name.text_value)
|
215
|
+
sc = feature.add_scenario(name.text_value.strip)
|
199
216
|
steps.elements.each{|s| s.populate(sc)}
|
200
217
|
Feature.last_scenario = sc
|
201
218
|
end
|
@@ -210,33 +227,59 @@ module Feature
|
|
210
227
|
end
|
211
228
|
|
212
229
|
i0, s0 = index, []
|
213
|
-
|
214
|
-
loop do
|
215
|
-
r2 = _nt_whitespace
|
216
|
-
if r2
|
217
|
-
s1 << r2
|
218
|
-
else
|
219
|
-
break
|
220
|
-
end
|
221
|
-
end
|
222
|
-
r1 = SyntaxNode.new(input, i1...index, s1)
|
230
|
+
r1 = _nt_scenario_keyword
|
223
231
|
s0 << r1
|
224
232
|
if r1
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
233
|
+
if input.index(":", index) == index
|
234
|
+
r2 = (SyntaxNode).new(input, index...(index + 1))
|
235
|
+
@index += 1
|
236
|
+
else
|
237
|
+
terminal_parse_failure(":")
|
238
|
+
r2 = nil
|
239
|
+
end
|
240
|
+
s0 << r2
|
241
|
+
if r2
|
242
|
+
s3, i3 = [], index
|
243
|
+
loop do
|
244
|
+
r4 = _nt_whitespace
|
245
|
+
if r4
|
246
|
+
s3 << r4
|
247
|
+
else
|
248
|
+
break
|
249
|
+
end
|
234
250
|
end
|
235
|
-
|
236
|
-
|
251
|
+
r3 = SyntaxNode.new(input, i3...index, s3)
|
252
|
+
s0 << r3
|
253
|
+
if r3
|
237
254
|
s5, i5 = [], index
|
238
255
|
loop do
|
239
|
-
|
256
|
+
i6, s6 = index, []
|
257
|
+
i7 = index
|
258
|
+
r8 = _nt_newline
|
259
|
+
if r8
|
260
|
+
r7 = nil
|
261
|
+
else
|
262
|
+
self.index = i7
|
263
|
+
r7 = SyntaxNode.new(input, index...index)
|
264
|
+
end
|
265
|
+
s6 << r7
|
266
|
+
if r7
|
267
|
+
if index < input_length
|
268
|
+
r9 = (SyntaxNode).new(input, index...(index + 1))
|
269
|
+
@index += 1
|
270
|
+
else
|
271
|
+
terminal_parse_failure("any character")
|
272
|
+
r9 = nil
|
273
|
+
end
|
274
|
+
s6 << r9
|
275
|
+
end
|
276
|
+
if s6.last
|
277
|
+
r6 = (SyntaxNode).new(input, i6...index, s6)
|
278
|
+
r6.extend(StepScenario0)
|
279
|
+
else
|
280
|
+
self.index = i6
|
281
|
+
r6 = nil
|
282
|
+
end
|
240
283
|
if r6
|
241
284
|
s5 << r6
|
242
285
|
else
|
@@ -246,72 +289,37 @@ module Feature
|
|
246
289
|
r5 = SyntaxNode.new(input, i5...index, s5)
|
247
290
|
s0 << r5
|
248
291
|
if r5
|
249
|
-
|
292
|
+
s10, i10 = [], index
|
250
293
|
loop do
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
if r10
|
255
|
-
r9 = nil
|
256
|
-
else
|
257
|
-
self.index = i9
|
258
|
-
r9 = SyntaxNode.new(input, index...index)
|
259
|
-
end
|
260
|
-
s8 << r9
|
261
|
-
if r9
|
262
|
-
if index < input_length
|
263
|
-
r11 = (SyntaxNode).new(input, index...(index + 1))
|
264
|
-
@index += 1
|
265
|
-
else
|
266
|
-
terminal_parse_failure("any character")
|
267
|
-
r11 = nil
|
268
|
-
end
|
269
|
-
s8 << r11
|
270
|
-
end
|
271
|
-
if s8.last
|
272
|
-
r8 = (SyntaxNode).new(input, i8...index, s8)
|
273
|
-
r8.extend(StepScenario0)
|
274
|
-
else
|
275
|
-
self.index = i8
|
276
|
-
r8 = nil
|
277
|
-
end
|
278
|
-
if r8
|
279
|
-
s7 << r8
|
294
|
+
r11 = _nt_newline
|
295
|
+
if r11
|
296
|
+
s10 << r11
|
280
297
|
else
|
281
298
|
break
|
282
299
|
end
|
283
300
|
end
|
284
|
-
|
285
|
-
s0 <<
|
286
|
-
if
|
287
|
-
|
288
|
-
loop do
|
289
|
-
r13 = _nt_newline
|
290
|
-
if r13
|
291
|
-
s12 << r13
|
292
|
-
else
|
293
|
-
break
|
294
|
-
end
|
295
|
-
end
|
296
|
-
r12 = SyntaxNode.new(input, i12...index, s12)
|
301
|
+
r10 = SyntaxNode.new(input, i10...index, s10)
|
302
|
+
s0 << r10
|
303
|
+
if r10
|
304
|
+
r12 = _nt_blanks
|
297
305
|
s0 << r12
|
298
306
|
if r12
|
299
|
-
|
307
|
+
s13, i13 = [], index
|
300
308
|
loop do
|
301
|
-
|
302
|
-
if
|
303
|
-
|
309
|
+
r14 = _nt_step
|
310
|
+
if r14
|
311
|
+
s13 << r14
|
304
312
|
else
|
305
313
|
break
|
306
314
|
end
|
307
315
|
end
|
308
|
-
if
|
309
|
-
self.index =
|
310
|
-
|
316
|
+
if s13.empty?
|
317
|
+
self.index = i13
|
318
|
+
r13 = nil
|
311
319
|
else
|
312
|
-
|
320
|
+
r13 = SyntaxNode.new(input, i13...index, s13)
|
313
321
|
end
|
314
|
-
s0 <<
|
322
|
+
s0 << r13
|
315
323
|
end
|
316
324
|
end
|
317
325
|
end
|
@@ -344,12 +352,15 @@ module Feature
|
|
344
352
|
elements[3]
|
345
353
|
end
|
346
354
|
|
355
|
+
def blanks
|
356
|
+
elements[5]
|
357
|
+
end
|
347
358
|
end
|
348
359
|
|
349
360
|
module Step2
|
350
361
|
def populate(scenario)
|
351
362
|
line = input.line_of(interval.first)
|
352
|
-
scenario.add_step(step_keyword.text_value, name.text_value, line)
|
363
|
+
scenario.add_step(step_keyword.text_value, name.text_value.strip, line)
|
353
364
|
end
|
354
365
|
end
|
355
366
|
|
@@ -438,6 +449,10 @@ module Feature
|
|
438
449
|
end
|
439
450
|
r11 = SyntaxNode.new(input, i11...index, s11)
|
440
451
|
s0 << r11
|
452
|
+
if r11
|
453
|
+
r13 = _nt_blanks
|
454
|
+
s0 << r13
|
455
|
+
end
|
441
456
|
end
|
442
457
|
end
|
443
458
|
end
|
@@ -853,6 +868,42 @@ module Feature
|
|
853
868
|
return r0
|
854
869
|
end
|
855
870
|
|
871
|
+
def _nt_blanks
|
872
|
+
start_index = index
|
873
|
+
if node_cache[:blanks].has_key?(index)
|
874
|
+
cached = node_cache[:blanks][index]
|
875
|
+
@index = cached.interval.end if cached
|
876
|
+
return cached
|
877
|
+
end
|
878
|
+
|
879
|
+
s0, i0 = [], index
|
880
|
+
loop do
|
881
|
+
i1 = index
|
882
|
+
r2 = _nt_newline
|
883
|
+
if r2
|
884
|
+
r1 = r2
|
885
|
+
else
|
886
|
+
r3 = _nt_whitespace
|
887
|
+
if r3
|
888
|
+
r1 = r3
|
889
|
+
else
|
890
|
+
self.index = i1
|
891
|
+
r1 = nil
|
892
|
+
end
|
893
|
+
end
|
894
|
+
if r1
|
895
|
+
s0 << r1
|
896
|
+
else
|
897
|
+
break
|
898
|
+
end
|
899
|
+
end
|
900
|
+
r0 = SyntaxNode.new(input, i0...index, s0)
|
901
|
+
|
902
|
+
node_cache[:blanks][start_index] = r0
|
903
|
+
|
904
|
+
return r0
|
905
|
+
end
|
906
|
+
|
856
907
|
def _nt_newline
|
857
908
|
start_index = index
|
858
909
|
if node_cache[:newline].has_key?(index)
|
@@ -900,7 +951,7 @@ module Feature
|
|
900
951
|
return cached
|
901
952
|
end
|
902
953
|
|
903
|
-
if input.index(Regexp.new('[ \\
|
954
|
+
if input.index(Regexp.new('[ \\t]'), index) == index
|
904
955
|
r0 = (SyntaxNode).new(input, index...(index + 1))
|
905
956
|
@index += 1
|
906
957
|
else
|
@@ -14,7 +14,7 @@ module Feature
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def scenarios
|
17
|
-
elements[
|
17
|
+
elements[2]
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
@@ -39,8 +39,21 @@ module Feature
|
|
39
39
|
r1 = _nt_header
|
40
40
|
s0 << r1
|
41
41
|
if r1
|
42
|
-
|
42
|
+
s2, i2 = [], index
|
43
|
+
loop do
|
44
|
+
r3 = _nt_whitespace
|
45
|
+
if r3
|
46
|
+
s2 << r3
|
47
|
+
else
|
48
|
+
break
|
49
|
+
end
|
50
|
+
end
|
51
|
+
r2 = SyntaxNode.new(input, i2...index, s2)
|
43
52
|
s0 << r2
|
53
|
+
if r2
|
54
|
+
r4 = _nt_scenarios
|
55
|
+
s0 << r4
|
56
|
+
end
|
44
57
|
end
|
45
58
|
if s0.last
|
46
59
|
r0 = (SyntaxNode).new(input, i0...index, s0)
|
@@ -181,11 +194,15 @@ module Feature
|
|
181
194
|
|
182
195
|
module StepScenario1
|
183
196
|
def scenario_keyword
|
184
|
-
elements[
|
197
|
+
elements[0]
|
185
198
|
end
|
186
199
|
|
187
200
|
def name
|
188
|
-
elements[
|
201
|
+
elements[3]
|
202
|
+
end
|
203
|
+
|
204
|
+
def blanks
|
205
|
+
elements[5]
|
189
206
|
end
|
190
207
|
|
191
208
|
def steps
|
@@ -195,7 +212,7 @@ module Feature
|
|
195
212
|
|
196
213
|
module StepScenario2
|
197
214
|
def populate(feature)
|
198
|
-
sc = feature.add_scenario(name.text_value)
|
215
|
+
sc = feature.add_scenario(name.text_value.strip)
|
199
216
|
steps.elements.each{|s| s.populate(sc)}
|
200
217
|
Feature.last_scenario = sc
|
201
218
|
end
|
@@ -210,33 +227,59 @@ module Feature
|
|
210
227
|
end
|
211
228
|
|
212
229
|
i0, s0 = index, []
|
213
|
-
|
214
|
-
loop do
|
215
|
-
r2 = _nt_whitespace
|
216
|
-
if r2
|
217
|
-
s1 << r2
|
218
|
-
else
|
219
|
-
break
|
220
|
-
end
|
221
|
-
end
|
222
|
-
r1 = SyntaxNode.new(input, i1...index, s1)
|
230
|
+
r1 = _nt_scenario_keyword
|
223
231
|
s0 << r1
|
224
232
|
if r1
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
233
|
+
if input.index(":", index) == index
|
234
|
+
r2 = (SyntaxNode).new(input, index...(index + 1))
|
235
|
+
@index += 1
|
236
|
+
else
|
237
|
+
terminal_parse_failure(":")
|
238
|
+
r2 = nil
|
239
|
+
end
|
240
|
+
s0 << r2
|
241
|
+
if r2
|
242
|
+
s3, i3 = [], index
|
243
|
+
loop do
|
244
|
+
r4 = _nt_whitespace
|
245
|
+
if r4
|
246
|
+
s3 << r4
|
247
|
+
else
|
248
|
+
break
|
249
|
+
end
|
234
250
|
end
|
235
|
-
|
236
|
-
|
251
|
+
r3 = SyntaxNode.new(input, i3...index, s3)
|
252
|
+
s0 << r3
|
253
|
+
if r3
|
237
254
|
s5, i5 = [], index
|
238
255
|
loop do
|
239
|
-
|
256
|
+
i6, s6 = index, []
|
257
|
+
i7 = index
|
258
|
+
r8 = _nt_newline
|
259
|
+
if r8
|
260
|
+
r7 = nil
|
261
|
+
else
|
262
|
+
self.index = i7
|
263
|
+
r7 = SyntaxNode.new(input, index...index)
|
264
|
+
end
|
265
|
+
s6 << r7
|
266
|
+
if r7
|
267
|
+
if index < input_length
|
268
|
+
r9 = (SyntaxNode).new(input, index...(index + 1))
|
269
|
+
@index += 1
|
270
|
+
else
|
271
|
+
terminal_parse_failure("any character")
|
272
|
+
r9 = nil
|
273
|
+
end
|
274
|
+
s6 << r9
|
275
|
+
end
|
276
|
+
if s6.last
|
277
|
+
r6 = (SyntaxNode).new(input, i6...index, s6)
|
278
|
+
r6.extend(StepScenario0)
|
279
|
+
else
|
280
|
+
self.index = i6
|
281
|
+
r6 = nil
|
282
|
+
end
|
240
283
|
if r6
|
241
284
|
s5 << r6
|
242
285
|
else
|
@@ -246,72 +289,37 @@ module Feature
|
|
246
289
|
r5 = SyntaxNode.new(input, i5...index, s5)
|
247
290
|
s0 << r5
|
248
291
|
if r5
|
249
|
-
|
292
|
+
s10, i10 = [], index
|
250
293
|
loop do
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
if r10
|
255
|
-
r9 = nil
|
256
|
-
else
|
257
|
-
self.index = i9
|
258
|
-
r9 = SyntaxNode.new(input, index...index)
|
259
|
-
end
|
260
|
-
s8 << r9
|
261
|
-
if r9
|
262
|
-
if index < input_length
|
263
|
-
r11 = (SyntaxNode).new(input, index...(index + 1))
|
264
|
-
@index += 1
|
265
|
-
else
|
266
|
-
terminal_parse_failure("any character")
|
267
|
-
r11 = nil
|
268
|
-
end
|
269
|
-
s8 << r11
|
270
|
-
end
|
271
|
-
if s8.last
|
272
|
-
r8 = (SyntaxNode).new(input, i8...index, s8)
|
273
|
-
r8.extend(StepScenario0)
|
274
|
-
else
|
275
|
-
self.index = i8
|
276
|
-
r8 = nil
|
277
|
-
end
|
278
|
-
if r8
|
279
|
-
s7 << r8
|
294
|
+
r11 = _nt_newline
|
295
|
+
if r11
|
296
|
+
s10 << r11
|
280
297
|
else
|
281
298
|
break
|
282
299
|
end
|
283
300
|
end
|
284
|
-
|
285
|
-
s0 <<
|
286
|
-
if
|
287
|
-
|
288
|
-
loop do
|
289
|
-
r13 = _nt_newline
|
290
|
-
if r13
|
291
|
-
s12 << r13
|
292
|
-
else
|
293
|
-
break
|
294
|
-
end
|
295
|
-
end
|
296
|
-
r12 = SyntaxNode.new(input, i12...index, s12)
|
301
|
+
r10 = SyntaxNode.new(input, i10...index, s10)
|
302
|
+
s0 << r10
|
303
|
+
if r10
|
304
|
+
r12 = _nt_blanks
|
297
305
|
s0 << r12
|
298
306
|
if r12
|
299
|
-
|
307
|
+
s13, i13 = [], index
|
300
308
|
loop do
|
301
|
-
|
302
|
-
if
|
303
|
-
|
309
|
+
r14 = _nt_step
|
310
|
+
if r14
|
311
|
+
s13 << r14
|
304
312
|
else
|
305
313
|
break
|
306
314
|
end
|
307
315
|
end
|
308
|
-
if
|
309
|
-
self.index =
|
310
|
-
|
316
|
+
if s13.empty?
|
317
|
+
self.index = i13
|
318
|
+
r13 = nil
|
311
319
|
else
|
312
|
-
|
320
|
+
r13 = SyntaxNode.new(input, i13...index, s13)
|
313
321
|
end
|
314
|
-
s0 <<
|
322
|
+
s0 << r13
|
315
323
|
end
|
316
324
|
end
|
317
325
|
end
|
@@ -344,12 +352,15 @@ module Feature
|
|
344
352
|
elements[3]
|
345
353
|
end
|
346
354
|
|
355
|
+
def blanks
|
356
|
+
elements[5]
|
357
|
+
end
|
347
358
|
end
|
348
359
|
|
349
360
|
module Step2
|
350
361
|
def populate(scenario)
|
351
362
|
line = input.line_of(interval.first)
|
352
|
-
scenario.add_step(step_keyword.text_value, name.text_value, line)
|
363
|
+
scenario.add_step(step_keyword.text_value, name.text_value.strip, line)
|
353
364
|
end
|
354
365
|
end
|
355
366
|
|
@@ -438,6 +449,10 @@ module Feature
|
|
438
449
|
end
|
439
450
|
r11 = SyntaxNode.new(input, i11...index, s11)
|
440
451
|
s0 << r11
|
452
|
+
if r11
|
453
|
+
r13 = _nt_blanks
|
454
|
+
s0 << r13
|
455
|
+
end
|
441
456
|
end
|
442
457
|
end
|
443
458
|
end
|
@@ -475,11 +490,11 @@ module Feature
|
|
475
490
|
if r1
|
476
491
|
r0 = r1
|
477
492
|
else
|
478
|
-
if input.index('
|
479
|
-
r2 = (SyntaxNode).new(input, index...(index +
|
480
|
-
@index +=
|
493
|
+
if input.index('Lorsque', index) == index
|
494
|
+
r2 = (SyntaxNode).new(input, index...(index + 7))
|
495
|
+
@index += 7
|
481
496
|
else
|
482
|
-
terminal_parse_failure('
|
497
|
+
terminal_parse_failure('Lorsque')
|
483
498
|
r2 = nil
|
484
499
|
end
|
485
500
|
if r2
|
@@ -853,6 +868,42 @@ module Feature
|
|
853
868
|
return r0
|
854
869
|
end
|
855
870
|
|
871
|
+
def _nt_blanks
|
872
|
+
start_index = index
|
873
|
+
if node_cache[:blanks].has_key?(index)
|
874
|
+
cached = node_cache[:blanks][index]
|
875
|
+
@index = cached.interval.end if cached
|
876
|
+
return cached
|
877
|
+
end
|
878
|
+
|
879
|
+
s0, i0 = [], index
|
880
|
+
loop do
|
881
|
+
i1 = index
|
882
|
+
r2 = _nt_newline
|
883
|
+
if r2
|
884
|
+
r1 = r2
|
885
|
+
else
|
886
|
+
r3 = _nt_whitespace
|
887
|
+
if r3
|
888
|
+
r1 = r3
|
889
|
+
else
|
890
|
+
self.index = i1
|
891
|
+
r1 = nil
|
892
|
+
end
|
893
|
+
end
|
894
|
+
if r1
|
895
|
+
s0 << r1
|
896
|
+
else
|
897
|
+
break
|
898
|
+
end
|
899
|
+
end
|
900
|
+
r0 = SyntaxNode.new(input, i0...index, s0)
|
901
|
+
|
902
|
+
node_cache[:blanks][start_index] = r0
|
903
|
+
|
904
|
+
return r0
|
905
|
+
end
|
906
|
+
|
856
907
|
def _nt_newline
|
857
908
|
start_index = index
|
858
909
|
if node_cache[:newline].has_key?(index)
|
@@ -900,7 +951,7 @@ module Feature
|
|
900
951
|
return cached
|
901
952
|
end
|
902
953
|
|
903
|
-
if input.index(Regexp.new('[ \\
|
954
|
+
if input.index(Regexp.new('[ \\t]'), index) == index
|
904
955
|
r0 = (SyntaxNode).new(input, index...(index + 1))
|
905
956
|
@index += 1
|
906
957
|
else
|