lib/cucumber/parser/feature.tt in aslakhellesoy-cucumber-0.1.99.23 vs lib/cucumber/parser/feature.tt in aslakhellesoy-cucumber-0.1.100.1
- old
+ new
@@ -15,19 +15,22 @@
comment
white
tags
white
header:(!(scenario_outline / scenario / background) .)*
- background:(background)?
+ bg:background?
feature_elements
comment? {
def build
- if background.respond_to?(:build)
- Ast::Feature.new(comment.build, tags.build, header.text_value, feature_elements.build, background.build)
- else
- Ast::Feature.new(comment.build, tags.build, header.text_value, feature_elements.build)
- end
+ background = bg.respond_to?(:build) ? bg.build : nil
+ Ast::Feature.new(
+ background,
+ comment.build,
+ tags.build,
+ header.text_value,
+ feature_elements.build(background)
+ )
end
}
end
rule tags
@@ -38,11 +41,11 @@
end
}
end
rule tag
- '@' tag_name:([^@\n\t ])+
+ '@' tag_name:([^@\r\n\t ])+
end
rule comment
(comment_line white)* {
def build
@@ -68,20 +71,21 @@
}
end
rule feature_elements
(scenario / scenario_outline)* {
- def build
- elements.map{|s| s.build}
+ def build(background)
+ elements.map{|s| s.build(background)}
end
}
end
rule scenario
- comment tags white scenario_keyword space* name:line_to_eol (white / eof) steps white {
- def build
+ comment tags white scenario_keyword space* name:line_to_eol white steps white {
+ def build(background)
Ast::Scenario.new(
+ background,
comment.build,
tags.build,
scenario_keyword.line,
scenario_keyword.text_value,
name.text_value,
@@ -91,11 +95,12 @@
}
end
rule scenario_outline
comment tags white scenario_outline_keyword space* name:line_to_eol white steps examples_sections white {
- def build
+ def build(background)
Ast::ScenarioOutline.new(
+ background,
comment.build,
tags.build,
scenario_outline_keyword.line,
scenario_outline_keyword.text_value,
name.text_value,
\ No newline at end of file