lib/cucumber/parser/feature.tt in aslakhellesoy-cucumber-0.3.0 vs lib/cucumber/parser/feature.tt in aslakhellesoy-cucumber-0.3.0.1
- old
+ new
@@ -74,17 +74,17 @@
rule comment_line
'#' line_to_eol
end
rule background
- comment white background_keyword space* name:line_to_eol? (eol+ / eof) steps {
+ comment white background_keyword space* name:lines_to_keyword? (eol+ / eof) steps {
def build
Ast::Background.new(
comment.build,
background_keyword.line,
background_keyword.text_value,
- name.text_value,
+ name.build,
steps.build
)
end
}
end
@@ -104,11 +104,11 @@
end
}
end
rule scenario
- comment tags white scenario_keyword space* name:line_to_eol white steps white {
+ comment tags white scenario_keyword space* name:lines_to_keyword white steps white {
def at_line?(line)
scenario_keyword.line == line ||
steps.at_line?(line) ||
tags.at_line?(line)
end
@@ -117,29 +117,29 @@
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
rule scenario_outline
- comment tags white scenario_outline_keyword space* name:line_to_eol white steps examples_sections white {
+ comment tags white scenario_outline_keyword space* name:lines_to_keyword white steps examples_sections white {
def at_line?(line)
outline_at_line?(line) ||
examples_sections.at_line?(line) ||
tags.at_line?(line)
end
@@ -153,21 +153,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
}
@@ -217,11 +217,11 @@
end
}
end
rule examples
- space* examples_keyword space* name:line_to_eol? eol table white {
+ space* examples_keyword space* name:lines_to_keyword? eol table white {
def at_line?(line)
examples_keyword.line == line ||
table.at_line?(line)
end
@@ -232,20 +232,36 @@
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
rule multiline_arg
table / py_string
end
rule line_to_eol
(!eol .)*
+ end
+
+ rule line_to_keyword
+ white text:(!step_keyword !scenario_keyword !scenario_outline_keyword !table !tag !comment_line !eol .)+ {
+ def build
+ text.text_value.strip
+ end
+ }
+ end
+
+ rule lines_to_keyword
+ (line_to_keyword)* {
+ def build
+ elements.map{|s| s.build}.join("\n")
+ end
+ }
end
rule py_string
open_py_string s:(!close_py_string .)* close_py_string {
def at_line?(line)