cucumber 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (80) hide show
  1. data/History.txt +81 -0
  2. data/Manifest.txt +30 -9
  3. data/README.txt +1 -2
  4. data/bin/cucumber +1 -1
  5. data/examples/calculator/README.txt +5 -0
  6. data/examples/calculator/Rakefile +1 -2
  7. data/examples/calculator/features/addition.feature +1 -0
  8. data/examples/chinese_simplified_calculator/Rakefile +6 -0
  9. data/examples/chinese_simplified_calculator/features/addition.feature +17 -0
  10. data/examples/chinese_simplified_calculator/features/steps/calculator_steps.rb +24 -0
  11. data/examples/chinese_simplified_calculator/lib/calculator.rb +10 -0
  12. data/examples/java/features/steps/hello_steps.rb +1 -1
  13. data/examples/swedish_calculator/Rakefile +5 -0
  14. data/examples/swedish_calculator/features/steps/kalkulator_steps.rb +22 -0
  15. data/examples/swedish_calculator/features/summering.feature +17 -0
  16. data/examples/swedish_calculator/lib/kalkulator.rb +11 -0
  17. data/examples/tickets/Rakefile +8 -1
  18. data/examples/tickets/cucumber.yml +2 -0
  19. data/examples/tickets/features/steps/tickets_steps.rb +15 -0
  20. data/examples/tickets/features/tickets.feature +12 -1
  21. data/gem_tasks/treetop.rake +35 -23
  22. data/lib/cucumber.rb +1 -0
  23. data/lib/cucumber/cli.rb +19 -5
  24. data/lib/cucumber/core_ext/proc.rb +8 -5
  25. data/lib/cucumber/executor.rb +7 -1
  26. data/lib/cucumber/formatters.rb +1 -1
  27. data/lib/cucumber/formatters/html_formatter.rb +6 -3
  28. data/lib/cucumber/formatters/pretty_formatter.rb +29 -7
  29. data/lib/cucumber/formatters/profile_formatter.rb +92 -0
  30. data/lib/cucumber/languages.yml +39 -12
  31. data/lib/cucumber/model.rb +1 -0
  32. data/lib/cucumber/model/table.rb +28 -0
  33. data/lib/cucumber/rails/world.rb +1 -3
  34. data/lib/cucumber/rake/task.rb +1 -1
  35. data/lib/cucumber/tree/feature.rb +8 -2
  36. data/lib/cucumber/tree/scenario.rb +23 -6
  37. data/lib/cucumber/tree/step.rb +5 -4
  38. data/lib/cucumber/treetop_parser/feature.treetop.erb +54 -12
  39. data/lib/cucumber/treetop_parser/feature_da.rb +415 -74
  40. data/lib/cucumber/treetop_parser/feature_de.rb +415 -74
  41. data/lib/cucumber/treetop_parser/feature_en.rb +415 -74
  42. data/lib/cucumber/treetop_parser/feature_es.rb +415 -74
  43. data/lib/cucumber/treetop_parser/feature_et.rb +415 -74
  44. data/lib/cucumber/treetop_parser/feature_fr.rb +415 -74
  45. data/lib/cucumber/treetop_parser/feature_nl.rb +1593 -0
  46. data/lib/cucumber/treetop_parser/feature_no.rb +415 -74
  47. data/lib/cucumber/treetop_parser/feature_pt.rb +415 -74
  48. data/lib/cucumber/treetop_parser/feature_ru.rb +415 -74
  49. data/lib/cucumber/treetop_parser/feature_se.rb +419 -78
  50. data/lib/cucumber/treetop_parser/feature_zh-CN.rb +1593 -0
  51. data/lib/cucumber/version.rb +1 -1
  52. data/{generators → rails_generators}/cucumber/cucumber_generator.rb +0 -0
  53. data/{generators → rails_generators}/cucumber/templates/common_webrat.rb +1 -10
  54. data/{generators → rails_generators}/cucumber/templates/cucumber +0 -0
  55. data/{generators → rails_generators}/cucumber/templates/cucumber.rake +0 -0
  56. data/{generators → rails_generators}/cucumber/templates/env.rb +0 -0
  57. data/{generators → rails_generators}/feature/feature_generator.rb +0 -0
  58. data/{generators → rails_generators}/feature/templates/feature.erb +1 -0
  59. data/{generators → rails_generators}/feature/templates/steps.erb +0 -0
  60. data/spec/cucumber/cli_spec.rb +11 -3
  61. data/spec/cucumber/core_ext/proc_spec.rb +6 -0
  62. data/spec/cucumber/formatters/html_formatter_spec.rb +16 -1
  63. data/spec/cucumber/formatters/pretty_formatter_spec.rb +54 -25
  64. data/spec/cucumber/formatters/profile_formatter_spec.rb +193 -0
  65. data/spec/cucumber/model/table_spec.rb +20 -0
  66. data/spec/cucumber/rails/stubs/mini_rails.rb +17 -0
  67. data/spec/cucumber/rails/stubs/test_help.rb +1 -0
  68. data/spec/cucumber/rails/world_spec.rb +11 -0
  69. data/spec/cucumber/tree/feature_spec.rb +12 -0
  70. data/spec/cucumber/tree/scenario_spec.rb +22 -0
  71. data/spec/cucumber/tree/step_spec.rb +12 -2
  72. data/spec/cucumber/treetop_parser/empty_scenario.feature +1 -1
  73. data/spec/cucumber/treetop_parser/feature_parser_spec.rb +18 -0
  74. data/spec/cucumber/treetop_parser/fit_scenario.feature +1 -0
  75. data/spec/cucumber/treetop_parser/multiline_steps.feature +13 -0
  76. data/spec/cucumber/treetop_parser/multiple_tables.feature +2 -0
  77. data/spec/cucumber/treetop_parser/test_dos.feature +1 -0
  78. data/spec/cucumber/treetop_parser/with_comments.feature +6 -2
  79. metadata +34 -12
  80. data/examples/calculator/cucumber.yml +0 -1
@@ -0,0 +1,1593 @@
1
+ module Cucumber #:nodoc:
2
+ module TreetopParser #:nodoc:
3
+
4
+ module Feature #:nodoc:
5
+ include Treetop::Runtime
6
+
7
+ def root #:nodoc:
8
+ @root || :root
9
+ end
10
+
11
+ module Root0 #:nodoc:
12
+ def header #:nodoc:
13
+ elements[1]
14
+ end
15
+
16
+ def scenario_sequence #:nodoc:
17
+ elements[2]
18
+ end
19
+
20
+ end
21
+
22
+ module Root1 #:nodoc:
23
+ def compile #:nodoc:
24
+ feature = Tree::Feature.new(header.text_value.strip)
25
+ scenario_sequence.compile(feature)
26
+ feature
27
+ end
28
+ end
29
+
30
+ def _nt_root #:nodoc:
31
+ start_index = index
32
+ if node_cache[:root].has_key?(index)
33
+ cached = node_cache[:root][index]
34
+ @index = cached.interval.end if cached
35
+ return cached
36
+ end
37
+
38
+ i0, s0 = index, []
39
+ r2 = _nt_space
40
+ if r2
41
+ r1 = r2
42
+ else
43
+ r1 = SyntaxNode.new(input, index...index)
44
+ end
45
+ s0 << r1
46
+ if r1
47
+ r3 = _nt_header
48
+ s0 << r3
49
+ if r3
50
+ r4 = _nt_scenario_sequence
51
+ s0 << r4
52
+ if r4
53
+ r6 = _nt_space
54
+ if r6
55
+ r5 = r6
56
+ else
57
+ r5 = SyntaxNode.new(input, index...index)
58
+ end
59
+ s0 << r5
60
+ end
61
+ end
62
+ end
63
+ if s0.last
64
+ r0 = (SyntaxNode).new(input, i0...index, s0)
65
+ r0.extend(Root0)
66
+ r0.extend(Root1)
67
+ else
68
+ self.index = i0
69
+ r0 = nil
70
+ end
71
+
72
+ node_cache[:root][start_index] = r0
73
+
74
+ return r0
75
+ end
76
+
77
+ module Header0 #:nodoc:
78
+ end
79
+
80
+ def _nt_header #:nodoc:
81
+ start_index = index
82
+ if node_cache[:header].has_key?(index)
83
+ cached = node_cache[:header][index]
84
+ @index = cached.interval.end if cached
85
+ return cached
86
+ end
87
+
88
+ s0, i0 = [], index
89
+ loop do
90
+ i1, s1 = index, []
91
+ i2 = index
92
+ i3 = index
93
+ r4 = _nt_scenario_keyword
94
+ if r4
95
+ r3 = r4
96
+ else
97
+ r5 = _nt_comment_to_eol
98
+ if r5
99
+ r3 = r5
100
+ else
101
+ self.index = i3
102
+ r3 = nil
103
+ end
104
+ end
105
+ if r3
106
+ r2 = nil
107
+ else
108
+ self.index = i2
109
+ r2 = SyntaxNode.new(input, index...index)
110
+ end
111
+ s1 << r2
112
+ if r2
113
+ if index < input_length
114
+ r6 = (SyntaxNode).new(input, index...(index + 1))
115
+ @index += 1
116
+ else
117
+ terminal_parse_failure("any character")
118
+ r6 = nil
119
+ end
120
+ s1 << r6
121
+ end
122
+ if s1.last
123
+ r1 = (SyntaxNode).new(input, i1...index, s1)
124
+ r1.extend(Header0)
125
+ else
126
+ self.index = i1
127
+ r1 = nil
128
+ end
129
+ if r1
130
+ s0 << r1
131
+ else
132
+ break
133
+ end
134
+ end
135
+ if s0.empty?
136
+ self.index = i0
137
+ r0 = nil
138
+ else
139
+ r0 = SyntaxNode.new(input, i0...index, s0)
140
+ end
141
+
142
+ node_cache[:header][start_index] = r0
143
+
144
+ return r0
145
+ end
146
+
147
+ module ScenarioSequence0 #:nodoc:
148
+ def space #:nodoc:
149
+ elements[0]
150
+ end
151
+
152
+ def scenario_or_table #:nodoc:
153
+ elements[1]
154
+ end
155
+ end
156
+
157
+ module ScenarioSequence1 #:nodoc:
158
+ def head #:nodoc:
159
+ elements[0]
160
+ end
161
+
162
+ def tail #:nodoc:
163
+ elements[1]
164
+ end
165
+ end
166
+
167
+ module ScenarioSequence2 #:nodoc:
168
+ def compile(feature) #:nodoc:
169
+ ([head] + tail).each do |scenario_or_table|
170
+ scenario_or_table.compile(feature) if scenario_or_table.respond_to?(:compile)
171
+ end
172
+ end
173
+
174
+ def tail #:nodoc:
175
+ super.elements.map { |elt| elt.scenario_or_table }
176
+ end
177
+ end
178
+
179
+ def _nt_scenario_sequence #:nodoc:
180
+ start_index = index
181
+ if node_cache[:scenario_sequence].has_key?(index)
182
+ cached = node_cache[:scenario_sequence][index]
183
+ @index = cached.interval.end if cached
184
+ return cached
185
+ end
186
+
187
+ i0, s0 = index, []
188
+ r2 = _nt_scenario
189
+ if r2
190
+ r1 = r2
191
+ else
192
+ r1 = SyntaxNode.new(input, index...index)
193
+ end
194
+ s0 << r1
195
+ if r1
196
+ s3, i3 = [], index
197
+ loop do
198
+ i4, s4 = index, []
199
+ r5 = _nt_space
200
+ s4 << r5
201
+ if r5
202
+ r6 = _nt_scenario_or_table
203
+ s4 << r6
204
+ end
205
+ if s4.last
206
+ r4 = (SyntaxNode).new(input, i4...index, s4)
207
+ r4.extend(ScenarioSequence0)
208
+ else
209
+ self.index = i4
210
+ r4 = nil
211
+ end
212
+ if r4
213
+ s3 << r4
214
+ else
215
+ break
216
+ end
217
+ end
218
+ r3 = SyntaxNode.new(input, i3...index, s3)
219
+ s0 << r3
220
+ end
221
+ if s0.last
222
+ r0 = (SyntaxNode).new(input, i0...index, s0)
223
+ r0.extend(ScenarioSequence1)
224
+ r0.extend(ScenarioSequence2)
225
+ else
226
+ self.index = i0
227
+ r0 = nil
228
+ end
229
+
230
+ node_cache[:scenario_sequence][start_index] = r0
231
+
232
+ return r0
233
+ end
234
+
235
+ module Scenario0 #:nodoc:
236
+ def space #:nodoc:
237
+ elements[0]
238
+ end
239
+
240
+ def step_sequence #:nodoc:
241
+ elements[1]
242
+ end
243
+ end
244
+
245
+ module Scenario1 #:nodoc:
246
+ def scenario_keyword #:nodoc:
247
+ elements[0]
248
+ end
249
+
250
+ def name #:nodoc:
251
+ elements[2]
252
+ end
253
+
254
+ def steps #:nodoc:
255
+ elements[3]
256
+ end
257
+ end
258
+
259
+ module Scenario2 #:nodoc:
260
+ def compile(feature) #:nodoc:
261
+ line = input.line_of(interval.first)
262
+ scenario = feature.add_scenario(name.text_value.strip, line)
263
+ steps.step_sequence.compile(scenario) if steps.respond_to?(:step_sequence)
264
+ # TODO - GET RID OF THIS last_scenario NASTINESS
265
+ # Use a better datastructure, like a linked list...
266
+ Feature.last_scenario = scenario
267
+ end
268
+ end
269
+
270
+ def _nt_scenario #:nodoc:
271
+ start_index = index
272
+ if node_cache[:scenario].has_key?(index)
273
+ cached = node_cache[:scenario][index]
274
+ @index = cached.interval.end if cached
275
+ return cached
276
+ end
277
+
278
+ i0, s0 = index, []
279
+ r1 = _nt_scenario_keyword
280
+ s0 << r1
281
+ if r1
282
+ r3 = _nt_space
283
+ if r3
284
+ r2 = r3
285
+ else
286
+ r2 = SyntaxNode.new(input, index...index)
287
+ end
288
+ s0 << r2
289
+ if r2
290
+ r4 = _nt_line_to_eol
291
+ s0 << r4
292
+ if r4
293
+ i6, s6 = index, []
294
+ r7 = _nt_space
295
+ s6 << r7
296
+ if r7
297
+ r8 = _nt_step_sequence
298
+ s6 << r8
299
+ end
300
+ if s6.last
301
+ r6 = (SyntaxNode).new(input, i6...index, s6)
302
+ r6.extend(Scenario0)
303
+ else
304
+ self.index = i6
305
+ r6 = nil
306
+ end
307
+ if r6
308
+ r5 = r6
309
+ else
310
+ r5 = SyntaxNode.new(input, index...index)
311
+ end
312
+ s0 << r5
313
+ end
314
+ end
315
+ end
316
+ if s0.last
317
+ r0 = (SyntaxNode).new(input, i0...index, s0)
318
+ r0.extend(Scenario1)
319
+ r0.extend(Scenario2)
320
+ else
321
+ self.index = i0
322
+ r0 = nil
323
+ end
324
+
325
+ node_cache[:scenario][start_index] = r0
326
+
327
+ return r0
328
+ end
329
+
330
+ def _nt_scenario_or_table #:nodoc:
331
+ start_index = index
332
+ if node_cache[:scenario_or_table].has_key?(index)
333
+ cached = node_cache[:scenario_or_table][index]
334
+ @index = cached.interval.end if cached
335
+ return cached
336
+ end
337
+
338
+ i0 = index
339
+ r1 = _nt_scenario
340
+ if r1
341
+ r0 = r1
342
+ else
343
+ r2 = _nt_more_examples
344
+ if r2
345
+ r0 = r2
346
+ else
347
+ self.index = i0
348
+ r0 = nil
349
+ end
350
+ end
351
+
352
+ node_cache[:scenario_or_table][start_index] = r0
353
+
354
+ return r0
355
+ end
356
+
357
+ module MoreExamples0 #:nodoc:
358
+ def more_examples_keyword #:nodoc:
359
+ elements[0]
360
+ end
361
+
362
+ def space #:nodoc:
363
+ elements[1]
364
+ end
365
+
366
+ def table #:nodoc:
367
+ elements[2]
368
+ end
369
+ end
370
+
371
+ module MoreExamples1 #:nodoc:
372
+ def compile(f) #:nodoc:
373
+ table.compile(f)
374
+ end
375
+ end
376
+
377
+ def _nt_more_examples #:nodoc:
378
+ start_index = index
379
+ if node_cache[:more_examples].has_key?(index)
380
+ cached = node_cache[:more_examples][index]
381
+ @index = cached.interval.end if cached
382
+ return cached
383
+ end
384
+
385
+ i0, s0 = index, []
386
+ r1 = _nt_more_examples_keyword
387
+ s0 << r1
388
+ if r1
389
+ r2 = _nt_space
390
+ s0 << r2
391
+ if r2
392
+ r3 = _nt_table
393
+ s0 << r3
394
+ end
395
+ end
396
+ if s0.last
397
+ r0 = (SyntaxNode).new(input, i0...index, s0)
398
+ r0.extend(MoreExamples0)
399
+ r0.extend(MoreExamples1)
400
+ else
401
+ self.index = i0
402
+ r0 = nil
403
+ end
404
+
405
+ node_cache[:more_examples][start_index] = r0
406
+
407
+ return r0
408
+ end
409
+
410
+ module Table0 #:nodoc:
411
+ def eol #:nodoc:
412
+ elements[1]
413
+ end
414
+
415
+ def table_line #:nodoc:
416
+ elements[3]
417
+ end
418
+ end
419
+
420
+ module Table1 #:nodoc:
421
+ def head #:nodoc:
422
+ elements[0]
423
+ end
424
+
425
+ def body #:nodoc:
426
+ elements[1]
427
+ end
428
+ end
429
+
430
+ module Table2 #:nodoc:
431
+ def compile(feature) #:nodoc:
432
+ Feature.last_scenario.table_header = head.cell_values
433
+ body.each do |table_line|
434
+ feature.add_row_scenario(Feature.last_scenario, table_line.cell_values, table_line.line)
435
+ end
436
+ end
437
+
438
+ def matrix #:nodoc:
439
+ ([head] + body).map do |table_line|
440
+ table_line.cell_values # We're losing the line - we'll get it back when we make our own class #:nodoc:
441
+ end
442
+ end
443
+
444
+ def to_arg #:nodoc:
445
+ Model::Table.new(matrix)
446
+ end
447
+
448
+ def body #:nodoc:
449
+ super.elements.map { |elt| elt.table_line }
450
+ end
451
+ end
452
+
453
+ def _nt_table #:nodoc:
454
+ start_index = index
455
+ if node_cache[:table].has_key?(index)
456
+ cached = node_cache[:table][index]
457
+ @index = cached.interval.end if cached
458
+ return cached
459
+ end
460
+
461
+ i0, s0 = index, []
462
+ r1 = _nt_table_line
463
+ s0 << r1
464
+ if r1
465
+ s2, i2 = [], index
466
+ loop do
467
+ i3, s3 = index, []
468
+ s4, i4 = [], index
469
+ loop do
470
+ r5 = _nt_blank
471
+ if r5
472
+ s4 << r5
473
+ else
474
+ break
475
+ end
476
+ end
477
+ r4 = SyntaxNode.new(input, i4...index, s4)
478
+ s3 << r4
479
+ if r4
480
+ r6 = _nt_eol
481
+ s3 << r6
482
+ if r6
483
+ r8 = _nt_space
484
+ if r8
485
+ r7 = r8
486
+ else
487
+ r7 = SyntaxNode.new(input, index...index)
488
+ end
489
+ s3 << r7
490
+ if r7
491
+ r9 = _nt_table_line
492
+ s3 << r9
493
+ end
494
+ end
495
+ end
496
+ if s3.last
497
+ r3 = (SyntaxNode).new(input, i3...index, s3)
498
+ r3.extend(Table0)
499
+ else
500
+ self.index = i3
501
+ r3 = nil
502
+ end
503
+ if r3
504
+ s2 << r3
505
+ else
506
+ break
507
+ end
508
+ end
509
+ r2 = SyntaxNode.new(input, i2...index, s2)
510
+ s0 << r2
511
+ end
512
+ if s0.last
513
+ r0 = (SyntaxNode).new(input, i0...index, s0)
514
+ r0.extend(Table1)
515
+ r0.extend(Table2)
516
+ else
517
+ self.index = i0
518
+ r0 = nil
519
+ end
520
+
521
+ node_cache[:table][start_index] = r0
522
+
523
+ return r0
524
+ end
525
+
526
+ module TableLine0 #:nodoc:
527
+ def cell_value #:nodoc:
528
+ elements[1]
529
+ end
530
+
531
+ def separator #:nodoc:
532
+ elements[3]
533
+ end
534
+ end
535
+
536
+ module TableLine1 #:nodoc:
537
+ def separator #:nodoc:
538
+ elements[0]
539
+ end
540
+
541
+ def cells #:nodoc:
542
+ elements[1]
543
+ end
544
+ end
545
+
546
+ module TableLine2 #:nodoc:
547
+ def cell_values #:nodoc:
548
+ cells.elements.map { |elt| elt.cell_value.text_value.strip }
549
+ end
550
+
551
+ def line #:nodoc:
552
+ input.line_of(interval.first)
553
+ end
554
+ end
555
+
556
+ def _nt_table_line #:nodoc:
557
+ start_index = index
558
+ if node_cache[:table_line].has_key?(index)
559
+ cached = node_cache[:table_line][index]
560
+ @index = cached.interval.end if cached
561
+ return cached
562
+ end
563
+
564
+ i0, s0 = index, []
565
+ r1 = _nt_separator
566
+ s0 << r1
567
+ if r1
568
+ s2, i2 = [], index
569
+ loop do
570
+ i3, s3 = index, []
571
+ s4, i4 = [], index
572
+ loop do
573
+ r5 = _nt_blank
574
+ if r5
575
+ s4 << r5
576
+ else
577
+ break
578
+ end
579
+ end
580
+ r4 = SyntaxNode.new(input, i4...index, s4)
581
+ s3 << r4
582
+ if r4
583
+ r6 = _nt_cell_value
584
+ s3 << r6
585
+ if r6
586
+ s7, i7 = [], index
587
+ loop do
588
+ r8 = _nt_blank
589
+ if r8
590
+ s7 << r8
591
+ else
592
+ break
593
+ end
594
+ end
595
+ r7 = SyntaxNode.new(input, i7...index, s7)
596
+ s3 << r7
597
+ if r7
598
+ r9 = _nt_separator
599
+ s3 << r9
600
+ end
601
+ end
602
+ end
603
+ if s3.last
604
+ r3 = (SyntaxNode).new(input, i3...index, s3)
605
+ r3.extend(TableLine0)
606
+ else
607
+ self.index = i3
608
+ r3 = nil
609
+ end
610
+ if r3
611
+ s2 << r3
612
+ else
613
+ break
614
+ end
615
+ end
616
+ if s2.empty?
617
+ self.index = i2
618
+ r2 = nil
619
+ else
620
+ r2 = SyntaxNode.new(input, i2...index, s2)
621
+ end
622
+ s0 << r2
623
+ end
624
+ if s0.last
625
+ r0 = (SyntaxNode).new(input, i0...index, s0)
626
+ r0.extend(TableLine1)
627
+ r0.extend(TableLine2)
628
+ else
629
+ self.index = i0
630
+ r0 = nil
631
+ end
632
+
633
+ node_cache[:table_line][start_index] = r0
634
+
635
+ return r0
636
+ end
637
+
638
+ module CellValue0 #:nodoc:
639
+ end
640
+
641
+ def _nt_cell_value #:nodoc:
642
+ start_index = index
643
+ if node_cache[:cell_value].has_key?(index)
644
+ cached = node_cache[:cell_value][index]
645
+ @index = cached.interval.end if cached
646
+ return cached
647
+ end
648
+
649
+ s0, i0 = [], index
650
+ loop do
651
+ i1, s1 = index, []
652
+ i2 = index
653
+ i3 = index
654
+ r4 = _nt_separator
655
+ if r4
656
+ r3 = r4
657
+ else
658
+ r5 = _nt_eol
659
+ if r5
660
+ r3 = r5
661
+ else
662
+ self.index = i3
663
+ r3 = nil
664
+ end
665
+ end
666
+ if r3
667
+ r2 = nil
668
+ else
669
+ self.index = i2
670
+ r2 = SyntaxNode.new(input, index...index)
671
+ end
672
+ s1 << r2
673
+ if r2
674
+ if index < input_length
675
+ r6 = (SyntaxNode).new(input, index...(index + 1))
676
+ @index += 1
677
+ else
678
+ terminal_parse_failure("any character")
679
+ r6 = nil
680
+ end
681
+ s1 << r6
682
+ end
683
+ if s1.last
684
+ r1 = (SyntaxNode).new(input, i1...index, s1)
685
+ r1.extend(CellValue0)
686
+ else
687
+ self.index = i1
688
+ r1 = nil
689
+ end
690
+ if r1
691
+ s0 << r1
692
+ else
693
+ break
694
+ end
695
+ end
696
+ r0 = SyntaxNode.new(input, i0...index, s0)
697
+
698
+ node_cache[:cell_value][start_index] = r0
699
+
700
+ return r0
701
+ end
702
+
703
+ module StepSequence0 #:nodoc:
704
+ def space #:nodoc:
705
+ elements[0]
706
+ end
707
+
708
+ def step #:nodoc:
709
+ elements[1]
710
+ end
711
+ end
712
+
713
+ module StepSequence1 #:nodoc:
714
+ def head #:nodoc:
715
+ elements[0]
716
+ end
717
+
718
+ def tail #:nodoc:
719
+ elements[1]
720
+ end
721
+ end
722
+
723
+ module StepSequence2 #:nodoc:
724
+ def compile(scenario) #:nodoc:
725
+ ([head] + tail).each do |step|
726
+ step.compile(scenario)
727
+ end
728
+ end
729
+
730
+ def tail #:nodoc:
731
+ super.elements.map { |elt| elt.step }
732
+ end
733
+ end
734
+
735
+ def _nt_step_sequence #:nodoc:
736
+ start_index = index
737
+ if node_cache[:step_sequence].has_key?(index)
738
+ cached = node_cache[:step_sequence][index]
739
+ @index = cached.interval.end if cached
740
+ return cached
741
+ end
742
+
743
+ i0, s0 = index, []
744
+ r1 = _nt_step
745
+ s0 << r1
746
+ if r1
747
+ s2, i2 = [], index
748
+ loop do
749
+ i3, s3 = index, []
750
+ r4 = _nt_space
751
+ s3 << r4
752
+ if r4
753
+ r5 = _nt_step
754
+ s3 << r5
755
+ end
756
+ if s3.last
757
+ r3 = (SyntaxNode).new(input, i3...index, s3)
758
+ r3.extend(StepSequence0)
759
+ else
760
+ self.index = i3
761
+ r3 = nil
762
+ end
763
+ if r3
764
+ s2 << r3
765
+ else
766
+ break
767
+ end
768
+ end
769
+ r2 = SyntaxNode.new(input, i2...index, s2)
770
+ s0 << r2
771
+ end
772
+ if s0.last
773
+ r0 = (SyntaxNode).new(input, i0...index, s0)
774
+ r0.extend(StepSequence1)
775
+ r0.extend(StepSequence2)
776
+ else
777
+ self.index = i0
778
+ r0 = nil
779
+ end
780
+
781
+ node_cache[:step_sequence][start_index] = r0
782
+
783
+ return r0
784
+ end
785
+
786
+ def _nt_step #:nodoc:
787
+ start_index = index
788
+ if node_cache[:step].has_key?(index)
789
+ cached = node_cache[:step][index]
790
+ @index = cached.interval.end if cached
791
+ return cached
792
+ end
793
+
794
+ i0 = index
795
+ r1 = _nt_given_scenario
796
+ if r1
797
+ r0 = r1
798
+ else
799
+ r2 = _nt_plain_step
800
+ if r2
801
+ r0 = r2
802
+ else
803
+ self.index = i0
804
+ r0 = nil
805
+ end
806
+ end
807
+
808
+ node_cache[:step][start_index] = r0
809
+
810
+ return r0
811
+ end
812
+
813
+ module GivenScenario0 #:nodoc:
814
+ def given_scenario_keyword #:nodoc:
815
+ elements[0]
816
+ end
817
+
818
+ def name #:nodoc:
819
+ elements[2]
820
+ end
821
+ end
822
+
823
+ module GivenScenario1 #:nodoc:
824
+ def compile(scenario) #:nodoc:
825
+ line = input.line_of(interval.first)
826
+ scenario.create_given_scenario(name.text_value.strip, line)
827
+ end
828
+ end
829
+
830
+ def _nt_given_scenario #:nodoc:
831
+ start_index = index
832
+ if node_cache[:given_scenario].has_key?(index)
833
+ cached = node_cache[:given_scenario][index]
834
+ @index = cached.interval.end if cached
835
+ return cached
836
+ end
837
+
838
+ i0, s0 = index, []
839
+ r1 = _nt_given_scenario_keyword
840
+ s0 << r1
841
+ if r1
842
+ r3 = _nt_space
843
+ if r3
844
+ r2 = r3
845
+ else
846
+ r2 = SyntaxNode.new(input, index...index)
847
+ end
848
+ s0 << r2
849
+ if r2
850
+ r4 = _nt_line_to_eol
851
+ s0 << r4
852
+ end
853
+ end
854
+ if s0.last
855
+ r0 = (SyntaxNode).new(input, i0...index, s0)
856
+ r0.extend(GivenScenario0)
857
+ r0.extend(GivenScenario1)
858
+ else
859
+ self.index = i0
860
+ r0 = nil
861
+ end
862
+
863
+ node_cache[:given_scenario][start_index] = r0
864
+
865
+ return r0
866
+ end
867
+
868
+ module PlainStep0 #:nodoc:
869
+ def space #:nodoc:
870
+ elements[0]
871
+ end
872
+
873
+ def multiline_arg #:nodoc:
874
+ elements[1]
875
+ end
876
+ end
877
+
878
+ module PlainStep1 #:nodoc:
879
+ def step_keyword #:nodoc:
880
+ elements[0]
881
+ end
882
+
883
+ def name #:nodoc:
884
+ elements[2]
885
+ end
886
+
887
+ def multi #:nodoc:
888
+ elements[3]
889
+ end
890
+ end
891
+
892
+ module PlainStep2 #:nodoc:
893
+ def compile(scenario) #:nodoc:
894
+ line = input.line_of(interval.first)
895
+ step = scenario.create_step(step_keyword.text_value, name.text_value.strip, line)
896
+ if multi.respond_to?(:multiline_arg)
897
+ step.extra_args << multi.multiline_arg.to_arg
898
+ end
899
+ end
900
+ end
901
+
902
+ def _nt_plain_step #:nodoc:
903
+ start_index = index
904
+ if node_cache[:plain_step].has_key?(index)
905
+ cached = node_cache[:plain_step][index]
906
+ @index = cached.interval.end if cached
907
+ return cached
908
+ end
909
+
910
+ i0, s0 = index, []
911
+ r1 = _nt_step_keyword
912
+ s0 << r1
913
+ if r1
914
+ r3 = _nt_space
915
+ if r3
916
+ r2 = r3
917
+ else
918
+ r2 = SyntaxNode.new(input, index...index)
919
+ end
920
+ s0 << r2
921
+ if r2
922
+ r4 = _nt_line_to_eol
923
+ s0 << r4
924
+ if r4
925
+ i6, s6 = index, []
926
+ r7 = _nt_space
927
+ s6 << r7
928
+ if r7
929
+ r8 = _nt_multiline_arg
930
+ s6 << r8
931
+ end
932
+ if s6.last
933
+ r6 = (SyntaxNode).new(input, i6...index, s6)
934
+ r6.extend(PlainStep0)
935
+ else
936
+ self.index = i6
937
+ r6 = nil
938
+ end
939
+ if r6
940
+ r5 = r6
941
+ else
942
+ r5 = SyntaxNode.new(input, index...index)
943
+ end
944
+ s0 << r5
945
+ end
946
+ end
947
+ end
948
+ if s0.last
949
+ r0 = (SyntaxNode).new(input, i0...index, s0)
950
+ r0.extend(PlainStep1)
951
+ r0.extend(PlainStep2)
952
+ else
953
+ self.index = i0
954
+ r0 = nil
955
+ end
956
+
957
+ node_cache[:plain_step][start_index] = r0
958
+
959
+ return r0
960
+ end
961
+
962
+ def _nt_multiline_arg #:nodoc:
963
+ start_index = index
964
+ if node_cache[:multiline_arg].has_key?(index)
965
+ cached = node_cache[:multiline_arg][index]
966
+ @index = cached.interval.end if cached
967
+ return cached
968
+ end
969
+
970
+ i0 = index
971
+ r1 = _nt_table
972
+ if r1
973
+ r0 = r1
974
+ else
975
+ r2 = _nt_multiline_string
976
+ if r2
977
+ r0 = r2
978
+ else
979
+ self.index = i0
980
+ r0 = nil
981
+ end
982
+ end
983
+
984
+ node_cache[:multiline_arg][start_index] = r0
985
+
986
+ return r0
987
+ end
988
+
989
+ module MultilineString0 #:nodoc:
990
+ end
991
+
992
+ module MultilineString1 #:nodoc:
993
+ def quote #:nodoc:
994
+ elements[0]
995
+ end
996
+
997
+ def string #:nodoc:
998
+ elements[1]
999
+ end
1000
+
1001
+ def quote #:nodoc:
1002
+ elements[2]
1003
+ end
1004
+ end
1005
+
1006
+ module MultilineString2 #:nodoc:
1007
+ def to_arg #:nodoc:
1008
+ string.text_value.split("\n").map{|l| l.strip}.join("\n")
1009
+ end
1010
+ end
1011
+
1012
+ def _nt_multiline_string #:nodoc:
1013
+ start_index = index
1014
+ if node_cache[:multiline_string].has_key?(index)
1015
+ cached = node_cache[:multiline_string][index]
1016
+ @index = cached.interval.end if cached
1017
+ return cached
1018
+ end
1019
+
1020
+ i0, s0 = index, []
1021
+ r1 = _nt_quote
1022
+ s0 << r1
1023
+ if r1
1024
+ s2, i2 = [], index
1025
+ loop do
1026
+ i3, s3 = index, []
1027
+ i4 = index
1028
+ r5 = _nt_quote
1029
+ if r5
1030
+ r4 = nil
1031
+ else
1032
+ self.index = i4
1033
+ r4 = SyntaxNode.new(input, index...index)
1034
+ end
1035
+ s3 << r4
1036
+ if r4
1037
+ if index < input_length
1038
+ r6 = (SyntaxNode).new(input, index...(index + 1))
1039
+ @index += 1
1040
+ else
1041
+ terminal_parse_failure("any character")
1042
+ r6 = nil
1043
+ end
1044
+ s3 << r6
1045
+ end
1046
+ if s3.last
1047
+ r3 = (SyntaxNode).new(input, i3...index, s3)
1048
+ r3.extend(MultilineString0)
1049
+ else
1050
+ self.index = i3
1051
+ r3 = nil
1052
+ end
1053
+ if r3
1054
+ s2 << r3
1055
+ else
1056
+ break
1057
+ end
1058
+ end
1059
+ r2 = SyntaxNode.new(input, i2...index, s2)
1060
+ s0 << r2
1061
+ if r2
1062
+ r7 = _nt_quote
1063
+ s0 << r7
1064
+ end
1065
+ end
1066
+ if s0.last
1067
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1068
+ r0.extend(MultilineString1)
1069
+ r0.extend(MultilineString2)
1070
+ else
1071
+ self.index = i0
1072
+ r0 = nil
1073
+ end
1074
+
1075
+ node_cache[:multiline_string][start_index] = r0
1076
+
1077
+ return r0
1078
+ end
1079
+
1080
+ def _nt_quote #:nodoc:
1081
+ start_index = index
1082
+ if node_cache[:quote].has_key?(index)
1083
+ cached = node_cache[:quote][index]
1084
+ @index = cached.interval.end if cached
1085
+ return cached
1086
+ end
1087
+
1088
+ if input.index('"', index) == index
1089
+ r0 = (SyntaxNode).new(input, index...(index + 1))
1090
+ @index += 1
1091
+ else
1092
+ terminal_parse_failure('"')
1093
+ r0 = nil
1094
+ end
1095
+
1096
+ node_cache[:quote][start_index] = r0
1097
+
1098
+ return r0
1099
+ end
1100
+
1101
+ def _nt_separator #:nodoc:
1102
+ start_index = index
1103
+ if node_cache[:separator].has_key?(index)
1104
+ cached = node_cache[:separator][index]
1105
+ @index = cached.interval.end if cached
1106
+ return cached
1107
+ end
1108
+
1109
+ if input.index('|', index) == index
1110
+ r0 = (SyntaxNode).new(input, index...(index + 1))
1111
+ @index += 1
1112
+ else
1113
+ terminal_parse_failure('|')
1114
+ r0 = nil
1115
+ end
1116
+
1117
+ node_cache[:separator][start_index] = r0
1118
+
1119
+ return r0
1120
+ end
1121
+
1122
+ def _nt_space #:nodoc:
1123
+ start_index = index
1124
+ if node_cache[:space].has_key?(index)
1125
+ cached = node_cache[:space][index]
1126
+ @index = cached.interval.end if cached
1127
+ return cached
1128
+ end
1129
+
1130
+ s0, i0 = [], index
1131
+ loop do
1132
+ i1 = index
1133
+ r2 = _nt_white
1134
+ if r2
1135
+ r1 = r2
1136
+ else
1137
+ r3 = _nt_comment_to_eol
1138
+ if r3
1139
+ r1 = r3
1140
+ else
1141
+ self.index = i1
1142
+ r1 = nil
1143
+ end
1144
+ end
1145
+ if r1
1146
+ s0 << r1
1147
+ else
1148
+ break
1149
+ end
1150
+ end
1151
+ if s0.empty?
1152
+ self.index = i0
1153
+ r0 = nil
1154
+ else
1155
+ r0 = SyntaxNode.new(input, i0...index, s0)
1156
+ end
1157
+
1158
+ node_cache[:space][start_index] = r0
1159
+
1160
+ return r0
1161
+ end
1162
+
1163
+ module LineToEol0 #:nodoc:
1164
+ end
1165
+
1166
+ def _nt_line_to_eol #:nodoc:
1167
+ start_index = index
1168
+ if node_cache[:line_to_eol].has_key?(index)
1169
+ cached = node_cache[:line_to_eol][index]
1170
+ @index = cached.interval.end if cached
1171
+ return cached
1172
+ end
1173
+
1174
+ s0, i0 = [], index
1175
+ loop do
1176
+ i1, s1 = index, []
1177
+ i2 = index
1178
+ r3 = _nt_eol
1179
+ if r3
1180
+ r2 = nil
1181
+ else
1182
+ self.index = i2
1183
+ r2 = SyntaxNode.new(input, index...index)
1184
+ end
1185
+ s1 << r2
1186
+ if r2
1187
+ if index < input_length
1188
+ r4 = (SyntaxNode).new(input, index...(index + 1))
1189
+ @index += 1
1190
+ else
1191
+ terminal_parse_failure("any character")
1192
+ r4 = nil
1193
+ end
1194
+ s1 << r4
1195
+ end
1196
+ if s1.last
1197
+ r1 = (SyntaxNode).new(input, i1...index, s1)
1198
+ r1.extend(LineToEol0)
1199
+ else
1200
+ self.index = i1
1201
+ r1 = nil
1202
+ end
1203
+ if r1
1204
+ s0 << r1
1205
+ else
1206
+ break
1207
+ end
1208
+ end
1209
+ r0 = SyntaxNode.new(input, i0...index, s0)
1210
+
1211
+ node_cache[:line_to_eol][start_index] = r0
1212
+
1213
+ return r0
1214
+ end
1215
+
1216
+ module CommentToEol0 #:nodoc:
1217
+ def line_to_eol #:nodoc:
1218
+ elements[1]
1219
+ end
1220
+ end
1221
+
1222
+ def _nt_comment_to_eol #:nodoc:
1223
+ start_index = index
1224
+ if node_cache[:comment_to_eol].has_key?(index)
1225
+ cached = node_cache[:comment_to_eol][index]
1226
+ @index = cached.interval.end if cached
1227
+ return cached
1228
+ end
1229
+
1230
+ i0, s0 = index, []
1231
+ if input.index('#', index) == index
1232
+ r1 = (SyntaxNode).new(input, index...(index + 1))
1233
+ @index += 1
1234
+ else
1235
+ terminal_parse_failure('#')
1236
+ r1 = nil
1237
+ end
1238
+ s0 << r1
1239
+ if r1
1240
+ r2 = _nt_line_to_eol
1241
+ s0 << r2
1242
+ end
1243
+ if s0.last
1244
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1245
+ r0.extend(CommentToEol0)
1246
+ else
1247
+ self.index = i0
1248
+ r0 = nil
1249
+ end
1250
+
1251
+ node_cache[:comment_to_eol][start_index] = r0
1252
+
1253
+ return r0
1254
+ end
1255
+
1256
+ def _nt_white #:nodoc:
1257
+ start_index = index
1258
+ if node_cache[:white].has_key?(index)
1259
+ cached = node_cache[:white][index]
1260
+ @index = cached.interval.end if cached
1261
+ return cached
1262
+ end
1263
+
1264
+ i0 = index
1265
+ r1 = _nt_blank
1266
+ if r1
1267
+ r0 = r1
1268
+ else
1269
+ r2 = _nt_eol
1270
+ if r2
1271
+ r0 = r2
1272
+ else
1273
+ self.index = i0
1274
+ r0 = nil
1275
+ end
1276
+ end
1277
+
1278
+ node_cache[:white][start_index] = r0
1279
+
1280
+ return r0
1281
+ end
1282
+
1283
+ def _nt_blank #:nodoc:
1284
+ start_index = index
1285
+ if node_cache[:blank].has_key?(index)
1286
+ cached = node_cache[:blank][index]
1287
+ @index = cached.interval.end if cached
1288
+ return cached
1289
+ end
1290
+
1291
+ if input.index(Regexp.new('[ \\t]'), index) == index
1292
+ r0 = (SyntaxNode).new(input, index...(index + 1))
1293
+ @index += 1
1294
+ else
1295
+ r0 = nil
1296
+ end
1297
+
1298
+ node_cache[:blank][start_index] = r0
1299
+
1300
+ return r0
1301
+ end
1302
+
1303
+ module Eol0 #:nodoc:
1304
+ end
1305
+
1306
+ def _nt_eol #:nodoc:
1307
+ start_index = index
1308
+ if node_cache[:eol].has_key?(index)
1309
+ cached = node_cache[:eol][index]
1310
+ @index = cached.interval.end if cached
1311
+ return cached
1312
+ end
1313
+
1314
+ i0 = index
1315
+ i1, s1 = index, []
1316
+ if input.index("\r", index) == index
1317
+ r2 = (SyntaxNode).new(input, index...(index + 1))
1318
+ @index += 1
1319
+ else
1320
+ terminal_parse_failure("\r")
1321
+ r2 = nil
1322
+ end
1323
+ s1 << r2
1324
+ if r2
1325
+ if input.index("\n", index) == index
1326
+ r4 = (SyntaxNode).new(input, index...(index + 1))
1327
+ @index += 1
1328
+ else
1329
+ terminal_parse_failure("\n")
1330
+ r4 = nil
1331
+ end
1332
+ if r4
1333
+ r3 = r4
1334
+ else
1335
+ r3 = SyntaxNode.new(input, index...index)
1336
+ end
1337
+ s1 << r3
1338
+ end
1339
+ if s1.last
1340
+ r1 = (SyntaxNode).new(input, i1...index, s1)
1341
+ r1.extend(Eol0)
1342
+ else
1343
+ self.index = i1
1344
+ r1 = nil
1345
+ end
1346
+ if r1
1347
+ r0 = r1
1348
+ else
1349
+ if input.index("\n", index) == index
1350
+ r5 = (SyntaxNode).new(input, index...(index + 1))
1351
+ @index += 1
1352
+ else
1353
+ terminal_parse_failure("\n")
1354
+ r5 = nil
1355
+ end
1356
+ if r5
1357
+ r0 = r5
1358
+ else
1359
+ self.index = i0
1360
+ r0 = nil
1361
+ end
1362
+ end
1363
+
1364
+ node_cache[:eol][start_index] = r0
1365
+
1366
+ return r0
1367
+ end
1368
+
1369
+ def _nt_step_keyword #:nodoc:
1370
+ start_index = index
1371
+ if node_cache[:step_keyword].has_key?(index)
1372
+ cached = node_cache[:step_keyword][index]
1373
+ @index = cached.interval.end if cached
1374
+ return cached
1375
+ end
1376
+
1377
+ i0 = index
1378
+ if input.index("假如", index) == index
1379
+ r1 = (SyntaxNode).new(input, index...(index + 6))
1380
+ @index += 6
1381
+ else
1382
+ terminal_parse_failure("假如")
1383
+ r1 = nil
1384
+ end
1385
+ if r1
1386
+ r0 = r1
1387
+ else
1388
+ if input.index("当", index) == index
1389
+ r2 = (SyntaxNode).new(input, index...(index + 3))
1390
+ @index += 3
1391
+ else
1392
+ terminal_parse_failure("当")
1393
+ r2 = nil
1394
+ end
1395
+ if r2
1396
+ r0 = r2
1397
+ else
1398
+ if input.index("那么", index) == index
1399
+ r3 = (SyntaxNode).new(input, index...(index + 6))
1400
+ @index += 6
1401
+ else
1402
+ terminal_parse_failure("那么")
1403
+ r3 = nil
1404
+ end
1405
+ if r3
1406
+ r0 = r3
1407
+ else
1408
+ if input.index("而且", index) == index
1409
+ r4 = (SyntaxNode).new(input, index...(index + 6))
1410
+ @index += 6
1411
+ else
1412
+ terminal_parse_failure("而且")
1413
+ r4 = nil
1414
+ end
1415
+ if r4
1416
+ r0 = r4
1417
+ else
1418
+ if input.index("但是", index) == index
1419
+ r5 = (SyntaxNode).new(input, index...(index + 6))
1420
+ @index += 6
1421
+ else
1422
+ terminal_parse_failure("但是")
1423
+ r5 = nil
1424
+ end
1425
+ if r5
1426
+ r0 = r5
1427
+ else
1428
+ self.index = i0
1429
+ r0 = nil
1430
+ end
1431
+ end
1432
+ end
1433
+ end
1434
+ end
1435
+
1436
+ node_cache[:step_keyword][start_index] = r0
1437
+
1438
+ return r0
1439
+ end
1440
+
1441
+ module ScenarioKeyword0 #:nodoc:
1442
+ end
1443
+
1444
+ def _nt_scenario_keyword #:nodoc:
1445
+ start_index = index
1446
+ if node_cache[:scenario_keyword].has_key?(index)
1447
+ cached = node_cache[:scenario_keyword][index]
1448
+ @index = cached.interval.end if cached
1449
+ return cached
1450
+ end
1451
+
1452
+ i0, s0 = index, []
1453
+ if input.index("场景", index) == index
1454
+ r1 = (SyntaxNode).new(input, index...(index + 6))
1455
+ @index += 6
1456
+ else
1457
+ terminal_parse_failure("场景")
1458
+ r1 = nil
1459
+ end
1460
+ s0 << r1
1461
+ if r1
1462
+ if input.index(":", index) == index
1463
+ r3 = (SyntaxNode).new(input, index...(index + 1))
1464
+ @index += 1
1465
+ else
1466
+ terminal_parse_failure(":")
1467
+ r3 = nil
1468
+ end
1469
+ if r3
1470
+ r2 = r3
1471
+ else
1472
+ r2 = SyntaxNode.new(input, index...index)
1473
+ end
1474
+ s0 << r2
1475
+ end
1476
+ if s0.last
1477
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1478
+ r0.extend(ScenarioKeyword0)
1479
+ else
1480
+ self.index = i0
1481
+ r0 = nil
1482
+ end
1483
+
1484
+ node_cache[:scenario_keyword][start_index] = r0
1485
+
1486
+ return r0
1487
+ end
1488
+
1489
+ module MoreExamplesKeyword0 #:nodoc:
1490
+ end
1491
+
1492
+ def _nt_more_examples_keyword #:nodoc:
1493
+ start_index = index
1494
+ if node_cache[:more_examples_keyword].has_key?(index)
1495
+ cached = node_cache[:more_examples_keyword][index]
1496
+ @index = cached.interval.end if cached
1497
+ return cached
1498
+ end
1499
+
1500
+ i0, s0 = index, []
1501
+ if input.index("More Examples", index) == index
1502
+ r1 = (SyntaxNode).new(input, index...(index + 13))
1503
+ @index += 13
1504
+ else
1505
+ terminal_parse_failure("More Examples")
1506
+ r1 = nil
1507
+ end
1508
+ s0 << r1
1509
+ if r1
1510
+ if input.index(":", index) == index
1511
+ r3 = (SyntaxNode).new(input, index...(index + 1))
1512
+ @index += 1
1513
+ else
1514
+ terminal_parse_failure(":")
1515
+ r3 = nil
1516
+ end
1517
+ if r3
1518
+ r2 = r3
1519
+ else
1520
+ r2 = SyntaxNode.new(input, index...index)
1521
+ end
1522
+ s0 << r2
1523
+ end
1524
+ if s0.last
1525
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1526
+ r0.extend(MoreExamplesKeyword0)
1527
+ else
1528
+ self.index = i0
1529
+ r0 = nil
1530
+ end
1531
+
1532
+ node_cache[:more_examples_keyword][start_index] = r0
1533
+
1534
+ return r0
1535
+ end
1536
+
1537
+ module GivenScenarioKeyword0 #:nodoc:
1538
+ end
1539
+
1540
+ def _nt_given_scenario_keyword #:nodoc:
1541
+ start_index = index
1542
+ if node_cache[:given_scenario_keyword].has_key?(index)
1543
+ cached = node_cache[:given_scenario_keyword][index]
1544
+ @index = cached.interval.end if cached
1545
+ return cached
1546
+ end
1547
+
1548
+ i0, s0 = index, []
1549
+ if input.index("引用场景", index) == index
1550
+ r1 = (SyntaxNode).new(input, index...(index + 12))
1551
+ @index += 12
1552
+ else
1553
+ terminal_parse_failure("引用场景")
1554
+ r1 = nil
1555
+ end
1556
+ s0 << r1
1557
+ if r1
1558
+ if input.index(":", index) == index
1559
+ r3 = (SyntaxNode).new(input, index...(index + 1))
1560
+ @index += 1
1561
+ else
1562
+ terminal_parse_failure(":")
1563
+ r3 = nil
1564
+ end
1565
+ if r3
1566
+ r2 = r3
1567
+ else
1568
+ r2 = SyntaxNode.new(input, index...index)
1569
+ end
1570
+ s0 << r2
1571
+ end
1572
+ if s0.last
1573
+ r0 = (SyntaxNode).new(input, i0...index, s0)
1574
+ r0.extend(GivenScenarioKeyword0)
1575
+ else
1576
+ self.index = i0
1577
+ r0 = nil
1578
+ end
1579
+
1580
+ node_cache[:given_scenario_keyword][start_index] = r0
1581
+
1582
+ return r0
1583
+ end
1584
+
1585
+ end
1586
+
1587
+ class FeatureParser < Treetop::Runtime::CompiledParser #:nodoc:
1588
+ include Feature
1589
+ end
1590
+
1591
+
1592
+ end
1593
+ end