@bablr/boot 0.1.6 → 0.1.7
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.
- package/lib/languages/regex.js +9 -5
- package/package.json +1 -1
package/lib/languages/regex.js
CHANGED
|
@@ -291,11 +291,13 @@ const grammar = class RegexMiniparserGrammar {
|
|
|
291
291
|
let attrs;
|
|
292
292
|
|
|
293
293
|
if (p.eatMatch('*', KW, { path: 'value' })) {
|
|
294
|
-
|
|
294
|
+
const greedy = !p.eatMatch('?', KW, { path: 'greedyOperator' });
|
|
295
|
+
attrs = { min: 0, max: Infinity, greedy };
|
|
295
296
|
} else if (p.eatMatch('+', KW, { path: 'value' })) {
|
|
296
|
-
|
|
297
|
+
const greedy = !p.eatMatch('?', KW, { path: 'greedyOperator' });
|
|
298
|
+
attrs = { min: 1, max: Infinity, greedy };
|
|
297
299
|
} else if (p.eatMatch('?', KW, { path: 'value' })) {
|
|
298
|
-
attrs = { min: 0, max: 1 };
|
|
300
|
+
attrs = { min: 0, max: 1, greedy: true };
|
|
299
301
|
} else if (p.match('{')) {
|
|
300
302
|
p.eat('{', PN, { path: 'open', balanced: '}' });
|
|
301
303
|
|
|
@@ -306,9 +308,11 @@ const grammar = class RegexMiniparserGrammar {
|
|
|
306
308
|
max = p.eatMatch(/\d+/y, 'Number', { path: 'max' });
|
|
307
309
|
}
|
|
308
310
|
|
|
309
|
-
attrs = { min: min && parseInt(min, 10), max: max && parseInt(max, 10) };
|
|
310
|
-
|
|
311
311
|
p.eat('}', PN, { path: 'close', balancer: true });
|
|
312
|
+
|
|
313
|
+
const greedy = !p.eatMatch('?', KW, { path: 'greedyOperator' });
|
|
314
|
+
|
|
315
|
+
attrs = { min: min && parseInt(min, 10), max: max && parseInt(max, 10), greedy };
|
|
312
316
|
}
|
|
313
317
|
|
|
314
318
|
return { attrs };
|