aslakhellesoy-cucumber 0.1.16.1 → 0.1.16.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,6 @@
1
+ $:.unshift(File.dirname(__FILE__) + '/../../../lib')
2
+ require 'cucumber/rake/task'
3
+
4
+ Cucumber::Rake::Task.new do |t|
5
+ t.cucumber_opts = "--language fi"
6
+ end
@@ -0,0 +1,10 @@
1
+ Ominaisuus: Jakolasku
2
+ Välttyäkseen hölmöiltä virheiltä
3
+ Kassanhoitajan on voitava laskea osamäärä
4
+
5
+ Tapaus: Kokonaislukujen jakolasku
6
+ Oletetaan että olen syöttänyt laskimeen luvun 3
7
+ Ja että olen syöttänyt laskimeen luvun 2
8
+ Kun painan "jaa"
9
+ Niin laskimen ruudulla pitäisi näkyä tulos 1.5
10
+ Ja tuloksen luokan pitäisi olla Float
@@ -0,0 +1,28 @@
1
+ # encoding: utf-8
2
+ require 'spec/expectations'
3
+ $:.unshift(File.dirname(__FILE__) + '/../../lib')
4
+ require 'cucumber/formatters/unicode'
5
+ require 'laskin'
6
+
7
+ Before do
8
+ @laskin = Laskin.new
9
+ end
10
+
11
+ After do
12
+ end
13
+
14
+ Given "että olen syöttänyt laskimeen luvun $n" do |n|
15
+ @laskin.pinoa n.to_i
16
+ end
17
+
18
+ When /painan "(\w+)"/ do |op|
19
+ @tulos = @laskin.send op
20
+ end
21
+
22
+ Then /laskimen ruudulla pitäisi näkyä tulos (.*)/ do |tulos|
23
+ @tulos.should == tulos.to_f
24
+ end
25
+
26
+ Then /tuloksen luokan pitäisi olla (\w*)/ do |luokan_nimi|
27
+ @tulos.class.name.should == luokan_nimi
28
+ end
@@ -0,0 +1,17 @@
1
+ Ominaisuus: Yhteenlasku
2
+ Välttyäkseni hölmöiltä virheiltä
3
+ Koska olen laskutaidoton
4
+ Haluan että yhteenlaskut lasketaan puolestani
5
+
6
+ Tapaus: Kahden luvun summa
7
+ Oletetaan että olen syöttänyt laskimeen luvun 50
8
+ Ja että olen syöttänyt laskimeen luvun 70
9
+ Kun painan "summaa"
10
+ Niin laskimen ruudulla pitäisi näkyä tulos 120
11
+ Ja tuloksen luokan pitäisi olla Fixnum
12
+
13
+ Lisätapaukset:
14
+ | luku_1 | luku_2 | nappi | tulos | luokka |
15
+ | 20 | 30 | summaa | 50 | Fixnum |
16
+ | 2 | 5 | summaa | 7 | Fixnum |
17
+ | 0 | 40 | summaa | 40 | Fixnum |
@@ -0,0 +1,14 @@
1
+ class Laskin
2
+ def pinoa(n)
3
+ @args ||= []
4
+ @args << n
5
+ end
6
+
7
+ def summaa
8
+ @args.inject(0){|n,sum| sum+=n}
9
+ end
10
+
11
+ def jaa
12
+ @args[0].to_f / @args[1].to_f
13
+ end
14
+ end
@@ -0,0 +1,1951 @@
1
+ # encoding: utf-8
2
+ module Cucumber
3
+ # :stopdoc:
4
+ module TreetopParser
5
+ module Feature
6
+ include Treetop::Runtime
7
+
8
+ def root
9
+ @root || :root
10
+ end
11
+
12
+ module Root0
13
+ def header
14
+ elements[1]
15
+ end
16
+
17
+ def scenario_sequence
18
+ elements[2]
19
+ end
20
+
21
+ end
22
+
23
+ module Root1
24
+ def compile
25
+ feature = Tree::Feature.new(header.text_value.strip)
26
+ scenario_sequence.compile(feature)
27
+ feature
28
+ end
29
+ end
30
+
31
+ def _nt_root
32
+ start_index = index
33
+ if node_cache[:root].has_key?(index)
34
+ cached = node_cache[:root][index]
35
+ @index = cached.interval.end if cached
36
+ return cached
37
+ end
38
+
39
+ i0, s0 = index, []
40
+ r2 = _nt_space
41
+ if r2
42
+ r1 = r2
43
+ else
44
+ r1 = SyntaxNode.new(input, index...index)
45
+ end
46
+ s0 << r1
47
+ if r1
48
+ r3 = _nt_header
49
+ s0 << r3
50
+ if r3
51
+ r4 = _nt_scenario_sequence
52
+ s0 << r4
53
+ if r4
54
+ r6 = _nt_space
55
+ if r6
56
+ r5 = r6
57
+ else
58
+ r5 = SyntaxNode.new(input, index...index)
59
+ end
60
+ s0 << r5
61
+ end
62
+ end
63
+ end
64
+ if s0.last
65
+ r0 = (SyntaxNode).new(input, i0...index, s0)
66
+ r0.extend(Root0)
67
+ r0.extend(Root1)
68
+ else
69
+ self.index = i0
70
+ r0 = nil
71
+ end
72
+
73
+ node_cache[:root][start_index] = r0
74
+
75
+ return r0
76
+ end
77
+
78
+ module Header0
79
+ end
80
+
81
+ def _nt_header
82
+ start_index = index
83
+ if node_cache[:header].has_key?(index)
84
+ cached = node_cache[:header][index]
85
+ @index = cached.interval.end if cached
86
+ return cached
87
+ end
88
+
89
+ s0, i0 = [], index
90
+ loop do
91
+ i1, s1 = index, []
92
+ i2 = index
93
+ i3 = index
94
+ r4 = _nt_scenario_keyword
95
+ if r4
96
+ r3 = r4
97
+ else
98
+ r5 = _nt_scenario_outline_keyword
99
+ if r5
100
+ r3 = r5
101
+ else
102
+ r6 = _nt_comment_to_eol
103
+ if r6
104
+ r3 = r6
105
+ else
106
+ self.index = i3
107
+ r3 = nil
108
+ end
109
+ end
110
+ end
111
+ if r3
112
+ r2 = nil
113
+ else
114
+ self.index = i2
115
+ r2 = SyntaxNode.new(input, index...index)
116
+ end
117
+ s1 << r2
118
+ if r2
119
+ if index < input_length
120
+ r7 = (SyntaxNode).new(input, index...(index + 1))
121
+ @index += 1
122
+ else
123
+ terminal_parse_failure("any character")
124
+ r7 = nil
125
+ end
126
+ s1 << r7
127
+ end
128
+ if s1.last
129
+ r1 = (SyntaxNode).new(input, i1...index, s1)
130
+ r1.extend(Header0)
131
+ else
132
+ self.index = i1
133
+ r1 = nil
134
+ end
135
+ if r1
136
+ s0 << r1
137
+ else
138
+ break
139
+ end
140
+ end
141
+ if s0.empty?
142
+ self.index = i0
143
+ r0 = nil
144
+ else
145
+ r0 = SyntaxNode.new(input, i0...index, s0)
146
+ end
147
+
148
+ node_cache[:header][start_index] = r0
149
+
150
+ return r0
151
+ end
152
+
153
+ module ScenarioSequence0
154
+ def space
155
+ elements[0]
156
+ end
157
+
158
+ def scenario_or_scenario_outline_or_table
159
+ elements[1]
160
+ end
161
+ end
162
+
163
+ module ScenarioSequence1
164
+ def head
165
+ elements[0]
166
+ end
167
+
168
+ def tail
169
+ elements[1]
170
+ end
171
+ end
172
+
173
+ module ScenarioSequence2
174
+ def compile(feature)
175
+ ([head] + tail).each do |scenario_or_scenario_outline_or_table|
176
+ scenario_or_scenario_outline_or_table.compile(feature) if scenario_or_scenario_outline_or_table.respond_to?(:compile)
177
+ end
178
+ end
179
+
180
+ def tail
181
+ super.elements.map { |elt| elt.scenario_or_scenario_outline_or_table }
182
+ end
183
+ end
184
+
185
+ def _nt_scenario_sequence
186
+ start_index = index
187
+ if node_cache[:scenario_sequence].has_key?(index)
188
+ cached = node_cache[:scenario_sequence][index]
189
+ @index = cached.interval.end if cached
190
+ return cached
191
+ end
192
+
193
+ i0, s0 = index, []
194
+ r2 = _nt_scenario_outline_or_scenario
195
+ if r2
196
+ r1 = r2
197
+ else
198
+ r1 = SyntaxNode.new(input, index...index)
199
+ end
200
+ s0 << r1
201
+ if r1
202
+ s3, i3 = [], index
203
+ loop do
204
+ i4, s4 = index, []
205
+ r5 = _nt_space
206
+ s4 << r5
207
+ if r5
208
+ r6 = _nt_scenario_or_scenario_outline_or_table
209
+ s4 << r6
210
+ end
211
+ if s4.last
212
+ r4 = (SyntaxNode).new(input, i4...index, s4)
213
+ r4.extend(ScenarioSequence0)
214
+ else
215
+ self.index = i4
216
+ r4 = nil
217
+ end
218
+ if r4
219
+ s3 << r4
220
+ else
221
+ break
222
+ end
223
+ end
224
+ r3 = SyntaxNode.new(input, i3...index, s3)
225
+ s0 << r3
226
+ end
227
+ if s0.last
228
+ r0 = (SyntaxNode).new(input, i0...index, s0)
229
+ r0.extend(ScenarioSequence1)
230
+ r0.extend(ScenarioSequence2)
231
+ else
232
+ self.index = i0
233
+ r0 = nil
234
+ end
235
+
236
+ node_cache[:scenario_sequence][start_index] = r0
237
+
238
+ return r0
239
+ end
240
+
241
+ def _nt_scenario_outline_or_scenario
242
+ start_index = index
243
+ if node_cache[:scenario_outline_or_scenario].has_key?(index)
244
+ cached = node_cache[:scenario_outline_or_scenario][index]
245
+ @index = cached.interval.end if cached
246
+ return cached
247
+ end
248
+
249
+ i0 = index
250
+ r1 = _nt_scenario_outline
251
+ if r1
252
+ r0 = r1
253
+ else
254
+ r2 = _nt_scenario
255
+ if r2
256
+ r0 = r2
257
+ else
258
+ self.index = i0
259
+ r0 = nil
260
+ end
261
+ end
262
+
263
+ node_cache[:scenario_outline_or_scenario][start_index] = r0
264
+
265
+ return r0
266
+ end
267
+
268
+ module Scenario0
269
+ def space
270
+ elements[0]
271
+ end
272
+
273
+ def step_sequence
274
+ elements[1]
275
+ end
276
+ end
277
+
278
+ module Scenario1
279
+ def scenario_keyword
280
+ elements[0]
281
+ end
282
+
283
+ def name
284
+ elements[2]
285
+ end
286
+
287
+ def steps
288
+ elements[3]
289
+ end
290
+ end
291
+
292
+ module Scenario2
293
+ def compile(feature)
294
+ line = input.line_of(interval.first)
295
+ scenario = feature.add_scenario(name.text_value.strip, line)
296
+ steps.step_sequence.compile(scenario) if steps.respond_to?(:step_sequence)
297
+ # TODO - GET RID OF THIS last_scenario NASTINESS
298
+ # Use a better datastructure, like a linked list...
299
+ Feature.last_scenario = scenario
300
+ end
301
+ end
302
+
303
+ def _nt_scenario
304
+ start_index = index
305
+ if node_cache[:scenario].has_key?(index)
306
+ cached = node_cache[:scenario][index]
307
+ @index = cached.interval.end if cached
308
+ return cached
309
+ end
310
+
311
+ i0, s0 = index, []
312
+ r1 = _nt_scenario_keyword
313
+ s0 << r1
314
+ if r1
315
+ r3 = _nt_space
316
+ if r3
317
+ r2 = r3
318
+ else
319
+ r2 = SyntaxNode.new(input, index...index)
320
+ end
321
+ s0 << r2
322
+ if r2
323
+ r4 = _nt_line_to_eol
324
+ s0 << r4
325
+ if r4
326
+ i6, s6 = index, []
327
+ r7 = _nt_space
328
+ s6 << r7
329
+ if r7
330
+ r8 = _nt_step_sequence
331
+ s6 << r8
332
+ end
333
+ if s6.last
334
+ r6 = (SyntaxNode).new(input, i6...index, s6)
335
+ r6.extend(Scenario0)
336
+ else
337
+ self.index = i6
338
+ r6 = nil
339
+ end
340
+ if r6
341
+ r5 = r6
342
+ else
343
+ r5 = SyntaxNode.new(input, index...index)
344
+ end
345
+ s0 << r5
346
+ end
347
+ end
348
+ end
349
+ if s0.last
350
+ r0 = (SyntaxNode).new(input, i0...index, s0)
351
+ r0.extend(Scenario1)
352
+ r0.extend(Scenario2)
353
+ else
354
+ self.index = i0
355
+ r0 = nil
356
+ end
357
+
358
+ node_cache[:scenario][start_index] = r0
359
+
360
+ return r0
361
+ end
362
+
363
+ module ScenarioOutline0
364
+ def scenario_outline_keyword
365
+ elements[0]
366
+ end
367
+
368
+ def name
369
+ elements[2]
370
+ end
371
+
372
+ def outline_body
373
+ elements[3]
374
+ end
375
+ end
376
+
377
+ module ScenarioOutline1
378
+ def compile(feature)
379
+ line = input.line_of(interval.first)
380
+ scenario = feature.add_scenario_outline(name.text_value.strip, line)
381
+ Feature.last_scenario = scenario
382
+ outline_body.compile(feature, scenario) if outline_body.respond_to?(:compile)
383
+ end
384
+ end
385
+
386
+ def _nt_scenario_outline
387
+ start_index = index
388
+ if node_cache[:scenario_outline].has_key?(index)
389
+ cached = node_cache[:scenario_outline][index]
390
+ @index = cached.interval.end if cached
391
+ return cached
392
+ end
393
+
394
+ i0, s0 = index, []
395
+ r1 = _nt_scenario_outline_keyword
396
+ s0 << r1
397
+ if r1
398
+ r3 = _nt_space
399
+ if r3
400
+ r2 = r3
401
+ else
402
+ r2 = SyntaxNode.new(input, index...index)
403
+ end
404
+ s0 << r2
405
+ if r2
406
+ r4 = _nt_line_to_eol
407
+ s0 << r4
408
+ if r4
409
+ r6 = _nt_steps_and_optional_examples
410
+ if r6
411
+ r5 = r6
412
+ else
413
+ r5 = SyntaxNode.new(input, index...index)
414
+ end
415
+ s0 << r5
416
+ end
417
+ end
418
+ end
419
+ if s0.last
420
+ r0 = (SyntaxNode).new(input, i0...index, s0)
421
+ r0.extend(ScenarioOutline0)
422
+ r0.extend(ScenarioOutline1)
423
+ else
424
+ self.index = i0
425
+ r0 = nil
426
+ end
427
+
428
+ node_cache[:scenario_outline][start_index] = r0
429
+
430
+ return r0
431
+ end
432
+
433
+ def _nt_scenario_or_scenario_outline_or_table
434
+ start_index = index
435
+ if node_cache[:scenario_or_scenario_outline_or_table].has_key?(index)
436
+ cached = node_cache[:scenario_or_scenario_outline_or_table][index]
437
+ @index = cached.interval.end if cached
438
+ return cached
439
+ end
440
+
441
+ i0 = index
442
+ r1 = _nt_scenario_outline
443
+ if r1
444
+ r0 = r1
445
+ else
446
+ i2 = index
447
+ r3 = _nt_scenario
448
+ if r3
449
+ r2 = r3
450
+ else
451
+ r4 = _nt_more_examples
452
+ if r4
453
+ r2 = r4
454
+ else
455
+ self.index = i2
456
+ r2 = nil
457
+ end
458
+ end
459
+ if r2
460
+ r0 = r2
461
+ else
462
+ self.index = i0
463
+ r0 = nil
464
+ end
465
+ end
466
+
467
+ node_cache[:scenario_or_scenario_outline_or_table][start_index] = r0
468
+
469
+ return r0
470
+ end
471
+
472
+ module StepsAndOptionalExamples0
473
+ def space
474
+ elements[0]
475
+ end
476
+
477
+ def step_sequence
478
+ elements[1]
479
+ end
480
+ end
481
+
482
+ module StepsAndOptionalExamples1
483
+ def space
484
+ elements[0]
485
+ end
486
+
487
+ def examples
488
+ elements[1]
489
+ end
490
+ end
491
+
492
+ module StepsAndOptionalExamples2
493
+ def steps
494
+ elements[0]
495
+ end
496
+
497
+ def table
498
+ elements[1]
499
+ end
500
+ end
501
+
502
+ module StepsAndOptionalExamples3
503
+ def compile(feature, scenario)
504
+ steps.step_sequence.compile(scenario) if steps.respond_to?(:step_sequence)
505
+ table.examples.compile(feature, scenario) if table.respond_to?(:examples) && table.examples.respond_to?(:compile)
506
+ end
507
+ end
508
+
509
+ def _nt_steps_and_optional_examples
510
+ start_index = index
511
+ if node_cache[:steps_and_optional_examples].has_key?(index)
512
+ cached = node_cache[:steps_and_optional_examples][index]
513
+ @index = cached.interval.end if cached
514
+ return cached
515
+ end
516
+
517
+ i0, s0 = index, []
518
+ i1, s1 = index, []
519
+ r2 = _nt_space
520
+ s1 << r2
521
+ if r2
522
+ r3 = _nt_step_sequence
523
+ s1 << r3
524
+ end
525
+ if s1.last
526
+ r1 = (SyntaxNode).new(input, i1...index, s1)
527
+ r1.extend(StepsAndOptionalExamples0)
528
+ else
529
+ self.index = i1
530
+ r1 = nil
531
+ end
532
+ s0 << r1
533
+ if r1
534
+ i5, s5 = index, []
535
+ r6 = _nt_space
536
+ s5 << r6
537
+ if r6
538
+ r7 = _nt_examples
539
+ s5 << r7
540
+ end
541
+ if s5.last
542
+ r5 = (SyntaxNode).new(input, i5...index, s5)
543
+ r5.extend(StepsAndOptionalExamples1)
544
+ else
545
+ self.index = i5
546
+ r5 = nil
547
+ end
548
+ if r5
549
+ r4 = r5
550
+ else
551
+ r4 = SyntaxNode.new(input, index...index)
552
+ end
553
+ s0 << r4
554
+ end
555
+ if s0.last
556
+ r0 = (SyntaxNode).new(input, i0...index, s0)
557
+ r0.extend(StepsAndOptionalExamples2)
558
+ r0.extend(StepsAndOptionalExamples3)
559
+ else
560
+ self.index = i0
561
+ r0 = nil
562
+ end
563
+
564
+ node_cache[:steps_and_optional_examples][start_index] = r0
565
+
566
+ return r0
567
+ end
568
+
569
+ module MoreExamples0
570
+ def more_examples_keyword
571
+ elements[0]
572
+ end
573
+
574
+ def table
575
+ elements[1]
576
+ end
577
+ end
578
+
579
+ module MoreExamples1
580
+ def compile(f)
581
+ table.compile(f)
582
+ end
583
+ end
584
+
585
+ def _nt_more_examples
586
+ start_index = index
587
+ if node_cache[:more_examples].has_key?(index)
588
+ cached = node_cache[:more_examples][index]
589
+ @index = cached.interval.end if cached
590
+ return cached
591
+ end
592
+
593
+ i0, s0 = index, []
594
+ r1 = _nt_more_examples_keyword
595
+ s0 << r1
596
+ if r1
597
+ r2 = _nt_table
598
+ s0 << r2
599
+ end
600
+ if s0.last
601
+ r0 = (SyntaxNode).new(input, i0...index, s0)
602
+ r0.extend(MoreExamples0)
603
+ r0.extend(MoreExamples1)
604
+ else
605
+ self.index = i0
606
+ r0 = nil
607
+ end
608
+
609
+ node_cache[:more_examples][start_index] = r0
610
+
611
+ return r0
612
+ end
613
+
614
+ module Examples0
615
+ def examples_keyword
616
+ elements[0]
617
+ end
618
+
619
+ def table
620
+ elements[1]
621
+ end
622
+ end
623
+
624
+ module Examples1
625
+ def compile(feature, scenario)
626
+ table.compile_examples(feature, scenario)
627
+ end
628
+ end
629
+
630
+ def _nt_examples
631
+ start_index = index
632
+ if node_cache[:examples].has_key?(index)
633
+ cached = node_cache[:examples][index]
634
+ @index = cached.interval.end if cached
635
+ return cached
636
+ end
637
+
638
+ i0, s0 = index, []
639
+ r1 = _nt_examples_keyword
640
+ s0 << r1
641
+ if r1
642
+ r2 = _nt_table
643
+ s0 << r2
644
+ end
645
+ if s0.last
646
+ r0 = (SyntaxNode).new(input, i0...index, s0)
647
+ r0.extend(Examples0)
648
+ r0.extend(Examples1)
649
+ else
650
+ self.index = i0
651
+ r0 = nil
652
+ end
653
+
654
+ node_cache[:examples][start_index] = r0
655
+
656
+ return r0
657
+ end
658
+
659
+ module Table0
660
+ def eol
661
+ elements[1]
662
+ end
663
+
664
+ def table_line
665
+ elements[3]
666
+ end
667
+ end
668
+
669
+ module Table1
670
+ def space
671
+ elements[0]
672
+ end
673
+
674
+ def head
675
+ elements[1]
676
+ end
677
+
678
+ def body
679
+ elements[2]
680
+ end
681
+ end
682
+
683
+ module Table2
684
+ def compile(feature)
685
+ Feature.last_scenario.table_header = head.cell_values
686
+ body.each do |table_line|
687
+ feature.add_row_scenario(Feature.last_scenario, table_line.cell_values, table_line.line)
688
+ end
689
+ end
690
+
691
+ def compile_examples(feature, scenario)
692
+ scenario.table_header = head.cell_values
693
+ body.each do |table_line|
694
+ feature.add_row_scenario_outline(scenario, table_line.cell_values, table_line.line)
695
+ end
696
+ end
697
+
698
+ def matrix
699
+ ([head] + body).map do |table_line|
700
+ table_line.cell_values # We're losing the line - we'll get it back when we make our own class
701
+ end
702
+ end
703
+
704
+ def to_arg
705
+ Model::Table.new(matrix)
706
+ end
707
+
708
+ def body
709
+ super.elements.map { |elt| elt.table_line }
710
+ end
711
+ end
712
+
713
+ def _nt_table
714
+ start_index = index
715
+ if node_cache[:table].has_key?(index)
716
+ cached = node_cache[:table][index]
717
+ @index = cached.interval.end if cached
718
+ return cached
719
+ end
720
+
721
+ i0, s0 = index, []
722
+ r1 = _nt_space
723
+ s0 << r1
724
+ if r1
725
+ r2 = _nt_table_line
726
+ s0 << r2
727
+ if r2
728
+ s3, i3 = [], index
729
+ loop do
730
+ i4, s4 = index, []
731
+ s5, i5 = [], index
732
+ loop do
733
+ r6 = _nt_blank
734
+ if r6
735
+ s5 << r6
736
+ else
737
+ break
738
+ end
739
+ end
740
+ r5 = SyntaxNode.new(input, i5...index, s5)
741
+ s4 << r5
742
+ if r5
743
+ r7 = _nt_eol
744
+ s4 << r7
745
+ if r7
746
+ r9 = _nt_space
747
+ if r9
748
+ r8 = r9
749
+ else
750
+ r8 = SyntaxNode.new(input, index...index)
751
+ end
752
+ s4 << r8
753
+ if r8
754
+ r10 = _nt_table_line
755
+ s4 << r10
756
+ end
757
+ end
758
+ end
759
+ if s4.last
760
+ r4 = (SyntaxNode).new(input, i4...index, s4)
761
+ r4.extend(Table0)
762
+ else
763
+ self.index = i4
764
+ r4 = nil
765
+ end
766
+ if r4
767
+ s3 << r4
768
+ else
769
+ break
770
+ end
771
+ end
772
+ r3 = SyntaxNode.new(input, i3...index, s3)
773
+ s0 << r3
774
+ end
775
+ end
776
+ if s0.last
777
+ r0 = (SyntaxNode).new(input, i0...index, s0)
778
+ r0.extend(Table1)
779
+ r0.extend(Table2)
780
+ else
781
+ self.index = i0
782
+ r0 = nil
783
+ end
784
+
785
+ node_cache[:table][start_index] = r0
786
+
787
+ return r0
788
+ end
789
+
790
+ module TableLine0
791
+ def cell_value
792
+ elements[1]
793
+ end
794
+
795
+ def separator
796
+ elements[3]
797
+ end
798
+ end
799
+
800
+ module TableLine1
801
+ def separator
802
+ elements[0]
803
+ end
804
+
805
+ def cells
806
+ elements[1]
807
+ end
808
+ end
809
+
810
+ module TableLine2
811
+ def cell_values
812
+ cells.elements.map { |elt| elt.cell_value.text_value.strip }
813
+ end
814
+
815
+ def line
816
+ input.line_of(interval.first)
817
+ end
818
+ end
819
+
820
+ def _nt_table_line
821
+ start_index = index
822
+ if node_cache[:table_line].has_key?(index)
823
+ cached = node_cache[:table_line][index]
824
+ @index = cached.interval.end if cached
825
+ return cached
826
+ end
827
+
828
+ i0, s0 = index, []
829
+ r1 = _nt_separator
830
+ s0 << r1
831
+ if r1
832
+ s2, i2 = [], index
833
+ loop do
834
+ i3, s3 = index, []
835
+ s4, i4 = [], index
836
+ loop do
837
+ r5 = _nt_blank
838
+ if r5
839
+ s4 << r5
840
+ else
841
+ break
842
+ end
843
+ end
844
+ r4 = SyntaxNode.new(input, i4...index, s4)
845
+ s3 << r4
846
+ if r4
847
+ r6 = _nt_cell_value
848
+ s3 << r6
849
+ if r6
850
+ s7, i7 = [], index
851
+ loop do
852
+ r8 = _nt_blank
853
+ if r8
854
+ s7 << r8
855
+ else
856
+ break
857
+ end
858
+ end
859
+ r7 = SyntaxNode.new(input, i7...index, s7)
860
+ s3 << r7
861
+ if r7
862
+ r9 = _nt_separator
863
+ s3 << r9
864
+ end
865
+ end
866
+ end
867
+ if s3.last
868
+ r3 = (SyntaxNode).new(input, i3...index, s3)
869
+ r3.extend(TableLine0)
870
+ else
871
+ self.index = i3
872
+ r3 = nil
873
+ end
874
+ if r3
875
+ s2 << r3
876
+ else
877
+ break
878
+ end
879
+ end
880
+ if s2.empty?
881
+ self.index = i2
882
+ r2 = nil
883
+ else
884
+ r2 = SyntaxNode.new(input, i2...index, s2)
885
+ end
886
+ s0 << r2
887
+ end
888
+ if s0.last
889
+ r0 = (SyntaxNode).new(input, i0...index, s0)
890
+ r0.extend(TableLine1)
891
+ r0.extend(TableLine2)
892
+ else
893
+ self.index = i0
894
+ r0 = nil
895
+ end
896
+
897
+ node_cache[:table_line][start_index] = r0
898
+
899
+ return r0
900
+ end
901
+
902
+ module CellValue0
903
+ end
904
+
905
+ def _nt_cell_value
906
+ start_index = index
907
+ if node_cache[:cell_value].has_key?(index)
908
+ cached = node_cache[:cell_value][index]
909
+ @index = cached.interval.end if cached
910
+ return cached
911
+ end
912
+
913
+ s0, i0 = [], index
914
+ loop do
915
+ i1, s1 = index, []
916
+ i2 = index
917
+ i3 = index
918
+ r4 = _nt_separator
919
+ if r4
920
+ r3 = r4
921
+ else
922
+ r5 = _nt_eol
923
+ if r5
924
+ r3 = r5
925
+ else
926
+ self.index = i3
927
+ r3 = nil
928
+ end
929
+ end
930
+ if r3
931
+ r2 = nil
932
+ else
933
+ self.index = i2
934
+ r2 = SyntaxNode.new(input, index...index)
935
+ end
936
+ s1 << r2
937
+ if r2
938
+ if index < input_length
939
+ r6 = (SyntaxNode).new(input, index...(index + 1))
940
+ @index += 1
941
+ else
942
+ terminal_parse_failure("any character")
943
+ r6 = nil
944
+ end
945
+ s1 << r6
946
+ end
947
+ if s1.last
948
+ r1 = (SyntaxNode).new(input, i1...index, s1)
949
+ r1.extend(CellValue0)
950
+ else
951
+ self.index = i1
952
+ r1 = nil
953
+ end
954
+ if r1
955
+ s0 << r1
956
+ else
957
+ break
958
+ end
959
+ end
960
+ r0 = SyntaxNode.new(input, i0...index, s0)
961
+
962
+ node_cache[:cell_value][start_index] = r0
963
+
964
+ return r0
965
+ end
966
+
967
+ module StepSequence0
968
+ def space
969
+ elements[0]
970
+ end
971
+
972
+ def step
973
+ elements[1]
974
+ end
975
+ end
976
+
977
+ module StepSequence1
978
+ def head
979
+ elements[0]
980
+ end
981
+
982
+ def tail
983
+ elements[1]
984
+ end
985
+ end
986
+
987
+ module StepSequence2
988
+ def compile(scenario)
989
+ ([head] + tail).each do |step|
990
+ step.compile(scenario)
991
+ end
992
+ end
993
+
994
+ def tail
995
+ super.elements.map { |elt| elt.step }
996
+ end
997
+ end
998
+
999
+ def _nt_step_sequence
1000
+ start_index = index
1001
+ if node_cache[:step_sequence].has_key?(index)
1002
+ cached = node_cache[:step_sequence][index]
1003
+ @index = cached.interval.end if cached
1004
+ return cached
1005
+ end
1006
+
1007
+ i0, s0 = index, []
1008
+ r1 = _nt_step
1009
+ s0 << r1
1010
+ if r1
1011
+ s2, i2 = [], index
1012
+ loop do
1013
+ i3, s3 = index, []
1014
+ r4 = _nt_space
1015
+ s3 << r4
1016
+ if r4
1017
+ r5 = _nt_step
1018
+ s3 << r5
1019
+ end
1020
+ if s3.last
1021
+ r3 = (SyntaxNode).new(input, i3...index, s3)
1022
+ r3.extend(StepSequence0)
1023
+ else
1024
+ self.index = i3
1025
+ r3 = nil
1026
+ end
1027
+ if r3
1028
+ s2 << r3
1029
+ else
1030
+ break
1031
+ end
1032
+ end
1033
+ r2 = SyntaxNode.new(input, i2...index, s2)
1034
+ s0 << r2
1035
+ end
1036
+ if s0.last
1037
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1038
+ r0.extend(StepSequence1)
1039
+ r0.extend(StepSequence2)
1040
+ else
1041
+ self.index = i0
1042
+ r0 = nil
1043
+ end
1044
+
1045
+ node_cache[:step_sequence][start_index] = r0
1046
+
1047
+ return r0
1048
+ end
1049
+
1050
+ def _nt_step
1051
+ start_index = index
1052
+ if node_cache[:step].has_key?(index)
1053
+ cached = node_cache[:step][index]
1054
+ @index = cached.interval.end if cached
1055
+ return cached
1056
+ end
1057
+
1058
+ i0 = index
1059
+ r1 = _nt_given_scenario
1060
+ if r1
1061
+ r0 = r1
1062
+ else
1063
+ r2 = _nt_plain_step
1064
+ if r2
1065
+ r0 = r2
1066
+ else
1067
+ self.index = i0
1068
+ r0 = nil
1069
+ end
1070
+ end
1071
+
1072
+ node_cache[:step][start_index] = r0
1073
+
1074
+ return r0
1075
+ end
1076
+
1077
+ module GivenScenario0
1078
+ def given_scenario_keyword
1079
+ elements[0]
1080
+ end
1081
+
1082
+ def name
1083
+ elements[2]
1084
+ end
1085
+ end
1086
+
1087
+ module GivenScenario1
1088
+ def compile(scenario)
1089
+ line = input.line_of(interval.first)
1090
+ scenario.create_given_scenario(name.text_value.strip, line)
1091
+ end
1092
+ end
1093
+
1094
+ def _nt_given_scenario
1095
+ start_index = index
1096
+ if node_cache[:given_scenario].has_key?(index)
1097
+ cached = node_cache[:given_scenario][index]
1098
+ @index = cached.interval.end if cached
1099
+ return cached
1100
+ end
1101
+
1102
+ i0, s0 = index, []
1103
+ r1 = _nt_given_scenario_keyword
1104
+ s0 << r1
1105
+ if r1
1106
+ r3 = _nt_space
1107
+ if r3
1108
+ r2 = r3
1109
+ else
1110
+ r2 = SyntaxNode.new(input, index...index)
1111
+ end
1112
+ s0 << r2
1113
+ if r2
1114
+ r4 = _nt_line_to_eol
1115
+ s0 << r4
1116
+ end
1117
+ end
1118
+ if s0.last
1119
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1120
+ r0.extend(GivenScenario0)
1121
+ r0.extend(GivenScenario1)
1122
+ else
1123
+ self.index = i0
1124
+ r0 = nil
1125
+ end
1126
+
1127
+ node_cache[:given_scenario][start_index] = r0
1128
+
1129
+ return r0
1130
+ end
1131
+
1132
+ module PlainStep0
1133
+ def step_keyword
1134
+ elements[0]
1135
+ end
1136
+
1137
+ def name
1138
+ elements[2]
1139
+ end
1140
+
1141
+ def multi
1142
+ elements[3]
1143
+ end
1144
+ end
1145
+
1146
+ module PlainStep1
1147
+ def compile(scenario)
1148
+ line = input.line_of(interval.first)
1149
+ step = scenario.create_step(step_keyword.text_value, name.text_value.strip, line)
1150
+
1151
+ if multi.respond_to?(:to_arg)
1152
+ step.extra_args << multi.to_arg
1153
+ end
1154
+ end
1155
+ end
1156
+
1157
+ def _nt_plain_step
1158
+ start_index = index
1159
+ if node_cache[:plain_step].has_key?(index)
1160
+ cached = node_cache[:plain_step][index]
1161
+ @index = cached.interval.end if cached
1162
+ return cached
1163
+ end
1164
+
1165
+ i0, s0 = index, []
1166
+ r1 = _nt_step_keyword
1167
+ s0 << r1
1168
+ if r1
1169
+ r3 = _nt_space
1170
+ if r3
1171
+ r2 = r3
1172
+ else
1173
+ r2 = SyntaxNode.new(input, index...index)
1174
+ end
1175
+ s0 << r2
1176
+ if r2
1177
+ r4 = _nt_line_to_eol
1178
+ s0 << r4
1179
+ if r4
1180
+ r6 = _nt_multiline_arg
1181
+ if r6
1182
+ r5 = r6
1183
+ else
1184
+ r5 = SyntaxNode.new(input, index...index)
1185
+ end
1186
+ s0 << r5
1187
+ end
1188
+ end
1189
+ end
1190
+ if s0.last
1191
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1192
+ r0.extend(PlainStep0)
1193
+ r0.extend(PlainStep1)
1194
+ else
1195
+ self.index = i0
1196
+ r0 = nil
1197
+ end
1198
+
1199
+ node_cache[:plain_step][start_index] = r0
1200
+
1201
+ return r0
1202
+ end
1203
+
1204
+ def _nt_multiline_arg
1205
+ start_index = index
1206
+ if node_cache[:multiline_arg].has_key?(index)
1207
+ cached = node_cache[:multiline_arg][index]
1208
+ @index = cached.interval.end if cached
1209
+ return cached
1210
+ end
1211
+
1212
+ i0 = index
1213
+ r1 = _nt_table
1214
+ if r1
1215
+ r0 = r1
1216
+ else
1217
+ r2 = _nt_multiline_string
1218
+ if r2
1219
+ r0 = r2
1220
+ else
1221
+ self.index = i0
1222
+ r0 = nil
1223
+ end
1224
+ end
1225
+
1226
+ node_cache[:multiline_arg][start_index] = r0
1227
+
1228
+ return r0
1229
+ end
1230
+
1231
+ module MultilineString0
1232
+ end
1233
+
1234
+ module MultilineString1
1235
+ def eol
1236
+ elements[0]
1237
+ end
1238
+
1239
+ def indent
1240
+ elements[1]
1241
+ end
1242
+
1243
+ def triple_quote
1244
+ elements[2]
1245
+ end
1246
+
1247
+ def string
1248
+ elements[3]
1249
+ end
1250
+
1251
+ def triple_quote
1252
+ elements[4]
1253
+ end
1254
+ end
1255
+
1256
+ module MultilineString2
1257
+ def to_arg
1258
+ indent_length = indent.text_value.length
1259
+ significant_lines = string.text_value.split("\n")[1..-2]
1260
+ significant_lines.map do |l|
1261
+ l[indent_length..-1]
1262
+ end.join("\n")
1263
+ end
1264
+ end
1265
+
1266
+ def _nt_multiline_string
1267
+ start_index = index
1268
+ if node_cache[:multiline_string].has_key?(index)
1269
+ cached = node_cache[:multiline_string][index]
1270
+ @index = cached.interval.end if cached
1271
+ return cached
1272
+ end
1273
+
1274
+ i0, s0 = index, []
1275
+ r1 = _nt_eol
1276
+ s0 << r1
1277
+ if r1
1278
+ r2 = _nt_space
1279
+ s0 << r2
1280
+ if r2
1281
+ r3 = _nt_triple_quote
1282
+ s0 << r3
1283
+ if r3
1284
+ s4, i4 = [], index
1285
+ loop do
1286
+ i5, s5 = index, []
1287
+ i6 = index
1288
+ r7 = _nt_triple_quote
1289
+ if r7
1290
+ r6 = nil
1291
+ else
1292
+ self.index = i6
1293
+ r6 = SyntaxNode.new(input, index...index)
1294
+ end
1295
+ s5 << r6
1296
+ if r6
1297
+ if index < input_length
1298
+ r8 = (SyntaxNode).new(input, index...(index + 1))
1299
+ @index += 1
1300
+ else
1301
+ terminal_parse_failure("any character")
1302
+ r8 = nil
1303
+ end
1304
+ s5 << r8
1305
+ end
1306
+ if s5.last
1307
+ r5 = (SyntaxNode).new(input, i5...index, s5)
1308
+ r5.extend(MultilineString0)
1309
+ else
1310
+ self.index = i5
1311
+ r5 = nil
1312
+ end
1313
+ if r5
1314
+ s4 << r5
1315
+ else
1316
+ break
1317
+ end
1318
+ end
1319
+ r4 = SyntaxNode.new(input, i4...index, s4)
1320
+ s0 << r4
1321
+ if r4
1322
+ r9 = _nt_triple_quote
1323
+ s0 << r9
1324
+ end
1325
+ end
1326
+ end
1327
+ end
1328
+ if s0.last
1329
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1330
+ r0.extend(MultilineString1)
1331
+ r0.extend(MultilineString2)
1332
+ else
1333
+ self.index = i0
1334
+ r0 = nil
1335
+ end
1336
+
1337
+ node_cache[:multiline_string][start_index] = r0
1338
+
1339
+ return r0
1340
+ end
1341
+
1342
+ def _nt_triple_quote
1343
+ start_index = index
1344
+ if node_cache[:triple_quote].has_key?(index)
1345
+ cached = node_cache[:triple_quote][index]
1346
+ @index = cached.interval.end if cached
1347
+ return cached
1348
+ end
1349
+
1350
+ if input.index('"""', index) == index
1351
+ r0 = (SyntaxNode).new(input, index...(index + 3))
1352
+ @index += 3
1353
+ else
1354
+ terminal_parse_failure('"""')
1355
+ r0 = nil
1356
+ end
1357
+
1358
+ node_cache[:triple_quote][start_index] = r0
1359
+
1360
+ return r0
1361
+ end
1362
+
1363
+ def _nt_separator
1364
+ start_index = index
1365
+ if node_cache[:separator].has_key?(index)
1366
+ cached = node_cache[:separator][index]
1367
+ @index = cached.interval.end if cached
1368
+ return cached
1369
+ end
1370
+
1371
+ if input.index('|', index) == index
1372
+ r0 = (SyntaxNode).new(input, index...(index + 1))
1373
+ @index += 1
1374
+ else
1375
+ terminal_parse_failure('|')
1376
+ r0 = nil
1377
+ end
1378
+
1379
+ node_cache[:separator][start_index] = r0
1380
+
1381
+ return r0
1382
+ end
1383
+
1384
+ def _nt_space
1385
+ start_index = index
1386
+ if node_cache[:space].has_key?(index)
1387
+ cached = node_cache[:space][index]
1388
+ @index = cached.interval.end if cached
1389
+ return cached
1390
+ end
1391
+
1392
+ s0, i0 = [], index
1393
+ loop do
1394
+ i1 = index
1395
+ r2 = _nt_white
1396
+ if r2
1397
+ r1 = r2
1398
+ else
1399
+ r3 = _nt_comment_to_eol
1400
+ if r3
1401
+ r1 = r3
1402
+ else
1403
+ self.index = i1
1404
+ r1 = nil
1405
+ end
1406
+ end
1407
+ if r1
1408
+ s0 << r1
1409
+ else
1410
+ break
1411
+ end
1412
+ end
1413
+ if s0.empty?
1414
+ self.index = i0
1415
+ r0 = nil
1416
+ else
1417
+ r0 = SyntaxNode.new(input, i0...index, s0)
1418
+ end
1419
+
1420
+ node_cache[:space][start_index] = r0
1421
+
1422
+ return r0
1423
+ end
1424
+
1425
+ module LineToEol0
1426
+ end
1427
+
1428
+ def _nt_line_to_eol
1429
+ start_index = index
1430
+ if node_cache[:line_to_eol].has_key?(index)
1431
+ cached = node_cache[:line_to_eol][index]
1432
+ @index = cached.interval.end if cached
1433
+ return cached
1434
+ end
1435
+
1436
+ s0, i0 = [], index
1437
+ loop do
1438
+ i1, s1 = index, []
1439
+ i2 = index
1440
+ r3 = _nt_eol
1441
+ if r3
1442
+ r2 = nil
1443
+ else
1444
+ self.index = i2
1445
+ r2 = SyntaxNode.new(input, index...index)
1446
+ end
1447
+ s1 << r2
1448
+ if r2
1449
+ if index < input_length
1450
+ r4 = (SyntaxNode).new(input, index...(index + 1))
1451
+ @index += 1
1452
+ else
1453
+ terminal_parse_failure("any character")
1454
+ r4 = nil
1455
+ end
1456
+ s1 << r4
1457
+ end
1458
+ if s1.last
1459
+ r1 = (SyntaxNode).new(input, i1...index, s1)
1460
+ r1.extend(LineToEol0)
1461
+ else
1462
+ self.index = i1
1463
+ r1 = nil
1464
+ end
1465
+ if r1
1466
+ s0 << r1
1467
+ else
1468
+ break
1469
+ end
1470
+ end
1471
+ r0 = SyntaxNode.new(input, i0...index, s0)
1472
+
1473
+ node_cache[:line_to_eol][start_index] = r0
1474
+
1475
+ return r0
1476
+ end
1477
+
1478
+ module CommentToEol0
1479
+ def line_to_eol
1480
+ elements[1]
1481
+ end
1482
+ end
1483
+
1484
+ def _nt_comment_to_eol
1485
+ start_index = index
1486
+ if node_cache[:comment_to_eol].has_key?(index)
1487
+ cached = node_cache[:comment_to_eol][index]
1488
+ @index = cached.interval.end if cached
1489
+ return cached
1490
+ end
1491
+
1492
+ i0, s0 = index, []
1493
+ if input.index('#', index) == index
1494
+ r1 = (SyntaxNode).new(input, index...(index + 1))
1495
+ @index += 1
1496
+ else
1497
+ terminal_parse_failure('#')
1498
+ r1 = nil
1499
+ end
1500
+ s0 << r1
1501
+ if r1
1502
+ r2 = _nt_line_to_eol
1503
+ s0 << r2
1504
+ end
1505
+ if s0.last
1506
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1507
+ r0.extend(CommentToEol0)
1508
+ else
1509
+ self.index = i0
1510
+ r0 = nil
1511
+ end
1512
+
1513
+ node_cache[:comment_to_eol][start_index] = r0
1514
+
1515
+ return r0
1516
+ end
1517
+
1518
+ def _nt_white
1519
+ start_index = index
1520
+ if node_cache[:white].has_key?(index)
1521
+ cached = node_cache[:white][index]
1522
+ @index = cached.interval.end if cached
1523
+ return cached
1524
+ end
1525
+
1526
+ i0 = index
1527
+ r1 = _nt_blank
1528
+ if r1
1529
+ r0 = r1
1530
+ else
1531
+ r2 = _nt_eol
1532
+ if r2
1533
+ r0 = r2
1534
+ else
1535
+ self.index = i0
1536
+ r0 = nil
1537
+ end
1538
+ end
1539
+
1540
+ node_cache[:white][start_index] = r0
1541
+
1542
+ return r0
1543
+ end
1544
+
1545
+ def _nt_blank
1546
+ start_index = index
1547
+ if node_cache[:blank].has_key?(index)
1548
+ cached = node_cache[:blank][index]
1549
+ @index = cached.interval.end if cached
1550
+ return cached
1551
+ end
1552
+
1553
+ if input.index(Regexp.new('[ \\t]'), index) == index
1554
+ r0 = (SyntaxNode).new(input, index...(index + 1))
1555
+ @index += 1
1556
+ else
1557
+ r0 = nil
1558
+ end
1559
+
1560
+ node_cache[:blank][start_index] = r0
1561
+
1562
+ return r0
1563
+ end
1564
+
1565
+ module Eol0
1566
+ end
1567
+
1568
+ def _nt_eol
1569
+ start_index = index
1570
+ if node_cache[:eol].has_key?(index)
1571
+ cached = node_cache[:eol][index]
1572
+ @index = cached.interval.end if cached
1573
+ return cached
1574
+ end
1575
+
1576
+ i0 = index
1577
+ i1, s1 = index, []
1578
+ if input.index("\r", index) == index
1579
+ r2 = (SyntaxNode).new(input, index...(index + 1))
1580
+ @index += 1
1581
+ else
1582
+ terminal_parse_failure("\r")
1583
+ r2 = nil
1584
+ end
1585
+ s1 << r2
1586
+ if r2
1587
+ if input.index("\n", index) == index
1588
+ r4 = (SyntaxNode).new(input, index...(index + 1))
1589
+ @index += 1
1590
+ else
1591
+ terminal_parse_failure("\n")
1592
+ r4 = nil
1593
+ end
1594
+ if r4
1595
+ r3 = r4
1596
+ else
1597
+ r3 = SyntaxNode.new(input, index...index)
1598
+ end
1599
+ s1 << r3
1600
+ end
1601
+ if s1.last
1602
+ r1 = (SyntaxNode).new(input, i1...index, s1)
1603
+ r1.extend(Eol0)
1604
+ else
1605
+ self.index = i1
1606
+ r1 = nil
1607
+ end
1608
+ if r1
1609
+ r0 = r1
1610
+ else
1611
+ if input.index("\n", index) == index
1612
+ r5 = (SyntaxNode).new(input, index...(index + 1))
1613
+ @index += 1
1614
+ else
1615
+ terminal_parse_failure("\n")
1616
+ r5 = nil
1617
+ end
1618
+ if r5
1619
+ r0 = r5
1620
+ else
1621
+ self.index = i0
1622
+ r0 = nil
1623
+ end
1624
+ end
1625
+
1626
+ node_cache[:eol][start_index] = r0
1627
+
1628
+ return r0
1629
+ end
1630
+
1631
+ def _nt_step_keyword
1632
+ start_index = index
1633
+ if node_cache[:step_keyword].has_key?(index)
1634
+ cached = node_cache[:step_keyword][index]
1635
+ @index = cached.interval.end if cached
1636
+ return cached
1637
+ end
1638
+
1639
+ i0 = index
1640
+ if input.index("Oletetaan", index) == index
1641
+ r1 = (SyntaxNode).new(input, index...(index + 9))
1642
+ @index += 9
1643
+ else
1644
+ terminal_parse_failure("Oletetaan")
1645
+ r1 = nil
1646
+ end
1647
+ if r1
1648
+ r0 = r1
1649
+ else
1650
+ if input.index("Kun", index) == index
1651
+ r2 = (SyntaxNode).new(input, index...(index + 3))
1652
+ @index += 3
1653
+ else
1654
+ terminal_parse_failure("Kun")
1655
+ r2 = nil
1656
+ end
1657
+ if r2
1658
+ r0 = r2
1659
+ else
1660
+ if input.index("Niin", index) == index
1661
+ r3 = (SyntaxNode).new(input, index...(index + 4))
1662
+ @index += 4
1663
+ else
1664
+ terminal_parse_failure("Niin")
1665
+ r3 = nil
1666
+ end
1667
+ if r3
1668
+ r0 = r3
1669
+ else
1670
+ if input.index("Ja", index) == index
1671
+ r4 = (SyntaxNode).new(input, index...(index + 2))
1672
+ @index += 2
1673
+ else
1674
+ terminal_parse_failure("Ja")
1675
+ r4 = nil
1676
+ end
1677
+ if r4
1678
+ r0 = r4
1679
+ else
1680
+ if input.index("Mutta", index) == index
1681
+ r5 = (SyntaxNode).new(input, index...(index + 5))
1682
+ @index += 5
1683
+ else
1684
+ terminal_parse_failure("Mutta")
1685
+ r5 = nil
1686
+ end
1687
+ if r5
1688
+ r0 = r5
1689
+ else
1690
+ self.index = i0
1691
+ r0 = nil
1692
+ end
1693
+ end
1694
+ end
1695
+ end
1696
+ end
1697
+
1698
+ node_cache[:step_keyword][start_index] = r0
1699
+
1700
+ return r0
1701
+ end
1702
+
1703
+ module ScenarioKeyword0
1704
+ end
1705
+
1706
+ def _nt_scenario_keyword
1707
+ start_index = index
1708
+ if node_cache[:scenario_keyword].has_key?(index)
1709
+ cached = node_cache[:scenario_keyword][index]
1710
+ @index = cached.interval.end if cached
1711
+ return cached
1712
+ end
1713
+
1714
+ i0, s0 = index, []
1715
+ if input.index("Tapaus", index) == index
1716
+ r1 = (SyntaxNode).new(input, index...(index + 6))
1717
+ @index += 6
1718
+ else
1719
+ terminal_parse_failure("Tapaus")
1720
+ r1 = nil
1721
+ end
1722
+ s0 << r1
1723
+ if r1
1724
+ if input.index(":", index) == index
1725
+ r3 = (SyntaxNode).new(input, index...(index + 1))
1726
+ @index += 1
1727
+ else
1728
+ terminal_parse_failure(":")
1729
+ r3 = nil
1730
+ end
1731
+ if r3
1732
+ r2 = r3
1733
+ else
1734
+ r2 = SyntaxNode.new(input, index...index)
1735
+ end
1736
+ s0 << r2
1737
+ end
1738
+ if s0.last
1739
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1740
+ r0.extend(ScenarioKeyword0)
1741
+ else
1742
+ self.index = i0
1743
+ r0 = nil
1744
+ end
1745
+
1746
+ node_cache[:scenario_keyword][start_index] = r0
1747
+
1748
+ return r0
1749
+ end
1750
+
1751
+ module ScenarioOutlineKeyword0
1752
+ end
1753
+
1754
+ def _nt_scenario_outline_keyword
1755
+ start_index = index
1756
+ if node_cache[:scenario_outline_keyword].has_key?(index)
1757
+ cached = node_cache[:scenario_outline_keyword][index]
1758
+ @index = cached.interval.end if cached
1759
+ return cached
1760
+ end
1761
+
1762
+ i0, s0 = index, []
1763
+ if input.index("Tapausaihio", index) == index
1764
+ r1 = (SyntaxNode).new(input, index...(index + 11))
1765
+ @index += 11
1766
+ else
1767
+ terminal_parse_failure("Tapausaihio")
1768
+ r1 = nil
1769
+ end
1770
+ s0 << r1
1771
+ if r1
1772
+ if input.index(":", index) == index
1773
+ r3 = (SyntaxNode).new(input, index...(index + 1))
1774
+ @index += 1
1775
+ else
1776
+ terminal_parse_failure(":")
1777
+ r3 = nil
1778
+ end
1779
+ if r3
1780
+ r2 = r3
1781
+ else
1782
+ r2 = SyntaxNode.new(input, index...index)
1783
+ end
1784
+ s0 << r2
1785
+ end
1786
+ if s0.last
1787
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1788
+ r0.extend(ScenarioOutlineKeyword0)
1789
+ else
1790
+ self.index = i0
1791
+ r0 = nil
1792
+ end
1793
+
1794
+ node_cache[:scenario_outline_keyword][start_index] = r0
1795
+
1796
+ return r0
1797
+ end
1798
+
1799
+ module MoreExamplesKeyword0
1800
+ end
1801
+
1802
+ def _nt_more_examples_keyword
1803
+ start_index = index
1804
+ if node_cache[:more_examples_keyword].has_key?(index)
1805
+ cached = node_cache[:more_examples_keyword][index]
1806
+ @index = cached.interval.end if cached
1807
+ return cached
1808
+ end
1809
+
1810
+ i0, s0 = index, []
1811
+ if input.index("Lisätapaukset", index) == index
1812
+ r1 = (SyntaxNode).new(input, index...(index + 14))
1813
+ @index += 14
1814
+ else
1815
+ terminal_parse_failure("Lisätapaukset")
1816
+ r1 = nil
1817
+ end
1818
+ s0 << r1
1819
+ if r1
1820
+ if input.index(":", index) == index
1821
+ r3 = (SyntaxNode).new(input, index...(index + 1))
1822
+ @index += 1
1823
+ else
1824
+ terminal_parse_failure(":")
1825
+ r3 = nil
1826
+ end
1827
+ if r3
1828
+ r2 = r3
1829
+ else
1830
+ r2 = SyntaxNode.new(input, index...index)
1831
+ end
1832
+ s0 << r2
1833
+ end
1834
+ if s0.last
1835
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1836
+ r0.extend(MoreExamplesKeyword0)
1837
+ else
1838
+ self.index = i0
1839
+ r0 = nil
1840
+ end
1841
+
1842
+ node_cache[:more_examples_keyword][start_index] = r0
1843
+
1844
+ return r0
1845
+ end
1846
+
1847
+ module ExamplesKeyword0
1848
+ end
1849
+
1850
+ def _nt_examples_keyword
1851
+ start_index = index
1852
+ if node_cache[:examples_keyword].has_key?(index)
1853
+ cached = node_cache[:examples_keyword][index]
1854
+ @index = cached.interval.end if cached
1855
+ return cached
1856
+ end
1857
+
1858
+ i0, s0 = index, []
1859
+ if input.index("Tapaukset", index) == index
1860
+ r1 = (SyntaxNode).new(input, index...(index + 9))
1861
+ @index += 9
1862
+ else
1863
+ terminal_parse_failure("Tapaukset")
1864
+ r1 = nil
1865
+ end
1866
+ s0 << r1
1867
+ if r1
1868
+ if input.index(":", index) == index
1869
+ r3 = (SyntaxNode).new(input, index...(index + 1))
1870
+ @index += 1
1871
+ else
1872
+ terminal_parse_failure(":")
1873
+ r3 = nil
1874
+ end
1875
+ if r3
1876
+ r2 = r3
1877
+ else
1878
+ r2 = SyntaxNode.new(input, index...index)
1879
+ end
1880
+ s0 << r2
1881
+ end
1882
+ if s0.last
1883
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1884
+ r0.extend(ExamplesKeyword0)
1885
+ else
1886
+ self.index = i0
1887
+ r0 = nil
1888
+ end
1889
+
1890
+ node_cache[:examples_keyword][start_index] = r0
1891
+
1892
+ return r0
1893
+ end
1894
+
1895
+ module GivenScenarioKeyword0
1896
+ end
1897
+
1898
+ def _nt_given_scenario_keyword
1899
+ start_index = index
1900
+ if node_cache[:given_scenario_keyword].has_key?(index)
1901
+ cached = node_cache[:given_scenario_keyword][index]
1902
+ @index = cached.interval.end if cached
1903
+ return cached
1904
+ end
1905
+
1906
+ i0, s0 = index, []
1907
+ if input.index("Oletetaan tapaus", index) == index
1908
+ r1 = (SyntaxNode).new(input, index...(index + 16))
1909
+ @index += 16
1910
+ else
1911
+ terminal_parse_failure("Oletetaan tapaus")
1912
+ r1 = nil
1913
+ end
1914
+ s0 << r1
1915
+ if r1
1916
+ if input.index(":", index) == index
1917
+ r3 = (SyntaxNode).new(input, index...(index + 1))
1918
+ @index += 1
1919
+ else
1920
+ terminal_parse_failure(":")
1921
+ r3 = nil
1922
+ end
1923
+ if r3
1924
+ r2 = r3
1925
+ else
1926
+ r2 = SyntaxNode.new(input, index...index)
1927
+ end
1928
+ s0 << r2
1929
+ end
1930
+ if s0.last
1931
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1932
+ r0.extend(GivenScenarioKeyword0)
1933
+ else
1934
+ self.index = i0
1935
+ r0 = nil
1936
+ end
1937
+
1938
+ node_cache[:given_scenario_keyword][start_index] = r0
1939
+
1940
+ return r0
1941
+ end
1942
+
1943
+ end
1944
+
1945
+ class FeatureParser < Treetop::Runtime::CompiledParser
1946
+ include Feature
1947
+ end
1948
+
1949
+
1950
+ end
1951
+ end