regexp_parser 0.3.2 → 0.3.3

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.
@@ -78,7 +78,7 @@
78
78
 
79
79
  conditional = '(?(';
80
80
 
81
- group_comment = '?#' . [^)]+ . group_close;
81
+ group_comment = '?#' . [^)]* . group_close;
82
82
 
83
83
  group_atomic = '?>';
84
84
  group_passive = '?:';
@@ -15,7 +15,7 @@ module Regexp::Syntax
15
15
  implements :backref, Backreference::All +
16
16
  SubexpressionCall::All
17
17
 
18
- implements :escape, CharacterType::Hex
18
+ implements :escape, CharacterType::Hex + Escape::Unicode
19
19
 
20
20
  implements :property,
21
21
  UnicodeProperty::V190
@@ -11,6 +11,8 @@ module Regexp::Syntax
11
11
  ASCII = [:bell, :backspace, :escape, :form_feed, :newline, :carriage,
12
12
  :space, :tab, :vertical_tab]
13
13
 
14
+ Unicode = [:codepoint_list]
15
+
14
16
  Meta = [:dot, :alternation,
15
17
  :zero_or_one, :zero_or_more, :one_or_more,
16
18
  :bol, :eol,
@@ -1,5 +1,5 @@
1
1
  class Regexp
2
2
  module Parser
3
- VERSION = '0.3.2'
3
+ VERSION = '0.3.3'
4
4
  end
5
5
  end
@@ -25,6 +25,9 @@ class TestParserEscapes < Test::Unit::TestCase
25
25
  /a\)c/ => [1, :escape, :group_close, EscapeSequence::Literal],
26
26
  /a\{c/ => [1, :escape, :interval_open, EscapeSequence::Literal],
27
27
  /a\}c/ => [1, :escape, :interval_close, EscapeSequence::Literal],
28
+
29
+ # unicode escapes
30
+ /a\u{9879}/ => [1, :escape, :codepoint_list, EscapeSequence::Literal],
28
31
  }
29
32
 
30
33
  count = 0
@@ -150,6 +150,7 @@ class TestRegexpParserQuantifiers < Test::Unit::TestCase
150
150
 
151
151
  assert_equal( true, t.expressions.first.quantified? )
152
152
  assert_equal( :interval, t.expressions.first.quantifier.token )
153
+ assert_equal( '{2,}?', t.expressions.first.quantifier.text )
153
154
  assert_equal( 2, t.expressions.first.quantifier.min)
154
155
  assert_equal( -1, t.expressions.first.quantifier.max)
155
156
  assert_equal( :reluctant, t.expressions.first.quantifier.mode )
@@ -161,6 +162,7 @@ class TestRegexpParserQuantifiers < Test::Unit::TestCase
161
162
 
162
163
  assert_equal( true, t.expressions.first.quantified? )
163
164
  assert_equal( :interval, t.expressions.first.quantifier.token )
165
+ assert_equal( '{3,}+', t.expressions.first.quantifier.text )
164
166
  assert_equal( 3, t.expressions.first.quantifier.min)
165
167
  assert_equal( -1, t.expressions.first.quantifier.max)
166
168
  assert_equal( :possessive, t.expressions.first.quantifier.mode )
@@ -29,6 +29,7 @@ class ScannerGroups < Test::Unit::TestCase
29
29
 
30
30
  # Comments
31
31
  '(?#abc)' => [0, :group, :comment, '(?#abc)', 0, 7],
32
+ '(?#)' => [0, :group, :comment, '(?#)', 0, 4],
32
33
 
33
34
  # Assertions
34
35
  '(?=abc)' => [0, :assertion, :lookahead, '(?=', 0, 3],
@@ -10,7 +10,7 @@ class TestSyntaxRuby_V191 < Test::Unit::TestCase
10
10
  tests = {
11
11
  :implements => {
12
12
  :escape => [
13
- Escape::Backreference + Escape::ASCII + Escape::Meta
13
+ Escape::Backreference + Escape::ASCII + Escape::Meta + Escape::Unicode
14
14
  ].flatten,
15
15
 
16
16
  :quantifier => [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: regexp_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ammar Ali
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-02 00:00:00.000000000 Z
11
+ date: 2016-04-26 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A library for tokenizing, lexing, and parsing Ruby regular expressions.
14
14
  email: