regexp_parser 2.7.0 → 2.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +62 -3
  3. data/Gemfile +3 -3
  4. data/LICENSE +1 -1
  5. data/README.md +33 -30
  6. data/lib/regexp_parser/expression/base.rb +0 -7
  7. data/lib/regexp_parser/expression/classes/alternation.rb +1 -1
  8. data/lib/regexp_parser/expression/classes/backreference.rb +4 -6
  9. data/lib/regexp_parser/expression/classes/character_set/range.rb +2 -7
  10. data/lib/regexp_parser/expression/classes/character_set.rb +3 -4
  11. data/lib/regexp_parser/expression/classes/conditional.rb +2 -14
  12. data/lib/regexp_parser/expression/classes/escape_sequence.rb +3 -1
  13. data/lib/regexp_parser/expression/classes/free_space.rb +3 -1
  14. data/lib/regexp_parser/expression/classes/group.rb +0 -22
  15. data/lib/regexp_parser/expression/classes/posix_class.rb +5 -1
  16. data/lib/regexp_parser/expression/classes/unicode_property.rb +5 -2
  17. data/lib/regexp_parser/expression/methods/construct.rb +2 -4
  18. data/lib/regexp_parser/expression/methods/parts.rb +23 -0
  19. data/lib/regexp_parser/expression/methods/printing.rb +26 -0
  20. data/lib/regexp_parser/expression/methods/tests.rb +40 -3
  21. data/lib/regexp_parser/expression/methods/traverse.rb +33 -20
  22. data/lib/regexp_parser/expression/quantifier.rb +30 -17
  23. data/lib/regexp_parser/expression/sequence.rb +5 -9
  24. data/lib/regexp_parser/expression/sequence_operation.rb +4 -9
  25. data/lib/regexp_parser/expression/shared.rb +37 -24
  26. data/lib/regexp_parser/expression/subexpression.rb +20 -18
  27. data/lib/regexp_parser/expression.rb +2 -0
  28. data/lib/regexp_parser/lexer.rb +15 -7
  29. data/lib/regexp_parser/parser.rb +85 -86
  30. data/lib/regexp_parser/scanner/errors/premature_end_error.rb +8 -0
  31. data/lib/regexp_parser/scanner/errors/scanner_error.rb +6 -0
  32. data/lib/regexp_parser/scanner/errors/validation_error.rb +63 -0
  33. data/lib/regexp_parser/scanner/properties/long.csv +11 -0
  34. data/lib/regexp_parser/scanner/properties/short.csv +2 -0
  35. data/lib/regexp_parser/scanner/property.rl +1 -1
  36. data/lib/regexp_parser/scanner/scanner.rl +35 -129
  37. data/lib/regexp_parser/scanner.rb +1084 -1303
  38. data/lib/regexp_parser/syntax/token/backreference.rb +3 -0
  39. data/lib/regexp_parser/syntax/token/character_set.rb +3 -0
  40. data/lib/regexp_parser/syntax/token/escape.rb +3 -1
  41. data/lib/regexp_parser/syntax/token/meta.rb +9 -2
  42. data/lib/regexp_parser/syntax/token/unicode_property.rb +17 -1
  43. data/lib/regexp_parser/syntax/token/virtual.rb +11 -0
  44. data/lib/regexp_parser/version.rb +1 -1
  45. metadata +9 -3
@@ -26,5 +26,8 @@ module Regexp::Syntax
26
26
 
27
27
  Map[Backreference::Type] = Backreference::All +
28
28
  SubexpressionCall::All
29
+
30
+ # alias for symmetry between token symbol and Expression class name
31
+ Backref = Backreference
29
32
  end
30
33
  end
@@ -9,5 +9,8 @@ module Regexp::Syntax
9
9
  end
10
10
 
11
11
  Map[CharacterSet::Type] = CharacterSet::All
12
+
13
+ # alias for symmetry between token symbol and Token module name
14
+ Set = CharacterSet
12
15
  end
13
16
  end
@@ -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 = %i[dot]
5
- Extended = Basic + %i[alternation]
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
@@ -59,7 +59,7 @@ module Regexp::Syntax
59
59
 
60
60
  Age_V3_1_0 = %i[age=13.0]
61
61
 
62
- Age_V3_2_0 = %i[age=14.0]
62
+ Age_V3_2_0 = %i[age=14.0 age=15.0]
63
63
 
64
64
  Age = all[:Age_V]
65
65
 
@@ -321,6 +321,8 @@ module Regexp::Syntax
321
321
 
322
322
  Script_V3_2_0 = %i[
323
323
  cypro_minoan
324
+ kawi
325
+ nag_mundari
324
326
  old_uyghur
325
327
  tangsa
326
328
  toto
@@ -667,11 +669,18 @@ module Regexp::Syntax
667
669
 
668
670
  UnicodeBlock_V3_2_0 = %i[
669
671
  in_arabic_extended_b
672
+ in_arabic_extended_c
673
+ in_cjk_unified_ideographs_extension_h
670
674
  in_cypro_minoan
675
+ in_cyrillic_extended_d
676
+ in_devanagari_extended_a
671
677
  in_ethiopic_extended_b
678
+ in_kaktovik_numerals
672
679
  in_kana_extended_b
680
+ in_kawi
673
681
  in_latin_extended_f
674
682
  in_latin_extended_g
683
+ in_nag_mundari
675
684
  in_old_uyghur
676
685
  in_tangsa
677
686
  in_toto
@@ -690,6 +699,10 @@ module Regexp::Syntax
690
699
  emoji_presentation
691
700
  ]
692
701
 
702
+ Emoji_V2_6_0 = %i[
703
+ extended_pictographic
704
+ ]
705
+
693
706
  Emoji = all[:Emoji_V]
694
707
 
695
708
  V1_9_0 = Category::All + POSIX + all[:V1_9_0]
@@ -713,5 +726,8 @@ module Regexp::Syntax
713
726
 
714
727
  Map[UnicodeProperty::Type] = UnicodeProperty::All
715
728
  Map[UnicodeProperty::NonType] = UnicodeProperty::All
729
+
730
+ # alias for symmetry between token symbol and Token module name
731
+ Property = UnicodeProperty
716
732
  end
717
733
  end
@@ -0,0 +1,11 @@
1
+ module Regexp::Syntax
2
+ module Token
3
+ module Virtual
4
+ Root = %i[root]
5
+ Sequence = %i[sequence]
6
+
7
+ All = %i[root sequence]
8
+ Type = :expression
9
+ end
10
+ end
11
+ end
@@ -1,5 +1,5 @@
1
1
  class Regexp
2
2
  class Parser
3
- VERSION = '2.7.0'
3
+ VERSION = '2.8.1'
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.7.0
4
+ version: 2.8.1
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-02-08 00:00:00.000000000 Z
11
+ date: 2023-06-10 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,9 @@ 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
62
67
  - lib/regexp_parser/scanner/properties/long.csv
63
68
  - lib/regexp_parser/scanner/properties/short.csv
64
69
  - lib/regexp_parser/scanner/property.rl
@@ -80,6 +85,7 @@ files:
80
85
  - lib/regexp_parser/syntax/token/posix_class.rb
81
86
  - lib/regexp_parser/syntax/token/quantifier.rb
82
87
  - lib/regexp_parser/syntax/token/unicode_property.rb
88
+ - lib/regexp_parser/syntax/token/virtual.rb
83
89
  - lib/regexp_parser/syntax/version_lookup.rb
84
90
  - lib/regexp_parser/syntax/versions.rb
85
91
  - lib/regexp_parser/syntax/versions/1.8.6.rb
@@ -125,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
131
  - !ruby/object:Gem::Version
126
132
  version: '0'
127
133
  requirements: []
128
- rubygems_version: 3.4.1
134
+ rubygems_version: 3.4.10
129
135
  signing_key:
130
136
  specification_version: 4
131
137
  summary: Scanner, lexer, parser for ruby's regular expressions