cucumber-tag-expressions 6.1.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/LICENSE +21 -0
- data/lib/cucumber/tag_expressions/parser.rb +11 -15
- metadata +56 -30
- data/spec/errors_spec.rb +0 -13
- data/spec/evaluations_spec.rb +0 -17
- data/spec/parsing_spec.rb +0 -13
- data/spec/spec_helper.rb +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fef87856d34112746f4eb55b79609465df3d58c6dd2653bd834b6a649b4521ea
|
4
|
+
data.tar.gz: e7dcc602274caaae9b5aa198a31d035cb375b6d5af07913cc52bc9ec371feabf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: de8838af38969ce92dda4f8e01ca7dacb100db30cf5b2207b51a2aba744e8dddc23b1801a92e2829b863ad968b62e13d7eae0e1d5a19840ed042cf2d7fde9528
|
7
|
+
data.tar.gz: 1e535cde232ca5762212c70306b7d70e94fef9ce683dd1aab01fdc8dd9353a9727d6cfaeb105f8750d017f2e121efb85b4a75d2f828ddc895e9eaab97d479cb7
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2016 Cucumber Ltd and contributors
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -15,28 +15,24 @@ module Cucumber
|
|
15
15
|
tokens = tokenize(infix_expression)
|
16
16
|
return True.new if tokens.empty?
|
17
17
|
|
18
|
-
tokens.each
|
19
|
-
expected_token_type = handle_sequential_tokens(token, infix_expression, expected_token_type)
|
20
|
-
end
|
21
|
-
|
18
|
+
tokens.each { |token| expected_token_type = handle_sequential_tokens(token, infix_expression, expected_token_type) }
|
22
19
|
while @operators.any?
|
23
|
-
raise
|
20
|
+
raise "Tag expression \"#{infix_expression}\" could not be parsed because of syntax error: Unmatched (." if @operators.last == '('
|
24
21
|
|
25
22
|
push_expression(pop(@operators))
|
26
23
|
end
|
27
|
-
|
28
|
-
@expressions.empty? ? expression : raise('Not empty')
|
24
|
+
pop(@expressions)
|
29
25
|
end
|
30
26
|
|
31
27
|
private
|
32
28
|
|
33
|
-
def
|
29
|
+
def assoc_correct?(token, value)
|
34
30
|
operator_types.dig(token, :assoc) == value
|
35
31
|
end
|
36
32
|
|
37
33
|
def lower_precedence?(operation)
|
38
|
-
(
|
39
|
-
(
|
34
|
+
(assoc_correct?(operation, :left) && precedence(operation) <= precedence(@operators.last)) ||
|
35
|
+
(assoc_correct?(operation, :right) && precedence(operation) < precedence(@operators.last))
|
40
36
|
end
|
41
37
|
|
42
38
|
def operator?(token)
|
@@ -54,7 +50,7 @@ module Cucumber
|
|
54
50
|
infix_expression.chars.each do |char|
|
55
51
|
if escaped
|
56
52
|
unless char == '(' || char == ')' || char == '\\' || whitespace?(char)
|
57
|
-
raise
|
53
|
+
raise "Tag expression \"#{infix_expression}\" could not be parsed because of syntax error: Illegal escape before \"#{char}\"."
|
58
54
|
end
|
59
55
|
|
60
56
|
token += char
|
@@ -62,7 +58,7 @@ module Cucumber
|
|
62
58
|
elsif char == '\\'
|
63
59
|
escaped = true
|
64
60
|
elsif char == '(' || char == ')' || whitespace?(char)
|
65
|
-
|
61
|
+
unless token.empty?
|
66
62
|
tokens.push(token)
|
67
63
|
token = +''
|
68
64
|
end
|
@@ -71,7 +67,7 @@ module Cucumber
|
|
71
67
|
token += char
|
72
68
|
end
|
73
69
|
end
|
74
|
-
tokens.push(token)
|
70
|
+
tokens.push(token) unless token.empty?
|
75
71
|
tokens
|
76
72
|
end
|
77
73
|
|
@@ -114,7 +110,7 @@ module Cucumber
|
|
114
110
|
def handle_close_paren(infix_expression, _token, expected_token_type)
|
115
111
|
check(infix_expression, expected_token_type, :operator)
|
116
112
|
push_expression(pop(@operators)) while @operators.any? && @operators.last != '('
|
117
|
-
raise
|
113
|
+
raise "Tag expression \"#{infix_expression}\" could not be parsed because of syntax error: Unmatched )." if @operators.empty?
|
118
114
|
|
119
115
|
pop(@operators) if @operators.last == '('
|
120
116
|
:operator
|
@@ -129,7 +125,7 @@ module Cucumber
|
|
129
125
|
def check(infix_expression, expected_token_type, token_type)
|
130
126
|
return if expected_token_type == token_type
|
131
127
|
|
132
|
-
raise
|
128
|
+
raise "Tag expression \"#{infix_expression}\" could not be parsed because of syntax error: Expected #{expected_token_type}."
|
133
129
|
end
|
134
130
|
|
135
131
|
def pop(array, amount = 1)
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cucumber-tag-expressions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrea Nodari
|
8
8
|
- Aslak Hellesøy
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rake
|
@@ -17,62 +16,95 @@ dependencies:
|
|
17
16
|
requirements:
|
18
17
|
- - "~>"
|
19
18
|
- !ruby/object:Gem::Version
|
20
|
-
version: '13.
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 13.0.6
|
19
|
+
version: '13.3'
|
24
20
|
type: :development
|
25
21
|
prerelease: false
|
26
22
|
version_requirements: !ruby/object:Gem::Requirement
|
27
23
|
requirements:
|
28
24
|
- - "~>"
|
29
25
|
- !ruby/object:Gem::Version
|
30
|
-
version: '13.
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 13.0.6
|
26
|
+
version: '13.3'
|
34
27
|
- !ruby/object:Gem::Dependency
|
35
28
|
name: rspec
|
36
29
|
requirement: !ruby/object:Gem::Requirement
|
37
30
|
requirements:
|
38
31
|
- - "~>"
|
39
32
|
- !ruby/object:Gem::Version
|
40
|
-
version: '3.
|
33
|
+
version: '3.13'
|
41
34
|
type: :development
|
42
35
|
prerelease: false
|
43
36
|
version_requirements: !ruby/object:Gem::Requirement
|
44
37
|
requirements:
|
45
38
|
- - "~>"
|
46
39
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
40
|
+
version: '3.13'
|
48
41
|
- !ruby/object:Gem::Dependency
|
49
42
|
name: rubocop
|
50
43
|
requirement: !ruby/object:Gem::Requirement
|
51
44
|
requirements:
|
52
45
|
- - "~>"
|
53
46
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
47
|
+
version: 1.47.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.47.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop-performance
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.16.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.16.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop-rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.6.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.6.0
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 2.18.0
|
55
90
|
type: :development
|
56
91
|
prerelease: false
|
57
92
|
version_requirements: !ruby/object:Gem::Requirement
|
58
93
|
requirements:
|
59
94
|
- - "~>"
|
60
95
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
96
|
+
version: 2.18.0
|
62
97
|
description: Cucumber tag expressions for ruby
|
63
98
|
email: cukes@googlegroups.com
|
64
99
|
executables: []
|
65
100
|
extensions: []
|
66
101
|
extra_rdoc_files: []
|
67
102
|
files:
|
103
|
+
- LICENSE
|
68
104
|
- README.md
|
69
105
|
- lib/cucumber/tag_expressions.rb
|
70
106
|
- lib/cucumber/tag_expressions/expressions.rb
|
71
107
|
- lib/cucumber/tag_expressions/parser.rb
|
72
|
-
- spec/errors_spec.rb
|
73
|
-
- spec/evaluations_spec.rb
|
74
|
-
- spec/parsing_spec.rb
|
75
|
-
- spec/spec_helper.rb
|
76
108
|
homepage: https://cucumber.io/docs/cucumber/api/#tag-expressions
|
77
109
|
licenses:
|
78
110
|
- MIT
|
@@ -82,7 +114,6 @@ metadata:
|
|
82
114
|
documentation_uri: https://cucumber.io/docs/cucumber/api/#tag-expressions
|
83
115
|
mailing_list_uri: https://groups.google.com/forum/#!forum/cukes
|
84
116
|
source_code_uri: https://github.com/cucumber/tag-expressions/tree/main/ruby
|
85
|
-
post_install_message:
|
86
117
|
rdoc_options:
|
87
118
|
- "--charset=UTF-8"
|
88
119
|
require_paths:
|
@@ -91,19 +122,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
122
|
requirements:
|
92
123
|
- - ">="
|
93
124
|
- !ruby/object:Gem::Version
|
94
|
-
version: '2.
|
125
|
+
version: '2.6'
|
95
126
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
96
127
|
requirements:
|
97
128
|
- - ">="
|
98
129
|
- !ruby/object:Gem::Version
|
99
|
-
version: 3.
|
130
|
+
version: 3.2.3
|
100
131
|
requirements: []
|
101
|
-
rubygems_version: 3.
|
102
|
-
signing_key:
|
132
|
+
rubygems_version: 3.6.9
|
103
133
|
specification_version: 4
|
104
|
-
summary: cucumber-tag-expressions-
|
105
|
-
test_files:
|
106
|
-
- spec/errors_spec.rb
|
107
|
-
- spec/evaluations_spec.rb
|
108
|
-
- spec/parsing_spec.rb
|
109
|
-
- spec/spec_helper.rb
|
134
|
+
summary: cucumber-tag-expressions-7.0.0
|
135
|
+
test_files: []
|
data/spec/errors_spec.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
tests = YAML.load_file('../testdata/errors.yml')
|
4
|
-
|
5
|
-
describe 'Errors' do
|
6
|
-
tests.each do |test|
|
7
|
-
let(:parser) { Cucumber::TagExpressions::Parser.new }
|
8
|
-
|
9
|
-
it "fails to parse '#{test['expression']}' with '#{test['error']}'" do
|
10
|
-
expect { parser.parse(test['expression']) }.to raise_error(test['error'])
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
data/spec/evaluations_spec.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
evaluations = YAML.load_file('../testdata/evaluations.yml')
|
4
|
-
|
5
|
-
describe 'Evaluations' do
|
6
|
-
evaluations.each do |evaluation|
|
7
|
-
context evaluation['expression'] do
|
8
|
-
let(:parser) { Cucumber::TagExpressions::Parser.new }
|
9
|
-
|
10
|
-
evaluation['tests'].each do |test|
|
11
|
-
it "evaluates [#{test['variables'].join(', ')}] to #{test['result']}" do
|
12
|
-
expect(parser.parse(evaluation['expression']).evaluate(test['variables'])).to eq(test['result'])
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
data/spec/parsing_spec.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
tests = YAML.load_file('../testdata/parsing.yml')
|
4
|
-
|
5
|
-
describe 'Parsing' do
|
6
|
-
let(:parser) { Cucumber::TagExpressions::Parser.new }
|
7
|
-
|
8
|
-
tests.each do |test|
|
9
|
-
it "parses '#{test['expression']}' into '#{test['formatted']}'" do
|
10
|
-
expect(parser.parse(test['expression']).to_s).to eq(test['formatted'])
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
data/spec/spec_helper.rb
DELETED