lib/cucumber/parser/feature.rb in aslakhellesoy-cucumber-0.3.0 vs lib/cucumber/parser/feature.rb in aslakhellesoy-cucumber-0.3.0.1

- old
+ new

@@ -484,11 +484,11 @@ def build Ast::Background.new( comment.build, background_keyword.line, background_keyword.text_value, - name.text_value, + name.build, steps.build ) end end @@ -520,11 +520,11 @@ end end r4 = instantiate_node(SyntaxNode,input, i4...index, s4) s0 << r4 if r4 - r7 = _nt_line_to_eol + r7 = _nt_lines_to_keyword if r7 r6 = r7 else r6 = instantiate_node(SyntaxNode,input, index...index) end @@ -677,21 +677,21 @@ feature_tags = self.parent.parent.tags tags.has_tags?(tag_names) || feature_tags.has_tags?(tag_names) end def matches_name?(name_to_match) - name.text_value == name_to_match + name.build == name_to_match end def build(background, filter) Ast::Scenario.new( background, comment.build, tags.build, scenario_keyword.line, scenario_keyword.text_value, - name.text_value, + name.build, steps.build ) end end @@ -726,11 +726,11 @@ end end r5 = instantiate_node(SyntaxNode,input, i5...index, s5) s0 << r5 if r5 - r7 = _nt_line_to_eol + r7 = _nt_lines_to_keyword s0 << r7 if r7 r8 = _nt_white s0 << r8 if r8 @@ -815,21 +815,21 @@ feature_tags = self.parent.parent.tags tags.has_tags?(tag_names) || feature_tags.has_tags?(tag_names) end def matches_name?(name_to_match) - name.text_value == name_to_match + name.build == name_to_match end def build(background, filter) Ast::ScenarioOutline.new( background, comment.build, tags.build, scenario_outline_keyword.line, scenario_outline_keyword.text_value, - name.text_value, + name.build, steps.build, examples_sections.build(filter, self) ) end end @@ -865,11 +865,11 @@ end end r5 = instantiate_node(SyntaxNode,input, i5...index, s5) s0 << r5 if r5 - r7 = _nt_line_to_eol + r7 = _nt_lines_to_keyword s0 << r7 if r7 r8 = _nt_white s0 << r8 if r8 @@ -1147,11 +1147,11 @@ def outline_at_line?(line) true end def build(filter, scenario_outline) - [examples_keyword.line, examples_keyword.text_value, name.text_value, table.raw(filter, scenario_outline)] + [examples_keyword.line, examples_keyword.text_value, name.build, table.raw(filter, scenario_outline)] end end def _nt_examples start_index = index @@ -1187,11 +1187,11 @@ end end r4 = instantiate_node(SyntaxNode,input, i4...index, s4) s0 << r4 if r4 - r7 = _nt_line_to_eol + r7 = _nt_lines_to_keyword if r7 r6 = r7 else r6 = instantiate_node(SyntaxNode,input, index...index) end @@ -1299,9 +1299,195 @@ end end r0 = instantiate_node(SyntaxNode,input, i0...index, s0) node_cache[:line_to_eol][start_index] = r0 + + return r0 + end + + module LineToKeyword0 + end + + module LineToKeyword1 + def white + elements[0] + end + + def text + elements[1] + end + end + + module LineToKeyword2 + def build + text.text_value.strip + end + end + + def _nt_line_to_keyword + start_index = index + if node_cache[:line_to_keyword].has_key?(index) + cached = node_cache[:line_to_keyword][index] + @index = cached.interval.end if cached + return cached + end + + i0, s0 = index, [] + r1 = _nt_white + s0 << r1 + if r1 + s2, i2 = [], index + loop do + i3, s3 = index, [] + i4 = index + r5 = _nt_step_keyword + if r5 + r4 = nil + else + self.index = i4 + r4 = instantiate_node(SyntaxNode,input, index...index) + end + s3 << r4 + if r4 + i6 = index + r7 = _nt_scenario_keyword + if r7 + r6 = nil + else + self.index = i6 + r6 = instantiate_node(SyntaxNode,input, index...index) + end + s3 << r6 + if r6 + i8 = index + r9 = _nt_scenario_outline_keyword + if r9 + r8 = nil + else + self.index = i8 + r8 = instantiate_node(SyntaxNode,input, index...index) + end + s3 << r8 + if r8 + i10 = index + r11 = _nt_table + if r11 + r10 = nil + else + self.index = i10 + r10 = instantiate_node(SyntaxNode,input, index...index) + end + s3 << r10 + if r10 + i12 = index + r13 = _nt_tag + if r13 + r12 = nil + else + self.index = i12 + r12 = instantiate_node(SyntaxNode,input, index...index) + end + s3 << r12 + if r12 + i14 = index + r15 = _nt_comment_line + if r15 + r14 = nil + else + self.index = i14 + r14 = instantiate_node(SyntaxNode,input, index...index) + end + s3 << r14 + if r14 + i16 = index + r17 = _nt_eol + if r17 + r16 = nil + else + self.index = i16 + r16 = instantiate_node(SyntaxNode,input, index...index) + end + s3 << r16 + if r16 + if index < input_length + r18 = instantiate_node(SyntaxNode,input, index...(index + 1)) + @index += 1 + else + terminal_parse_failure("any character") + r18 = nil + end + s3 << r18 + end + end + end + end + end + end + end + if s3.last + r3 = instantiate_node(SyntaxNode,input, i3...index, s3) + r3.extend(LineToKeyword0) + else + self.index = i3 + r3 = nil + end + if r3 + s2 << r3 + else + break + end + end + if s2.empty? + self.index = i2 + r2 = nil + else + r2 = instantiate_node(SyntaxNode,input, i2...index, s2) + end + s0 << r2 + end + if s0.last + r0 = instantiate_node(SyntaxNode,input, i0...index, s0) + r0.extend(LineToKeyword1) + r0.extend(LineToKeyword2) + else + self.index = i0 + r0 = nil + end + + node_cache[:line_to_keyword][start_index] = r0 + + return r0 + end + + module LinesToKeyword0 + + def build + elements.map{|s| s.build}.join("\n") + end + end + + def _nt_lines_to_keyword + start_index = index + if node_cache[:lines_to_keyword].has_key?(index) + cached = node_cache[:lines_to_keyword][index] + @index = cached.interval.end if cached + return cached + end + + s0, i0 = [], index + loop do + r1 = _nt_line_to_keyword + if r1 + s0 << r1 + else + break + end + end + r0 = instantiate_node(SyntaxNode,input, i0...index, s0) + r0.extend(LinesToKeyword0) + + node_cache[:lines_to_keyword][start_index] = r0 return r0 end module PyString0