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