js_regex 1.0.9 → 1.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: 6cb3d7055fec1f15ccd2de436ec8f2e54be92f44
4
- data.tar.gz: 43eb2c6310a49e014f88c09ddf038c4f1e8e0203
3
+ metadata.gz: 618111f397f9ea7eaedc926f1fc7fec5853ba2f4
4
+ data.tar.gz: 93c341b5952e85fdf01350289a7090e3504bb107
5
5
  SHA512:
6
- metadata.gz: 2e33845123254edea36788006898ade901b7d61b0f344658fb2f3fdb849a4e7865561b3e942b9773a393ede8a4a3ce047e13c1924662cb643f56cd6f9cc4a83c
7
- data.tar.gz: 537f23e4ee912e8efb4fb0868409c2c0328be89cd7f4d05d003e583d47b8e9c908e7fb07a81be3cd21a0c8ad3c79ca2e56c17960359e0e04e71fe4deda9dfe26
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, :dot, :form_feed, :hex, :interval_close,
15
- :interval_open, :newline, :one_or_more, :octal, :return,
16
- :space, :tab, :vertical_tab, :zero_or_more, :zero_or_one
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.9
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-19 00:00:00.000000000 Z
11
+ date: 2015-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: regexp_parser