cucumber-expressions 5.0.7 → 5.0.10
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 50ebfcf2cfdb4abd82cbb5249315229fb737aad6
|
4
|
+
data.tar.gz: bc852a832a6723d2bd3d49fbcf9b2bd1cc88f8a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6770cad378c2a1661e6dd9f645fd38d7e0ba1e7cfc388f50613570a1bd0433b02601552831207e4c3b2ceff504d58ad0baf95ab41711f9f5dfeb041b7f8d9b4a
|
7
|
+
data.tar.gz: 2610566bef43fae42a66c1290538a8ca868b061b3ac9218266607921c3feea5a3406bc04601786e2c987558630b127fb0e522a620e9fb6a7d5f53909897d02f4
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
Gem::Specification.new do |s|
|
3
3
|
s.name = 'cucumber-expressions'
|
4
|
-
s.version = '5.0.
|
4
|
+
s.version = '5.0.10'
|
5
5
|
s.authors = ["Aslak Hellesøy"]
|
6
6
|
s.description = 'Cucumber Expressions - a simpler alternative to Regular Expressions'
|
7
7
|
s.summary = "cucumber-expressions-#{s.version}"
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
|
|
13
13
|
|
14
14
|
s.add_development_dependency 'bundler'
|
15
15
|
s.add_development_dependency 'rake', '~> 12.3'
|
16
|
-
s.add_development_dependency 'rspec', '~> 3.
|
16
|
+
s.add_development_dependency 'rspec', '~> 3.7'
|
17
17
|
|
18
18
|
# For coverage reports
|
19
19
|
s.add_development_dependency 'coveralls'
|
@@ -3,6 +3,8 @@ require 'cucumber/cucumber_expressions/group_builder'
|
|
3
3
|
module Cucumber
|
4
4
|
module CucumberExpressions
|
5
5
|
class TreeRegexp
|
6
|
+
REGEXP_CHARS = ['#', '$', '(', ')', '*', '+', '.', '?', '[', '\\', '^', '{', '|']
|
7
|
+
|
6
8
|
attr_reader :regexp, :group_builder
|
7
9
|
|
8
10
|
def initialize(regexp)
|
@@ -11,13 +13,18 @@ module Cucumber
|
|
11
13
|
stack = [GroupBuilder.new]
|
12
14
|
group_start_stack = []
|
13
15
|
last = nil
|
16
|
+
escaping = false
|
14
17
|
non_capturing_maybe = false
|
15
18
|
@regexp.source.split('').each_with_index do |c, n|
|
16
|
-
if
|
19
|
+
if escaping && regexp_char?(c)
|
20
|
+
escaping = false
|
21
|
+
elsif c == '\\'
|
22
|
+
escaping = true
|
23
|
+
elsif c == '(' && !escaping
|
17
24
|
stack.push(GroupBuilder.new)
|
18
25
|
group_start_stack.push(n+1)
|
19
26
|
non_capturing_maybe = false
|
20
|
-
elsif c == ')' &&
|
27
|
+
elsif c == ')' && !escaping
|
21
28
|
gb = stack.pop
|
22
29
|
group_start = group_start_stack.pop
|
23
30
|
if gb.capturing?
|
@@ -38,6 +45,10 @@ module Cucumber
|
|
38
45
|
@group_builder = stack.pop
|
39
46
|
end
|
40
47
|
|
48
|
+
def regexp_char?(c)
|
49
|
+
REGEXP_CHARS.include?(c)
|
50
|
+
end
|
51
|
+
|
41
52
|
def match(s)
|
42
53
|
match = @regexp.match(s)
|
43
54
|
return nil if match.nil?
|
@@ -53,6 +53,12 @@ module Cucumber
|
|
53
53
|
expect(group.children.length).to eq(3)
|
54
54
|
end
|
55
55
|
|
56
|
+
it 'works with escaped backslash' do
|
57
|
+
tr = TreeRegexp.new(/foo\\(bar|baz)/)
|
58
|
+
group = tr.match("foo\\bar")
|
59
|
+
expect(group.children.length).to eq(1)
|
60
|
+
end
|
61
|
+
|
56
62
|
it 'captures non capturing groups with capturing groups inside' do
|
57
63
|
tr = TreeRegexp.new(/the stdout(?: from "(.*?)")?/)
|
58
64
|
group = tr.match("the stdout")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-expressions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0.
|
4
|
+
version: 5.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aslak Hellesøy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
47
|
+
version: '3.7'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
54
|
+
version: '3.7'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: coveralls
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -131,7 +131,7 @@ rubyforge_project:
|
|
131
131
|
rubygems_version: 2.6.8
|
132
132
|
signing_key:
|
133
133
|
specification_version: 4
|
134
|
-
summary: cucumber-expressions-5.0.
|
134
|
+
summary: cucumber-expressions-5.0.10
|
135
135
|
test_files:
|
136
136
|
- spec/capture_warnings.rb
|
137
137
|
- spec/coverage.rb
|