regexp_parser 0.4.13 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (103) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +15 -0
  3. data/lib/regexp_parser/expression.rb +43 -51
  4. data/lib/regexp_parser/expression/classes/alternation.rb +6 -7
  5. data/lib/regexp_parser/expression/classes/character_class.rb +11 -0
  6. data/lib/regexp_parser/expression/classes/conditional.rb +10 -18
  7. data/lib/regexp_parser/expression/classes/free_space.rb +1 -1
  8. data/lib/regexp_parser/expression/classes/group.rb +9 -21
  9. data/lib/regexp_parser/expression/classes/property.rb +2 -2
  10. data/lib/regexp_parser/expression/classes/set.rb +1 -12
  11. data/lib/regexp_parser/expression/methods/traverse.rb +1 -1
  12. data/lib/regexp_parser/expression/quantifier.rb +9 -9
  13. data/lib/regexp_parser/expression/sequence.rb +5 -4
  14. data/lib/regexp_parser/expression/subexpression.rb +16 -59
  15. data/lib/regexp_parser/lexer.rb +31 -27
  16. data/lib/regexp_parser/parser.rb +179 -179
  17. data/lib/regexp_parser/scanner.rb +172 -166
  18. data/lib/regexp_parser/scanner/scanner.rl +44 -38
  19. data/lib/regexp_parser/syntax.rb +2 -53
  20. data/lib/regexp_parser/syntax/base.rb +13 -24
  21. data/lib/regexp_parser/syntax/tokens/character_class.rb +16 -0
  22. data/lib/regexp_parser/syntax/tokens/unicode_property.rb +26 -26
  23. data/lib/regexp_parser/syntax/version_lookup.rb +82 -0
  24. data/lib/regexp_parser/syntax/versions.rb +1 -5
  25. data/lib/regexp_parser/syntax/versions/1.8.6.rb +30 -0
  26. data/lib/regexp_parser/syntax/versions/1.9.1.rb +36 -0
  27. data/lib/regexp_parser/syntax/versions/1.9.3.rb +11 -0
  28. data/lib/regexp_parser/syntax/versions/2.0.0.rb +20 -0
  29. data/lib/regexp_parser/syntax/versions/2.2.0.rb +10 -0
  30. data/lib/regexp_parser/syntax/versions/2.3.0.rb +10 -0
  31. data/lib/regexp_parser/syntax/versions/2.4.0.rb +10 -0
  32. data/lib/regexp_parser/syntax/versions/2.4.1.rb +9 -0
  33. data/lib/regexp_parser/syntax/versions/2.5.0.rb +10 -0
  34. data/lib/regexp_parser/token.rb +6 -29
  35. data/lib/regexp_parser/version.rb +1 -1
  36. data/test/expression/test_strfregexp.rb +7 -0
  37. data/test/expression/test_to_h.rb +6 -0
  38. data/test/parser/test_properties.rb +12 -4
  39. data/test/support/warning_extractor.rb +3 -1
  40. data/test/syntax/test_all.rb +1 -1
  41. data/test/syntax/test_syntax.rb +5 -9
  42. data/test/syntax/{ruby → versions}/test_1.8.rb +14 -14
  43. data/test/syntax/{ruby → versions}/test_1.9.1.rb +7 -8
  44. data/test/syntax/{ruby → versions}/test_1.9.3.rb +7 -7
  45. data/test/syntax/versions/test_2.0.0.rb +37 -0
  46. data/test/syntax/{ruby → versions}/test_2.2.0.rb +7 -7
  47. data/test/syntax/versions/test_aliases.rb +129 -0
  48. data/test/syntax/{ruby → versions}/test_all.rb +1 -1
  49. metadata +73 -113
  50. data/lib/regexp_parser/syntax/ruby/1.8.6.rb +0 -37
  51. data/lib/regexp_parser/syntax/ruby/1.8.7.rb +0 -14
  52. data/lib/regexp_parser/syntax/ruby/1.8.rb +0 -13
  53. data/lib/regexp_parser/syntax/ruby/1.9.1.rb +0 -45
  54. data/lib/regexp_parser/syntax/ruby/1.9.2.rb +0 -9
  55. data/lib/regexp_parser/syntax/ruby/1.9.3.rb +0 -19
  56. data/lib/regexp_parser/syntax/ruby/1.9.rb +0 -8
  57. data/lib/regexp_parser/syntax/ruby/2.0.0.rb +0 -23
  58. data/lib/regexp_parser/syntax/ruby/2.0.rb +0 -8
  59. data/lib/regexp_parser/syntax/ruby/2.1.0.rb +0 -13
  60. data/lib/regexp_parser/syntax/ruby/2.1.10.rb +0 -13
  61. data/lib/regexp_parser/syntax/ruby/2.1.2.rb +0 -13
  62. data/lib/regexp_parser/syntax/ruby/2.1.3.rb +0 -13
  63. data/lib/regexp_parser/syntax/ruby/2.1.4.rb +0 -13
  64. data/lib/regexp_parser/syntax/ruby/2.1.5.rb +0 -13
  65. data/lib/regexp_parser/syntax/ruby/2.1.6.rb +0 -13
  66. data/lib/regexp_parser/syntax/ruby/2.1.7.rb +0 -13
  67. data/lib/regexp_parser/syntax/ruby/2.1.8.rb +0 -13
  68. data/lib/regexp_parser/syntax/ruby/2.1.9.rb +0 -13
  69. data/lib/regexp_parser/syntax/ruby/2.1.rb +0 -8
  70. data/lib/regexp_parser/syntax/ruby/2.2.0.rb +0 -16
  71. data/lib/regexp_parser/syntax/ruby/2.2.1.rb +0 -13
  72. data/lib/regexp_parser/syntax/ruby/2.2.10.rb +0 -13
  73. data/lib/regexp_parser/syntax/ruby/2.2.2.rb +0 -13
  74. data/lib/regexp_parser/syntax/ruby/2.2.3.rb +0 -13
  75. data/lib/regexp_parser/syntax/ruby/2.2.4.rb +0 -13
  76. data/lib/regexp_parser/syntax/ruby/2.2.5.rb +0 -13
  77. data/lib/regexp_parser/syntax/ruby/2.2.6.rb +0 -13
  78. data/lib/regexp_parser/syntax/ruby/2.2.7.rb +0 -13
  79. data/lib/regexp_parser/syntax/ruby/2.2.8.rb +0 -13
  80. data/lib/regexp_parser/syntax/ruby/2.2.9.rb +0 -13
  81. data/lib/regexp_parser/syntax/ruby/2.2.rb +0 -8
  82. data/lib/regexp_parser/syntax/ruby/2.3.0.rb +0 -16
  83. data/lib/regexp_parser/syntax/ruby/2.3.1.rb +0 -13
  84. data/lib/regexp_parser/syntax/ruby/2.3.2.rb +0 -13
  85. data/lib/regexp_parser/syntax/ruby/2.3.3.rb +0 -13
  86. data/lib/regexp_parser/syntax/ruby/2.3.4.rb +0 -13
  87. data/lib/regexp_parser/syntax/ruby/2.3.5.rb +0 -13
  88. data/lib/regexp_parser/syntax/ruby/2.3.6.rb +0 -13
  89. data/lib/regexp_parser/syntax/ruby/2.3.7.rb +0 -13
  90. data/lib/regexp_parser/syntax/ruby/2.3.rb +0 -8
  91. data/lib/regexp_parser/syntax/ruby/2.4.0.rb +0 -16
  92. data/lib/regexp_parser/syntax/ruby/2.4.1.rb +0 -15
  93. data/lib/regexp_parser/syntax/ruby/2.4.2.rb +0 -13
  94. data/lib/regexp_parser/syntax/ruby/2.4.3.rb +0 -13
  95. data/lib/regexp_parser/syntax/ruby/2.4.4.rb +0 -13
  96. data/lib/regexp_parser/syntax/ruby/2.4.rb +0 -8
  97. data/lib/regexp_parser/syntax/ruby/2.5.0.rb +0 -16
  98. data/lib/regexp_parser/syntax/ruby/2.5.1.rb +0 -13
  99. data/lib/regexp_parser/syntax/ruby/2.5.rb +0 -8
  100. data/lib/regexp_parser/syntax/ruby/2.6.0.rb +0 -13
  101. data/lib/regexp_parser/syntax/ruby/2.6.rb +0 -8
  102. data/test/syntax/ruby/test_2.0.0.rb +0 -32
  103. data/test/syntax/ruby/test_files.rb +0 -353
@@ -1,37 +0,0 @@
1
- module Regexp::Syntax
2
-
3
- module Ruby
4
- class V186 < Regexp::Syntax::Base
5
- include Regexp::Syntax::Token
6
-
7
- def initialize
8
- super
9
-
10
- implements :anchor, Anchor::All
11
- implements :assertion, Assertion::Lookahead
12
- implements :backref, [:number]
13
-
14
- implements :escape,
15
- Escape::Basic + Escape::Backreference +
16
- Escape::ASCII + Escape::Meta + Escape::Control
17
-
18
- implements :group, Group::All
19
-
20
- implements :meta, Meta::Extended
21
-
22
- implements :quantifier,
23
- Quantifier::Greedy + Quantifier::Reluctant +
24
- Quantifier::Interval + Quantifier::IntervalReluctant
25
-
26
- implements :set, CharacterSet::OpenClose +
27
- CharacterSet::Extended + CharacterSet::Types +
28
- CharacterSet::POSIX::Standard
29
-
30
- implements :type,
31
- CharacterType::Extended
32
- end
33
-
34
- end
35
- end
36
-
37
- end
@@ -1,14 +0,0 @@
1
- require File.expand_path('../1.8.6', __FILE__)
2
-
3
- module Regexp::Syntax
4
-
5
- module Ruby
6
- class V187 < Regexp::Syntax::Ruby::V186
7
- def initialize
8
- super
9
- end
10
-
11
- end
12
- end
13
-
14
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path('../1.8.7', __FILE__)
2
-
3
- module Regexp::Syntax
4
-
5
- module Ruby
6
- class V18 < Regexp::Syntax::Ruby::V187
7
- def initialize
8
- super
9
- end
10
- end
11
- end
12
-
13
- end
@@ -1,45 +0,0 @@
1
- require File.expand_path('../1.8', __FILE__)
2
-
3
- module Regexp::Syntax
4
-
5
- module Ruby
6
- class V191 < Regexp::Syntax::Ruby::V18
7
- include Regexp::Syntax::Token
8
-
9
- def initialize
10
- super
11
-
12
- implements :assertion, Assertion::Lookbehind +
13
- SubexpressionCall::All
14
-
15
- implements :backref, Backreference::All +
16
- SubexpressionCall::All
17
-
18
- implements :escape, Escape::Unicode + Escape::Hex + Escape::Octal
19
-
20
- implements :type, CharacterType::Hex
21
-
22
- implements :property,
23
- UnicodeProperty::V190
24
-
25
- implements :nonproperty,
26
- UnicodeProperty::V190
27
-
28
- implements :quantifier,
29
- Quantifier::Possessive + Quantifier::IntervalPossessive
30
-
31
- implements :set,
32
- CharacterSet::POSIX::StandardNegative +
33
- CharacterSet::POSIX::Extensions +
34
- CharacterSet::POSIX::ExtensionsNegative +
35
- UnicodeProperty::V190
36
-
37
- implements :subset, CharacterSet::OpenClose +
38
- CharacterSet::Extended + CharacterSet::Types +
39
- CharacterSet::POSIX::Standard
40
- end
41
-
42
- end
43
- end
44
-
45
- end
@@ -1,9 +0,0 @@
1
- require File.expand_path('../1.9.1', __FILE__)
2
-
3
- module Regexp::Syntax
4
-
5
- module Ruby
6
- class V192 < Regexp::Syntax::Ruby::V191; end
7
- end
8
-
9
- end
@@ -1,19 +0,0 @@
1
- require File.expand_path('../1.9.2', __FILE__)
2
-
3
- module Regexp::Syntax
4
-
5
- module Ruby
6
- class V193 < Regexp::Syntax::Ruby::V192
7
- include Regexp::Syntax::Token
8
-
9
- def initialize
10
- super
11
-
12
- # these were added with update of Oniguruma to Unicode 6.0
13
- implements :property, UnicodeProperty::V193
14
- implements :nonproperty, UnicodeProperty::V193
15
- end
16
- end
17
- end
18
-
19
- end
@@ -1,8 +0,0 @@
1
- require File.expand_path('../1.9.3', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
- # uses the latest 1.9 release
6
- class V19 < Regexp::Syntax::Ruby::V193; end
7
- end
8
- end
@@ -1,23 +0,0 @@
1
- require File.expand_path('../1.9', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
-
6
- # use the last 1.9 release as the base
7
- class V200 < Regexp::Syntax::Ruby::V19
8
- def initialize
9
- super
10
-
11
- implements :keep, Keep::All
12
- implements :conditional, Conditional::All
13
- implements :property, UnicodeProperty::V200
14
- implements :nonproperty, UnicodeProperty::V200
15
-
16
- implements :type, CharacterType::Clustered
17
- implements :set, CharacterSet::Clustered
18
- implements :subset, CharacterSet::Clustered
19
- end
20
- end
21
-
22
- end
23
- end
@@ -1,8 +0,0 @@
1
- require File.expand_path('../2.0.0', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
- # use the last 2.0 release as the base
6
- class V20 < Regexp::Syntax::Ruby::V200; end
7
- end
8
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path('../2.0', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
-
6
- class V210 < Regexp::Syntax::Ruby::V20
7
- def initialize
8
- super
9
- end
10
- end
11
-
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path('../2.1.9', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
-
6
- class V2110 < Regexp::Syntax::Ruby::V219
7
- def initialize
8
- super
9
- end
10
- end
11
-
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path('../2.1.0', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
-
6
- class V212 < Regexp::Syntax::Ruby::V210
7
- def initialize
8
- super
9
- end
10
- end
11
-
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path('../2.1.2', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
-
6
- class V213 < Regexp::Syntax::Ruby::V212
7
- def initialize
8
- super
9
- end
10
- end
11
-
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path('../2.1.3', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
-
6
- class V214 < Regexp::Syntax::Ruby::V213
7
- def initialize
8
- super
9
- end
10
- end
11
-
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path('../2.1.4', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
-
6
- class V215 < Regexp::Syntax::Ruby::V214
7
- def initialize
8
- super
9
- end
10
- end
11
-
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path('../2.1.5', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
-
6
- class V216 < Regexp::Syntax::Ruby::V215
7
- def initialize
8
- super
9
- end
10
- end
11
-
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path('../2.1.6', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
-
6
- class V217 < Regexp::Syntax::Ruby::V216
7
- def initialize
8
- super
9
- end
10
- end
11
-
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path('../2.1.7', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
-
6
- class V218 < Regexp::Syntax::Ruby::V217
7
- def initialize
8
- super
9
- end
10
- end
11
-
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path('../2.1.8', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
-
6
- class V219 < Regexp::Syntax::Ruby::V218
7
- def initialize
8
- super
9
- end
10
- end
11
-
12
- end
13
- end
@@ -1,8 +0,0 @@
1
- require File.expand_path('../2.1.10', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
- # uses the latest 2.1 release
6
- class V21 < Regexp::Syntax::Ruby::V2110; end
7
- end
8
- end
@@ -1,16 +0,0 @@
1
- require File.expand_path('../2.1', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
-
6
- class V220 < Regexp::Syntax::Ruby::V21
7
- def initialize
8
- super
9
-
10
- implements :property, UnicodeProperty::V220
11
- implements :nonproperty, UnicodeProperty::V220
12
- end
13
- end
14
-
15
- end
16
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path('../2.2.0', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
-
6
- class V221 < Regexp::Syntax::Ruby::V220
7
- def initialize
8
- super
9
- end
10
- end
11
-
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path('../2.2.9', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
-
6
- class V2210 < Regexp::Syntax::Ruby::V229
7
- def initialize
8
- super
9
- end
10
- end
11
-
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path('../2.2.1', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
-
6
- class V222 < Regexp::Syntax::Ruby::V221
7
- def initialize
8
- super
9
- end
10
- end
11
-
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path('../2.2.2', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
-
6
- class V223 < Regexp::Syntax::Ruby::V222
7
- def initialize
8
- super
9
- end
10
- end
11
-
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path('../2.2.3', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
-
6
- class V224 < Regexp::Syntax::Ruby::V223
7
- def initialize
8
- super
9
- end
10
- end
11
-
12
- end
13
- end
@@ -1,13 +0,0 @@
1
- require File.expand_path('../2.2.4', __FILE__)
2
-
3
- module Regexp::Syntax
4
- module Ruby
5
-
6
- class V225 < Regexp::Syntax::Ruby::V224
7
- def initialize
8
- super
9
- end
10
- end
11
-
12
- end
13
- end