regexp_parser 2.11.1 → 2.11.2
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 +4 -4
- data/Gemfile +2 -0
- data/Rakefile +2 -0
- data/lib/regexp_parser/error.rb +2 -0
- data/lib/regexp_parser/expression/base.rb +2 -0
- data/lib/regexp_parser/expression/classes/alternation.rb +2 -0
- data/lib/regexp_parser/expression/classes/anchor.rb +2 -0
- data/lib/regexp_parser/expression/classes/backreference.rb +2 -0
- data/lib/regexp_parser/expression/classes/character_set/intersection.rb +2 -0
- data/lib/regexp_parser/expression/classes/character_set/range.rb +2 -0
- data/lib/regexp_parser/expression/classes/character_set.rb +2 -0
- data/lib/regexp_parser/expression/classes/character_type.rb +2 -0
- data/lib/regexp_parser/expression/classes/conditional.rb +2 -0
- data/lib/regexp_parser/expression/classes/escape_sequence.rb +2 -0
- data/lib/regexp_parser/expression/classes/free_space.rb +2 -0
- data/lib/regexp_parser/expression/classes/group.rb +2 -0
- data/lib/regexp_parser/expression/classes/keep.rb +2 -0
- data/lib/regexp_parser/expression/classes/literal.rb +2 -0
- data/lib/regexp_parser/expression/classes/posix_class.rb +2 -0
- data/lib/regexp_parser/expression/classes/root.rb +2 -0
- data/lib/regexp_parser/expression/classes/unicode_property.rb +2 -0
- data/lib/regexp_parser/expression/methods/construct.rb +2 -0
- data/lib/regexp_parser/expression/methods/escape_sequence_char.rb +2 -0
- data/lib/regexp_parser/expression/methods/escape_sequence_codepoint.rb +2 -0
- data/lib/regexp_parser/expression/methods/human_name.rb +2 -0
- data/lib/regexp_parser/expression/methods/match.rb +2 -0
- data/lib/regexp_parser/expression/methods/match_length.rb +2 -0
- data/lib/regexp_parser/expression/methods/negative.rb +2 -0
- data/lib/regexp_parser/expression/methods/options.rb +2 -0
- data/lib/regexp_parser/expression/methods/parts.rb +2 -0
- data/lib/regexp_parser/expression/methods/printing.rb +2 -0
- data/lib/regexp_parser/expression/methods/referenced_expressions.rb +2 -0
- data/lib/regexp_parser/expression/methods/strfregexp.rb +2 -0
- data/lib/regexp_parser/expression/methods/tests.rb +2 -0
- data/lib/regexp_parser/expression/methods/traverse.rb +2 -0
- data/lib/regexp_parser/expression/quantifier.rb +3 -1
- data/lib/regexp_parser/expression/sequence.rb +2 -0
- data/lib/regexp_parser/expression/sequence_operation.rb +2 -0
- data/lib/regexp_parser/expression/shared.rb +2 -0
- data/lib/regexp_parser/expression/subexpression.rb +2 -0
- data/lib/regexp_parser/expression.rb +2 -0
- data/lib/regexp_parser/lexer.rb +2 -0
- data/lib/regexp_parser/parser.rb +2 -0
- data/lib/regexp_parser/scanner/errors/premature_end_error.rb +2 -0
- data/lib/regexp_parser/scanner/errors/scanner_error.rb +2 -0
- data/lib/regexp_parser/scanner/errors/validation_error.rb +2 -0
- data/lib/regexp_parser/scanner/scanner.rl +9 -1
- data/lib/regexp_parser/scanner.rb +10 -2
- data/lib/regexp_parser/syntax/any.rb +2 -0
- data/lib/regexp_parser/syntax/base.rb +2 -0
- data/lib/regexp_parser/syntax/token/anchor.rb +5 -3
- data/lib/regexp_parser/syntax/token/assertion.rb +4 -2
- data/lib/regexp_parser/syntax/token/backreference.rb +8 -6
- data/lib/regexp_parser/syntax/token/character_set.rb +3 -1
- data/lib/regexp_parser/syntax/token/character_type.rb +6 -4
- data/lib/regexp_parser/syntax/token/conditional.rb +5 -3
- data/lib/regexp_parser/syntax/token/escape.rb +9 -7
- data/lib/regexp_parser/syntax/token/group.rb +8 -6
- data/lib/regexp_parser/syntax/token/keep.rb +3 -1
- data/lib/regexp_parser/syntax/token/meta.rb +4 -2
- data/lib/regexp_parser/syntax/token/posix_class.rb +4 -2
- data/lib/regexp_parser/syntax/token/quantifier.rb +8 -6
- data/lib/regexp_parser/syntax/token/unicode_property.rb +51 -49
- data/lib/regexp_parser/syntax/token/virtual.rb +5 -3
- data/lib/regexp_parser/syntax/token.rb +5 -3
- data/lib/regexp_parser/syntax/version_lookup.rb +4 -2
- data/lib/regexp_parser/syntax/versions/1.8.6.rb +2 -0
- data/lib/regexp_parser/syntax/versions/1.9.1.rb +2 -0
- data/lib/regexp_parser/syntax/versions/1.9.3.rb +2 -0
- data/lib/regexp_parser/syntax/versions/2.0.0.rb +2 -0
- data/lib/regexp_parser/syntax/versions/2.2.0.rb +2 -0
- data/lib/regexp_parser/syntax/versions/2.3.0.rb +2 -0
- data/lib/regexp_parser/syntax/versions/2.4.0.rb +2 -0
- data/lib/regexp_parser/syntax/versions/2.4.1.rb +2 -0
- data/lib/regexp_parser/syntax/versions/2.5.0.rb +2 -0
- data/lib/regexp_parser/syntax/versions/2.6.0.rb +2 -0
- data/lib/regexp_parser/syntax/versions/2.6.2.rb +2 -0
- data/lib/regexp_parser/syntax/versions/2.6.3.rb +2 -0
- data/lib/regexp_parser/syntax/versions/3.1.0.rb +2 -0
- data/lib/regexp_parser/syntax/versions/3.2.0.rb +2 -0
- data/lib/regexp_parser/syntax/versions.rb +2 -0
- data/lib/regexp_parser/syntax.rb +2 -0
- data/lib/regexp_parser/token.rb +2 -0
- data/lib/regexp_parser/version.rb +3 -1
- data/lib/regexp_parser.rb +2 -0
- data/regexp_parser.gemspec +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a040acf8a74a8fba3bb10e289258195ecfbd78a0708da8757230fc6d6e9fe23
|
4
|
+
data.tar.gz: 2c444d8dcb5f24d752e00eca09adb0c2c9b1f4612accf3356b923b19c47cae57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 57021cd49ca2c5db4b62de77b6e929e717f44520eeff6d39a195f15b8a5b2e9bdb98eb74e849465dd2648a24a2c8c0102c38b9f938b41bc4ca40059925d038c4
|
7
|
+
data.tar.gz: 0e03ce414e29548f4923c98396262297f61260a1960b9849ffb24ed6da32788fd728cc42e0949b176fa9e1404790d4b3f788219f345607c187f81c0b9352ea3c
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/lib/regexp_parser/error.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Regexp::Expression
|
2
4
|
# TODO: in v3.0.0, maybe put Shared back into Base, and inherit from Base and
|
3
5
|
# call super in #initialize, but raise in #quantifier= and #quantify,
|
@@ -6,7 +8,7 @@ module Regexp::Expression
|
|
6
8
|
class Quantifier
|
7
9
|
include Regexp::Expression::Shared
|
8
10
|
|
9
|
-
MODES = %i[greedy possessive reluctant]
|
11
|
+
MODES = %i[greedy possessive reluctant].freeze
|
10
12
|
|
11
13
|
def initialize(*args)
|
12
14
|
deprecated_old_init(*args) and return if args.count == 4 || args.count == 5
|
data/lib/regexp_parser/lexer.rb
CHANGED
data/lib/regexp_parser/parser.rb
CHANGED
@@ -686,7 +686,7 @@ class Regexp::Scanner
|
|
686
686
|
|
687
687
|
input = input_object.is_a?(Regexp) ? input_object.source : input_object
|
688
688
|
self.free_spacing = free_spacing?(input_object, options)
|
689
|
-
self.regexp_encoding = input_object
|
689
|
+
self.regexp_encoding = extract_encoding(input_object, options)
|
690
690
|
self.spacing_stack = [{:free_spacing => free_spacing, :depth => 0}]
|
691
691
|
|
692
692
|
data = input.unpack("c*")
|
@@ -780,6 +780,14 @@ class Regexp::Scanner
|
|
780
780
|
:group_depth, :set_depth, :conditional_stack,
|
781
781
|
:char_pos
|
782
782
|
|
783
|
+
def extract_encoding(input_object, options)
|
784
|
+
if input_object.is_a?(::Regexp)
|
785
|
+
input_object.encoding
|
786
|
+
elsif options && (options & Regexp::NOENCODING)
|
787
|
+
Encoding::BINARY
|
788
|
+
end
|
789
|
+
end
|
790
|
+
|
783
791
|
def free_spacing?(input_object, options)
|
784
792
|
if options && !input_object.is_a?(String)
|
785
793
|
raise ArgumentError, 'options cannot be supplied unless scanning a String'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# -*- warn-indent:false
|
1
|
+
# -*- frozen_string_literal: true; warn-indent: false -*-
|
2
2
|
#
|
3
3
|
# THIS IS A GENERATED FILE, DO NOT EDIT DIRECTLY
|
4
4
|
#
|
@@ -28,7 +28,7 @@ class Regexp::Scanner
|
|
28
28
|
|
29
29
|
input = input_object.is_a?(Regexp) ? input_object.source : input_object
|
30
30
|
self.free_spacing = free_spacing?(input_object, options)
|
31
|
-
self.regexp_encoding = input_object
|
31
|
+
self.regexp_encoding = extract_encoding(input_object, options)
|
32
32
|
self.spacing_stack = [{:free_spacing => free_spacing, :depth => 0}]
|
33
33
|
|
34
34
|
data = input.unpack("c*")
|
@@ -2425,6 +2425,14 @@ end
|
|
2425
2425
|
:group_depth, :set_depth, :conditional_stack,
|
2426
2426
|
:char_pos
|
2427
2427
|
|
2428
|
+
def extract_encoding(input_object, options)
|
2429
|
+
if input_object.is_a?(::Regexp)
|
2430
|
+
input_object.encoding
|
2431
|
+
elsif options && (options & Regexp::NOENCODING)
|
2432
|
+
Encoding::BINARY
|
2433
|
+
end
|
2434
|
+
end
|
2435
|
+
|
2428
2436
|
def free_spacing?(input_object, options)
|
2429
2437
|
if options && !input_object.is_a?(String)
|
2430
2438
|
raise ArgumentError, 'options cannot be supplied unless scanning a String'
|
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Regexp::Syntax
|
2
4
|
module Token
|
3
5
|
module Anchor
|
4
|
-
Basic = %i[bol eol]
|
6
|
+
Basic = %i[bol eol].freeze
|
5
7
|
Extended = Basic + %i[word_boundary nonword_boundary]
|
6
|
-
String = %i[bos eos eos_ob_eol]
|
7
|
-
MatchStart = %i[match_start]
|
8
|
+
String = %i[bos eos eos_ob_eol].freeze
|
9
|
+
MatchStart = %i[match_start].freeze
|
8
10
|
|
9
11
|
All = Extended + String + MatchStart
|
10
12
|
Type = :anchor
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Regexp::Syntax
|
2
4
|
module Token
|
3
5
|
module Assertion
|
4
|
-
Lookahead = %i[lookahead nlookahead]
|
5
|
-
Lookbehind = %i[lookbehind nlookbehind]
|
6
|
+
Lookahead = %i[lookahead nlookahead].freeze
|
7
|
+
Lookbehind = %i[lookbehind nlookbehind].freeze
|
6
8
|
|
7
9
|
All = Lookahead + Lookbehind
|
8
10
|
Type = :assertion
|
@@ -1,12 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Regexp::Syntax
|
2
4
|
module Token
|
3
5
|
module Backreference
|
4
|
-
Plain = %i[number]
|
5
|
-
NumberRef = %i[number_ref number_rel_ref]
|
6
|
+
Plain = %i[number].freeze
|
7
|
+
NumberRef = %i[number_ref number_rel_ref].freeze
|
6
8
|
Number = Plain + NumberRef
|
7
|
-
Name = %i[name_ref]
|
9
|
+
Name = %i[name_ref].freeze
|
8
10
|
|
9
|
-
RecursionLevel = %i[name_recursion_ref number_recursion_ref]
|
11
|
+
RecursionLevel = %i[name_recursion_ref number_recursion_ref].freeze
|
10
12
|
|
11
13
|
V1_8_6 = Plain
|
12
14
|
|
@@ -18,8 +20,8 @@ module Regexp::Syntax
|
|
18
20
|
|
19
21
|
# Type is the same as Backreference so keeping it here, for now.
|
20
22
|
module SubexpressionCall
|
21
|
-
Name = %i[name_call]
|
22
|
-
Number = %i[number_call number_rel_call]
|
23
|
+
Name = %i[name_call].freeze
|
24
|
+
Number = %i[number_call number_rel_call].freeze
|
23
25
|
|
24
26
|
All = Name + Number
|
25
27
|
end
|
@@ -1,11 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Regexp::Syntax
|
2
4
|
module Token
|
3
5
|
module CharacterType
|
4
|
-
Basic = []
|
5
|
-
Extended = %i[digit nondigit space nonspace word nonword]
|
6
|
-
Hex = %i[hex nonhex]
|
6
|
+
Basic = [].freeze
|
7
|
+
Extended = %i[digit nondigit space nonspace word nonword].freeze
|
8
|
+
Hex = %i[hex nonhex].freeze
|
7
9
|
|
8
|
-
Clustered = %i[linebreak xgrapheme]
|
10
|
+
Clustered = %i[linebreak xgrapheme].freeze
|
9
11
|
|
10
12
|
All = Basic + Extended + Hex + Clustered
|
11
13
|
Type = :type
|
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Regexp::Syntax
|
2
4
|
module Token
|
3
5
|
module Conditional
|
4
|
-
Delimiters = %i[open close]
|
6
|
+
Delimiters = %i[open close].freeze
|
5
7
|
|
6
|
-
Condition = %i[condition_open condition condition_close]
|
7
|
-
Separator = %i[separator]
|
8
|
+
Condition = %i[condition_open condition condition_close].freeze
|
9
|
+
Separator = %i[separator].freeze
|
8
10
|
|
9
11
|
All = Conditional::Delimiters + Conditional::Condition + Conditional::Separator
|
10
12
|
|
@@ -1,25 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Regexp::Syntax
|
2
4
|
module Token
|
3
5
|
module Escape
|
4
|
-
Basic = %i[backslash literal]
|
6
|
+
Basic = %i[backslash literal].freeze
|
5
7
|
|
6
|
-
Control = %i[control meta_sequence]
|
8
|
+
Control = %i[control meta_sequence].freeze
|
7
9
|
|
8
10
|
ASCII = %i[bell backspace escape form_feed newline carriage
|
9
|
-
tab vertical_tab]
|
11
|
+
tab vertical_tab].freeze
|
10
12
|
|
11
|
-
Unicode = %i[codepoint codepoint_list]
|
13
|
+
Unicode = %i[codepoint codepoint_list].freeze
|
12
14
|
|
13
15
|
Meta = %i[dot alternation
|
14
16
|
zero_or_one zero_or_more one_or_more
|
15
17
|
bol eol
|
16
18
|
group_open group_close
|
17
19
|
interval_open interval_close
|
18
|
-
set_open set_close]
|
20
|
+
set_open set_close].freeze
|
19
21
|
|
20
|
-
Hex = %i[hex utf8_hex]
|
22
|
+
Hex = %i[hex utf8_hex].freeze
|
21
23
|
|
22
|
-
Octal = %i[octal]
|
24
|
+
Octal = %i[octal].freeze
|
23
25
|
|
24
26
|
All = Basic + Control + ASCII + Unicode + Meta + Hex + Octal
|
25
27
|
Type = :escape
|
@@ -1,18 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Regexp::Syntax
|
2
4
|
module Token
|
3
5
|
module Group
|
4
|
-
Basic = %i[capture close]
|
6
|
+
Basic = %i[capture close].freeze
|
5
7
|
Extended = Basic + %i[options options_switch]
|
6
8
|
|
7
|
-
Named = %i[named]
|
8
|
-
Atomic = %i[atomic]
|
9
|
-
Passive = %i[passive]
|
10
|
-
Comment = %i[comment]
|
9
|
+
Named = %i[named].freeze
|
10
|
+
Atomic = %i[atomic].freeze
|
11
|
+
Passive = %i[passive].freeze
|
12
|
+
Comment = %i[comment].freeze
|
11
13
|
|
12
14
|
V1_8_6 = Group::Extended + Group::Named + Group::Atomic +
|
13
15
|
Group::Passive + Group::Comment
|
14
16
|
|
15
|
-
V2_4_1 = %i[absence]
|
17
|
+
V2_4_1 = %i[absence].freeze
|
16
18
|
|
17
19
|
All = V1_8_6 + V2_4_1
|
18
20
|
Type = :group
|
@@ -1,10 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Regexp::Syntax
|
2
4
|
module Token
|
3
5
|
module PosixClass
|
4
6
|
Standard = %i[alnum alpha blank cntrl digit graph
|
5
|
-
lower print punct space upper xdigit]
|
7
|
+
lower print punct space upper xdigit].freeze
|
6
8
|
|
7
|
-
Extensions = %i[ascii word]
|
9
|
+
Extensions = %i[ascii word].freeze
|
8
10
|
|
9
11
|
All = Standard + Extensions
|
10
12
|
Type = :posixclass
|