regexp_parser 2.1.1 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/README.md +15 -21
  4. data/Rakefile +5 -11
  5. data/lib/regexp_parser/expression/base.rb +123 -0
  6. data/lib/regexp_parser/expression/classes/anchor.rb +0 -2
  7. data/lib/regexp_parser/expression/classes/{backref.rb → backreference.rb} +0 -0
  8. data/lib/regexp_parser/expression/classes/{set → character_set}/intersection.rb +0 -0
  9. data/lib/regexp_parser/expression/classes/{set → character_set}/range.rb +0 -0
  10. data/lib/regexp_parser/expression/classes/{set.rb → character_set.rb} +0 -0
  11. data/lib/regexp_parser/expression/classes/{escape.rb → escape_sequence.rb} +1 -0
  12. data/lib/regexp_parser/expression/classes/free_space.rb +0 -2
  13. data/lib/regexp_parser/expression/classes/literal.rb +1 -5
  14. data/lib/regexp_parser/expression/classes/property.rb +0 -2
  15. data/lib/regexp_parser/expression/classes/root.rb +0 -1
  16. data/lib/regexp_parser/expression/classes/type.rb +0 -2
  17. data/lib/regexp_parser/expression/quantifier.rb +1 -1
  18. data/lib/regexp_parser/expression/sequence.rb +0 -1
  19. data/lib/regexp_parser/expression/subexpression.rb +0 -1
  20. data/lib/regexp_parser/expression.rb +6 -130
  21. data/lib/regexp_parser/lexer.rb +7 -5
  22. data/lib/regexp_parser/scanner/properties/long.yml +13 -0
  23. data/lib/regexp_parser/scanner/properties/short.yml +9 -1
  24. data/lib/regexp_parser/syntax/any.rb +1 -3
  25. data/lib/regexp_parser/syntax/base.rb +9 -9
  26. data/lib/regexp_parser/syntax/token/anchor.rb +15 -0
  27. data/lib/regexp_parser/syntax/{tokens → token}/assertion.rb +2 -2
  28. data/lib/regexp_parser/syntax/{tokens/backref.rb → token/backreference.rb} +6 -5
  29. data/lib/regexp_parser/syntax/{tokens → token}/character_set.rb +2 -2
  30. data/lib/regexp_parser/syntax/{tokens → token}/character_type.rb +3 -3
  31. data/lib/regexp_parser/syntax/{tokens → token}/conditional.rb +3 -3
  32. data/lib/regexp_parser/syntax/token/escape.rb +31 -0
  33. data/lib/regexp_parser/syntax/{tokens → token}/group.rb +7 -7
  34. data/lib/regexp_parser/syntax/{tokens → token}/keep.rb +1 -1
  35. data/lib/regexp_parser/syntax/{tokens → token}/meta.rb +2 -2
  36. data/lib/regexp_parser/syntax/{tokens → token}/posix_class.rb +3 -3
  37. data/lib/regexp_parser/syntax/token/quantifier.rb +35 -0
  38. data/lib/regexp_parser/syntax/token/unicode_property.rb +696 -0
  39. data/lib/regexp_parser/syntax/token.rb +45 -0
  40. data/lib/regexp_parser/syntax/versions/1.8.6.rb +1 -1
  41. data/lib/regexp_parser/syntax/versions/3.1.0.rb +10 -0
  42. data/lib/regexp_parser/syntax.rb +1 -1
  43. data/lib/regexp_parser/token.rb +9 -20
  44. data/lib/regexp_parser/version.rb +1 -1
  45. data/lib/regexp_parser.rb +0 -2
  46. data/spec/lexer/nesting_spec.rb +2 -2
  47. data/spec/parser/escapes_spec.rb +43 -31
  48. data/spec/parser/properties_spec.rb +6 -4
  49. data/spec/parser/set/ranges_spec.rb +26 -16
  50. data/spec/scanner/escapes_spec.rb +28 -19
  51. data/spec/scanner/sets_spec.rb +9 -9
  52. data/spec/spec_helper.rb +13 -1
  53. data/spec/support/capturing_stderr.rb +9 -0
  54. data/spec/syntax/versions/1.8.6_spec.rb +2 -2
  55. data/spec/syntax/versions/2.0.0_spec.rb +2 -2
  56. data/spec/syntax/versions/aliases_spec.rb +1 -0
  57. metadata +26 -26
  58. data/lib/regexp_parser/syntax/tokens/anchor.rb +0 -15
  59. data/lib/regexp_parser/syntax/tokens/escape.rb +0 -30
  60. data/lib/regexp_parser/syntax/tokens/quantifier.rb +0 -35
  61. data/lib/regexp_parser/syntax/tokens/unicode_property.rb +0 -675
  62. data/lib/regexp_parser/syntax/tokens.rb +0 -45
  63. data/spec/support/runner.rb +0 -42
  64. data/spec/support/warning_extractor.rb +0 -60
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.1.1
4
+ version: 2.2.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: 2021-02-23 00:00:00.000000000 Z
11
+ date: 2021-12-04 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A library for tokenizing, lexing, and parsing Ruby regular expressions.
14
14
  email:
@@ -25,11 +25,15 @@ files:
25
25
  - lib/regexp_parser.rb
26
26
  - lib/regexp_parser/error.rb
27
27
  - lib/regexp_parser/expression.rb
28
+ - lib/regexp_parser/expression/base.rb
28
29
  - lib/regexp_parser/expression/classes/alternation.rb
29
30
  - lib/regexp_parser/expression/classes/anchor.rb
30
- - lib/regexp_parser/expression/classes/backref.rb
31
+ - lib/regexp_parser/expression/classes/backreference.rb
32
+ - lib/regexp_parser/expression/classes/character_set.rb
33
+ - lib/regexp_parser/expression/classes/character_set/intersection.rb
34
+ - lib/regexp_parser/expression/classes/character_set/range.rb
31
35
  - lib/regexp_parser/expression/classes/conditional.rb
32
- - lib/regexp_parser/expression/classes/escape.rb
36
+ - lib/regexp_parser/expression/classes/escape_sequence.rb
33
37
  - lib/regexp_parser/expression/classes/free_space.rb
34
38
  - lib/regexp_parser/expression/classes/group.rb
35
39
  - lib/regexp_parser/expression/classes/keep.rb
@@ -37,9 +41,6 @@ files:
37
41
  - lib/regexp_parser/expression/classes/posix_class.rb
38
42
  - lib/regexp_parser/expression/classes/property.rb
39
43
  - lib/regexp_parser/expression/classes/root.rb
40
- - lib/regexp_parser/expression/classes/set.rb
41
- - lib/regexp_parser/expression/classes/set/intersection.rb
42
- - lib/regexp_parser/expression/classes/set/range.rb
43
44
  - lib/regexp_parser/expression/classes/type.rb
44
45
  - lib/regexp_parser/expression/methods/match.rb
45
46
  - lib/regexp_parser/expression/methods/match_length.rb
@@ -62,20 +63,20 @@ files:
62
63
  - lib/regexp_parser/syntax.rb
63
64
  - lib/regexp_parser/syntax/any.rb
64
65
  - lib/regexp_parser/syntax/base.rb
65
- - lib/regexp_parser/syntax/tokens.rb
66
- - lib/regexp_parser/syntax/tokens/anchor.rb
67
- - lib/regexp_parser/syntax/tokens/assertion.rb
68
- - lib/regexp_parser/syntax/tokens/backref.rb
69
- - lib/regexp_parser/syntax/tokens/character_set.rb
70
- - lib/regexp_parser/syntax/tokens/character_type.rb
71
- - lib/regexp_parser/syntax/tokens/conditional.rb
72
- - lib/regexp_parser/syntax/tokens/escape.rb
73
- - lib/regexp_parser/syntax/tokens/group.rb
74
- - lib/regexp_parser/syntax/tokens/keep.rb
75
- - lib/regexp_parser/syntax/tokens/meta.rb
76
- - lib/regexp_parser/syntax/tokens/posix_class.rb
77
- - lib/regexp_parser/syntax/tokens/quantifier.rb
78
- - lib/regexp_parser/syntax/tokens/unicode_property.rb
66
+ - lib/regexp_parser/syntax/token.rb
67
+ - lib/regexp_parser/syntax/token/anchor.rb
68
+ - lib/regexp_parser/syntax/token/assertion.rb
69
+ - lib/regexp_parser/syntax/token/backreference.rb
70
+ - lib/regexp_parser/syntax/token/character_set.rb
71
+ - lib/regexp_parser/syntax/token/character_type.rb
72
+ - lib/regexp_parser/syntax/token/conditional.rb
73
+ - lib/regexp_parser/syntax/token/escape.rb
74
+ - lib/regexp_parser/syntax/token/group.rb
75
+ - lib/regexp_parser/syntax/token/keep.rb
76
+ - lib/regexp_parser/syntax/token/meta.rb
77
+ - lib/regexp_parser/syntax/token/posix_class.rb
78
+ - lib/regexp_parser/syntax/token/quantifier.rb
79
+ - lib/regexp_parser/syntax/token/unicode_property.rb
79
80
  - lib/regexp_parser/syntax/version_lookup.rb
80
81
  - lib/regexp_parser/syntax/versions.rb
81
82
  - lib/regexp_parser/syntax/versions/1.8.6.rb
@@ -90,6 +91,7 @@ files:
90
91
  - lib/regexp_parser/syntax/versions/2.6.0.rb
91
92
  - lib/regexp_parser/syntax/versions/2.6.2.rb
92
93
  - lib/regexp_parser/syntax/versions/2.6.3.rb
94
+ - lib/regexp_parser/syntax/versions/3.1.0.rb
93
95
  - lib/regexp_parser/token.rb
94
96
  - lib/regexp_parser/version.rb
95
97
  - regexp_parser.gemspec
@@ -150,9 +152,8 @@ files:
150
152
  - spec/scanner/sets_spec.rb
151
153
  - spec/scanner/types_spec.rb
152
154
  - spec/spec_helper.rb
153
- - spec/support/runner.rb
155
+ - spec/support/capturing_stderr.rb
154
156
  - spec/support/shared_examples.rb
155
- - spec/support/warning_extractor.rb
156
157
  - spec/syntax/syntax_spec.rb
157
158
  - spec/syntax/syntax_token_map_spec.rb
158
159
  - spec/syntax/versions/1.8.6_spec.rb
@@ -184,7 +185,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
184
185
  - !ruby/object:Gem::Version
185
186
  version: '0'
186
187
  requirements: []
187
- rubygems_version: 3.2.3
188
+ rubygems_version: 3.3.0.dev
188
189
  signing_key:
189
190
  specification_version: 4
190
191
  summary: Scanner, lexer, parser for ruby's regular expressions
@@ -246,9 +247,8 @@ test_files:
246
247
  - spec/scanner/sets_spec.rb
247
248
  - spec/scanner/types_spec.rb
248
249
  - spec/spec_helper.rb
249
- - spec/support/runner.rb
250
+ - spec/support/capturing_stderr.rb
250
251
  - spec/support/shared_examples.rb
251
- - spec/support/warning_extractor.rb
252
252
  - spec/syntax/syntax_spec.rb
253
253
  - spec/syntax/syntax_token_map_spec.rb
254
254
  - spec/syntax/versions/1.8.6_spec.rb
@@ -1,15 +0,0 @@
1
- module Regexp::Syntax
2
- module Token
3
- module Anchor
4
- Basic = [:bol, :eol]
5
- Extended = Basic + [:word_boundary, :nonword_boundary]
6
- String = [:bos, :eos, :eos_ob_eol]
7
- MatchStart = [:match_start]
8
-
9
- All = Extended + String + MatchStart
10
- Type = :anchor
11
- end
12
-
13
- Map[Anchor::Type] = Anchor::All
14
- end
15
- end
@@ -1,30 +0,0 @@
1
- module Regexp::Syntax
2
- module Token
3
- module Escape
4
- Basic = [:backslash, :literal]
5
-
6
- Control = [:control, :meta_sequence]
7
-
8
- ASCII = [:bell, :backspace, :escape, :form_feed, :newline, :carriage,
9
- :tab, :vertical_tab]
10
-
11
- Unicode = [:codepoint, :codepoint_list]
12
-
13
- Meta = [:dot, :alternation,
14
- :zero_or_one, :zero_or_more, :one_or_more,
15
- :bol, :eol,
16
- :group_open, :group_close,
17
- :interval_open, :interval_close,
18
- :set_open, :set_close]
19
-
20
- Hex = [:hex]
21
-
22
- Octal = [:octal]
23
-
24
- All = Basic + Control + ASCII + Unicode + Meta + Hex + Octal
25
- Type = :escape
26
- end
27
-
28
- Map[Escape::Type] = Escape::All
29
- end
30
- end
@@ -1,35 +0,0 @@
1
- module Regexp::Syntax
2
- module Token
3
- module Quantifier
4
- Greedy = [
5
- :zero_or_one,
6
- :zero_or_more,
7
- :one_or_more
8
- ]
9
-
10
- Reluctant = [
11
- :zero_or_one_reluctant,
12
- :zero_or_more_reluctant,
13
- :one_or_more_reluctant
14
- ]
15
-
16
- Possessive = [
17
- :zero_or_one_possessive,
18
- :zero_or_more_possessive,
19
- :one_or_more_possessive
20
- ]
21
-
22
- Interval = [:interval]
23
- IntervalReluctant = [:interval_reluctant]
24
- IntervalPossessive = [:interval_possessive]
25
-
26
- IntervalAll = Interval + IntervalReluctant +
27
- IntervalPossessive
28
-
29
- All = Greedy + Reluctant + Possessive + IntervalAll
30
- Type = :quantifier
31
- end
32
-
33
- Map[Quantifier::Type] = Quantifier::All
34
- end
35
- end