js_regex 3.7.1 → 3.7.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/js_regex/converter/base.rb +3 -1
- data/lib/js_regex/node.rb +25 -1
- data/lib/js_regex/second_pass.rb +5 -2
- data/lib/js_regex/version.rb +1 -1
- metadata +5 -89
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ec1645dcb85514957cbc0d1d08d973c44386e7ae554b83ceb56be807178a08d
|
4
|
+
data.tar.gz: cebf15dc34ca2e2f6ed1e57cc9a4719ee79c652070d8d0b687dae9278ed18e8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74eb573819cf814ca8c196dae4a6ddbb139b941947197cb115153ec749a89fe5189b1296693f86596ded4a882f81858b877b1514ff346289510dce351df8224f
|
7
|
+
data.tar.gz: 07e5743c335d15bcadfd465df576e32a5b9c6c27918b16c0282f1ac19ecf5ba7634fdf6b9a528963742316ce1a15f174098934da61d2c0a8975f639e1827a4b0
|
@@ -32,8 +32,10 @@ class JsRegex
|
|
32
32
|
return node if node.dropped? || (qtf = expression.quantifier).nil?
|
33
33
|
|
34
34
|
if qtf.possessive?
|
35
|
-
node.update(quantifier: qtf.text[0..-2])
|
35
|
+
node.update(quantifier: qtf.dup.tap { |q| q.text = q.text[0..-2] })
|
36
36
|
return wrap_in_backrefed_lookahead(node)
|
37
|
+
elsif qtf.token == :interval && qtf.text[0..1] == "{,"
|
38
|
+
node.update(quantifier: qtf.dup.tap { |q| q.text = "{0,#{q.max}}" })
|
37
39
|
else
|
38
40
|
node.update(quantifier: qtf)
|
39
41
|
end
|
data/lib/js_regex/node.rb
CHANGED
@@ -63,6 +63,30 @@ class JsRegex
|
|
63
63
|
|
64
64
|
private
|
65
65
|
|
66
|
-
|
66
|
+
TypeError = Class.new(::TypeError).extend(JsRegex::Error)
|
67
|
+
|
68
|
+
def type=(arg)
|
69
|
+
arg.nil? || TYPES.include?(arg) ||
|
70
|
+
raise(TypeError, "unsupported type #{arg.class} for #{__method__}")
|
71
|
+
@type = arg
|
72
|
+
end
|
73
|
+
|
74
|
+
def children=(arg)
|
75
|
+
arg.class == Array ||
|
76
|
+
raise(TypeError, "unsupported type #{arg.class} for #{__method__}")
|
77
|
+
@children = arg
|
78
|
+
end
|
79
|
+
|
80
|
+
def quantifier=(arg)
|
81
|
+
arg.nil? || arg.class == Regexp::Expression::Quantifier ||
|
82
|
+
raise(TypeError, "unsupported type #{arg.class} for #{__method__}")
|
83
|
+
@quantifier = arg
|
84
|
+
end
|
85
|
+
|
86
|
+
def reference=(arg)
|
87
|
+
arg.nil? || arg.is_a?(Numeric) ||
|
88
|
+
raise(TypeError, "unsupported type #{arg.class} for #{__method__}")
|
89
|
+
@reference = arg
|
90
|
+
end
|
67
91
|
end
|
68
92
|
end
|
data/lib/js_regex/second_pass.rb
CHANGED
@@ -101,7 +101,9 @@ class JsRegex
|
|
101
101
|
if qtf.max.equal?(1) # any zero_or_one quantifier (?, ??, ?+)
|
102
102
|
node.update(quantifier: nil)
|
103
103
|
else
|
104
|
-
|
104
|
+
min_quantifier = qtf.dup
|
105
|
+
min_quantifier.text = "{1,#{qtf.max}}#{'?' if qtf.reluctant?}"
|
106
|
+
node.update(quantifier: min_quantifier)
|
105
107
|
end
|
106
108
|
end
|
107
109
|
|
@@ -110,7 +112,8 @@ class JsRegex
|
|
110
112
|
end
|
111
113
|
|
112
114
|
def null_quantify(node)
|
113
|
-
|
115
|
+
null_quantifier = Regexp::Expression::Quantifier.construct(text: '{0}')
|
116
|
+
node.update(quantifier: null_quantifier)
|
114
117
|
end
|
115
118
|
end
|
116
119
|
end
|
data/lib/js_regex/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: js_regex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.7.
|
4
|
+
version: 3.7.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janosch Müller
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: character_set
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '2.
|
33
|
+
version: '2.5'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '2.
|
40
|
+
version: '2.5'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: regexp_property_values
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,90 +52,6 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: duktape
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '2.6'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '2.6'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: rake
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '13.0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '13.0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rspec
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - "~>"
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '3.10'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - "~>"
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '3.10'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: codecov
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - "~>"
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: 0.2.12
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - "~>"
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 0.2.12
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: gouteur
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '1.0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - "~>"
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '1.0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rubocop
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - "~>"
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '1.8'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - "~>"
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '1.8'
|
139
55
|
description: JsRegex converts Ruby's native regular expressions for JavaScript, taking
|
140
56
|
care of various incompatibilities and returning warnings for unsolvable differences.
|
141
57
|
email:
|
@@ -186,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
102
|
- !ruby/object:Gem::Version
|
187
103
|
version: '0'
|
188
104
|
requirements: []
|
189
|
-
rubygems_version: 3.
|
105
|
+
rubygems_version: 3.4.0.dev
|
190
106
|
signing_key:
|
191
107
|
specification_version: 4
|
192
108
|
summary: Converts Ruby regexes to JavaScript regexes.
|