regexp_parser 2.6.2 → 2.8.0
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/CHANGELOG.md +67 -0
- data/Gemfile +2 -2
- data/README.md +32 -29
- data/lib/regexp_parser/expression/base.rb +0 -7
- data/lib/regexp_parser/expression/classes/alternation.rb +1 -1
- data/lib/regexp_parser/expression/classes/backreference.rb +4 -2
- data/lib/regexp_parser/expression/classes/character_set/range.rb +2 -7
- data/lib/regexp_parser/expression/classes/character_set.rb +3 -4
- data/lib/regexp_parser/expression/classes/conditional.rb +2 -6
- data/lib/regexp_parser/expression/classes/escape_sequence.rb +3 -1
- data/lib/regexp_parser/expression/classes/free_space.rb +3 -1
- data/lib/regexp_parser/expression/classes/group.rb +0 -22
- data/lib/regexp_parser/expression/classes/posix_class.rb +5 -1
- data/lib/regexp_parser/expression/classes/unicode_property.rb +5 -2
- data/lib/regexp_parser/expression/methods/construct.rb +2 -4
- data/lib/regexp_parser/expression/methods/parts.rb +23 -0
- data/lib/regexp_parser/expression/methods/printing.rb +26 -0
- data/lib/regexp_parser/expression/methods/tests.rb +40 -3
- data/lib/regexp_parser/expression/methods/traverse.rb +35 -19
- data/lib/regexp_parser/expression/quantifier.rb +30 -17
- data/lib/regexp_parser/expression/sequence.rb +5 -10
- data/lib/regexp_parser/expression/sequence_operation.rb +4 -9
- data/lib/regexp_parser/expression/shared.rb +37 -20
- data/lib/regexp_parser/expression/subexpression.rb +20 -15
- data/lib/regexp_parser/expression.rb +2 -0
- data/lib/regexp_parser/lexer.rb +76 -36
- data/lib/regexp_parser/parser.rb +97 -97
- data/lib/regexp_parser/scanner/errors/premature_end_error.rb +8 -0
- data/lib/regexp_parser/scanner/errors/scanner_error.rb +6 -0
- data/lib/regexp_parser/scanner/errors/validation_error.rb +63 -0
- data/lib/regexp_parser/scanner/mapping.rb +89 -0
- data/lib/regexp_parser/scanner/property.rl +2 -2
- data/lib/regexp_parser/scanner/scanner.rl +90 -169
- data/lib/regexp_parser/scanner.rb +1157 -1330
- data/lib/regexp_parser/syntax/token/backreference.rb +3 -0
- data/lib/regexp_parser/syntax/token/character_set.rb +3 -0
- data/lib/regexp_parser/syntax/token/escape.rb +3 -1
- data/lib/regexp_parser/syntax/token/meta.rb +9 -2
- data/lib/regexp_parser/syntax/token/unicode_property.rb +3 -0
- data/lib/regexp_parser/syntax/token/virtual.rb +11 -0
- data/lib/regexp_parser/syntax/version_lookup.rb +0 -8
- data/lib/regexp_parser/syntax/versions.rb +2 -0
- data/lib/regexp_parser/version.rb +1 -1
- metadata +10 -3
@@ -1,6 +1,5 @@
|
|
1
1
|
module Regexp::Syntax
|
2
2
|
module Token
|
3
|
-
# TODO: unify naming with RE::EscapeSequence, one way or the other, in v3.0.0
|
4
3
|
module Escape
|
5
4
|
Basic = %i[backslash literal]
|
6
5
|
|
@@ -27,5 +26,8 @@ module Regexp::Syntax
|
|
27
26
|
end
|
28
27
|
|
29
28
|
Map[Escape::Type] = Escape::All
|
29
|
+
|
30
|
+
# alias for symmetry between Token::* and Expression::*
|
31
|
+
EscapeSequence = Escape
|
30
32
|
end
|
31
33
|
end
|
@@ -1,13 +1,20 @@
|
|
1
1
|
module Regexp::Syntax
|
2
2
|
module Token
|
3
3
|
module Meta
|
4
|
-
Basic
|
5
|
-
|
4
|
+
Basic = %i[dot]
|
5
|
+
Alternation = %i[alternation]
|
6
|
+
Extended = Basic + Alternation
|
6
7
|
|
7
8
|
All = Extended
|
8
9
|
Type = :meta
|
9
10
|
end
|
10
11
|
|
11
12
|
Map[Meta::Type] = Meta::All
|
13
|
+
|
14
|
+
# alias for symmetry between Token::* and Expression::*
|
15
|
+
module Alternation
|
16
|
+
All = Meta::Alternation
|
17
|
+
Type = Meta::Type
|
18
|
+
end
|
12
19
|
end
|
13
20
|
end
|
@@ -713,5 +713,8 @@ module Regexp::Syntax
|
|
713
713
|
|
714
714
|
Map[UnicodeProperty::Type] = UnicodeProperty::All
|
715
715
|
Map[UnicodeProperty::NonType] = UnicodeProperty::All
|
716
|
+
|
717
|
+
# alias for symmetry between token symbol and Token module name
|
718
|
+
Property = UnicodeProperty
|
716
719
|
end
|
717
720
|
end
|
@@ -37,7 +37,6 @@ module Regexp::Syntax
|
|
37
37
|
return Regexp::Syntax::Any if ['*', 'any'].include?(version.to_s)
|
38
38
|
|
39
39
|
version =~ VERSION_REGEXP || raise(InvalidVersionNameError, version)
|
40
|
-
warn_if_future_version(version)
|
41
40
|
version_const_name = "V#{version.to_s.scan(/\d+/).join('_')}"
|
42
41
|
const_get(version_const_name) || raise(UnknownSyntaxNameError, version)
|
43
42
|
end
|
@@ -63,11 +62,4 @@ module Regexp::Syntax
|
|
63
62
|
# add .99 to treat versions without a patch value as latest patch version
|
64
63
|
Gem::Version.new((name.to_s.scan(/\d+/) << 99).join('.'))
|
65
64
|
end
|
66
|
-
|
67
|
-
def warn_if_future_version(const_name)
|
68
|
-
return if comparable(const_name) < comparable('4.0.0')
|
69
|
-
|
70
|
-
warn('This library has only been tested up to Ruby 3.x, '\
|
71
|
-
"but you are running with #{const_name}")
|
72
|
-
end
|
73
65
|
end
|
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: 2.
|
4
|
+
version: 2.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ammar Ali
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A library for tokenizing, lexing, and parsing Ruby regular expressions.
|
14
14
|
email:
|
@@ -47,6 +47,8 @@ files:
|
|
47
47
|
- lib/regexp_parser/expression/methods/match.rb
|
48
48
|
- lib/regexp_parser/expression/methods/match_length.rb
|
49
49
|
- lib/regexp_parser/expression/methods/options.rb
|
50
|
+
- lib/regexp_parser/expression/methods/parts.rb
|
51
|
+
- lib/regexp_parser/expression/methods/printing.rb
|
50
52
|
- lib/regexp_parser/expression/methods/strfregexp.rb
|
51
53
|
- lib/regexp_parser/expression/methods/tests.rb
|
52
54
|
- lib/regexp_parser/expression/methods/traverse.rb
|
@@ -59,6 +61,10 @@ files:
|
|
59
61
|
- lib/regexp_parser/parser.rb
|
60
62
|
- lib/regexp_parser/scanner.rb
|
61
63
|
- lib/regexp_parser/scanner/char_type.rl
|
64
|
+
- lib/regexp_parser/scanner/errors/premature_end_error.rb
|
65
|
+
- lib/regexp_parser/scanner/errors/scanner_error.rb
|
66
|
+
- lib/regexp_parser/scanner/errors/validation_error.rb
|
67
|
+
- lib/regexp_parser/scanner/mapping.rb
|
62
68
|
- lib/regexp_parser/scanner/properties/long.csv
|
63
69
|
- lib/regexp_parser/scanner/properties/short.csv
|
64
70
|
- lib/regexp_parser/scanner/property.rl
|
@@ -80,6 +86,7 @@ files:
|
|
80
86
|
- lib/regexp_parser/syntax/token/posix_class.rb
|
81
87
|
- lib/regexp_parser/syntax/token/quantifier.rb
|
82
88
|
- lib/regexp_parser/syntax/token/unicode_property.rb
|
89
|
+
- lib/regexp_parser/syntax/token/virtual.rb
|
83
90
|
- lib/regexp_parser/syntax/version_lookup.rb
|
84
91
|
- lib/regexp_parser/syntax/versions.rb
|
85
92
|
- lib/regexp_parser/syntax/versions/1.8.6.rb
|
@@ -125,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
132
|
- !ruby/object:Gem::Version
|
126
133
|
version: '0'
|
127
134
|
requirements: []
|
128
|
-
rubygems_version: 3.
|
135
|
+
rubygems_version: 3.4.1
|
129
136
|
signing_key:
|
130
137
|
specification_version: 4
|
131
138
|
summary: Scanner, lexer, parser for ruby's regular expressions
|