lib/cucumber/parser/feature.rb in aslakhellesoy-cucumber-0.2.3 vs lib/cucumber/parser/feature.rb in aslakhellesoy-cucumber-0.2.3.1

- old
+ new

@@ -116,25 +116,25 @@ end if r9 r8 = nil else self.index = i8 - r8 = SyntaxNode.new(input, index...index) + r8 = instantiate_node(SyntaxNode,input, index...index) end s7 << r8 if r8 if index < input_length - r13 = (SyntaxNode).new(input, index...(index + 1)) + r13 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure("any character") r13 = nil end s7 << r13 end if s7.last - r7 = (SyntaxNode).new(input, i7...index, s7) + r7 = instantiate_node(SyntaxNode,input, i7...index, s7) r7.extend(Feature0) else self.index = i7 r7 = nil end @@ -142,29 +142,29 @@ s6 << r7 else break end end - r6 = SyntaxNode.new(input, i6...index, s6) + r6 = instantiate_node(SyntaxNode,input, i6...index, s6) s0 << r6 if r6 r15 = _nt_background if r15 r14 = r15 else - r14 = SyntaxNode.new(input, index...index) + r14 = instantiate_node(SyntaxNode,input, index...index) end s0 << r14 if r14 r16 = _nt_feature_elements s0 << r16 if r16 r18 = _nt_comment if r18 r17 = r18 else - r17 = SyntaxNode.new(input, index...index) + r17 = instantiate_node(SyntaxNode,input, index...index) end s0 << r17 end end end @@ -172,11 +172,11 @@ end end end end if s0.last - r0 = (SyntaxNode).new(input, i0...index, s0) + r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(Feature1) r0.extend(Feature2) else self.index = i0 r0 = nil @@ -252,16 +252,16 @@ end if s5.empty? self.index = i5 r5 = nil else - r5 = SyntaxNode.new(input, i5...index, s5) + r5 = instantiate_node(SyntaxNode,input, i5...index, s5) end s3 << r5 end if s3.last - r3 = (SyntaxNode).new(input, i3...index, s3) + r3 = instantiate_node(SyntaxNode,input, i3...index, s3) r3.extend(Tags0) else self.index = i3 r3 = nil end @@ -269,15 +269,15 @@ s2 << r3 else break end end - r2 = SyntaxNode.new(input, i2...index, s2) + r2 = instantiate_node(SyntaxNode,input, i2...index, s2) s0 << r2 end if s0.last - r0 = (SyntaxNode).new(input, i0...index, s0) + r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(Tags1) r0.extend(Tags2) else self.index = i0 r0 = nil @@ -302,22 +302,22 @@ return cached end i0, s0 = index, [] if input.index('@', index) == index - r1 = (SyntaxNode).new(input, index...(index + 1)) + r1 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('@') r1 = nil end s0 << r1 if r1 s2, i2 = [], index loop do if input.index(Regexp.new('[^@\\r\\n\\t ]'), index) == index - r3 = (SyntaxNode).new(input, index...(index + 1)) + r3 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else r3 = nil end if r3 @@ -328,16 +328,16 @@ end if s2.empty? self.index = i2 r2 = nil else - r2 = SyntaxNode.new(input, i2...index, s2) + r2 = instantiate_node(SyntaxNode,input, i2...index, s2) end s0 << r2 end if s0.last - r0 = (SyntaxNode).new(input, i0...index, s0) + r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(Tag0) else self.index = i0 r0 = nil end @@ -379,11 +379,11 @@ if r2 r3 = _nt_white s1 << r3 end if s1.last - r1 = (SyntaxNode).new(input, i1...index, s1) + r1 = instantiate_node(SyntaxNode,input, i1...index, s1) r1.extend(Comment0) else self.index = i1 r1 = nil end @@ -391,11 +391,11 @@ s0 << r1 else break end end - r0 = SyntaxNode.new(input, i0...index, s0) + r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(Comment1) node_cache[:comment][start_index] = r0 return r0 @@ -415,11 +415,11 @@ return cached end i0, s0 = index, [] if input.index('#', index) == index - r1 = (SyntaxNode).new(input, index...(index + 1)) + r1 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure('#') r1 = nil end @@ -427,11 +427,11 @@ if r1 r2 = _nt_line_to_eol s0 << r2 end if s0.last - r0 = (SyntaxNode).new(input, i0...index, s0) + r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(CommentLine0) else self.index = i0 r0 = nil end @@ -452,21 +452,26 @@ def background_keyword elements[2] end + def name + elements[4] + end + def steps - elements[5] + elements[6] end end module Background1 def build Ast::Background.new( comment.build, background_keyword.line, - background_keyword.text_value, + background_keyword.text_value, + name.text_value, steps.build ) end end @@ -495,51 +500,60 @@ s4 << r5 else break end end - r4 = SyntaxNode.new(input, i4...index, s4) + r4 = instantiate_node(SyntaxNode,input, i4...index, s4) s0 << r4 if r4 - i6 = index - s7, i7 = [], index - loop do - r8 = _nt_eol - if r8 - s7 << r8 - else - break - end - end - if s7.empty? - self.index = i7 - r7 = nil - else - r7 = SyntaxNode.new(input, i7...index, s7) - end + r7 = _nt_line_to_eol if r7 r6 = r7 else - r9 = _nt_eof + r6 = instantiate_node(SyntaxNode,input, index...index) + end + s0 << r6 + if r6 + i8 = index + s9, i9 = [], index + loop do + r10 = _nt_eol + if r10 + s9 << r10 + else + break + end + end + if s9.empty? + self.index = i9 + r9 = nil + else + r9 = instantiate_node(SyntaxNode,input, i9...index, s9) + end if r9 - r6 = r9 + r8 = r9 else - self.index = i6 - r6 = nil + r11 = _nt_eof + if r11 + r8 = r11 + else + self.index = i8 + r8 = nil + end end + s0 << r8 + if r8 + r12 = _nt_steps + s0 << r12 + end end - s0 << r6 - if r6 - r10 = _nt_steps - s0 << r10 - end end end end end if s0.last - r0 = (SyntaxNode).new(input, i0...index, s0) + r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(Background0) r0.extend(Background1) else self.index = i0 r0 = nil @@ -583,11 +597,11 @@ s0 << r1 else break end end - r0 = SyntaxNode.new(input, i0...index, s0) + r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(FeatureElements0) node_cache[:feature_elements][start_index] = r0 return r0 @@ -669,11 +683,11 @@ s5 << r6 else break end end - r5 = SyntaxNode.new(input, i5...index, s5) + r5 = instantiate_node(SyntaxNode,input, i5...index, s5) s0 << r5 if r5 r7 = _nt_line_to_eol s0 << r7 if r7 @@ -692,11 +706,11 @@ end end end end if s0.last - r0 = (SyntaxNode).new(input, i0...index, s0) + r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(Scenario0) r0.extend(Scenario1) else self.index = i0 r0 = nil @@ -788,11 +802,11 @@ s5 << r6 else break end end - r5 = SyntaxNode.new(input, i5...index, s5) + r5 = instantiate_node(SyntaxNode,input, i5...index, s5) s0 << r5 if r5 r7 = _nt_line_to_eol s0 << r7 if r7 @@ -815,11 +829,11 @@ end end end end if s0.last - r0 = (SyntaxNode).new(input, i0...index, s0) + r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(ScenarioOutline0) r0.extend(ScenarioOutline1) else self.index = i0 r0 = nil @@ -851,11 +865,11 @@ s0 << r1 else break end end - r0 = SyntaxNode.new(input, i0...index, s0) + r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(Steps0) node_cache[:steps][start_index] = r0 return r0 @@ -916,11 +930,11 @@ s2 << r3 else break end end - r2 = SyntaxNode.new(input, i2...index, s2) + r2 = instantiate_node(SyntaxNode,input, i2...index, s2) s0 << r2 if r2 r4 = _nt_step_keyword s0 << r4 if r4 @@ -942,11 +956,11 @@ end if s8.empty? self.index = i8 r8 = nil else - r8 = SyntaxNode.new(input, i8...index, s8) + r8 = instantiate_node(SyntaxNode,input, i8...index, s8) end if r8 r7 = r8 else r10 = _nt_eof @@ -961,11 +975,11 @@ if r7 r12 = _nt_multiline_arg if r12 r11 = r12 else - r11 = SyntaxNode.new(input, index...index) + r11 = instantiate_node(SyntaxNode,input, index...index) end s0 << r11 if r11 r13 = _nt_white s0 << r13 @@ -975,11 +989,11 @@ end end end end if s0.last - r0 = (SyntaxNode).new(input, i0...index, s0) + r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(Step0) r0.extend(Step1) else self.index = i0 r0 = nil @@ -1011,11 +1025,11 @@ s0 << r1 else break end end - r0 = SyntaxNode.new(input, i0...index, s0) + r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(ExamplesSections0) node_cache[:examples_sections][start_index] = r0 return r0 @@ -1065,11 +1079,11 @@ s1 << r2 else break end end - r1 = SyntaxNode.new(input, i1...index, s1) + r1 = instantiate_node(SyntaxNode,input, i1...index, s1) s0 << r1 if r1 r3 = _nt_examples_keyword s0 << r3 if r3 @@ -1080,18 +1094,18 @@ s4 << r5 else break end end - r4 = SyntaxNode.new(input, i4...index, s4) + r4 = instantiate_node(SyntaxNode,input, i4...index, s4) s0 << r4 if r4 r7 = _nt_line_to_eol if r7 r6 = r7 else - r6 = SyntaxNode.new(input, index...index) + r6 = instantiate_node(SyntaxNode,input, index...index) end s0 << r6 if r6 r8 = _nt_eol s0 << r8 @@ -1106,11 +1120,11 @@ end end end end if s0.last - r0 = (SyntaxNode).new(input, i0...index, s0) + r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(Examples0) r0.extend(Examples1) else self.index = i0 r0 = nil @@ -1166,25 +1180,25 @@ r3 = _nt_eol if r3 r2 = nil else self.index = i2 - r2 = SyntaxNode.new(input, index...index) + r2 = instantiate_node(SyntaxNode,input, index...index) end s1 << r2 if r2 if index < input_length - r4 = (SyntaxNode).new(input, index...(index + 1)) + r4 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure("any character") r4 = nil end s1 << r4 end if s1.last - r1 = (SyntaxNode).new(input, i1...index, s1) + r1 = instantiate_node(SyntaxNode,input, i1...index, s1) r1.extend(LineToEol0) else self.index = i1 r1 = nil end @@ -1192,11 +1206,11 @@ s0 << r1 else break end end - r0 = SyntaxNode.new(input, i0...index, s0) + r0 = instantiate_node(SyntaxNode,input, i0...index, s0) node_cache[:line_to_eol][start_index] = r0 return r0 end @@ -1243,25 +1257,25 @@ r5 = _nt_close_py_string if r5 r4 = nil else self.index = i4 - r4 = SyntaxNode.new(input, index...index) + r4 = instantiate_node(SyntaxNode,input, index...index) end s3 << r4 if r4 if index < input_length - r6 = (SyntaxNode).new(input, index...(index + 1)) + r6 = instantiate_node(SyntaxNode,input, index...(index + 1)) @index += 1 else terminal_parse_failure("any character") r6 = nil end s3 << r6 end if s3.last - r3 = (SyntaxNode).new(input, i3...index, s3) + r3 = instantiate_node(SyntaxNode,input, i3...index, s3) r3.extend(PyString0) else self.index = i3 r3 = nil end @@ -1269,19 +1283,19 @@ s2 << r3 else break end end - r2 = SyntaxNode.new(input, i2...index, s2) + r2 = instantiate_node(SyntaxNode,input, i2...index, s2) s0 << r2 if r2 r7 = _nt_close_py_string s0 << r7 end end if s0.last - r0 = (SyntaxNode).new(input, i0...index, s0) + r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(PyString1) r0.extend(PyString2) else self.index = i0 r0 = nil @@ -1323,11 +1337,11 @@ i0, s0 = index, [] r1 = _nt_white s0 << r1 if r1 if input.index('"""', index) == index - r2 = (SyntaxNode).new(input, index...(index + 3)) + r2 = instantiate_node(SyntaxNode,input, index...(index + 3)) @index += 3 else terminal_parse_failure('"""') r2 = nil end @@ -1340,20 +1354,20 @@ s3 << r4 else break end end - r3 = SyntaxNode.new(input, i3...index, s3) + r3 = instantiate_node(SyntaxNode,input, i3...index, s3) s0 << r3 if r3 r5 = _nt_eol s0 << r5 end end end if s0.last - r0 = (SyntaxNode).new(input, i0...index, s0) + r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(OpenPyString0) r0.extend(OpenPyString1) else self.index = i0 r0 = nil @@ -1403,15 +1417,15 @@ s2 << r3 else break end end - r2 = SyntaxNode.new(input, i2...index, s2) + r2 = instantiate_node(SyntaxNode,input, i2...index, s2) s0 << r2 if r2 if input.index('"""', index) == index - r4 = (SyntaxNode).new(input, index...(index + 3)) + r4 = instantiate_node(SyntaxNode,input, index...(index + 3)) @index += 3 else terminal_parse_failure('"""') r4 = nil end @@ -1421,11 +1435,11 @@ s0 << r5 end end end if s0.last - r0 = (SyntaxNode).new(input, i0...index, s0) + r0 = instantiate_node(SyntaxNode,input, i0...index, s0) r0.extend(ClosePyString0) r0.extend(ClosePyString1) else self.index = i0 r0 = nil @@ -1463,10 +1477,10 @@ s0 << r1 else break end end - r0 = SyntaxNode.new(input, i0...index, s0) + r0 = instantiate_node(SyntaxNode,input, i0...index, s0) node_cache[:white][start_index] = r0 return r0 end \ No newline at end of file