cucumber 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. data/History.txt +53 -0
  2. data/Manifest.txt +4 -0
  3. data/Rakefile +1 -0
  4. data/examples/calculator/cucumber.yml +1 -1
  5. data/examples/dos_line_endings/Rakefile +6 -0
  6. data/examples/dos_line_endings/features/dos_line_endings.feature +9 -0
  7. data/examples/tickets/features/steps/tickets_steps.rb +13 -1
  8. data/examples/tickets/features/tickets.feature +5 -1
  9. data/gem_tasks/treetop.rake +10 -0
  10. data/generators/cucumber/templates/common_webrat.rb +1 -1
  11. data/lib/cucumber.rb +3 -1
  12. data/lib/cucumber/cli.rb +16 -15
  13. data/lib/cucumber/core_ext/proc.rb +11 -2
  14. data/lib/cucumber/executor.rb +32 -15
  15. data/lib/cucumber/formatters/ansicolor.rb +25 -3
  16. data/lib/cucumber/formatters/pretty_formatter.rb +44 -15
  17. data/lib/cucumber/languages.yml +10 -0
  18. data/lib/cucumber/step_methods.rb +8 -4
  19. data/lib/cucumber/step_mother.rb +4 -3
  20. data/lib/cucumber/tree/scenario.rb +22 -10
  21. data/lib/cucumber/tree/step.rb +9 -1
  22. data/lib/cucumber/treetop_parser/feature.treetop.erb +5 -5
  23. data/lib/cucumber/treetop_parser/feature_da.rb +146 -108
  24. data/lib/cucumber/treetop_parser/feature_de.rb +146 -108
  25. data/lib/cucumber/treetop_parser/feature_en.rb +146 -108
  26. data/lib/cucumber/treetop_parser/feature_es.rb +146 -108
  27. data/lib/cucumber/treetop_parser/feature_et.rb +146 -108
  28. data/lib/cucumber/treetop_parser/feature_fr.rb +146 -108
  29. data/lib/cucumber/treetop_parser/feature_no.rb +146 -108
  30. data/lib/cucumber/treetop_parser/feature_parser.rb +4 -2
  31. data/lib/cucumber/treetop_parser/feature_pt.rb +146 -108
  32. data/lib/cucumber/treetop_parser/feature_ru.rb +146 -108
  33. data/lib/cucumber/treetop_parser/feature_se.rb +146 -108
  34. data/lib/cucumber/version.rb +1 -1
  35. data/spec/cucumber/cli_spec.rb +14 -4
  36. data/spec/cucumber/executor_spec.rb +4 -3
  37. data/spec/cucumber/formatters/ansicolor_spec.rb +4 -0
  38. data/spec/cucumber/formatters/pretty_formatter_spec.rb +67 -2
  39. data/spec/cucumber/tree/scenario_spec.rb +2 -2
  40. data/spec/cucumber/tree/step_spec.rb +21 -0
  41. data/spec/cucumber/treetop_parser/feature_parser_spec.rb +5 -0
  42. data/spec/cucumber/treetop_parser/test_dos.feature +24 -0
  43. data/spec/spec_helper.rb +1 -7
  44. metadata +6 -2
@@ -8,8 +8,10 @@ module Cucumber
8
8
  INDENT = "\n "
9
9
  BACKTRACE_FILTER_PATTERNS = [/vendor\/rails/, /vendor\/plugins\/cucumber/, /spec\/expectations/, /spec\/matchers/]
10
10
 
11
- def initialize(io)
11
+ def initialize(io, step_mother, options={})
12
12
  @io = (io == STDOUT) ? Kernel : io
13
+ @options = options
14
+ @step_mother = step_mother
13
15
  @passed = []
14
16
  @failed = []
15
17
  @pending = []
@@ -50,7 +52,12 @@ module Cucumber
50
52
  args.each{|arg| @io.print passed(arg) ; @io.print "|"}
51
53
  else
52
54
  @passed << step
53
- @io.puts passed(" #{step.keyword} #{step.format(regexp){|param| passed_param(param) << passed}}")
55
+ @io.print passed(" #{step.keyword} #{step.format(regexp){|param| passed_param(param) << passed}}")
56
+ if @options[:source]
57
+ @io.print padding_spaces(step)
58
+ @io.print source_comment(step)
59
+ end
60
+ @io.puts
54
61
  end
55
62
  end
56
63
 
@@ -62,11 +69,30 @@ module Cucumber
62
69
  else
63
70
  @failed << step
64
71
  @scenario_failed = true
65
- @io.puts failed(" #{step.keyword} #{step.format(regexp){|param| failed_param(param) << failed}}")
72
+ @io.print failed(" #{step.keyword} #{step.format(regexp){|param| failed_param(param) << failed}}")
73
+ if @options[:source]
74
+ @io.print padding_spaces(step)
75
+ @io.print source_comment(step)
76
+ end
77
+ @io.puts
66
78
  output_failing_step(step)
67
79
  end
68
80
  end
69
81
 
82
+ def step_skipped(step, regexp, args)
83
+ @skipped << step
84
+ if step.row?
85
+ args.each{|arg| @io.print skipped(arg) ; @io.print "|"}
86
+ else
87
+ @io.print skipped(" #{step.keyword} #{step.format(regexp){|param| skipped_param(param) << skipped}}")
88
+ if @options[:source]
89
+ @io.print padding_spaces(step)
90
+ @io.print source_comment(step)
91
+ end
92
+ @io.puts
93
+ end
94
+ end
95
+
70
96
  def step_pending(step, regexp, args)
71
97
  if step.row?
72
98
  @pending << step
@@ -77,17 +103,9 @@ module Cucumber
77
103
  end
78
104
  end
79
105
 
80
- def step_skipped(step, regexp, args)
81
- @skipped << step
82
- if step.row?
83
- args.each{|arg| @io.print skipped(arg) ; @io.print "|"}
84
- else
85
- @io.puts skipped(" #{step.keyword} #{step.format(regexp){|param| skipped_param(param) << skipped}}")
86
- end
87
- end
88
-
89
106
  def output_failing_step(step)
90
- clean_backtrace = step.error.backtrace.map {|b| b.split("\n") }.flatten.reject do |line|
107
+ backtrace = step.error.backtrace || []
108
+ clean_backtrace = backtrace.map {|b| b.split("\n") }.flatten.reject do |line|
91
109
  BACKTRACE_FILTER_PATTERNS.detect{|p| line =~ p}
92
110
  end.map { |line| line.strip }
93
111
  @io.puts failed(" #{step.error.message.split("\n").join(INDENT)} (#{step.error.class})")
@@ -103,7 +121,7 @@ module Cucumber
103
121
  @io.print reset
104
122
  print_snippets
105
123
  end
106
-
124
+
107
125
  def print_snippets
108
126
  unless @pending.empty?
109
127
  @io.puts "\nYou can use these snippets to implement pending steps:\n\n"
@@ -111,7 +129,7 @@ module Cucumber
111
129
  prev_keyword = nil
112
130
  snippets = @pending.map do |step|
113
131
  next if step.row?
114
- snippet = "#{step.actual_keyword} /#{step.name}/ do\nend\n\n"
132
+ snippet = "#{step.actual_keyword} /^#{step.name}$/ do\nend\n\n"
115
133
  prev_keyword = step.keyword
116
134
  snippet
117
135
  end.compact.uniq
@@ -121,6 +139,17 @@ module Cucumber
121
139
  end
122
140
  end
123
141
  end
142
+
143
+ private
144
+
145
+ def source_comment(step)
146
+ _, _, proc = step.regexp_args_proc(@step_mother)
147
+ comment(proc.to_comment_line)
148
+ end
149
+
150
+ def padding_spaces(step)
151
+ " " * step.padding_length
152
+ end
124
153
  end
125
154
  end
126
155
  end
@@ -9,6 +9,7 @@
9
9
  when: Når
10
10
  then: Så
11
11
  and: Og
12
+ but: Men
12
13
  "de":
13
14
  feature: Funktionalität
14
15
  scenario: Szenario
@@ -17,6 +18,7 @@
17
18
  when: Wenn
18
19
  then: Dann
19
20
  and: Und
21
+ but: Aber
20
22
  "en":
21
23
  feature: Feature
22
24
  scenario: Scenario
@@ -25,6 +27,7 @@
25
27
  when: When
26
28
  then: Then
27
29
  and: And
30
+ but: But
28
31
  "es":
29
32
  feature: Característica
30
33
  scenario: Escenario
@@ -33,6 +36,7 @@
33
36
  when: Cuando
34
37
  then: Entonces
35
38
  and: Y
39
+ but: Pero
36
40
  "fr":
37
41
  feature: Fonction
38
42
  scenario: Scenario
@@ -41,6 +45,7 @@
41
45
  when: Lorsque
42
46
  then: Alors
43
47
  and: Et
48
+ but: Mais
44
49
  "no":
45
50
  feature: Egenskap
46
51
  scenario: Scenario
@@ -49,6 +54,7 @@
49
54
  when: Når
50
55
  then: Så
51
56
  and: Og
57
+ but: Men
52
58
  "pt":
53
59
  feature: Característica
54
60
  scenario: Cenário
@@ -57,6 +63,7 @@
57
63
  when: Quando
58
64
  then: Então
59
65
  and: E
66
+ but: Mas
60
67
  "ru":
61
68
  feature: Функционал
62
69
  scenario: Сценарий
@@ -65,6 +72,7 @@
65
72
  when: Если
66
73
  then: То
67
74
  and: И
75
+ but: Но
68
76
  "se":
69
77
  feature: Egenskap
70
78
  scenario: Scenario
@@ -73,6 +81,7 @@
73
81
  when: Når
74
82
  then: Så
75
83
  and: Och
84
+ but: Men
76
85
  "et":
77
86
  feature: Omadus
78
87
  scenario: Stsenaarium
@@ -81,3 +90,4 @@
81
90
  when: Kui
82
91
  then: Siis
83
92
  and: Ja
93
+ but: Kuid
@@ -5,19 +5,19 @@ module Cucumber
5
5
  module StepMethods
6
6
  # Each scenario will execute in the context of what the supplied block returns.
7
7
  def World(&proc)
8
- $executor.register_world_proc(&proc)
8
+ executor.register_world_proc(&proc)
9
9
  end
10
10
 
11
11
  def Before(&proc)
12
- $executor.register_before_scenario_proc(&proc)
12
+ executor.register_before_scenario_proc(&proc)
13
13
  end
14
14
 
15
15
  def After(&proc)
16
- $executor.register_after_scenario_proc(&proc)
16
+ executor.register_after_scenario_proc(&proc)
17
17
  end
18
18
 
19
19
  def AfterStep(&proc)
20
- $executor.register_after_step_proc(&proc)
20
+ executor.register_after_step_proc(&proc)
21
21
  end
22
22
 
23
23
  def Given(key, &proc)
@@ -41,5 +41,9 @@ module Cucumber
41
41
  def step_mother #:nodoc:
42
42
  @step_mother ||= StepMother.new
43
43
  end
44
+
45
+ def executor
46
+ @executor ||= Executor.new(step_mother)
47
+ end
44
48
  end
45
49
  end
@@ -40,8 +40,8 @@ module Cucumber
40
40
  first_proc = @step_procs[regexp]
41
41
  message = %{Duplicate step definitions:
42
42
 
43
- #{first_proc.backtrace_line}
44
- #{proc.backtrace_line}
43
+ #{first_proc.to_backtrace_line}
44
+ #{proc.to_backtrace_line}
45
45
 
46
46
  }
47
47
  raise Duplicate.new(message)
@@ -65,7 +65,7 @@ module Cucumber
65
65
  else
66
66
  message = %{Multiple step definitions match #{step_name.inspect}:
67
67
 
68
- #{candidates.map{|regexp, args, proc| proc.backtrace_line}.join("\n")}
68
+ #{candidates.map{|regexp, args, proc| proc.to_backtrace_line}.join("\n")}
69
69
 
70
70
  }
71
71
  raise Multiple.new(message)
@@ -76,6 +76,7 @@ module Cucumber
76
76
  @step_procs[regexp]
77
77
  end
78
78
 
79
+ # TODO - move execute here?
79
80
  def execute(step)
80
81
  end
81
82
  end
@@ -27,9 +27,11 @@ module Cucumber
27
27
  end
28
28
 
29
29
  class Scenario < BaseScenario
30
+ MIN_PADDING = 2
30
31
 
31
32
  # If a table follows, the header will be stored here. Weird, but convenient.
32
33
  attr_accessor :table_header
34
+ attr_reader :name, :line
33
35
 
34
36
  def initialize(feature, name, &proc)
35
37
  @feature, @name = feature, name
@@ -49,36 +51,46 @@ module Cucumber
49
51
  @feature.scenario_named(name)
50
52
  end
51
53
 
54
+ def padding_length(step)
55
+ (max_step_length - step.length) + MIN_PADDING
56
+ end
57
+
58
+ def max_step_length
59
+ steps.map{|step| step.length}.max
60
+ end
61
+
52
62
  def row?
53
63
  false
54
64
  end
55
65
 
56
- def add_step(keyword, name, line)
57
- @steps_and_given_scenarios << Step.new(self, keyword, name, line)
66
+ def create_step(keyword, name, line)
67
+ step = Step.new(self, keyword, name, line)
68
+ @steps_and_given_scenarios << step
69
+ step
58
70
  end
59
71
 
60
- def add_given_scenario(name, line)
61
- @steps_and_given_scenarios << GivenScenario.new(self, name, line)
72
+ def create_given_scenario(name, line)
73
+ given_scenario = GivenScenario.new(self, name, line)
74
+ @steps_and_given_scenarios << given_scenario
75
+ given_scenario
62
76
  end
63
77
 
64
78
  def Given(name)
65
- add_step('Given', name, *caller[0].split(':')[1].to_i)
79
+ create_step('Given', name, *caller[0].split(':')[1].to_i)
66
80
  end
67
81
 
68
82
  def When(name)
69
- add_step('When', name, *caller[0].split(':')[1].to_i)
83
+ create_step('When', name, *caller[0].split(':')[1].to_i)
70
84
  end
71
85
 
72
86
  def Then(name)
73
- add_step('Then', name, *caller[0].split(':')[1].to_i)
87
+ create_step('Then', name, *caller[0].split(':')[1].to_i)
74
88
  end
75
89
 
76
90
  def And(name)
77
- add_step('And', name, *caller[0].split(':')[1].to_i)
91
+ create_step('And', name, *caller[0].split(':')[1].to_i)
78
92
  end
79
93
 
80
- attr_reader :name, :line
81
-
82
94
  end
83
95
 
84
96
  class RowScenario < BaseScenario
@@ -17,6 +17,10 @@ module Cucumber
17
17
  def steps
18
18
  self
19
19
  end
20
+
21
+ def length
22
+ keyword.length + 1 + name.length
23
+ end
20
24
 
21
25
  if defined?(JRUBY_VERSION)
22
26
  PENDING_ADJUSTMENT = 2
@@ -31,7 +35,7 @@ module Cucumber
31
35
  begin
32
36
  proc.call_in(world, *args)
33
37
  rescue ArityMismatchError => e
34
- e.backtrace[0] = proc.backtrace_line
38
+ e.backtrace[0] = proc.to_backtrace_line
35
39
  strip_pos = e.backtrace.index("#{__FILE__}:#{__LINE__ - 3}:in `execute_in'")
36
40
  format_error(strip_pos, proc, e)
37
41
  rescue => e
@@ -73,6 +77,10 @@ module Cucumber
73
77
  def previous_step
74
78
  @scenario.previous_step(self)
75
79
  end
80
+
81
+ def padding_length
82
+ @scenario.padding_length(self)
83
+ end
76
84
  end
77
85
 
78
86
  class Step < BaseStep
@@ -99,7 +99,7 @@ grammar Feature
99
99
  given_scenario_keyword space name:line_to_eol {
100
100
  def compile(scenario)
101
101
  line = input.line_of(interval.first)
102
- scenario.add_given_scenario(name.text_value.strip, line)
102
+ scenario.create_given_scenario(name.text_value.strip, line)
103
103
  end
104
104
  }
105
105
  end
@@ -108,7 +108,7 @@ grammar Feature
108
108
  step_keyword space name:line_to_eol {
109
109
  def compile(scenario)
110
110
  line = input.line_of(interval.first)
111
- scenario.add_step(step_keyword.text_value, name.text_value.strip, line)
111
+ scenario.create_step(step_keyword.text_value, name.text_value.strip, line)
112
112
  end
113
113
  }
114
114
  end
@@ -138,11 +138,11 @@ grammar Feature
138
138
  end
139
139
 
140
140
  rule eol
141
- "\r\n?" / "\n"
141
+ ("\r" "\n"?) / "\n"
142
142
  end
143
-
143
+
144
144
  rule step_keyword
145
- '<%= words['given'] %>' / '<%= words['when'] %>' / '<%= words['then'] %>' / '<%= words['and'] %>'
145
+ '<%= words['given'] %>' / '<%= words['when'] %>' / '<%= words['then'] %>' / '<%= words['and'] %>' / '<%= words['but'] %>'
146
146
  end
147
147
 
148
148
  rule scenario_keyword
@@ -1,33 +1,33 @@
1
- module Cucumber
2
- module TreetopParser
1
+ module Cucumber #:nodoc:
2
+ module TreetopParser #:nodoc:
3
3
 
4
- module Feature
4
+ module Feature #:nodoc:
5
5
  include Treetop::Runtime
6
6
 
7
- def root
7
+ def root #:nodoc:
8
8
  @root || :root
9
9
  end
10
10
 
11
- module Root0
12
- def header
11
+ module Root0 #:nodoc:
12
+ def header #:nodoc:
13
13
  elements[0]
14
14
  end
15
15
 
16
- def scenario_sequence
16
+ def scenario_sequence #:nodoc:
17
17
  elements[1]
18
18
  end
19
19
 
20
20
  end
21
21
 
22
- module Root1
23
- def compile
22
+ module Root1 #:nodoc:
23
+ def compile #:nodoc:
24
24
  feature = Tree::Feature.new(header.text_value.strip)
25
25
  scenario_sequence.compile(feature)
26
26
  feature
27
27
  end
28
28
  end
29
29
 
30
- def _nt_root
30
+ def _nt_root #:nodoc:
31
31
  start_index = index
32
32
  if node_cache[:root].has_key?(index)
33
33
  cached = node_cache[:root][index]
@@ -65,10 +65,10 @@ module Feature
65
65
  return r0
66
66
  end
67
67
 
68
- module Header0
68
+ module Header0 #:nodoc:
69
69
  end
70
70
 
71
- def _nt_header
71
+ def _nt_header #:nodoc:
72
72
  start_index = index
73
73
  if node_cache[:header].has_key?(index)
74
74
  cached = node_cache[:header][index]
@@ -123,39 +123,39 @@ module Feature
123
123
  return r0
124
124
  end
125
125
 
126
- module ScenarioSequence0
127
- def space
126
+ module ScenarioSequence0 #:nodoc:
127
+ def space #:nodoc:
128
128
  elements[0]
129
129
  end
130
130
 
131
- def scenario_or_table
131
+ def scenario_or_table #:nodoc:
132
132
  elements[1]
133
133
  end
134
134
  end
135
135
 
136
- module ScenarioSequence1
137
- def head
136
+ module ScenarioSequence1 #:nodoc:
137
+ def head #:nodoc:
138
138
  elements[0]
139
139
  end
140
140
 
141
- def tail
141
+ def tail #:nodoc:
142
142
  elements[1]
143
143
  end
144
144
  end
145
145
 
146
- module ScenarioSequence2
147
- def compile(feature)
146
+ module ScenarioSequence2 #:nodoc:
147
+ def compile(feature) #:nodoc:
148
148
  ([head] + tail).each do |scenario_or_table|
149
149
  scenario_or_table.compile(feature) if scenario_or_table.respond_to?(:compile)
150
150
  end
151
151
  end
152
152
 
153
- def tail
153
+ def tail #:nodoc:
154
154
  super.elements.map { |elt| elt.scenario_or_table }
155
155
  end
156
156
  end
157
157
 
158
- def _nt_scenario_sequence
158
+ def _nt_scenario_sequence #:nodoc:
159
159
  start_index = index
160
160
  if node_cache[:scenario_sequence].has_key?(index)
161
161
  cached = node_cache[:scenario_sequence][index]
@@ -211,36 +211,36 @@ module Feature
211
211
  return r0
212
212
  end
213
213
 
214
- module Scenario0
215
- def space
214
+ module Scenario0 #:nodoc:
215
+ def space #:nodoc:
216
216
  elements[0]
217
217
  end
218
218
 
219
- def step_sequence
219
+ def step_sequence #:nodoc:
220
220
  elements[1]
221
221
  end
222
222
  end
223
223
 
224
- module Scenario1
225
- def scenario_keyword
224
+ module Scenario1 #:nodoc:
225
+ def scenario_keyword #:nodoc:
226
226
  elements[0]
227
227
  end
228
228
 
229
- def space
229
+ def space #:nodoc:
230
230
  elements[1]
231
231
  end
232
232
 
233
- def name
233
+ def name #:nodoc:
234
234
  elements[2]
235
235
  end
236
236
 
237
- def steps
237
+ def steps #:nodoc:
238
238
  elements[3]
239
239
  end
240
240
  end
241
241
 
242
- module Scenario2
243
- def compile(feature)
242
+ module Scenario2 #:nodoc:
243
+ def compile(feature) #:nodoc:
244
244
  scenario = feature.add_scenario(name.text_value.strip)
245
245
  steps.step_sequence.compile(scenario) if steps.respond_to?(:step_sequence)
246
246
  # TODO - GET RID OF THIS last_scenario NASTINESS
@@ -249,7 +249,7 @@ module Feature
249
249
  end
250
250
  end
251
251
 
252
- def _nt_scenario
252
+ def _nt_scenario #:nodoc:
253
253
  start_index = index
254
254
  if node_cache[:scenario].has_key?(index)
255
255
  cached = node_cache[:scenario][index]
@@ -304,7 +304,7 @@ module Feature
304
304
  return r0
305
305
  end
306
306
 
307
- def _nt_scenario_or_table
307
+ def _nt_scenario_or_table #:nodoc:
308
308
  start_index = index
309
309
  if node_cache[:scenario_or_table].has_key?(index)
310
310
  cached = node_cache[:scenario_or_table][index]
@@ -331,40 +331,40 @@ module Feature
331
331
  return r0
332
332
  end
333
333
 
334
- module Table0
335
- def eol
334
+ module Table0 #:nodoc:
335
+ def eol #:nodoc:
336
336
  elements[1]
337
337
  end
338
338
 
339
- def table_line
339
+ def table_line #:nodoc:
340
340
  elements[3]
341
341
  end
342
342
  end
343
343
 
344
- module Table1
345
- def head
344
+ module Table1 #:nodoc:
345
+ def head #:nodoc:
346
346
  elements[0]
347
347
  end
348
348
 
349
- def body
349
+ def body #:nodoc:
350
350
  elements[1]
351
351
  end
352
352
  end
353
353
 
354
- module Table2
355
- def compile(feature)
354
+ module Table2 #:nodoc:
355
+ def compile(feature) #:nodoc:
356
356
  Feature.last_scenario.table_header = head.cell_values
357
357
  body.each do |table_line|
358
358
  feature.add_row_scenario(Feature.last_scenario, table_line.cell_values, table_line.line)
359
359
  end
360
360
  end
361
361
 
362
- def body
362
+ def body #:nodoc:
363
363
  super.elements.map { |elt| elt.table_line }
364
364
  end
365
365
  end
366
366
 
367
- def _nt_table
367
+ def _nt_table #:nodoc:
368
368
  start_index = index
369
369
  if node_cache[:table].has_key?(index)
370
370
  cached = node_cache[:table][index]
@@ -437,37 +437,37 @@ module Feature
437
437
  return r0
438
438
  end
439
439
 
440
- module TableLine0
441
- def cell_value
440
+ module TableLine0 #:nodoc:
441
+ def cell_value #:nodoc:
442
442
  elements[1]
443
443
  end
444
444
 
445
- def separator
445
+ def separator #:nodoc:
446
446
  elements[3]
447
447
  end
448
448
  end
449
449
 
450
- module TableLine1
451
- def separator
450
+ module TableLine1 #:nodoc:
451
+ def separator #:nodoc:
452
452
  elements[0]
453
453
  end
454
454
 
455
- def cells
455
+ def cells #:nodoc:
456
456
  elements[1]
457
457
  end
458
458
  end
459
459
 
460
- module TableLine2
461
- def cell_values
460
+ module TableLine2 #:nodoc:
461
+ def cell_values #:nodoc:
462
462
  cells.elements.map { |elt| elt.cell_value.text_value.strip }
463
463
  end
464
464
 
465
- def line
465
+ def line #:nodoc:
466
466
  input.line_of(interval.first)
467
467
  end
468
468
  end
469
469
 
470
- def _nt_table_line
470
+ def _nt_table_line #:nodoc:
471
471
  start_index = index
472
472
  if node_cache[:table_line].has_key?(index)
473
473
  cached = node_cache[:table_line][index]
@@ -549,10 +549,10 @@ module Feature
549
549
  return r0
550
550
  end
551
551
 
552
- module CellValue0
552
+ module CellValue0 #:nodoc:
553
553
  end
554
554
 
555
- def _nt_cell_value
555
+ def _nt_cell_value #:nodoc:
556
556
  start_index = index
557
557
  if node_cache[:cell_value].has_key?(index)
558
558
  cached = node_cache[:cell_value][index]
@@ -614,39 +614,39 @@ module Feature
614
614
  return r0
615
615
  end
616
616
 
617
- module StepSequence0
618
- def space
617
+ module StepSequence0 #:nodoc:
618
+ def space #:nodoc:
619
619
  elements[0]
620
620
  end
621
621
 
622
- def step
622
+ def step #:nodoc:
623
623
  elements[1]
624
624
  end
625
625
  end
626
626
 
627
- module StepSequence1
628
- def head
627
+ module StepSequence1 #:nodoc:
628
+ def head #:nodoc:
629
629
  elements[0]
630
630
  end
631
631
 
632
- def tail
632
+ def tail #:nodoc:
633
633
  elements[1]
634
634
  end
635
635
  end
636
636
 
637
- module StepSequence2
638
- def compile(scenario)
637
+ module StepSequence2 #:nodoc:
638
+ def compile(scenario) #:nodoc:
639
639
  ([head] + tail).each do |step|
640
640
  step.compile(scenario)
641
641
  end
642
642
  end
643
643
 
644
- def tail
644
+ def tail #:nodoc:
645
645
  super.elements.map { |elt| elt.step }
646
646
  end
647
647
  end
648
648
 
649
- def _nt_step_sequence
649
+ def _nt_step_sequence #:nodoc:
650
650
  start_index = index
651
651
  if node_cache[:step_sequence].has_key?(index)
652
652
  cached = node_cache[:step_sequence][index]
@@ -697,7 +697,7 @@ module Feature
697
697
  return r0
698
698
  end
699
699
 
700
- def _nt_step
700
+ def _nt_step #:nodoc:
701
701
  start_index = index
702
702
  if node_cache[:step].has_key?(index)
703
703
  cached = node_cache[:step][index]
@@ -724,28 +724,28 @@ module Feature
724
724
  return r0
725
725
  end
726
726
 
727
- module GivenScenario0
728
- def given_scenario_keyword
727
+ module GivenScenario0 #:nodoc:
728
+ def given_scenario_keyword #:nodoc:
729
729
  elements[0]
730
730
  end
731
731
 
732
- def space
732
+ def space #:nodoc:
733
733
  elements[1]
734
734
  end
735
735
 
736
- def name
736
+ def name #:nodoc:
737
737
  elements[2]
738
738
  end
739
739
  end
740
740
 
741
- module GivenScenario1
742
- def compile(scenario)
741
+ module GivenScenario1 #:nodoc:
742
+ def compile(scenario) #:nodoc:
743
743
  line = input.line_of(interval.first)
744
- scenario.add_given_scenario(name.text_value.strip, line)
744
+ scenario.create_given_scenario(name.text_value.strip, line)
745
745
  end
746
746
  end
747
747
 
748
- def _nt_given_scenario
748
+ def _nt_given_scenario #:nodoc:
749
749
  start_index = index
750
750
  if node_cache[:given_scenario].has_key?(index)
751
751
  cached = node_cache[:given_scenario][index]
@@ -778,28 +778,28 @@ module Feature
778
778
  return r0
779
779
  end
780
780
 
781
- module PlainStep0
782
- def step_keyword
781
+ module PlainStep0 #:nodoc:
782
+ def step_keyword #:nodoc:
783
783
  elements[0]
784
784
  end
785
785
 
786
- def space
786
+ def space #:nodoc:
787
787
  elements[1]
788
788
  end
789
789
 
790
- def name
790
+ def name #:nodoc:
791
791
  elements[2]
792
792
  end
793
793
  end
794
794
 
795
- module PlainStep1
796
- def compile(scenario)
795
+ module PlainStep1 #:nodoc:
796
+ def compile(scenario) #:nodoc:
797
797
  line = input.line_of(interval.first)
798
- scenario.add_step(step_keyword.text_value, name.text_value.strip, line)
798
+ scenario.create_step(step_keyword.text_value, name.text_value.strip, line)
799
799
  end
800
800
  end
801
801
 
802
- def _nt_plain_step
802
+ def _nt_plain_step #:nodoc:
803
803
  start_index = index
804
804
  if node_cache[:plain_step].has_key?(index)
805
805
  cached = node_cache[:plain_step][index]
@@ -832,7 +832,7 @@ module Feature
832
832
  return r0
833
833
  end
834
834
 
835
- def _nt_separator
835
+ def _nt_separator #:nodoc:
836
836
  start_index = index
837
837
  if node_cache[:separator].has_key?(index)
838
838
  cached = node_cache[:separator][index]
@@ -853,7 +853,7 @@ module Feature
853
853
  return r0
854
854
  end
855
855
 
856
- def _nt_space
856
+ def _nt_space #:nodoc:
857
857
  start_index = index
858
858
  if node_cache[:space].has_key?(index)
859
859
  cached = node_cache[:space][index]
@@ -894,10 +894,10 @@ module Feature
894
894
  return r0
895
895
  end
896
896
 
897
- module LineToEol0
897
+ module LineToEol0 #:nodoc:
898
898
  end
899
899
 
900
- def _nt_line_to_eol
900
+ def _nt_line_to_eol #:nodoc:
901
901
  start_index = index
902
902
  if node_cache[:line_to_eol].has_key?(index)
903
903
  cached = node_cache[:line_to_eol][index]
@@ -947,13 +947,13 @@ module Feature
947
947
  return r0
948
948
  end
949
949
 
950
- module CommentToEol0
951
- def line_to_eol
950
+ module CommentToEol0 #:nodoc:
951
+ def line_to_eol #:nodoc:
952
952
  elements[1]
953
953
  end
954
954
  end
955
955
 
956
- def _nt_comment_to_eol
956
+ def _nt_comment_to_eol #:nodoc:
957
957
  start_index = index
958
958
  if node_cache[:comment_to_eol].has_key?(index)
959
959
  cached = node_cache[:comment_to_eol][index]
@@ -987,7 +987,7 @@ module Feature
987
987
  return r0
988
988
  end
989
989
 
990
- def _nt_white
990
+ def _nt_white #:nodoc:
991
991
  start_index = index
992
992
  if node_cache[:white].has_key?(index)
993
993
  cached = node_cache[:white][index]
@@ -1014,7 +1014,7 @@ module Feature
1014
1014
  return r0
1015
1015
  end
1016
1016
 
1017
- def _nt_blank
1017
+ def _nt_blank #:nodoc:
1018
1018
  start_index = index
1019
1019
  if node_cache[:blank].has_key?(index)
1020
1020
  cached = node_cache[:blank][index]
@@ -1034,7 +1034,10 @@ module Feature
1034
1034
  return r0
1035
1035
  end
1036
1036
 
1037
- def _nt_eol
1037
+ module Eol0 #:nodoc:
1038
+ end
1039
+
1040
+ def _nt_eol #:nodoc:
1038
1041
  start_index = index
1039
1042
  if node_cache[:eol].has_key?(index)
1040
1043
  cached = node_cache[:eol][index]
@@ -1043,25 +1046,49 @@ module Feature
1043
1046
  end
1044
1047
 
1045
1048
  i0 = index
1046
- if input.index("\r\n?", index) == index
1047
- r1 = (SyntaxNode).new(input, index...(index + 3))
1048
- @index += 3
1049
+ i1, s1 = index, []
1050
+ if input.index("\r", index) == index
1051
+ r2 = (SyntaxNode).new(input, index...(index + 1))
1052
+ @index += 1
1049
1053
  else
1050
- terminal_parse_failure("\r\n?")
1054
+ terminal_parse_failure("\r")
1055
+ r2 = nil
1056
+ end
1057
+ s1 << r2
1058
+ if r2
1059
+ if input.index("\n", index) == index
1060
+ r4 = (SyntaxNode).new(input, index...(index + 1))
1061
+ @index += 1
1062
+ else
1063
+ terminal_parse_failure("\n")
1064
+ r4 = nil
1065
+ end
1066
+ if r4
1067
+ r3 = r4
1068
+ else
1069
+ r3 = SyntaxNode.new(input, index...index)
1070
+ end
1071
+ s1 << r3
1072
+ end
1073
+ if s1.last
1074
+ r1 = (SyntaxNode).new(input, i1...index, s1)
1075
+ r1.extend(Eol0)
1076
+ else
1077
+ self.index = i1
1051
1078
  r1 = nil
1052
1079
  end
1053
1080
  if r1
1054
1081
  r0 = r1
1055
1082
  else
1056
1083
  if input.index("\n", index) == index
1057
- r2 = (SyntaxNode).new(input, index...(index + 1))
1084
+ r5 = (SyntaxNode).new(input, index...(index + 1))
1058
1085
  @index += 1
1059
1086
  else
1060
1087
  terminal_parse_failure("\n")
1061
- r2 = nil
1088
+ r5 = nil
1062
1089
  end
1063
- if r2
1064
- r0 = r2
1090
+ if r5
1091
+ r0 = r5
1065
1092
  else
1066
1093
  self.index = i0
1067
1094
  r0 = nil
@@ -1073,7 +1100,7 @@ module Feature
1073
1100
  return r0
1074
1101
  end
1075
1102
 
1076
- def _nt_step_keyword
1103
+ def _nt_step_keyword #:nodoc:
1077
1104
  start_index = index
1078
1105
  if node_cache[:step_keyword].has_key?(index)
1079
1106
  cached = node_cache[:step_keyword][index]
@@ -1122,8 +1149,19 @@ module Feature
1122
1149
  if r4
1123
1150
  r0 = r4
1124
1151
  else
1125
- self.index = i0
1126
- r0 = nil
1152
+ if input.index('Men', index) == index
1153
+ r5 = (SyntaxNode).new(input, index...(index + 3))
1154
+ @index += 3
1155
+ else
1156
+ terminal_parse_failure('Men')
1157
+ r5 = nil
1158
+ end
1159
+ if r5
1160
+ r0 = r5
1161
+ else
1162
+ self.index = i0
1163
+ r0 = nil
1164
+ end
1127
1165
  end
1128
1166
  end
1129
1167
  end
@@ -1134,7 +1172,7 @@ module Feature
1134
1172
  return r0
1135
1173
  end
1136
1174
 
1137
- def _nt_scenario_keyword
1175
+ def _nt_scenario_keyword #:nodoc:
1138
1176
  start_index = index
1139
1177
  if node_cache[:scenario_keyword].has_key?(index)
1140
1178
  cached = node_cache[:scenario_keyword][index]
@@ -1155,10 +1193,10 @@ module Feature
1155
1193
  return r0
1156
1194
  end
1157
1195
 
1158
- module GivenScenarioKeyword0
1196
+ module GivenScenarioKeyword0 #:nodoc:
1159
1197
  end
1160
1198
 
1161
- def _nt_given_scenario_keyword
1199
+ def _nt_given_scenario_keyword #:nodoc:
1162
1200
  start_index = index
1163
1201
  if node_cache[:given_scenario_keyword].has_key?(index)
1164
1202
  cached = node_cache[:given_scenario_keyword][index]
@@ -1205,7 +1243,7 @@ module Feature
1205
1243
 
1206
1244
  end
1207
1245
 
1208
- class FeatureParser < Treetop::Runtime::CompiledParser
1246
+ class FeatureParser < Treetop::Runtime::CompiledParser #:nodoc:
1209
1247
  include Feature
1210
1248
  end
1211
1249