srl_ruby 0.4.13 → 0.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +17 -0
- data/CHANGELOG.md +6 -0
- data/bin/srl2ruby +1 -1
- data/lib/srl_ruby/tokenizer.rb +10 -10
- data/lib/srl_ruby/version.rb +1 -1
- data/spec/acceptance/srl_test_suite_spec.rb +17 -17
- data/spec/acceptance/support/rule_file_tokenizer.rb +1 -1
- data/spec/regex/atomic_expression_spec.rb +13 -13
- data/spec/regex/character_spec.rb +39 -39
- data/spec/regex/match_option_spec.rb +10 -9
- data/spec/regex/monadic_expression_spec.rb +14 -13
- data/spec/regex/multiplicity_spec.rb +10 -10
- data/spec/regex/repetition_spec.rb +10 -9
- data/spec/srl_ruby/srl_ruby_spec.rb +1 -1
- data/spec/srl_ruby/tokenizer_spec.rb +45 -45
- data/spec/srl_ruby_spec.rb +129 -129
- metadata +1 -1
data/spec/srl_ruby_spec.rb
CHANGED
@@ -5,208 +5,208 @@ require_relative '../lib/srl_ruby'
|
|
5
5
|
|
6
6
|
describe SrlRuby do
|
7
7
|
context 'Parsing character ranges:' do
|
8
|
-
it "
|
9
|
-
regexp =
|
8
|
+
it "parses 'letter from ... to ...' syntax" do
|
9
|
+
regexp = described_class.parse('letter from a to f')
|
10
10
|
expect(regexp.source).to eq('[a-f]')
|
11
11
|
end
|
12
12
|
|
13
|
-
it "
|
14
|
-
regexp =
|
13
|
+
it "parses 'uppercase letter from ... to ...' syntax" do
|
14
|
+
regexp = described_class.parse('UPPERCASE letter from A to F')
|
15
15
|
expect(regexp.source).to eq('[A-F]')
|
16
16
|
end
|
17
17
|
|
18
|
-
it "
|
19
|
-
regexp =
|
18
|
+
it "parses 'letter' syntax" do
|
19
|
+
regexp = described_class.parse('letter')
|
20
20
|
expect(regexp.source).to eq('[a-z]')
|
21
21
|
end
|
22
22
|
|
23
|
-
it "
|
24
|
-
regexp =
|
23
|
+
it "parses 'uppercase letter' syntax" do
|
24
|
+
regexp = described_class.parse('uppercase letter')
|
25
25
|
expect(regexp.source).to eq('[A-Z]')
|
26
26
|
end
|
27
27
|
|
28
|
-
it "
|
29
|
-
regexp =
|
28
|
+
it "parses 'digit from ... to ...' syntax" do
|
29
|
+
regexp = described_class.parse('digit from 1 to 4')
|
30
30
|
expect(regexp.source).to eq('[1-4]')
|
31
31
|
end
|
32
32
|
end # context
|
33
33
|
|
34
34
|
context 'Parsing string literals:' do
|
35
|
-
it '
|
36
|
-
regexp =
|
35
|
+
it 'parses double quotes literal string' do
|
36
|
+
regexp = described_class.parse('literally "hello"')
|
37
37
|
expect(regexp.source).to eq('hello')
|
38
38
|
end
|
39
39
|
|
40
|
-
it '
|
41
|
-
regexp =
|
40
|
+
it 'parses single quotes literal string' do
|
41
|
+
regexp = described_class.parse("literally 'hello'")
|
42
42
|
expect(regexp.source).to eq('hello')
|
43
43
|
end
|
44
44
|
|
45
|
-
it '
|
46
|
-
regexp =
|
45
|
+
it 'Escapes special characters' do
|
46
|
+
regexp = described_class.parse("literally '.'")
|
47
47
|
expect(regexp.source).to eq('\.')
|
48
48
|
end
|
49
49
|
|
50
|
-
it '
|
51
|
-
regexp =
|
50
|
+
it 'parses single quotes literal string' do
|
51
|
+
regexp = described_class.parse('literally "an", whitespace, raw "[a-zA-Z]"')
|
52
52
|
expect(regexp.source).to eq('an\s[a-zA-Z]')
|
53
53
|
end
|
54
54
|
end # context
|
55
55
|
|
56
56
|
context 'Parsing character classes:' do
|
57
|
-
it "
|
58
|
-
regexp =
|
57
|
+
it "parses 'digit' syntax" do
|
58
|
+
regexp = described_class.parse('digit')
|
59
59
|
expect(regexp.source).to eq('\d')
|
60
60
|
end
|
61
61
|
|
62
|
-
it "
|
63
|
-
regexp =
|
62
|
+
it "parses 'number' syntax" do
|
63
|
+
regexp = described_class.parse('number')
|
64
64
|
expect(regexp.source).to eq('\d')
|
65
65
|
end
|
66
66
|
|
67
|
-
it "
|
68
|
-
regexp =
|
67
|
+
it "parses 'no digit' syntax" do
|
68
|
+
regexp = described_class.parse('no digit')
|
69
69
|
expect(regexp.source).to eq('\D')
|
70
70
|
end
|
71
71
|
|
72
|
-
it "
|
73
|
-
regexp =
|
72
|
+
it "parses 'any character' syntax" do
|
73
|
+
regexp = described_class.parse('any character')
|
74
74
|
expect(regexp.source).to eq('\w')
|
75
75
|
end
|
76
76
|
|
77
|
-
it "
|
78
|
-
regexp =
|
77
|
+
it "parses 'no character' syntax" do
|
78
|
+
regexp = described_class.parse('no character')
|
79
79
|
expect(regexp.source).to eq('\W')
|
80
80
|
end
|
81
81
|
|
82
|
-
it "
|
83
|
-
regexp =
|
82
|
+
it "parses 'whitespace' syntax" do
|
83
|
+
regexp = described_class.parse('whitespace')
|
84
84
|
expect(regexp.source).to eq('\s')
|
85
85
|
end
|
86
86
|
|
87
|
-
it "
|
88
|
-
regexp =
|
87
|
+
it "parses 'no whitespace' syntax" do
|
88
|
+
regexp = described_class.parse('no whitespace')
|
89
89
|
expect(regexp.source).to eq('\S')
|
90
90
|
end
|
91
91
|
|
92
|
-
it "
|
93
|
-
regexp =
|
92
|
+
it "parses 'anything' syntax" do
|
93
|
+
regexp = described_class.parse('anything')
|
94
94
|
expect(regexp.source).to eq('.')
|
95
95
|
end
|
96
96
|
|
97
|
-
it "
|
98
|
-
regexp =
|
97
|
+
it "parses 'one of' syntax" do
|
98
|
+
regexp = described_class.parse('one of "._%+-"')
|
99
99
|
# Remark: reference implementation less readable
|
100
100
|
# (escapes more characters than required)
|
101
101
|
expect(regexp.source).to eq('[._%+\-]')
|
102
102
|
end
|
103
103
|
|
104
|
-
it "
|
104
|
+
it "parses 'one of' with unquoted character class syntax" do
|
105
105
|
# Case of digit sequence
|
106
|
-
regexp =
|
106
|
+
regexp = described_class.parse('one of 13579, must end')
|
107
107
|
expect(regexp.source).to eq('[13579]$')
|
108
108
|
|
109
109
|
# Case of identifier-like character class
|
110
|
-
regexp =
|
110
|
+
regexp = described_class.parse('one of abcd, must end')
|
111
111
|
expect(regexp.source).to eq('[abcd]$')
|
112
112
|
|
113
113
|
# Case of arbitrary character class
|
114
|
-
regexp =
|
114
|
+
regexp = described_class.parse('one of 12hms:, must end')
|
115
115
|
expect(regexp.source).to eq('[12hms:]$')
|
116
116
|
end
|
117
117
|
|
118
|
-
it "
|
119
|
-
regexp =
|
118
|
+
it "parses 'none of' syntax" do
|
119
|
+
regexp = described_class.parse('none of "._%+-"')
|
120
120
|
# Remark: reference implementation less readable
|
121
121
|
# (escapes more characters than required)
|
122
122
|
expect(regexp.source).to eq('[^._%+\-]')
|
123
123
|
end
|
124
124
|
|
125
|
-
it "
|
125
|
+
it "parses 'none of' with unquoted character class syntax" do
|
126
126
|
# Case of digit sequence
|
127
|
-
regexp =
|
127
|
+
regexp = described_class.parse('none of 13579, must end')
|
128
128
|
expect(regexp.source).to eq('[^13579]$')
|
129
129
|
|
130
130
|
# Case of identifier-like character class
|
131
|
-
regexp =
|
131
|
+
regexp = described_class.parse('none of abcd, must end')
|
132
132
|
expect(regexp.source).to eq('[^abcd]$')
|
133
133
|
|
134
134
|
# Case of arbitrary character class
|
135
|
-
regexp =
|
135
|
+
regexp = described_class.parse('none of 12hms:^, must end')
|
136
136
|
expect(regexp.source).to eq('[^12hms:\^]$')
|
137
137
|
end
|
138
138
|
end # context
|
139
139
|
|
140
140
|
context 'Parsing special character declarations:' do
|
141
|
-
it "
|
142
|
-
regexp =
|
141
|
+
it "parses 'tab' syntax" do
|
142
|
+
regexp = described_class.parse('tab')
|
143
143
|
expect(regexp.source).to eq('\t')
|
144
144
|
end
|
145
145
|
|
146
|
-
it "
|
147
|
-
regexp =
|
146
|
+
it "parses 'vertical tab' syntax" do
|
147
|
+
regexp = described_class.parse('vertical tab')
|
148
148
|
expect(regexp.source).to eq('\v')
|
149
149
|
end
|
150
150
|
|
151
|
-
it "
|
152
|
-
regexp =
|
151
|
+
it "parses 'backslash' syntax" do
|
152
|
+
regexp = described_class.parse('backslash')
|
153
153
|
expect(regexp.source).to eq('\\\\')
|
154
154
|
end
|
155
155
|
|
156
|
-
it "
|
157
|
-
regexp =
|
156
|
+
it "parses 'new line' syntax" do
|
157
|
+
regexp = described_class.parse('new line')
|
158
158
|
expect(regexp.source).to eq('\n')
|
159
159
|
end
|
160
160
|
|
161
|
-
it "
|
162
|
-
regexp =
|
161
|
+
it "parses 'carriage return' syntax" do
|
162
|
+
regexp = described_class.parse('carriage return')
|
163
163
|
expect(regexp.source).to eq('\r')
|
164
164
|
end
|
165
165
|
|
166
|
-
it "
|
167
|
-
regexp =
|
166
|
+
it "parses 'word' syntax" do
|
167
|
+
regexp = described_class.parse('word, literally "is"')
|
168
168
|
expect(regexp.source).to eq('\bis')
|
169
169
|
end
|
170
170
|
|
171
|
-
it "
|
172
|
-
regexp =
|
171
|
+
it "parses 'no word' syntax" do
|
172
|
+
regexp = described_class.parse('no word, literally "is"')
|
173
173
|
expect(regexp.source).to eq('\Bis')
|
174
174
|
end
|
175
175
|
end # context
|
176
176
|
|
177
177
|
context 'Parsing alternations:' do
|
178
|
-
it "
|
178
|
+
it "parses 'any of' syntax" do
|
179
179
|
source = 'any of (any character, one of "._%-+")'
|
180
|
-
regexp =
|
180
|
+
regexp = described_class.parse(source)
|
181
181
|
expect(regexp.source).to eq('(?:\w|[._%\-+])')
|
182
182
|
end
|
183
183
|
|
184
|
-
it "
|
184
|
+
it "parses 'either of' syntax" do
|
185
185
|
source = 'either of (any character, one of "._%-+")'
|
186
|
-
regexp =
|
186
|
+
regexp = described_class.parse(source)
|
187
187
|
expect(regexp.source).to eq('(?:\w|[._%\-+])')
|
188
188
|
end
|
189
189
|
|
190
|
-
it '
|
191
|
-
regexp =
|
190
|
+
it 'Anchors as alternative' do
|
191
|
+
regexp = described_class.parse('any of (literally "?", must end)')
|
192
192
|
expect(regexp.source).to eq('(?:\\?|$)')
|
193
193
|
end
|
194
194
|
end # context
|
195
195
|
|
196
196
|
context 'Parsing concatenation:' do
|
197
|
-
it '
|
197
|
+
it 'Rejects dangling comma' do
|
198
198
|
source = 'literally "a",'
|
199
199
|
err = StandardError
|
200
200
|
msg_pattern = /Premature end of input after ',' at position line 1, column 14/
|
201
|
-
expect {
|
201
|
+
expect { described_class.parse(source) }.to raise_error(err, msg_pattern)
|
202
202
|
end
|
203
203
|
|
204
|
-
it '
|
205
|
-
regexp =
|
204
|
+
it 'parses concatenation' do
|
205
|
+
regexp = described_class.parse('any of (literally "sample", (digit once or more))')
|
206
206
|
expect(regexp.source).to eq('(?:sample|(?:\d+))')
|
207
207
|
end
|
208
208
|
|
209
|
-
it '
|
209
|
+
it 'parses a long sequence of patterns' do
|
210
210
|
source = <<-SRL
|
211
211
|
any of (any character, one of "._%-+") once or more,
|
212
212
|
literally "@",
|
@@ -215,7 +215,7 @@ describe SrlRuby do
|
|
215
215
|
letter at least 2 times
|
216
216
|
SRL
|
217
217
|
|
218
|
-
regexp =
|
218
|
+
regexp = described_class.parse(source)
|
219
219
|
# SRL: (?:\w|[\._%\-\+])+(?:@)(?:[0-9]|[a-z]|[\.\-])+(?:\.)[a-z]{2,}
|
220
220
|
expectation = '(?:\w|[._%\-+])+@(?:\d|[a-z]|[.\-])+\.[a-z]{2,}'
|
221
221
|
expect(regexp.source).to eq(expectation)
|
@@ -225,182 +225,182 @@ SRL
|
|
225
225
|
context 'Parsing quantifiers:' do
|
226
226
|
let(:prefix) { 'letter from p to t ' }
|
227
227
|
|
228
|
-
it "
|
229
|
-
regexp =
|
228
|
+
it "parses 'once' syntax" do
|
229
|
+
regexp = described_class.parse("#{prefix}once")
|
230
230
|
expect(regexp.source).to eq('[p-t]{1}')
|
231
231
|
end
|
232
232
|
|
233
|
-
it "
|
234
|
-
regexp =
|
233
|
+
it "parses 'twice' syntax" do
|
234
|
+
regexp = described_class.parse('digit twice')
|
235
235
|
expect(regexp.source).to eq('\d{2}')
|
236
236
|
end
|
237
237
|
|
238
|
-
it "
|
239
|
-
regexp =
|
238
|
+
it "parses 'optional' syntax" do
|
239
|
+
regexp = described_class.parse('anything optional')
|
240
240
|
expect(regexp.source).to eq('.?')
|
241
241
|
end
|
242
242
|
|
243
|
-
it "
|
244
|
-
regexp =
|
243
|
+
it "parses 'exactly ... times' syntax" do
|
244
|
+
regexp = described_class.parse('letter from a to f exactly 4 times')
|
245
245
|
expect(regexp.source).to eq('[a-f]{4}')
|
246
246
|
end
|
247
247
|
|
248
|
-
it "
|
249
|
-
regexp =
|
248
|
+
it "parses 'between ... and ... times' syntax" do
|
249
|
+
regexp = described_class.parse("#{prefix}between 2 and 4 times")
|
250
250
|
expect(regexp.source).to eq('[p-t]{2,4}')
|
251
251
|
|
252
252
|
# Dropping 'times' keyword is a shorter alternative syntax
|
253
|
-
regexp =
|
253
|
+
regexp = described_class.parse("#{prefix}between 2 and 4")
|
254
254
|
expect(regexp.source).to eq('[p-t]{2,4}')
|
255
255
|
end
|
256
256
|
|
257
|
-
it "
|
258
|
-
regexp =
|
257
|
+
it "parses 'once or more' syntax" do
|
258
|
+
regexp = described_class.parse("#{prefix}once or more")
|
259
259
|
expect(regexp.source).to eq('[p-t]+')
|
260
260
|
end
|
261
261
|
|
262
|
-
it "
|
263
|
-
regexp =
|
262
|
+
it "parses 'never or more' syntax" do
|
263
|
+
regexp = described_class.parse("#{prefix}never or more")
|
264
264
|
expect(regexp.source).to eq('[p-t]*')
|
265
265
|
end
|
266
266
|
|
267
|
-
it "
|
268
|
-
regexp =
|
267
|
+
it "parses 'at least ... times' syntax" do
|
268
|
+
regexp = described_class.parse("#{prefix}at least 10 times")
|
269
269
|
expect(regexp.source).to eq('[p-t]{10,}')
|
270
270
|
end
|
271
271
|
end # context
|
272
272
|
|
273
273
|
context 'Parsing lookaround:' do
|
274
|
-
it '
|
275
|
-
regexp =
|
274
|
+
it 'parses positive lookahead' do
|
275
|
+
regexp = described_class.parse('letter if followed by (anything once or more, digit)')
|
276
276
|
expect(regexp.source).to eq('[a-z](?=(?:.+\d))')
|
277
277
|
end
|
278
278
|
|
279
|
-
it '
|
280
|
-
regexp =
|
279
|
+
it 'parses negative lookahead' do
|
280
|
+
regexp = described_class.parse('letter if not followed by (anything once or more, digit)')
|
281
281
|
expect(regexp.source).to eq('[a-z](?!(?:.+\d))')
|
282
282
|
end
|
283
283
|
|
284
|
-
it '
|
285
|
-
regexp =
|
284
|
+
it 'parses positive lookbehind' do
|
285
|
+
regexp = described_class.parse('literally "bar" if already had literally "foo"')
|
286
286
|
expect(regexp.source).to eq('(?<=foo)bar')
|
287
287
|
end
|
288
288
|
|
289
|
-
it '
|
290
|
-
regexp =
|
289
|
+
it 'parses negative lookbehind' do
|
290
|
+
regexp = described_class.parse('literally "bar" if not already had literally "foo"')
|
291
291
|
expect(regexp.source).to eq('(?<!foo)bar')
|
292
292
|
end
|
293
293
|
end # context
|
294
294
|
|
295
295
|
context 'Parsing capturing group:' do
|
296
|
-
it '
|
297
|
-
regexp =
|
296
|
+
it 'parses simple anonymous capturing group' do
|
297
|
+
regexp = described_class.parse('capture(literally "sample")')
|
298
298
|
expect(regexp.source).to eq('(sample)')
|
299
299
|
end
|
300
300
|
|
301
|
-
it '
|
301
|
+
it 'parses complex anonymous capturing group' do
|
302
302
|
source = 'capture(any of (literally "sample", (digit once or more)))'
|
303
|
-
regexp =
|
303
|
+
regexp = described_class.parse(source)
|
304
304
|
expect(regexp.source).to eq('((?:sample|(?:\d+)))')
|
305
305
|
end
|
306
306
|
|
307
|
-
it '
|
308
|
-
regexp =
|
307
|
+
it 'parses simple anonymous until capturing group' do
|
308
|
+
regexp = described_class.parse('capture anything once or more until literally "!"')
|
309
309
|
expect(regexp.source).to eq('(.+?)!')
|
310
310
|
end
|
311
311
|
|
312
|
-
it '
|
312
|
+
it 'parses unquoted named capturing group' do
|
313
313
|
source = 'capture (anything once or more) as first, must end'
|
314
|
-
regexp =
|
314
|
+
regexp = described_class.parse(source)
|
315
315
|
expect(regexp.source).to eq('(?<first>.+)$')
|
316
316
|
end
|
317
317
|
|
318
|
-
it '
|
318
|
+
it 'parses complex named capturing group' do
|
319
319
|
source = <<-SRL
|
320
320
|
capture(any of (literally "sample", (digit once or more)))
|
321
321
|
as "foo"
|
322
322
|
SRL
|
323
|
-
regexp =
|
323
|
+
regexp = described_class.parse(source)
|
324
324
|
expect(regexp.source).to eq('(?<foo>(?:sample|(?:\d+)))')
|
325
325
|
end
|
326
326
|
|
327
|
-
it '
|
327
|
+
it 'parses a sequence with named capturing groups' do
|
328
328
|
source = <<-SRL
|
329
329
|
capture (anything once or more) as "first",
|
330
330
|
literally " - ",
|
331
331
|
capture literally "second part" as "second"
|
332
332
|
SRL
|
333
|
-
regexp =
|
333
|
+
regexp = described_class.parse(source)
|
334
334
|
expect(regexp.source).to eq('(?<first>.+) - (?<second>second part)')
|
335
335
|
end
|
336
336
|
|
337
|
-
it '
|
337
|
+
it 'parses complex named until capturing group' do
|
338
338
|
source = 'capture (anything once or more) as "foo" until literally "m"'
|
339
|
-
regexp =
|
339
|
+
regexp = described_class.parse(source)
|
340
340
|
expect(regexp.source).to eq('(?<foo>.+?)m')
|
341
341
|
end
|
342
342
|
end # context
|
343
343
|
|
344
344
|
context 'Parsing anchors:' do
|
345
|
-
it '
|
346
|
-
regexp =
|
345
|
+
it 'parses begin anchors' do
|
346
|
+
regexp = described_class.parse('starts with literally "match"')
|
347
347
|
expect(regexp.source).to eq('^match')
|
348
348
|
expect(regexp.to_s).to eq('(?-mix:^match)')
|
349
349
|
end
|
350
350
|
|
351
|
-
it '
|
352
|
-
regexp =
|
351
|
+
it 'parses begin anchors (alternative syntax)' do
|
352
|
+
regexp = described_class.parse('begin with literally "match"')
|
353
353
|
expect(regexp.source).to eq('^match')
|
354
354
|
end
|
355
355
|
|
356
|
-
it '
|
357
|
-
regexp =
|
356
|
+
it 'parses end anchors' do
|
357
|
+
regexp = described_class.parse('literally "match" must end')
|
358
358
|
expect(regexp.source).to eq('match$')
|
359
359
|
end
|
360
360
|
|
361
|
-
it '
|
362
|
-
regexp =
|
361
|
+
it 'parses combination of begin and end anchors' do
|
362
|
+
regexp = described_class.parse('starts with literally "match" must end')
|
363
363
|
expect(regexp.source).to eq('^match$')
|
364
364
|
end
|
365
365
|
|
366
|
-
it '
|
366
|
+
it 'Accepts anchor with a sequence of patterns' do
|
367
367
|
source = <<-SRL
|
368
368
|
begin with any of (digit, letter, one of ".-") once or more,
|
369
369
|
literally ".",
|
370
370
|
letter at least 2 times must end
|
371
371
|
SRL
|
372
372
|
|
373
|
-
regexp =
|
373
|
+
regexp = described_class.parse(source)
|
374
374
|
# SRL: (?:\w|[\._%\-\+])+(?:@)(?:[0-9]|[a-z]|[\.\-])+(?:\.)[a-z]{2,}
|
375
375
|
expect(regexp.source).to eq('^(?:\d|[a-z]|[.\-])+\.[a-z]{2,}$')
|
376
376
|
end
|
377
377
|
end # context
|
378
378
|
|
379
379
|
context 'Parsing flags' do
|
380
|
-
it "
|
381
|
-
regexp =
|
380
|
+
it "parses 'case insensitive'" do
|
381
|
+
regexp = described_class.parse('starts with literally "hello", case insensitive')
|
382
382
|
expect(regexp.source).to eq('^hello')
|
383
383
|
expect(regexp.to_s).to eq('(?i-mx:^hello)')
|
384
384
|
end
|
385
385
|
|
386
|
-
it "
|
387
|
-
regexp =
|
386
|
+
it "parses 'multi line'" do
|
387
|
+
regexp = described_class.parse('starts with literally "hello", multi line')
|
388
388
|
expect(regexp.source).to eq('^hello')
|
389
389
|
expect(regexp.to_s).to eq('(?m-ix:^hello)')
|
390
390
|
end
|
391
391
|
|
392
|
-
it '
|
392
|
+
it 'parses combined flags' do
|
393
393
|
source = <<-SRL
|
394
394
|
starts with literally "hello",
|
395
395
|
multi line,
|
396
396
|
case insensitive
|
397
397
|
SRL
|
398
|
-
regexp =
|
398
|
+
regexp = described_class.parse(source)
|
399
399
|
expect(regexp.source).to eq('^hello')
|
400
400
|
expect(regexp.to_s).to eq('(?mi-x:^hello)')
|
401
401
|
end
|
402
402
|
|
403
|
-
it "
|
403
|
+
it "parses 'all lazy' flag" do
|
404
404
|
source = <<-SRL
|
405
405
|
begin with any of (digit, letter, one of ".-") once or more,
|
406
406
|
literally ".",
|
@@ -409,7 +409,7 @@ SRL
|
|
409
409
|
all lazy
|
410
410
|
SRL
|
411
411
|
|
412
|
-
regexp =
|
412
|
+
regexp = described_class.parse(source)
|
413
413
|
expect(regexp.source).to eq('^(?:\d|[a-z]|[.\-])+?\.[a-z]{2,}?$')
|
414
414
|
end
|
415
415
|
end # context
|