regexp_parser 1.5.0 → 1.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/lib/regexp_parser/expression.rb +6 -43
  4. data/lib/regexp_parser/expression/classes/conditional.rb +3 -2
  5. data/lib/regexp_parser/expression/classes/escape.rb +0 -4
  6. data/lib/regexp_parser/expression/methods/match.rb +13 -0
  7. data/lib/regexp_parser/expression/methods/options.rb +35 -0
  8. data/lib/regexp_parser/expression/methods/strfregexp.rb +0 -1
  9. data/lib/regexp_parser/expression/methods/tests.rb +6 -15
  10. data/lib/regexp_parser/expression/sequence.rb +3 -2
  11. data/lib/regexp_parser/expression/sequence_operation.rb +2 -6
  12. data/lib/regexp_parser/lexer.rb +0 -21
  13. data/lib/regexp_parser/parser.rb +22 -21
  14. data/lib/regexp_parser/scanner.rb +1159 -1329
  15. data/lib/regexp_parser/scanner/char_type.rl +0 -3
  16. data/lib/regexp_parser/scanner/scanner.rl +82 -190
  17. data/lib/regexp_parser/version.rb +1 -1
  18. data/spec/expression/base_spec.rb +14 -0
  19. data/spec/expression/methods/match_length_spec.rb +13 -0
  20. data/spec/expression/methods/match_spec.rb +25 -0
  21. data/spec/expression/methods/tests_spec.rb +2 -0
  22. data/spec/expression/options_spec.rb +128 -0
  23. data/spec/expression/root_spec.rb +9 -0
  24. data/spec/expression/sequence_spec.rb +9 -0
  25. data/spec/lexer/conditionals_spec.rb +49 -119
  26. data/spec/lexer/escapes_spec.rb +8 -32
  27. data/spec/lexer/keep_spec.rb +5 -17
  28. data/spec/lexer/literals_spec.rb +73 -110
  29. data/spec/lexer/nesting_spec.rb +86 -117
  30. data/spec/lexer/refcalls_spec.rb +51 -50
  31. data/spec/parser/all_spec.rb +13 -1
  32. data/spec/parser/anchors_spec.rb +9 -23
  33. data/spec/parser/conditionals_spec.rb +9 -9
  34. data/spec/parser/errors_spec.rb +22 -43
  35. data/spec/parser/escapes_spec.rb +33 -44
  36. data/spec/parser/groups_spec.rb +98 -257
  37. data/spec/parser/keep_spec.rb +2 -15
  38. data/spec/parser/posix_classes_spec.rb +5 -24
  39. data/spec/parser/properties_spec.rb +42 -54
  40. data/spec/parser/quantifiers_spec.rb +41 -283
  41. data/spec/parser/refcalls_spec.rb +60 -185
  42. data/spec/parser/set/intersections_spec.rb +17 -17
  43. data/spec/parser/set/ranges_spec.rb +17 -17
  44. data/spec/parser/sets_spec.rb +5 -5
  45. data/spec/parser/types_spec.rb +11 -36
  46. data/spec/scanner/anchors_spec.rb +13 -28
  47. data/spec/scanner/conditionals_spec.rb +121 -173
  48. data/spec/scanner/errors_spec.rb +65 -87
  49. data/spec/scanner/escapes_spec.rb +49 -50
  50. data/spec/scanner/free_space_spec.rb +102 -165
  51. data/spec/scanner/groups_spec.rb +45 -64
  52. data/spec/scanner/keep_spec.rb +5 -28
  53. data/spec/scanner/literals_spec.rb +45 -81
  54. data/spec/scanner/meta_spec.rb +13 -33
  55. data/spec/scanner/properties_spec.rb +43 -286
  56. data/spec/scanner/quantifiers_spec.rb +13 -28
  57. data/spec/scanner/refcalls_spec.rb +32 -48
  58. data/spec/scanner/sets_spec.rb +88 -102
  59. data/spec/scanner/types_spec.rb +10 -25
  60. data/spec/spec_helper.rb +1 -0
  61. data/spec/support/shared_examples.rb +77 -0
  62. data/spec/syntax/syntax_spec.rb +4 -0
  63. data/spec/syntax/versions/1.8.6_spec.rb +12 -33
  64. data/spec/syntax/versions/1.9.1_spec.rb +5 -18
  65. data/spec/syntax/versions/1.9.3_spec.rb +4 -17
  66. data/spec/syntax/versions/2.0.0_spec.rb +8 -23
  67. data/spec/syntax/versions/2.2.0_spec.rb +4 -17
  68. data/spec/syntax/versions/aliases_spec.rb +25 -109
  69. metadata +14 -6
  70. data/spec/scanner/scripts_spec.rb +0 -49
  71. data/spec/scanner/unicode_blocks_spec.rb +0 -28
@@ -41,4 +41,8 @@ RSpec.describe(Regexp::Syntax) do
41
41
 
42
42
  expect(Regexp::Syntax.version_class('ruby/2.3')).to eq Regexp::Syntax::V2_3
43
43
  end
44
+
45
+ specify('raises for unknown constant lookups') do
46
+ expect { Regexp::Syntax::V1 }.to raise_error(/V1/)
47
+ end
44
48
  end
@@ -1,38 +1,17 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe(Regexp::Syntax::V1_8_6) do
4
- let(:syntax) { Regexp::Syntax.new('ruby/1.8.6') }
5
-
6
- tests = {
7
- implements: {
8
- assertion: T::Assertion::Lookahead,
9
- backref: [:number],
10
- escape: T::Escape::Basic + T::Escape::ASCII + T::Escape::Meta + T::Escape::Control,
11
- group: T::Group::V1_8_6,
12
- quantifier: T::Quantifier::Greedy + T::Quantifier::Reluctant + T::Quantifier::Interval + T::Quantifier::IntervalReluctant
13
- },
14
- excludes: {
15
- assertion: T::Assertion::Lookbehind,
16
- backref: T::Backreference::All - [:number] + T::SubexpressionCall::All,
17
- quantifier: T::Quantifier::Possessive
18
- }
4
+ include_examples 'syntax', Regexp::Syntax.new('ruby/1.8.6'),
5
+ implements: {
6
+ assertion: T::Assertion::Lookahead,
7
+ backref: [:number],
8
+ escape: T::Escape::Basic + T::Escape::ASCII + T::Escape::Meta + T::Escape::Control,
9
+ group: T::Group::V1_8_6,
10
+ quantifier: T::Quantifier::Greedy + T::Quantifier::Reluctant + T::Quantifier::Interval + T::Quantifier::IntervalReluctant
11
+ },
12
+ excludes: {
13
+ assertion: T::Assertion::Lookbehind,
14
+ backref: T::Backreference::All - [:number] + T::SubexpressionCall::All,
15
+ quantifier: T::Quantifier::Possessive
19
16
  }
20
-
21
- tests.each do |method, types|
22
- expected = method != :excludes
23
-
24
- types.each do |type, tokens|
25
- if tokens.nil? || tokens.empty?
26
- specify("syntax_V1_8_#{method}_#{type}") do
27
- expect(syntax.implements?(type, nil)).to eq expected
28
- end
29
- else
30
- tokens.each do |token|
31
- specify("syntax_V1_8_#{method}_#{type}_#{token}") do
32
- expect(syntax.implements?(type, token)).to eq expected
33
- end
34
- end
35
- end
36
- end
37
- end
38
17
  end
@@ -1,23 +1,10 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe(Regexp::Syntax::V1_9_1) do
4
- let(:syntax) { Regexp::Syntax.new('ruby/1.9.1') }
5
-
6
- tests = {
7
- implements: {
8
- escape: T::Escape::Hex + T::Escape::Octal + T::Escape::Unicode,
9
- type: T::CharacterType::Hex,
10
- quantifier: T::Quantifier::Greedy + T::Quantifier::Reluctant + T::Quantifier::Possessive
11
- }
4
+ include_examples 'syntax', Regexp::Syntax.new('ruby/1.9.1'),
5
+ implements: {
6
+ escape: T::Escape::Hex + T::Escape::Octal + T::Escape::Unicode,
7
+ type: T::CharacterType::Hex,
8
+ quantifier: T::Quantifier::Greedy + T::Quantifier::Reluctant + T::Quantifier::Possessive
12
9
  }
13
-
14
- tests.each do |method, types|
15
- types.each do |type, tokens|
16
- tokens.each do |token|
17
- specify("syntax_V1_9_1_#{method}_#{type}_#{token}") do
18
- expect(syntax.implements?(type, token)).to be true
19
- end
20
- end
21
- end
22
- end
23
10
  end
@@ -1,22 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe(Regexp::Syntax::V1_9_3) do
4
- let(:syntax) { Regexp::Syntax.new('ruby/1.9.3') }
5
-
6
- tests = {
7
- implements: {
8
- property: T::UnicodeProperty::Script_V1_9_3 + T::UnicodeProperty::Age_V1_9_3,
9
- nonproperty: T::UnicodeProperty::Script_V1_9_3 + T::UnicodeProperty::Age_V1_9_3
10
- }
4
+ include_examples 'syntax', Regexp::Syntax.new('ruby/1.9.3'),
5
+ implements: {
6
+ property: T::UnicodeProperty::Script_V1_9_3 + T::UnicodeProperty::Age_V1_9_3,
7
+ nonproperty: T::UnicodeProperty::Script_V1_9_3 + T::UnicodeProperty::Age_V1_9_3
11
8
  }
12
-
13
- tests.each do |method, types|
14
- types.each do |type, tokens|
15
- tokens.each do |token|
16
- specify("syntax_V1_9_3_#{method}_#{type}_#{token}") do
17
- expect(syntax.implements?(type, token)).to be true
18
- end
19
- end
20
- end
21
- end
22
9
  end
@@ -1,28 +1,13 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe(Regexp::Syntax::V2_0_0) do
4
- let(:syntax) { Regexp::Syntax.new('ruby/2.0.0') }
5
-
6
- tests = {
7
- implements: {
8
- property: T::UnicodeProperty::Age_V2_0_0,
9
- nonproperty: T::UnicodeProperty::Age_V2_0_0
10
- },
11
- excludes: {
12
- property: [:newline],
13
- nonproperty: [:newline]
14
- }
4
+ include_examples 'syntax', Regexp::Syntax.new('ruby/2.0.0'),
5
+ implements: {
6
+ property: T::UnicodeProperty::Age_V2_0_0,
7
+ nonproperty: T::UnicodeProperty::Age_V2_0_0
8
+ },
9
+ excludes: {
10
+ property: [:newline],
11
+ nonproperty: [:newline]
15
12
  }
16
-
17
- tests.each do |method, types|
18
- expected = method != :excludes
19
-
20
- types.each do |type, tokens|
21
- tokens.each do |token|
22
- specify("syntax_ruby_V2_0_0_#{method}_#{type}_#{token}") do
23
- expect(syntax.implements?(type, token)).to eq expected
24
- end
25
- end
26
- end
27
- end
28
13
  end
@@ -1,22 +1,9 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe(Regexp::Syntax::V2_2_0) do
4
- let(:syntax) { Regexp::Syntax.new('ruby/2.2.0') }
5
-
6
- tests = {
7
- implements: {
8
- property: T::UnicodeProperty::Script_V2_2_0 + T::UnicodeProperty::Age_V2_2_0,
9
- nonproperty: T::UnicodeProperty::Script_V2_2_0 + T::UnicodeProperty::Age_V2_2_0
10
- }
4
+ include_examples 'syntax', Regexp::Syntax.new('ruby/2.2.0'),
5
+ implements: {
6
+ property: T::UnicodeProperty::Script_V2_2_0 + T::UnicodeProperty::Age_V2_2_0,
7
+ nonproperty: T::UnicodeProperty::Script_V2_2_0 + T::UnicodeProperty::Age_V2_2_0
11
8
  }
12
-
13
- tests.each do |method, types|
14
- types.each do |type, tokens|
15
- tokens.each do |token|
16
- specify("syntax_V2_2_0_#{method}_#{type}_#{token}") do
17
- expect(syntax.implements?(type, token)).to be true
18
- end
19
- end
20
- end
21
- end
22
9
  end
@@ -1,115 +1,31 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe(Regexp::Syntax) do
4
- specify('syntax alias 1 8 6') do
5
- syntax = Regexp::Syntax.new('ruby/1.8.6')
6
-
7
- expect(syntax).to be_a(Regexp::Syntax::V1_8_6)
8
- end
9
-
10
- specify('syntax alias 1 8 alias') do
11
- syntax = Regexp::Syntax.new('ruby/1.8')
12
-
13
- expect(syntax).to be_a(Regexp::Syntax::V1_8_6)
14
- end
15
-
16
- specify('syntax alias 1 9 1') do
17
- syntax = Regexp::Syntax.new('ruby/1.9.1')
18
-
19
- expect(syntax).to be_a(Regexp::Syntax::V1_9_1)
20
- end
21
-
22
- specify('syntax alias 1 9 alias') do
23
- syntax = Regexp::Syntax.new('ruby/1.9')
24
-
25
- expect(syntax).to be_a(Regexp::Syntax::V1_9_3)
26
- end
27
-
28
- specify('syntax alias 2 0 0') do
29
- syntax = Regexp::Syntax.new('ruby/2.0.0')
30
-
31
- expect(syntax).to be_a(Regexp::Syntax::V1_9)
32
- end
33
-
34
- specify('syntax alias 2 0 alias') do
35
- syntax = Regexp::Syntax.new('ruby/2.0')
36
-
37
- expect(syntax).to be_a(Regexp::Syntax::V2_0_0)
38
- end
39
-
40
- specify('syntax alias 2 1 alias') do
41
- syntax = Regexp::Syntax.new('ruby/2.1')
42
-
43
- expect(syntax).to be_a(Regexp::Syntax::V2_0_0)
44
- end
45
-
46
- specify('syntax alias 2 2 0') do
47
- syntax = Regexp::Syntax.new('ruby/2.2.0')
48
-
49
- expect(syntax).to be_a(Regexp::Syntax::V2_0_0)
50
- end
51
-
52
- specify('syntax alias 2 2 10') do
53
- syntax = Regexp::Syntax.new('ruby/2.2.10')
54
-
55
- expect(syntax).to be_a(Regexp::Syntax::V2_0_0)
56
- end
57
-
58
- specify('syntax alias 2 2 alias') do
59
- syntax = Regexp::Syntax.new('ruby/2.2')
60
-
61
- expect(syntax).to be_a(Regexp::Syntax::V2_0_0)
62
- end
63
-
64
- specify('syntax alias 2 3 0') do
65
- syntax = Regexp::Syntax.new('ruby/2.3.0')
66
-
67
- expect(syntax).to be_a(Regexp::Syntax::V2_3_0)
68
- end
69
-
70
- specify('syntax alias 2 3') do
71
- syntax = Regexp::Syntax.new('ruby/2.3')
72
-
73
- expect(syntax).to be_a(Regexp::Syntax::V2_3_0)
74
- end
75
-
76
- specify('syntax alias 2 4 0') do
77
- syntax = Regexp::Syntax.new('ruby/2.4.0')
78
-
79
- expect(syntax).to be_a(Regexp::Syntax::V2_4_0)
80
- end
81
-
82
- specify('syntax alias 2 4 1') do
83
- syntax = Regexp::Syntax.new('ruby/2.4.1')
84
-
85
- expect(syntax).to be_a(Regexp::Syntax::V2_4_1)
86
- end
87
-
88
- specify('syntax alias 2 5 0') do
89
- syntax = Regexp::Syntax.new('ruby/2.5.0')
90
-
91
- expect(syntax).to be_a(Regexp::Syntax::V2_4_1)
92
- expect(syntax).to be_a(Regexp::Syntax::V2_5_0)
93
- end
94
-
95
- specify('syntax alias 2 5') do
96
- syntax = Regexp::Syntax.new('ruby/2.5')
97
-
98
- expect(syntax).to be_a(Regexp::Syntax::V2_5_0)
99
- end
100
-
101
- specify('syntax alias 2 6 0') do
102
- syntax = Regexp::Syntax.new('ruby/2.6.0')
103
-
104
- expect(syntax).to be_a(Regexp::Syntax::V2_5_0)
105
- expect(syntax).to be_a(Regexp::Syntax::V2_6_0)
106
- end
107
-
108
- specify('syntax alias 2 6') do
109
- syntax = Regexp::Syntax.new('ruby/2.6')
110
-
111
- expect(syntax).to be_a(Regexp::Syntax::V2_5_0)
112
- end
4
+ RSpec.shared_examples 'syntax alias' do |string, klass|
5
+ it "aliases #{string} to #{klass}" do
6
+ syntax = Regexp::Syntax.new(string)
7
+ expect(syntax).to be_a klass
8
+ end
9
+ end
10
+
11
+ include_examples 'syntax alias', 'ruby/1.8.6', Regexp::Syntax::V1_8_6
12
+ include_examples 'syntax alias', 'ruby/1.8', Regexp::Syntax::V1_8_6
13
+ include_examples 'syntax alias', 'ruby/1.9.1', Regexp::Syntax::V1_9_1
14
+ include_examples 'syntax alias', 'ruby/1.9', Regexp::Syntax::V1_9_3
15
+ include_examples 'syntax alias', 'ruby/2.0.0', Regexp::Syntax::V1_9
16
+ include_examples 'syntax alias', 'ruby/2.0', Regexp::Syntax::V2_0_0
17
+ include_examples 'syntax alias', 'ruby/2.1', Regexp::Syntax::V2_0_0
18
+ include_examples 'syntax alias', 'ruby/2.2.0', Regexp::Syntax::V2_0_0
19
+ include_examples 'syntax alias', 'ruby/2.2.10', Regexp::Syntax::V2_0_0
20
+ include_examples 'syntax alias', 'ruby/2.2', Regexp::Syntax::V2_0_0
21
+ include_examples 'syntax alias', 'ruby/2.3.0', Regexp::Syntax::V2_3_0
22
+ include_examples 'syntax alias', 'ruby/2.3', Regexp::Syntax::V2_3_0
23
+ include_examples 'syntax alias', 'ruby/2.4.0', Regexp::Syntax::V2_4_0
24
+ include_examples 'syntax alias', 'ruby/2.4.1', Regexp::Syntax::V2_4_1
25
+ include_examples 'syntax alias', 'ruby/2.5.0', Regexp::Syntax::V2_4_1
26
+ include_examples 'syntax alias', 'ruby/2.5', Regexp::Syntax::V2_5_0
27
+ include_examples 'syntax alias', 'ruby/2.6.0', Regexp::Syntax::V2_5_0
28
+ include_examples 'syntax alias', 'ruby/2.6', Regexp::Syntax::V2_5_0
113
29
 
114
30
  specify('future alias warning') do
115
31
  expect { Regexp::Syntax.new('ruby/5.0') }
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: 1.5.0
4
+ version: 1.5.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: 2019-05-15 00:00:00.000000000 Z
11
+ date: 2019-05-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A library for tokenizing, lexing, and parsing Ruby regular expressions.
14
14
  email:
@@ -40,7 +40,9 @@ files:
40
40
  - lib/regexp_parser/expression/classes/set/intersection.rb
41
41
  - lib/regexp_parser/expression/classes/set/range.rb
42
42
  - lib/regexp_parser/expression/classes/type.rb
43
+ - lib/regexp_parser/expression/methods/match.rb
43
44
  - lib/regexp_parser/expression/methods/match_length.rb
45
+ - lib/regexp_parser/expression/methods/options.rb
44
46
  - lib/regexp_parser/expression/methods/strfregexp.rb
45
47
  - lib/regexp_parser/expression/methods/tests.rb
46
48
  - lib/regexp_parser/expression/methods/traverse.rb
@@ -93,9 +95,13 @@ files:
93
95
  - spec/expression/conditional_spec.rb
94
96
  - spec/expression/free_space_spec.rb
95
97
  - spec/expression/methods/match_length_spec.rb
98
+ - spec/expression/methods/match_spec.rb
96
99
  - spec/expression/methods/strfregexp_spec.rb
97
100
  - spec/expression/methods/tests_spec.rb
98
101
  - spec/expression/methods/traverse_spec.rb
102
+ - spec/expression/options_spec.rb
103
+ - spec/expression/root_spec.rb
104
+ - spec/expression/sequence_spec.rb
99
105
  - spec/expression/subexpression_spec.rb
100
106
  - spec/expression/to_h_spec.rb
101
107
  - spec/expression/to_s_spec.rb
@@ -136,12 +142,11 @@ files:
136
142
  - spec/scanner/properties_spec.rb
137
143
  - spec/scanner/quantifiers_spec.rb
138
144
  - spec/scanner/refcalls_spec.rb
139
- - spec/scanner/scripts_spec.rb
140
145
  - spec/scanner/sets_spec.rb
141
146
  - spec/scanner/types_spec.rb
142
- - spec/scanner/unicode_blocks_spec.rb
143
147
  - spec/spec_helper.rb
144
148
  - spec/support/runner.rb
149
+ - spec/support/shared_examples.rb
145
150
  - spec/support/warning_extractor.rb
146
151
  - spec/syntax/syntax_spec.rb
147
152
  - spec/syntax/syntax_token_map_spec.rb
@@ -206,14 +211,19 @@ test_files:
206
211
  - spec/parser/groups_spec.rb
207
212
  - spec/parser/quantifiers_spec.rb
208
213
  - spec/support/warning_extractor.rb
214
+ - spec/support/shared_examples.rb
209
215
  - spec/support/runner.rb
210
216
  - spec/expression/subexpression_spec.rb
217
+ - spec/expression/methods/match_spec.rb
211
218
  - spec/expression/methods/match_length_spec.rb
212
219
  - spec/expression/methods/traverse_spec.rb
213
220
  - spec/expression/methods/strfregexp_spec.rb
214
221
  - spec/expression/methods/tests_spec.rb
215
222
  - spec/expression/free_space_spec.rb
223
+ - spec/expression/options_spec.rb
216
224
  - spec/expression/to_s_spec.rb
225
+ - spec/expression/root_spec.rb
226
+ - spec/expression/sequence_spec.rb
217
227
  - spec/expression/clone_spec.rb
218
228
  - spec/expression/to_h_spec.rb
219
229
  - spec/expression/conditional_spec.rb
@@ -234,9 +244,7 @@ test_files:
234
244
  - spec/scanner/all_spec.rb
235
245
  - spec/scanner/conditionals_spec.rb
236
246
  - spec/scanner/types_spec.rb
237
- - spec/scanner/scripts_spec.rb
238
247
  - spec/scanner/anchors_spec.rb
239
- - spec/scanner/unicode_blocks_spec.rb
240
248
  - spec/scanner/meta_spec.rb
241
249
  - spec/scanner/errors_spec.rb
242
250
  - spec/scanner/refcalls_spec.rb
@@ -1,49 +0,0 @@
1
- require 'spec_helper'
2
-
3
- RSpec.describe('UnicodeScript scanning') do
4
- tests = {
5
- 'Aghb' => :caucasian_albanian,
6
- 'Caucasian Albanian' => :caucasian_albanian,
7
-
8
- 'Arab' => :arabic,
9
- 'Arabic' => :arabic,
10
-
11
- 'Armi' => :imperial_aramaic,
12
- 'Imperial Aramaic' => :imperial_aramaic,
13
-
14
- 'Egyp' => :egyptian_hieroglyphs,
15
- 'Egyptian Hieroglyphs' => :egyptian_hieroglyphs, # test whitespace
16
-
17
- 'Linb' => :linear_b,
18
- 'Linear-B' => :linear_b, # test dash
19
-
20
- 'Yiii' => :yi,
21
- 'Yi' => :yi,
22
-
23
- 'Zinh' => :inherited,
24
- 'Inherited' => :inherited,
25
- 'Qaai' => :inherited,
26
-
27
- 'Zyyy' => :common,
28
- 'Common' => :common,
29
-
30
- 'Zzzz' => :unknown,
31
- 'Unknown' => :unknown,
32
- }
33
-
34
- tests.each_with_index do |(property, token), count|
35
- specify("scanner_property_#{token}_#{count}") do
36
- tokens = RS.scan("a\\p{#{property}}c")
37
- result = tokens.at(1)
38
- expect(result[0]).to eq :property
39
- expect(result[1]).to eq token
40
- end
41
-
42
- specify("scanner_nonproperty_#{token}_#{count}") do
43
- tokens = RS.scan("a\\P{#{property}}c")
44
- result = tokens.at(1)
45
- expect(result[0]).to eq :nonproperty
46
- expect(result[1]).to eq token
47
- end
48
- end
49
- end