js_regex 1.2.2 → 1.2.3
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/escape_converter.rb +12 -0
- data/lib/js_regex/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d910abcbfe22ab6a470b8784025da0d81a7d823
|
4
|
+
data.tar.gz: 8a30eddfc5efe71a598afe7064f3a0ee944e017e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 031334a1f4d48e5f432cb6bfada63eb2821b61d8d2c8e052548c98db0f5a8fd83f606305c00976c51c6e6f1caaa6f0def2c0f405914a4daa694c2606b92a5c25
|
7
|
+
data.tar.gz: eb7be820e5112f488fa69326e4870a0f9ac8d4538138c41d83e201551a8aa2a2cfe36ca5cba18e944a5a89a0fd25fc8783306062bea7017f1fddbb559d1fb299
|
@@ -19,6 +19,8 @@ class JsRegex
|
|
19
19
|
:dot,
|
20
20
|
:eol,
|
21
21
|
:form_feed,
|
22
|
+
:group_close,
|
23
|
+
:group_open,
|
22
24
|
:hex,
|
23
25
|
:interval_close,
|
24
26
|
:interval_open,
|
@@ -35,6 +37,8 @@ class JsRegex
|
|
35
37
|
|
36
38
|
def convert_data
|
37
39
|
case subtype
|
40
|
+
when :codepoint_list
|
41
|
+
convert_codepoint_list
|
38
42
|
when :literal
|
39
43
|
LiteralConverter.convert_data(data)
|
40
44
|
when *ESCAPES_SHARED_BY_RUBY_AND_JS
|
@@ -44,6 +48,14 @@ class JsRegex
|
|
44
48
|
warn_of_unsupported_feature
|
45
49
|
end
|
46
50
|
end
|
51
|
+
|
52
|
+
def convert_codepoint_list
|
53
|
+
elements = data.scan(/\h+/).map do |codepoint|
|
54
|
+
literal = Regexp.escape([codepoint.hex].pack('U'))
|
55
|
+
LiteralConverter.convert_data(literal)
|
56
|
+
end
|
57
|
+
elements.join
|
58
|
+
end
|
47
59
|
end
|
48
60
|
end
|
49
61
|
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: 1.2.
|
4
|
+
version: 1.2.3
|
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: 2017-
|
11
|
+
date: 2017-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: regexp_parser
|