regexp_parser 0.1.6 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +57 -0
  3. data/Gemfile +8 -0
  4. data/LICENSE +1 -1
  5. data/README.md +225 -206
  6. data/Rakefile +9 -3
  7. data/lib/regexp_parser.rb +7 -11
  8. data/lib/regexp_parser/expression.rb +72 -14
  9. data/lib/regexp_parser/expression/classes/alternation.rb +3 -16
  10. data/lib/regexp_parser/expression/classes/conditional.rb +57 -0
  11. data/lib/regexp_parser/expression/classes/free_space.rb +17 -0
  12. data/lib/regexp_parser/expression/classes/keep.rb +7 -0
  13. data/lib/regexp_parser/expression/classes/set.rb +28 -7
  14. data/lib/regexp_parser/expression/methods/strfregexp.rb +113 -0
  15. data/lib/regexp_parser/expression/methods/tests.rb +116 -0
  16. data/lib/regexp_parser/expression/methods/traverse.rb +63 -0
  17. data/lib/regexp_parser/expression/quantifier.rb +10 -0
  18. data/lib/regexp_parser/expression/sequence.rb +45 -0
  19. data/lib/regexp_parser/expression/subexpression.rb +29 -1
  20. data/lib/regexp_parser/lexer.rb +31 -8
  21. data/lib/regexp_parser/parser.rb +118 -45
  22. data/lib/regexp_parser/scanner.rb +1745 -1404
  23. data/lib/regexp_parser/scanner/property.rl +57 -3
  24. data/lib/regexp_parser/scanner/scanner.rl +161 -34
  25. data/lib/regexp_parser/syntax.rb +12 -2
  26. data/lib/regexp_parser/syntax/ruby/1.9.1.rb +3 -3
  27. data/lib/regexp_parser/syntax/ruby/1.9.3.rb +2 -7
  28. data/lib/regexp_parser/syntax/ruby/2.0.0.rb +4 -1
  29. data/lib/regexp_parser/syntax/ruby/2.1.4.rb +13 -0
  30. data/lib/regexp_parser/syntax/ruby/2.1.5.rb +13 -0
  31. data/lib/regexp_parser/syntax/ruby/2.1.rb +2 -2
  32. data/lib/regexp_parser/syntax/ruby/2.2.0.rb +16 -0
  33. data/lib/regexp_parser/syntax/ruby/2.2.rb +8 -0
  34. data/lib/regexp_parser/syntax/tokens.rb +19 -2
  35. data/lib/regexp_parser/syntax/tokens/conditional.rb +22 -0
  36. data/lib/regexp_parser/syntax/tokens/keep.rb +14 -0
  37. data/lib/regexp_parser/syntax/tokens/unicode_property.rb +45 -4
  38. data/lib/regexp_parser/token.rb +23 -8
  39. data/lib/regexp_parser/version.rb +5 -0
  40. data/regexp_parser.gemspec +35 -0
  41. data/test/expression/test_all.rb +6 -1
  42. data/test/expression/test_base.rb +19 -0
  43. data/test/expression/test_conditionals.rb +114 -0
  44. data/test/expression/test_free_space.rb +33 -0
  45. data/test/expression/test_set.rb +61 -0
  46. data/test/expression/test_strfregexp.rb +214 -0
  47. data/test/expression/test_subexpression.rb +24 -0
  48. data/test/expression/test_tests.rb +99 -0
  49. data/test/expression/test_to_h.rb +48 -0
  50. data/test/expression/test_to_s.rb +46 -0
  51. data/test/expression/test_traverse.rb +164 -0
  52. data/test/lexer/test_all.rb +16 -3
  53. data/test/lexer/test_conditionals.rb +101 -0
  54. data/test/lexer/test_keep.rb +24 -0
  55. data/test/lexer/test_literals.rb +51 -51
  56. data/test/lexer/test_nesting.rb +62 -62
  57. data/test/lexer/test_refcalls.rb +18 -20
  58. data/test/parser/test_all.rb +18 -3
  59. data/test/parser/test_alternation.rb +11 -14
  60. data/test/parser/test_conditionals.rb +148 -0
  61. data/test/parser/test_escapes.rb +29 -5
  62. data/test/parser/test_free_space.rb +139 -0
  63. data/test/parser/test_groups.rb +40 -0
  64. data/test/parser/test_keep.rb +21 -0
  65. data/test/scanner/test_all.rb +8 -2
  66. data/test/scanner/test_conditionals.rb +166 -0
  67. data/test/scanner/test_escapes.rb +8 -5
  68. data/test/scanner/test_free_space.rb +133 -0
  69. data/test/scanner/test_groups.rb +28 -0
  70. data/test/scanner/test_keep.rb +33 -0
  71. data/test/scanner/test_properties.rb +4 -0
  72. data/test/scanner/test_scripts.rb +71 -1
  73. data/test/syntax/ruby/test_1.9.3.rb +2 -2
  74. data/test/syntax/ruby/test_2.0.0.rb +38 -0
  75. data/test/syntax/ruby/test_2.2.0.rb +38 -0
  76. data/test/syntax/ruby/test_all.rb +1 -8
  77. data/test/syntax/ruby/test_files.rb +104 -0
  78. data/test/test_all.rb +2 -1
  79. data/test/token/test_all.rb +2 -0
  80. data/test/token/test_token.rb +109 -0
  81. metadata +75 -21
  82. data/VERSION.yml +0 -5
  83. data/lib/regexp_parser/ctype.rb +0 -48
  84. data/test/syntax/ruby/test_2.x.rb +0 -46
@@ -27,12 +27,15 @@ class ScannerEscapes < Test::Unit::TestCase
27
27
  'a\u0640c' => [1, :escape, :codepoint, '\u0640', 1, 7],
28
28
  'a\u{0640 0641}c' => [1, :escape, :codepoint_list, '\u{0640 0641}', 1, 14],
29
29
 
30
- 'a\cBc' => [1, :escape, :control, '\cB', 1, 4],
31
- 'a\C-bc' => [1, :escape, :control, '\C-b', 1, 5],
30
+ /a\cBc/ => [1, :escape, :control, '\cB', 1, 4],
31
+ /a\C-bc/ => [1, :escape, :control, '\C-b', 1, 5],
32
32
 
33
- # TODO: verify these escapes
34
- 'a\M-Bc' => [1, :escape, :meta_sequence, '\M-B', 1, 5],
35
- 'a\M-\C-Bc' => [1, :escape, :meta_sequence, '\M-\C-B', 1, 8],
33
+ /a\M-Bc/n => [1, :escape, :meta_sequence, '\M-B', 1, 5],
34
+ /a\M-\C-Bc/n => [1, :escape, :meta_sequence, '\M-\C-B', 1, 8],
35
+
36
+ 'ab\\\xcd' => [1, :escape, :backslash, '\\\\', 2, 4],
37
+ 'ab\\\0cd' => [1, :escape, :backslash, '\\\\', 2, 4],
38
+ 'ab\\\Kcd' => [1, :escape, :backslash, '\\\\', 2, 4],
36
39
  }
37
40
 
38
41
  count = 0
@@ -0,0 +1,133 @@
1
+ require File.expand_path("../../helpers", __FILE__)
2
+
3
+ class ScannerFreeSpace < Test::Unit::TestCase
4
+
5
+ def test_scan_free_space_tokens
6
+ regexp = %r{
7
+ a
8
+ b ? c *
9
+ d {2,3}
10
+ e + | f +
11
+ }x
12
+
13
+ tokens = RS.scan(regexp)
14
+
15
+ 0.upto(24) do |i|
16
+ if i % 2 == 0
17
+ assert_equal( :free_space, tokens[i][0] )
18
+ assert_equal( :whitespace, tokens[i][1] )
19
+ else
20
+ assert_not_equal( :free_space, tokens[i][0] )
21
+ assert_not_equal( :whitespace, tokens[i][1] )
22
+ end
23
+ end
24
+
25
+ [0, 2, 10, 14].each do |i|
26
+ assert_equal( "\n ", tokens[i][2] )
27
+ end
28
+
29
+ [4, 6, 8, 12].each do |i|
30
+ assert_equal( ' ', tokens[i][2] )
31
+ end
32
+ end
33
+
34
+ def test_scan_free_space_comments
35
+ regexp = %r{
36
+ a + # A + comment
37
+ b ? # B ? comment
38
+ c {2,3} # C {2,3} comment
39
+ d + | e + # D|E comment
40
+ }x
41
+
42
+ tokens = RS.scan(regexp)
43
+
44
+ [
45
+ [ 5, [:free_space, :comment, "# A + comment\n", 11, 25]],
46
+ [11, [:free_space, :comment, "# B ? comment\n", 37, 51]],
47
+ [17, [:free_space, :comment, "# C {2,3} comment\n", 66, 84]],
48
+ [29, [:free_space, :comment, "# D|E comment\n", 100, 114]],
49
+ ].each do |index, token|
50
+ assert_equal( token, tokens[index] )
51
+ end
52
+ end
53
+
54
+ def test_scan_free_space_inlined
55
+ # Matches 'a bcdef g'
56
+ regexp = /a b(?x:c d e)f g/
57
+ tokens = RS.scan(regexp)
58
+
59
+ [
60
+ [0, [:literal, :literal, 'a b', 0, 3]],
61
+ [1, [:group, :options, '(?x:', 3, 7]],
62
+ [2, [:literal, :literal, 'c', 7, 8]],
63
+ [3, [:free_space, :whitespace, ' ', 8, 9]],
64
+ [4, [:literal, :literal, 'd', 9, 10]],
65
+ [5, [:free_space, :whitespace, ' ', 10, 11]],
66
+ [6, [:literal, :literal, 'e', 11, 12]],
67
+ [7, [:group, :close, ')', 12, 13]],
68
+ [8, [:literal, :literal, 'f g', 13, 16]]
69
+ ].each do |index, token|
70
+ assert_equal( token, tokens[index] )
71
+ end
72
+ end
73
+
74
+ def test_scan_free_space_nested
75
+ # Matches 'a bcde fghi j'
76
+ regexp = /a b(?x:c d(?-x:e f)g h)i j/
77
+ tokens = RS.scan(regexp)
78
+
79
+ [
80
+ [ 0, [:literal, :literal, 'a b', 0, 3]],
81
+ [ 1, [:group, :options, '(?x:', 3, 7]],
82
+ [ 2, [:literal, :literal, 'c', 7, 8]],
83
+ [ 3, [:free_space, :whitespace, ' ', 8, 9]],
84
+ [ 4, [:literal, :literal, 'd', 9, 10]],
85
+ [ 5, [:group, :options, '(?-x:', 10, 15]],
86
+ [ 6, [:literal, :literal, 'e f', 15, 18]],
87
+ [ 7, [:group, :close, ')', 18, 19]],
88
+ [ 8, [:literal, :literal, 'g', 19, 20]],
89
+ [ 9, [:free_space, :whitespace, ' ', 20, 21]],
90
+ [10, [:literal, :literal, 'h', 21, 22]],
91
+ [11, [:group, :close, ')', 22, 23]],
92
+ [12, [:literal, :literal, 'i j', 23, 26]]
93
+ ].each do |index, token|
94
+ assert_equal( token, tokens[index] )
95
+ end
96
+ end
97
+
98
+ def test_scan_free_space_nested_groups
99
+ # Matches 'a bcde f g hi j'
100
+ regexp = /(a (b(?x: (c d) (?-x:(e f) )g) h)i j)/
101
+ tokens = RS.scan(regexp)
102
+
103
+ [
104
+ [ 0, [:group, :capture, '(', 0, 1]],
105
+ [ 1, [:literal, :literal, 'a ', 1, 3]],
106
+ [ 2, [:group, :capture, '(', 3, 4]],
107
+ [ 3, [:literal, :literal, 'b', 4, 5]],
108
+ [ 4, [:group, :options, '(?x:', 5, 9]],
109
+ [ 5, [:free_space, :whitespace, ' ', 9, 10]],
110
+ [ 6, [:group, :capture, '(', 10, 11]],
111
+ [ 7, [:literal, :literal, 'c', 11, 12]],
112
+ [ 8, [:free_space, :whitespace, ' ', 12, 13]],
113
+ [ 9, [:literal, :literal, 'd', 13, 14]],
114
+ [10, [:group, :close, ')', 14, 15]],
115
+ [11, [:free_space, :whitespace, ' ', 15, 16]],
116
+ [12, [:group, :options, '(?-x:', 16, 21]],
117
+ [13, [:group, :capture, '(', 21, 22]],
118
+ [14, [:literal, :literal, 'e f', 22, 25]],
119
+ [15, [:group, :close, ')', 25, 26]],
120
+ [16, [:literal, :literal, ' ', 26, 27]],
121
+ [17, [:group, :close, ')', 27, 28]],
122
+ [18, [:literal, :literal, 'g', 28, 29]],
123
+ [19, [:group, :close, ')', 29, 30]],
124
+ [20, [:literal, :literal, ' h', 30, 32]],
125
+ [21, [:group, :close, ')', 32, 33]],
126
+ [22, [:literal, :literal, 'i j', 33, 36]],
127
+ [23, [:group, :close, ')', 36, 37]]
128
+ ].each do |index, token|
129
+ assert_equal( token, tokens[index] )
130
+ end
131
+ end
132
+
133
+ end
@@ -20,6 +20,9 @@ class ScannerGroups < Test::Unit::TestCase
20
20
  '(?<name>abc)' => [0, :group, :named_ab, '(?<name>', 0, 8],
21
21
  "(?'name'abc)" => [0, :group, :named_sq, "(?'name'", 0, 8],
22
22
 
23
+ '(?<name_1>abc)' => [0, :group, :named_ab, '(?<name_1>', 0,10],
24
+ "(?'name_1'abc)" => [0, :group, :named_sq, "(?'name_1'", 0,10],
25
+
23
26
  '(?:abc)' => [0, :group, :passive, '(?:', 0, 3],
24
27
  '(?:)' => [0, :group, :passive, '(?:', 0, 3],
25
28
  '(?::)' => [0, :group, :passive, '(?:', 0, 3],
@@ -45,4 +48,29 @@ class ScannerGroups < Test::Unit::TestCase
45
48
  end
46
49
  end
47
50
 
51
+ if RUBY_VERSION >= '2.0'
52
+ option_tests = {
53
+ '(?m-dau:abc)' => [0, :group, :options, '(?m-dau:', 0, 8],
54
+ '(?x-dmu:abc)' => [0, :group, :options, '(?x-dmu:', 0, 8],
55
+ '(?-dau:abc)' => [0, :group, :options, '(?-dau:', 0, 7],
56
+ '(?d-au:abc)' => [0, :group, :options, '(?d-au:', 0, 7],
57
+ '(?da-u:abc)' => [0, :group, :options, '(?da-u:', 0, 7],
58
+ '(?dau:abc)' => [0, :group, :options, '(?dau:', 0, 6],
59
+ '(?dau)' => [0, :group, :options, '(?dau', 0, 5],
60
+ '(?d:)' => [0, :group, :options, '(?d:', 0, 4],
61
+ '(?a:)' => [0, :group, :options, '(?a:', 0, 4],
62
+ '(?u:)' => [0, :group, :options, '(?u:', 0, 4],
63
+ }
64
+
65
+ tests.each do |pattern, test|
66
+ define_method "test_scan_#{test[1]}_#{test[2]}_#{count+=1}" do
67
+
68
+ tokens = RS.scan(pattern)
69
+ assert_equal( test[1,5], tokens[test[0]])
70
+ assert_equal( test[3], pattern[tokens[test[0]][3], tokens[test[0]][4]])
71
+
72
+ end
73
+ end
74
+ end
75
+
48
76
  end
@@ -0,0 +1,33 @@
1
+ require File.expand_path("../../helpers", __FILE__)
2
+
3
+ class ScannerKeep < Test::Unit::TestCase
4
+
5
+ def test_scan_keep_token
6
+ regexp = /ab\Kcd/
7
+ tokens = RS.scan(regexp)
8
+
9
+ assert_equal( :keep, tokens[1][0] )
10
+ assert_equal( :mark, tokens[1][1] )
11
+ assert_equal( '\\K', tokens[1][2] )
12
+ assert_equal( 2, tokens[1][3] )
13
+ assert_equal( 4, tokens[1][4] )
14
+ end
15
+
16
+ def test_scan_keep_nested
17
+ regexp = /(a\Kb)|(c\\\Kd)ef/
18
+ tokens = RS.scan(regexp)
19
+
20
+ assert_equal( :keep, tokens[2][0] )
21
+ assert_equal( :mark, tokens[2][1] )
22
+ assert_equal( '\\K', tokens[2][2] )
23
+ assert_equal( 2, tokens[2][3] )
24
+ assert_equal( 4, tokens[2][4] )
25
+
26
+ assert_equal( :keep, tokens[9][0] )
27
+ assert_equal( :mark, tokens[9][1] )
28
+ assert_equal( '\\K', tokens[9][2] )
29
+ assert_equal( 11, tokens[9][3] )
30
+ assert_equal( 13, tokens[9][4] )
31
+ end
32
+
33
+ end
@@ -143,6 +143,10 @@ class ScannerProperties < Test::Unit::TestCase
143
143
  'Age=5.1' => :age_5_1,
144
144
  'Age=5.2' => :age_5_2,
145
145
  'Age=6.0' => :age_6_0,
146
+ 'Age=6.1' => :age_6_1,
147
+ 'Age=6.2' => :age_6_2,
148
+ 'Age=6.3' => :age_6_3,
149
+ 'Age=7.0' => :age_7_0,
146
150
 
147
151
  'ahex' => :ascii_hex,
148
152
  'ASCII_Hex_Digit' => :ascii_hex,
@@ -3,6 +3,9 @@ require File.expand_path("../../helpers", __FILE__)
3
3
  class ScannerUnicodeScripts < Test::Unit::TestCase
4
4
 
5
5
  tests = {
6
+ 'Aghb' => :script_caucasian_albanian,
7
+ 'Caucasian Albanian' => :script_caucasian_albanian,
8
+
6
9
  'Arab' => :script_arabic,
7
10
  'Arabic' => :script_arabic,
8
11
 
@@ -21,6 +24,9 @@ class ScannerUnicodeScripts < Test::Unit::TestCase
21
24
  'Bamu' => :script_bamum,
22
25
  'Bamum' => :script_bamum,
23
26
 
27
+ 'Bass' => :script_bassa_vah,
28
+ 'Bassa Vah' => :script_bassa_vah,
29
+
24
30
  'Batk' => :script_batak,
25
31
  'Batak' => :script_batak,
26
32
 
@@ -69,9 +75,17 @@ class ScannerUnicodeScripts < Test::Unit::TestCase
69
75
  'Dsrt' => :script_deseret,
70
76
  'Deseret' => :script_deseret,
71
77
 
78
+
79
+ 'Dupl' => :script_duployan,
80
+ 'Duployan' => :script_duployan,
81
+
82
+
72
83
  'Egyp' => :script_egyptian_hieroglyphs,
73
84
  'Egyptian Hieroglyphs' => :script_egyptian_hieroglyphs,
74
85
 
86
+ 'Elba' => :script_elbasan,
87
+ 'Elbasan' => :script_elbasan,
88
+
75
89
  'Ethi' => :script_ethiopic,
76
90
  'Ethiopic' => :script_ethiopic,
77
91
 
@@ -84,6 +98,9 @@ class ScannerUnicodeScripts < Test::Unit::TestCase
84
98
  'Goth' => :script_gothic,
85
99
  'Gothic' => :script_gothic,
86
100
 
101
+ 'Gran' => :script_grantha,
102
+ 'Grantha' => :script_grantha,
103
+
87
104
  'Grek' => :script_greek,
88
105
  'Greek' => :script_greek,
89
106
 
@@ -108,6 +125,9 @@ class ScannerUnicodeScripts < Test::Unit::TestCase
108
125
  'Hira' => :script_hiragana,
109
126
  'Hiragana' => :script_hiragana,
110
127
 
128
+ 'Hmng' => :script_pahawh_hmong,
129
+ 'Pahawh Hmong' => :script_pahawh_hmong,
130
+
111
131
  'Hrkt' => :script_katakana_or_hiragana,
112
132
  'Katakana or Hiragana' => :script_katakana_or_hiragana,
113
133
 
@@ -129,6 +149,9 @@ class ScannerUnicodeScripts < Test::Unit::TestCase
129
149
  'Khmr' => :script_khmer,
130
150
  'Khmer' => :script_khmer,
131
151
 
152
+ 'Khoj' => :script_khojki,
153
+ 'Khojki' => :script_khojki,
154
+
132
155
  'Knda' => :script_kannada,
133
156
  'Kannada' => :script_kannada,
134
157
 
@@ -150,6 +173,9 @@ class ScannerUnicodeScripts < Test::Unit::TestCase
150
173
  'Limb' => :script_limbu,
151
174
  'Limbu' => :script_limbu,
152
175
 
176
+ 'Lina' => :script_linear_a,
177
+ 'Linear A' => :script_linear_a,
178
+
153
179
  'Linb' => :script_linear_b,
154
180
  'Linear B' => :script_linear_b,
155
181
 
@@ -167,15 +193,35 @@ class ScannerUnicodeScripts < Test::Unit::TestCase
167
193
  'Mlym' => :script_malayalam,
168
194
  'Malayalam' => :script_malayalam,
169
195
 
196
+ 'Mahj' => :script_mahajani,
197
+ 'Mahajani' => :script_mahajani,
198
+
199
+ 'Mani' => :script_manichaean,
200
+ 'Manichaean' => :script_manichaean,
201
+
202
+ 'Mend' => :script_mende_kikakui,
203
+ 'Mende Kikakui' => :script_mende_kikakui,
204
+
205
+ 'Modi' => :script_modi,
206
+
170
207
  'Mong' => :script_mongolian,
171
208
  'Mongolian' => :script_mongolian,
172
209
 
210
+ 'Mroo' => :script_mro,
211
+ 'Mro' => :script_mro,
212
+
173
213
  'Mtei' => :script_meetei_mayek,
174
214
  'Meetei Mayek' => :script_meetei_mayek,
175
215
 
176
216
  'Mymr' => :script_myanmar,
177
217
  'Myanmar' => :script_myanmar,
178
218
 
219
+ 'Narb' => :script_old_north_arabian,
220
+ 'Old North Arabian' => :script_old_north_arabian,
221
+
222
+ 'Nbat' => :script_nabataean,
223
+ 'Nabataean' => :script_nabataean,
224
+
179
225
  'Nkoo' => :script_nko,
180
226
  'Nko' => :script_nko,
181
227
 
@@ -194,12 +240,24 @@ class ScannerUnicodeScripts < Test::Unit::TestCase
194
240
  'Osma' => :script_osmanya,
195
241
  'Osmanya' => :script_osmanya,
196
242
 
243
+ 'Palm' => :script_palmyrene,
244
+ 'Palmyrene' => :script_palmyrene,
245
+
246
+ 'Pauc' => :script_pau_cin_hau,
247
+ 'Pau Cin Hau' => :script_pau_cin_hau,
248
+
249
+ 'Perm' => :script_old_permic,
250
+ 'Old Permic' => :script_old_permic,
251
+
197
252
  'Phag' => :script_phags_pa,
198
253
  'Phags Pa' => :script_phags_pa,
199
254
 
200
255
  'Phli' => :script_inscriptional_pahlavi,
201
256
  'Inscriptional Pahlavi' => :script_inscriptional_pahlavi,
202
257
 
258
+ 'Phlp' => :script_psalter_pahlavi,
259
+ 'Psalter Pahlavi' => :script_psalter_pahlavi,
260
+
203
261
  'Phnx' => :script_phoenician,
204
262
  'Phoenician' => :script_phoenician,
205
263
 
@@ -224,6 +282,12 @@ class ScannerUnicodeScripts < Test::Unit::TestCase
224
282
  'Shaw' => :script_shavian,
225
283
  'Shavian' => :script_shavian,
226
284
 
285
+ 'Sidd' => :script_siddham,
286
+ 'Siddham' => :script_siddham,
287
+
288
+ 'Sind' => :script_khudawadi,
289
+ 'Khudawadi' => :script_khudawadi,
290
+
227
291
  'Sinh' => :script_sinhala,
228
292
  'Sinhala' => :script_sinhala,
229
293
 
@@ -263,17 +327,23 @@ class ScannerUnicodeScripts < Test::Unit::TestCase
263
327
  'Thaa' => :script_thaana,
264
328
  'Thaana' => :script_thaana,
265
329
 
266
- 'Thai' => :script_thai,
330
+ 'Thai' => :script_thai,
267
331
 
268
332
  'Tibt' => :script_tibetan,
269
333
  'Tibetan' => :script_tibetan,
270
334
 
335
+ 'Tirh' => :script_tirhuta,
336
+ 'Tirhuta' => :script_tirhuta,
337
+
271
338
  'Ugar' => :script_ugaritic,
272
339
  'Ugaritic' => :script_ugaritic,
273
340
 
274
341
  'Vaii' => :script_vai,
275
342
  'Vai' => :script_vai,
276
343
 
344
+ 'Wara' => :script_warang_citi,
345
+ 'Warang Citi' => :script_warang_citi,
346
+
277
347
  'Xpeo' => :script_old_persian,
278
348
  'Old Persian' => :script_old_persian,
279
349
 
@@ -10,11 +10,11 @@ class TestSyntaxRuby_V193 < Test::Unit::TestCase
10
10
  tests = {
11
11
  :implements => {
12
12
  :property => [
13
- UnicodeProperty::Script_6_0 + UnicodeProperty::Age
13
+ UnicodeProperty::Script_6_0 + UnicodeProperty::Age_V193
14
14
  ].flatten,
15
15
 
16
16
  :nonproperty => [
17
- UnicodeProperty::Script_6_0 + UnicodeProperty::Age
17
+ UnicodeProperty::Script_6_0 + UnicodeProperty::Age_V193
18
18
  ].flatten,
19
19
  },
20
20
 
@@ -0,0 +1,38 @@
1
+ require File.expand_path("../../../helpers", __FILE__)
2
+
3
+ class TestSyntaxRuby_V200 < Test::Unit::TestCase
4
+ include Regexp::Syntax::Token
5
+
6
+ def setup
7
+ @syntax = Regexp::Syntax.new 'ruby/2.0.0'
8
+ end
9
+
10
+ tests = {
11
+ :implements => {
12
+ :property => [
13
+ UnicodeProperty::Age_V200
14
+ ].flatten,
15
+
16
+ :nonproperty => [
17
+ UnicodeProperty::Age_V200
18
+ ].flatten,
19
+ },
20
+
21
+ :excludes => {
22
+ },
23
+ }
24
+
25
+ tests.each do |method, types|
26
+ types.each do |type, tokens|
27
+ tokens.each do |token|
28
+ define_method "test_syntax_ruby_v200_#{method}_#{type}_#{token}" do
29
+ assert_equal(
30
+ method == :excludes ? false : true,
31
+ @syntax.implements?(type, token)
32
+ )
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ end