lib/cucumber/parser/feature.rb in square-cucumber-0.3.12.2 vs lib/cucumber/parser/feature.rb in square-cucumber-0.3.93.1
- old
+ new
@@ -53,11 +53,15 @@
module FeatureSub2
def has_tags?(tag_names)
tags.has_tags?(tag_names)
end
-
+
+ def has_all_tags?(tag_names)
+ tags.has_all_tags?(tag_names)
+ end
+
def build(filter)
if(filter.nil? || feature_elements.accept?(filter) || (!bg.empty? && filter.accept?(bg)))
background = bg.respond_to?(:build) ? bg.build : nil
Ast::Feature.new(
background,
@@ -109,19 +113,19 @@
else
r12 = _nt_background
if r12
r9 = r12
else
- self.index = i9
+ @index = i9
r9 = nil
end
end
end
if r9
r8 = nil
else
- self.index = i8
+ @index = i8
r8 = instantiate_node(SyntaxNode,input, index...index)
end
s7 << r8
if r8
if index < input_length
@@ -135,11 +139,11 @@
end
if s7.last
r7 = instantiate_node(SyntaxNode,input, i7...index, s7)
r7.extend(FeatureSub0)
else
- self.index = i7
+ @index = i7
r7 = nil
end
if r7
s6 << r7
else
@@ -178,17 +182,17 @@
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(FeatureSub1)
r0.extend(FeatureSub2)
else
- self.index = i0
+ @index = i0
r0 = nil
end
node_cache[:feature_sub][start_index] = r0
- return r0
+ r0
end
module Tags0
def tag
elements[0]
@@ -213,10 +217,14 @@
def has_tags?(tags)
(tag_names & tags).any?
end
+ def has_all_tags?(tags)
+ (tags & tag_names) == tags
+ end
+
def build
Ast::Tags.new(ts.line, tag_names)
end
def tag_names
@@ -251,33 +259,33 @@
else
r8 = _nt_eol
if r8
r6 = r8
else
- self.index = i6
+ @index = i6
r6 = nil
end
end
if r6
s5 << r6
else
break
end
end
if s5.empty?
- self.index = i5
+ @index = i5
r5 = nil
else
r5 = instantiate_node(SyntaxNode,input, i5...index, s5)
end
s3 << r5
end
if s3.last
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
r3.extend(Tags0)
else
- self.index = i3
+ @index = i3
r3 = nil
end
if r3
s2 << r3
else
@@ -290,17 +298,17 @@
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(Tags1)
r0.extend(Tags2)
else
- self.index = i0
+ @index = i0
r0 = nil
end
node_cache[:tags][start_index] = r0
- return r0
+ r0
end
module Tag0
def tag_name
elements[1]
@@ -314,22 +322,22 @@
@index = cached.interval.end if cached
return cached
end
i0, s0 = index, []
- if input.index('@', index) == index
+ if has_terminal?('@', false, index)
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
+ if has_terminal?('\G[^@\\r\\n\\t ]', true, index)
r3 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
r3 = nil
end
@@ -338,28 +346,28 @@
else
break
end
end
if s2.empty?
- self.index = i2
+ @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(Tag0)
else
- self.index = i0
+ @index = i0
r0 = nil
end
node_cache[:tag][start_index] = r0
- return r0
+ r0
end
module Comment0
def comment_line
elements[0]
@@ -395,11 +403,11 @@
end
if s1.last
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
r1.extend(Comment0)
else
- self.index = i1
+ @index = i1
r1 = nil
end
if r1
s0 << r1
else
@@ -409,11 +417,11 @@
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(Comment1)
node_cache[:comment][start_index] = r0
- return r0
+ r0
end
module CommentLine0
def line_to_eol
elements[1]
@@ -427,11 +435,11 @@
@index = cached.interval.end if cached
return cached
end
i0, s0 = index, []
- if input.index('#', index) == index
+ if has_terminal?('#', false, index)
r1 = instantiate_node(SyntaxNode,input, index...(index + 1))
@index += 1
else
terminal_parse_failure('#')
r1 = nil
@@ -443,17 +451,17 @@
end
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(CommentLine0)
else
- self.index = i0
+ @index = i0
r0 = nil
end
node_cache[:comment_line][start_index] = r0
- return r0
+ r0
end
module Background0
def comment
elements[0]
@@ -489,10 +497,15 @@
def has_tags?(tag_names)
feature_tags = self.parent.tags
feature_tags.has_tags?(tag_names)
end
+ def has_all_tags?(tag_names)
+ feature_tags = self.parent.tags
+ feature_tags.has_all_tags?(tag_names)
+ end
+
def build
Ast::Background.new(
comment.build,
background_keyword.line,
background_keyword.text_value,
@@ -549,11 +562,11 @@
else
break
end
end
if s9.empty?
- self.index = i9
+ @index = i9
r9 = nil
else
r9 = instantiate_node(SyntaxNode,input, i9...index, s9)
end
if r9
@@ -561,11 +574,11 @@
else
r11 = _nt_eof
if r11
r8 = r11
else
- self.index = i8
+ @index = i8
r8 = nil
end
end
s0 << r8
if r8
@@ -580,17 +593,17 @@
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(Background0)
r0.extend(Background1)
else
- self.index = i0
+ @index = i0
r0 = nil
end
node_cache[:background][start_index] = r0
- return r0
+ r0
end
module FeatureElements0
def accept?(filter)
filter.nil? || elements.empty? || elements.detect{|feature_element| filter.accept?(feature_element)}
@@ -622,11 +635,11 @@
else
r3 = _nt_scenario_outline
if r3
r1 = r3
else
- self.index = i1
+ @index = i1
r1 = nil
end
end
if r1
s0 << r1
@@ -637,11 +650,11 @@
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(FeatureElements0)
node_cache[:feature_elements][start_index] = r0
- return r0
+ r0
end
module Scenario0
def comment
elements[0]
@@ -686,10 +699,15 @@
def has_tags?(tag_names)
feature_tags = self.parent.parent.tags
tags.has_tags?(tag_names) || feature_tags.has_tags?(tag_names)
end
+ def has_all_tags?(tag_names)
+ feature_tags = self.parent.parent.tags
+ tags.has_all_tags?(tag_names) || feature_tags.has_all_tags?(tag_names)
+ end
+
def matches_name?(regexp_to_match)
name.build =~ regexp_to_match
end
def build(background, filter)
@@ -760,17 +778,17 @@
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(Scenario0)
r0.extend(Scenario1)
else
- self.index = i0
+ @index = i0
r0 = nil
end
node_cache[:scenario][start_index] = r0
- return r0
+ r0
end
module ScenarioOutline0
def comment
elements[0]
@@ -824,10 +842,15 @@
def has_tags?(tag_names)
feature_tags = self.parent.parent.tags
tags.has_tags?(tag_names) || feature_tags.has_tags?(tag_names)
end
+ def has_all_tags?(tag_names)
+ feature_tags = self.parent.parent.tags
+ tags.has_all_tags?(tag_names) || feature_tags.has_all_tags?(tag_names)
+ end
+
def matches_name?(regexp_to_match)
outline_matches_name?(regexp_to_match) || examples_sections.matches_name?(regexp_to_match)
end
def outline_matches_name?(regexp_to_match)
@@ -907,17 +930,17 @@
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(ScenarioOutline0)
r0.extend(ScenarioOutline1)
else
- self.index = i0
+ @index = i0
r0 = nil
end
node_cache[:scenario_outline][start_index] = r0
- return r0
+ r0
end
module Steps0
def at_line?(line)
elements.detect{|e| e.at_line?(line)}
@@ -948,11 +971,11 @@
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(Steps0)
node_cache[:steps][start_index] = r0
- return r0
+ r0
end
module Step0
def comment
elements[0]
@@ -1036,11 +1059,11 @@
else
break
end
end
if s8.empty?
- self.index = i8
+ @index = i8
r8 = nil
else
r8 = instantiate_node(SyntaxNode,input, i8...index, s8)
end
if r8
@@ -1048,11 +1071,11 @@
else
r10 = _nt_eof
if r10
r7 = r10
else
- self.index = i7
+ @index = i7
r7 = nil
end
end
s0 << r7
if r7
@@ -1076,17 +1099,17 @@
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(Step0)
r0.extend(Step1)
else
- self.index = i0
+ @index = i0
r0 = nil
end
node_cache[:step][start_index] = r0
- return r0
+ r0
end
module ExamplesSections0
def at_line?(line)
elements.detect { |e| e.at_line?(line) }
@@ -1125,11 +1148,11 @@
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(ExamplesSections0)
node_cache[:examples_sections][start_index] = r0
- return r0
+ r0
end
module Examples0
def examples_keyword
elements[1]
@@ -1160,10 +1183,14 @@
def has_tags?(tag_names)
true
end
+ def has_all_tags?(tag_names)
+ true
+ end
+
def outline_at_line?(line)
true
end
def matches_name?(regexp_to_match)
@@ -1236,17 +1263,17 @@
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(Examples0)
r0.extend(Examples1)
else
- self.index = i0
+ @index = i0
r0 = nil
end
node_cache[:examples][start_index] = r0
- return r0
+ r0
end
def _nt_multiline_arg
start_index = index
if node_cache[:multiline_arg].has_key?(index)
@@ -1262,18 +1289,18 @@
else
r2 = _nt_py_string
if r2
r0 = r2
else
- self.index = i0
+ @index = i0
r0 = nil
end
end
node_cache[:multiline_arg][start_index] = r0
- return r0
+ r0
end
module LineToEol0
end
@@ -1291,11 +1318,11 @@
i2 = index
r3 = _nt_eol
if r3
r2 = nil
else
- self.index = i2
+ @index = i2
r2 = instantiate_node(SyntaxNode,input, index...index)
end
s1 << r2
if r2
if index < input_length
@@ -1309,11 +1336,11 @@
end
if s1.last
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
r1.extend(LineToEol0)
else
- self.index = i1
+ @index = i1
r1 = nil
end
if r1
s0 << r1
else
@@ -1322,11 +1349,11 @@
end
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
node_cache[:line_to_eol][start_index] = r0
- return r0
+ r0
end
module LinesToKeyword0
def eol
elements[0]
@@ -1380,17 +1407,17 @@
end
if s3.last
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
r3.extend(LinesToKeyword0)
else
- self.index = i3
+ @index = i3
r3 = nil
end
if r3
r2 = nil
else
- self.index = i2
+ @index = i2
r2 = instantiate_node(SyntaxNode,input, index...index)
end
s1 << r2
if r2
if index < input_length
@@ -1404,11 +1431,11 @@
end
if s1.last
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
r1.extend(LinesToKeyword1)
else
- self.index = i1
+ @index = i1
r1 = nil
end
if r1
s0 << r1
else
@@ -1418,11 +1445,11 @@
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(LinesToKeyword2)
node_cache[:lines_to_keyword][start_index] = r0
- return r0
+ r0
end
module ReservedWordsAndSymbols0
def step_keyword
elements[0]
@@ -1451,11 +1478,11 @@
end
if s1.last
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
r1.extend(ReservedWordsAndSymbols0)
else
- self.index = i1
+ @index = i1
r1 = nil
end
if r1
r0 = r1
else
@@ -1477,22 +1504,22 @@
else
r8 = _nt_comment_line
if r8
r0 = r8
else
- self.index = i0
+ @index = i0
r0 = nil
end
end
end
end
end
end
node_cache[:reserved_words_and_symbols][start_index] = r0
- return r0
+ r0
end
module PyString0
end
@@ -1538,11 +1565,11 @@
i4 = index
r5 = _nt_close_py_string
if r5
r4 = nil
else
- self.index = i4
+ @index = i4
r4 = instantiate_node(SyntaxNode,input, index...index)
end
s3 << r4
if r4
if index < input_length
@@ -1556,11 +1583,11 @@
end
if s3.last
r3 = instantiate_node(SyntaxNode,input, i3...index, s3)
r3.extend(PyString0)
else
- self.index = i3
+ @index = i3
r3 = nil
end
if r3
s2 << r3
else
@@ -1577,17 +1604,17 @@
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(PyString1)
r0.extend(PyString2)
else
- self.index = i0
+ @index = i0
r0 = nil
end
node_cache[:py_string][start_index] = r0
- return r0
+ r0
end
module OpenPyString0
def indent
elements[0]
@@ -1627,11 +1654,11 @@
end
end
r1 = instantiate_node(SyntaxNode,input, i1...index, s1)
s0 << r1
if r1
- if input.index('"""', index) == index
+ if has_terminal?('"""', false, index)
r3 = instantiate_node(SyntaxNode,input, index...(index + 3))
@index += 3
else
terminal_parse_failure('"""')
r3 = nil
@@ -1658,17 +1685,17 @@
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(OpenPyString0)
r0.extend(OpenPyString1)
else
- self.index = i0
+ @index = i0
r0 = nil
end
node_cache[:open_py_string][start_index] = r0
- return r0
+ r0
end
module ClosePyString0
def eol
elements[0]
@@ -1711,11 +1738,11 @@
end
end
r2 = instantiate_node(SyntaxNode,input, i2...index, s2)
s0 << r2
if r2
- if input.index('"""', index) == index
+ if has_terminal?('"""', false, index)
r4 = instantiate_node(SyntaxNode,input, index...(index + 3))
@index += 3
else
terminal_parse_failure('"""')
r4 = nil
@@ -1730,17 +1757,17 @@
if s0.last
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
r0.extend(ClosePyString0)
r0.extend(ClosePyString1)
else
- self.index = i0
+ @index = i0
r0 = nil
end
node_cache[:close_py_string][start_index] = r0
- return r0
+ r0
end
def _nt_white
start_index = index
if node_cache[:white].has_key?(index)
@@ -1758,11 +1785,11 @@
else
r3 = _nt_eol
if r3
r1 = r3
else
- self.index = i1
+ @index = i1
r1 = nil
end
end
if r1
s0 << r1
@@ -1772,10 +1799,10 @@
end
r0 = instantiate_node(SyntaxNode,input, i0...index, s0)
node_cache[:white][start_index] = r0
- return r0
+ r0
end
end
class FeatureParser < Treetop::Runtime::CompiledParser