js_regex 1.0.9 → 1.0.10
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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 618111f397f9ea7eaedc926f1fc7fec5853ba2f4
|
4
|
+
data.tar.gz: 93c341b5952e85fdf01350289a7090e3504bb107
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14b09a4a7f04c78faca5c700c80207b21787741ce4c9540a9db69861f30e90476cc04b9026111cafd8d9c97f5ac392289e30f38db1ce3c4ddf112680c55d3a69
|
7
|
+
data.tar.gz: b0280df75ee2d1ab152ba34b425b6be744f8eb6e347a2ffe01e1eefa60e266cd86e008dd4ef25791a1f6addf2da81adcc233b9d999d556967e15da02608dd7c0
|
@@ -11,9 +11,9 @@ class JsRegex
|
|
11
11
|
|
12
12
|
def convert_data
|
13
13
|
case subtype
|
14
|
-
when :backslash, :codepoint, :
|
15
|
-
:interval_open, :newline, :one_or_more, :octal, :
|
16
|
-
:
|
14
|
+
when :backslash, :codepoint, :form_feed, :return, :hex, :interval_close,
|
15
|
+
:interval_open, :newline, :one_or_more, :octal, :space, :set_close,
|
16
|
+
:set_open, :dot, :tab, :vertical_tab, :zero_or_more, :zero_or_one
|
17
17
|
pass_through
|
18
18
|
when :literal
|
19
19
|
LiteralConverter.convert(data, self)
|
@@ -11,12 +11,19 @@ class JsRegex
|
|
11
11
|
if /[\u{10000}-\u{FFFFF}]/ =~ utf8_data
|
12
12
|
converter.send(:warn_of_unsupported_feature, 'astral plane character')
|
13
13
|
else
|
14
|
+
escape_literal_forward_slashes(utf8_data)
|
14
15
|
ensure_json_compatibility(utf8_data)
|
16
|
+
utf8_data
|
15
17
|
end
|
16
18
|
end
|
17
19
|
|
20
|
+
def self.escape_literal_forward_slashes(data)
|
21
|
+
# literal slashes would be mistaken for the pattern end in JsRegex#to_s
|
22
|
+
data.gsub!('/', '\\/')
|
23
|
+
end
|
24
|
+
|
18
25
|
def self.ensure_json_compatibility(data)
|
19
|
-
data.gsub(/\\?[\f\n\r\t]/) { |lit| Regexp.escape(lit.delete('\\')) }
|
26
|
+
data.gsub!(/\\?[\f\n\r\t]/) { |lit| Regexp.escape(lit.delete('\\')) }
|
20
27
|
end
|
21
28
|
|
22
29
|
private
|
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.0.
|
4
|
+
version: 1.0.10
|
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: 2015-10-
|
11
|
+
date: 2015-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: regexp_parser
|