regexp_parser 2.4.0 → 2.7.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.
Files changed (31) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +98 -42
  3. data/README.md +46 -30
  4. data/lib/regexp_parser/expression/base.rb +17 -9
  5. data/lib/regexp_parser/expression/classes/backreference.rb +19 -2
  6. data/lib/regexp_parser/expression/classes/{type.rb → character_type.rb} +0 -0
  7. data/lib/regexp_parser/expression/classes/conditional.rb +8 -0
  8. data/lib/regexp_parser/expression/classes/escape_sequence.rb +1 -1
  9. data/lib/regexp_parser/expression/classes/group.rb +10 -0
  10. data/lib/regexp_parser/expression/classes/keep.rb +2 -0
  11. data/lib/regexp_parser/expression/classes/root.rb +3 -5
  12. data/lib/regexp_parser/expression/classes/{property.rb → unicode_property.rb} +1 -0
  13. data/lib/regexp_parser/expression/methods/construct.rb +43 -0
  14. data/lib/regexp_parser/expression/methods/human_name.rb +43 -0
  15. data/lib/regexp_parser/expression/methods/match_length.rb +9 -5
  16. data/lib/regexp_parser/expression/methods/traverse.rb +6 -3
  17. data/lib/regexp_parser/expression/quantifier.rb +6 -5
  18. data/lib/regexp_parser/expression/sequence.rb +6 -21
  19. data/lib/regexp_parser/expression/shared.rb +20 -3
  20. data/lib/regexp_parser/expression/subexpression.rb +4 -1
  21. data/lib/regexp_parser/expression.rb +4 -2
  22. data/lib/regexp_parser/lexer.rb +61 -29
  23. data/lib/regexp_parser/parser.rb +36 -26
  24. data/lib/regexp_parser/scanner/property.rl +1 -1
  25. data/lib/regexp_parser/scanner/scanner.rl +57 -42
  26. data/lib/regexp_parser/scanner.rb +873 -823
  27. data/lib/regexp_parser/syntax/token/escape.rb +1 -1
  28. data/lib/regexp_parser/syntax/version_lookup.rb +0 -8
  29. data/lib/regexp_parser/syntax/versions.rb +2 -0
  30. data/lib/regexp_parser/version.rb +1 -1
  31. metadata +7 -5
@@ -1,6 +1,6 @@
1
1
  module Regexp::Syntax
2
2
  module Token
3
- # TODO: unify naming with RE::EscapeSequence, on way or the other, in v3.0.0
3
+ # TODO: unify naming with RE::EscapeSequence, one way or the other, in v3.0.0
4
4
  module Escape
5
5
  Basic = %i[backslash literal]
6
6
 
@@ -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
@@ -4,3 +4,5 @@
4
4
  # Aliases for the latest patch version are provided as 'ruby/n.n',
5
5
  # e.g. 'ruby/1.9' refers to Ruby v1.9.3.
6
6
  Dir[File.expand_path('../versions/*.rb', __FILE__)].sort.each { |f| require f }
7
+
8
+ Regexp::Syntax::CURRENT = Regexp::Syntax.for("ruby/#{RUBY_VERSION}")
@@ -1,5 +1,5 @@
1
1
  class Regexp
2
2
  class Parser
3
- VERSION = '2.4.0'
3
+ VERSION = '2.7.0'
4
4
  end
5
5
  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.0
4
+ version: 2.7.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: 2022-05-09 00:00:00.000000000 Z
11
+ date: 2023-02-08 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A library for tokenizing, lexing, and parsing Ruby regular expressions.
14
14
  email:
@@ -32,6 +32,7 @@ files:
32
32
  - lib/regexp_parser/expression/classes/character_set.rb
33
33
  - lib/regexp_parser/expression/classes/character_set/intersection.rb
34
34
  - lib/regexp_parser/expression/classes/character_set/range.rb
35
+ - lib/regexp_parser/expression/classes/character_type.rb
35
36
  - lib/regexp_parser/expression/classes/conditional.rb
36
37
  - lib/regexp_parser/expression/classes/escape_sequence.rb
37
38
  - lib/regexp_parser/expression/classes/free_space.rb
@@ -39,9 +40,10 @@ files:
39
40
  - lib/regexp_parser/expression/classes/keep.rb
40
41
  - lib/regexp_parser/expression/classes/literal.rb
41
42
  - lib/regexp_parser/expression/classes/posix_class.rb
42
- - lib/regexp_parser/expression/classes/property.rb
43
43
  - lib/regexp_parser/expression/classes/root.rb
44
- - lib/regexp_parser/expression/classes/type.rb
44
+ - lib/regexp_parser/expression/classes/unicode_property.rb
45
+ - lib/regexp_parser/expression/methods/construct.rb
46
+ - lib/regexp_parser/expression/methods/human_name.rb
45
47
  - lib/regexp_parser/expression/methods/match.rb
46
48
  - lib/regexp_parser/expression/methods/match_length.rb
47
49
  - lib/regexp_parser/expression/methods/options.rb
@@ -123,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
125
  - !ruby/object:Gem::Version
124
126
  version: '0'
125
127
  requirements: []
126
- rubygems_version: 3.3.3
128
+ rubygems_version: 3.4.1
127
129
  signing_key:
128
130
  specification_version: 4
129
131
  summary: Scanner, lexer, parser for ruby's regular expressions