regexp_parser 2.2.0 → 2.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -2
- data/LICENSE +1 -1
- data/README.md +2 -2
- data/Rakefile +5 -8
- data/lib/regexp_parser/expression/classes/escape_sequence.rb +12 -7
- data/lib/regexp_parser/expression/methods/strfregexp.rb +1 -1
- data/lib/regexp_parser/scanner/properties/long.csv +604 -0
- data/lib/regexp_parser/scanner/properties/short.csv +242 -0
- data/lib/regexp_parser/scanner/scanner.rl +6 -4
- data/lib/regexp_parser/scanner.rb +126 -124
- data/lib/regexp_parser/syntax/base.rb +3 -5
- data/lib/regexp_parser/syntax/token/backreference.rb +7 -2
- data/lib/regexp_parser/syntax/versions/1.8.6.rb +2 -2
- data/lib/regexp_parser/syntax/versions/1.9.1.rb +1 -1
- data/lib/regexp_parser/version.rb +1 -1
- data/regexp_parser.gemspec +20 -22
- metadata +11 -143
- data/lib/regexp_parser/scanner/properties/long.yml +0 -607
- data/lib/regexp_parser/scanner/properties/short.yml +0 -245
- data/spec/expression/base_spec.rb +0 -104
- data/spec/expression/clone_spec.rb +0 -152
- data/spec/expression/conditional_spec.rb +0 -89
- data/spec/expression/free_space_spec.rb +0 -27
- data/spec/expression/methods/match_length_spec.rb +0 -161
- data/spec/expression/methods/match_spec.rb +0 -25
- data/spec/expression/methods/strfregexp_spec.rb +0 -224
- data/spec/expression/methods/tests_spec.rb +0 -99
- data/spec/expression/methods/traverse_spec.rb +0 -161
- data/spec/expression/options_spec.rb +0 -128
- data/spec/expression/subexpression_spec.rb +0 -50
- data/spec/expression/to_h_spec.rb +0 -26
- data/spec/expression/to_s_spec.rb +0 -108
- data/spec/lexer/all_spec.rb +0 -22
- data/spec/lexer/conditionals_spec.rb +0 -53
- data/spec/lexer/delimiters_spec.rb +0 -68
- data/spec/lexer/escapes_spec.rb +0 -14
- data/spec/lexer/keep_spec.rb +0 -10
- data/spec/lexer/literals_spec.rb +0 -64
- data/spec/lexer/nesting_spec.rb +0 -99
- data/spec/lexer/refcalls_spec.rb +0 -60
- data/spec/parser/all_spec.rb +0 -43
- data/spec/parser/alternation_spec.rb +0 -88
- data/spec/parser/anchors_spec.rb +0 -17
- data/spec/parser/conditionals_spec.rb +0 -179
- data/spec/parser/errors_spec.rb +0 -30
- data/spec/parser/escapes_spec.rb +0 -133
- data/spec/parser/free_space_spec.rb +0 -130
- data/spec/parser/groups_spec.rb +0 -108
- data/spec/parser/keep_spec.rb +0 -6
- data/spec/parser/options_spec.rb +0 -28
- data/spec/parser/posix_classes_spec.rb +0 -8
- data/spec/parser/properties_spec.rb +0 -117
- data/spec/parser/quantifiers_spec.rb +0 -68
- data/spec/parser/refcalls_spec.rb +0 -117
- data/spec/parser/set/intersections_spec.rb +0 -127
- data/spec/parser/set/ranges_spec.rb +0 -121
- data/spec/parser/sets_spec.rb +0 -178
- data/spec/parser/types_spec.rb +0 -18
- data/spec/scanner/all_spec.rb +0 -18
- data/spec/scanner/anchors_spec.rb +0 -21
- data/spec/scanner/conditionals_spec.rb +0 -128
- data/spec/scanner/delimiters_spec.rb +0 -52
- data/spec/scanner/errors_spec.rb +0 -67
- data/spec/scanner/escapes_spec.rb +0 -73
- data/spec/scanner/free_space_spec.rb +0 -165
- data/spec/scanner/groups_spec.rb +0 -61
- data/spec/scanner/keep_spec.rb +0 -10
- data/spec/scanner/literals_spec.rb +0 -39
- data/spec/scanner/meta_spec.rb +0 -18
- data/spec/scanner/options_spec.rb +0 -36
- data/spec/scanner/properties_spec.rb +0 -64
- data/spec/scanner/quantifiers_spec.rb +0 -25
- data/spec/scanner/refcalls_spec.rb +0 -55
- data/spec/scanner/sets_spec.rb +0 -151
- data/spec/scanner/types_spec.rb +0 -14
- data/spec/spec_helper.rb +0 -28
- data/spec/support/capturing_stderr.rb +0 -9
- data/spec/support/shared_examples.rb +0 -77
- data/spec/syntax/syntax_spec.rb +0 -48
- data/spec/syntax/syntax_token_map_spec.rb +0 -23
- data/spec/syntax/versions/1.8.6_spec.rb +0 -17
- data/spec/syntax/versions/1.9.1_spec.rb +0 -10
- data/spec/syntax/versions/1.9.3_spec.rb +0 -9
- data/spec/syntax/versions/2.0.0_spec.rb +0 -13
- data/spec/syntax/versions/2.2.0_spec.rb +0 -9
- data/spec/syntax/versions/aliases_spec.rb +0 -38
- data/spec/token/token_spec.rb +0 -85
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 381a794200168f95ff6329cc8a01330d21a05e02b75e0b06dcc6bd8f763c111d
|
4
|
+
data.tar.gz: bd7617cb3763e6d759c8e1364aed037ae2fff85af3cf28823476cadd14ff080e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a039012013e9b57329fd685aaf29386d8b848071e514f59df0acc3437a1dae5c76b6bf94158cc3deece08f3a1fec9437ac84590d97f8590d8dcee1e0dc6c726
|
7
|
+
data.tar.gz: 4d67da41fbef9b9336ccfd02e3a742286bf4ef96d469c8aa2bbb9a6a55ed4aa6027a28b10ba6c9993b15937e3fe51a349632bcf5808f6237cf77a1d29ceb74f2
|
data/CHANGELOG.md
CHANGED
@@ -1,10 +1,22 @@
|
|
1
|
-
## [
|
1
|
+
## [2.2.1] - 2022-02-11 - [Janosch Müller](mailto:janosch84@gmail.com)
|
2
|
+
|
3
|
+
### Fixed
|
4
|
+
|
5
|
+
- fixed Syntax version of absence groups (`(?~...)`)
|
6
|
+
- the lexer accepted them for any Ruby version
|
7
|
+
- now they are only recognized for Ruby >= 2.4.1 in which they were introduced
|
8
|
+
- reduced gem size by excluding specs from package
|
9
|
+
- removed deprecated `test_files` gemspec setting
|
10
|
+
- no longer depend on `yaml`/`psych` (except for Ruby <= 2.4)
|
11
|
+
- no longer depend on `set`
|
12
|
+
- `set` was removed from the stdlib and made a standalone gem as of Ruby 3
|
13
|
+
- this made it a hidden/undeclared dependency of `regexp_parser`
|
2
14
|
|
3
15
|
## [2.2.0] - 2021-12-04 - [Janosch Müller](mailto:janosch84@gmail.com)
|
4
16
|
|
5
17
|
### Added
|
6
18
|
|
7
|
-
-
|
19
|
+
- added support for 13 new unicode properties introduced in Ruby 3.1.0
|
8
20
|
|
9
21
|
## [2.1.1] - 2021-02-23 - [Janosch Müller](mailto:janosch84@gmail.com)
|
10
22
|
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -437,7 +437,7 @@ Projects using regexp_parser.
|
|
437
437
|
|
438
438
|
- [meta_re](https://github.com/ammar/meta_re) is a regular expression preprocessor with alias support.
|
439
439
|
|
440
|
-
- [mutant](https://github.com/mbj/mutant)
|
440
|
+
- [mutant](https://github.com/mbj/mutant) manipulates your regular expressions (amongst others) to see if your tests cover their behavior.
|
441
441
|
|
442
442
|
- [rubocop](https://github.com/rubocop-hq/rubocop) is a linter for Ruby that uses regexp_parser to lint Regexps.
|
443
443
|
|
@@ -470,4 +470,4 @@ Documentation and books used while working on this project.
|
|
470
470
|
|
471
471
|
---
|
472
472
|
##### Copyright
|
473
|
-
_Copyright (c) 2010-
|
473
|
+
_Copyright (c) 2010-2022 Ammar Ali. See LICENSE file for details._
|
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ require 'rspec/core/rake_task'
|
|
7
7
|
|
8
8
|
RAGEL_SOURCE_DIR = File.join(__dir__, 'lib/regexp_parser/scanner')
|
9
9
|
RAGEL_OUTPUT_DIR = File.join(__dir__, 'lib/regexp_parser')
|
10
|
-
RAGEL_SOURCE_FILES = %w
|
10
|
+
RAGEL_SOURCE_FILES = %w[scanner] # scanner.rl imports the other files
|
11
11
|
|
12
12
|
Bundler::GemHelper.install_tasks
|
13
13
|
|
@@ -57,13 +57,10 @@ namespace :props do
|
|
57
57
|
RegexpPropertyValues.update
|
58
58
|
dir = File.join(__dir__, 'lib/regexp_parser/scanner/properties')
|
59
59
|
|
60
|
-
require 'psych'
|
61
60
|
write_hash_to_file = ->(hash, path) do
|
62
61
|
File.open(path, 'w') do |f|
|
63
|
-
f.puts
|
64
|
-
|
65
|
-
'#',
|
66
|
-
hash.sort.to_h.to_yaml
|
62
|
+
f.puts "# THIS FILE IS AUTO-GENERATED BY `rake props:update` - DO NOT EDIT",
|
63
|
+
*hash.sort.map { |pair| pair.join(',') }
|
67
64
|
end
|
68
65
|
puts "Wrote #{hash.count} aliases to `#{path}`"
|
69
66
|
end
|
@@ -71,11 +68,11 @@ namespace :props do
|
|
71
68
|
long_names_to_tokens = RegexpPropertyValues.all.map do |val|
|
72
69
|
[val.identifier, val.full_name.downcase]
|
73
70
|
end
|
74
|
-
write_hash_to_file.call(long_names_to_tokens, "#{dir}/long.
|
71
|
+
write_hash_to_file.call(long_names_to_tokens, "#{dir}/long.csv")
|
75
72
|
|
76
73
|
short_names_to_tokens = RegexpPropertyValues.alias_hash.map do |k, v|
|
77
74
|
[k.identifier, v.full_name.downcase]
|
78
75
|
end
|
79
|
-
write_hash_to_file.call(short_names_to_tokens, "#{dir}/short.
|
76
|
+
write_hash_to_file.call(short_names_to_tokens, "#{dir}/short.csv")
|
80
77
|
end
|
81
78
|
end
|
@@ -2,16 +2,21 @@ module Regexp::Expression
|
|
2
2
|
# TODO: unify naming with Token::Escape, on way or the other, in v3.0.0
|
3
3
|
module EscapeSequence
|
4
4
|
class Base < Regexp::Expression::Base
|
5
|
-
require 'yaml'
|
6
|
-
|
7
|
-
def char
|
8
|
-
# poor man's unescape without using eval
|
9
|
-
YAML.load(%Q(---\n"#{text}"\n))
|
10
|
-
end
|
11
|
-
|
12
5
|
def codepoint
|
13
6
|
char.ord
|
14
7
|
end
|
8
|
+
|
9
|
+
if ''.respond_to?(:undump)
|
10
|
+
def char
|
11
|
+
%("#{text}").undump
|
12
|
+
end
|
13
|
+
else
|
14
|
+
# poor man's unescape without using eval
|
15
|
+
require 'yaml'
|
16
|
+
def char
|
17
|
+
YAML.load(%Q(---\n"#{text}"\n))
|
18
|
+
end
|
19
|
+
end
|
15
20
|
end
|
16
21
|
|
17
22
|
class Literal < EscapeSequence::Base
|
@@ -43,7 +43,7 @@ module Regexp::Expression
|
|
43
43
|
|
44
44
|
# Order is important! Fields that use other fields in their
|
45
45
|
# definition must appear before the fields they use.
|
46
|
-
part_keys = %w
|
46
|
+
part_keys = %w[a m b o i l x s e S y k c q Q z Z t ~t T >]
|
47
47
|
part.keys.each {|k| part[k] = "<?#{k}?>"}
|
48
48
|
|
49
49
|
part['>'] = print_level ? (' ' * (print_level + indent_offset)) : ''
|