|
110 | 110 | var tokenMatcher = /(\\.)|[-()|\[\]]((?=\?<?[=!]))?/g;
|
111 | 111 |
|
112 | 112 |
|
113 |
| - var uProblemCharClassMatcher = /\\u(?:[0-9A-Fa-f]){4}|\\x(?:[0-9A-Fa-f]){2}|\\c[A-Za-z]|\\([^.?*+^$[\]\\(){}|\/DSWdswfnrtv-])|(\\[DSWdsw]-[^\]]|.-\\[DSWdsw])|\\.|\]/g; |
| 113 | + var uProblemCharClassMatcher = /\\u[0-9A-Fa-f]{4}|\\x[0-9A-Fa-f]{2}|\\c[A-Za-z]|\\([^.?*+^$[\]\\(){}|\/DSWdswfnrtv-])|(\\[DSWdsw]-[^\]]|.-\\[DSWdsw])|\\.|\]/g; |
114 | 114 |
|
115 | 115 |
|
116 |
| - var uProblemDefaultMatcher = /\\u(?:[0-9A-Fa-f]){4}|\\x(?:[0-9A-Fa-f]){2}|\\c[A-Za-z]|\\k<(.*?)>|\\([^.?*+^$[\]\\(){}|\/DSWdswBbfnrtv])|\\.|\.|\[\^\]|\[|(\((?:\?[^])?)|(\)(?:[+?*]|\{\d+,?\d*\})?)/g; |
| 116 | + var uProblemDefaultMatcher = /\\u[0-9A-Fa-f]{4}|\\x[0-9A-Fa-f]{2}|\\c[A-Za-z]|\\k<(.*?)>|\\([^.?*+^$[\]\\(){}|\/DSWdswBbfnrtv])|\\.|\.|\[\^\]|\[|(\((?:\?[^])?)|(\)(?:[+?*]|\{\d+,?\d*\})?)/g; |
117 | 117 |
|
118 | 118 | // General notes:
|
119 | 119 | //
|
|
396 | 396 | if (!inCClass) {
|
397 | 397 | if (refIndex != null) {
|
398 | 398 | var fixedRefIndex = (Number(refIndex) + count);
|
399 |
| - if (fixedRefIndex > 99) throw new RangeError("Too many back references") |
| 399 | + if (fixedRefIndex > 99) throw new RangeError("Back reference index larger than 99") |
400 | 400 |
|
401 | 401 | return '\\' + String(fixedRefIndex)
|
402 | 402 | } else if (depth != null) {
|
403 |
| - if (depth === '0') return '\\' + String(thunkIndex) |
| 403 | + if (depth === '0') { |
| 404 | + var fixedRefIndex = Number(thunkIndex) + initialOffset; |
| 405 | + if (fixedRefIndex > 99) throw new RangeError("Back reference index larger than 99") |
| 406 | + return '\\' + String(fixedRefIndex) |
| 407 | + } |
404 | 408 | else return '$d:' + (Number(depth) -1) + ',n:' + thunkIndex + '^'
|
405 | 409 | }
|
406 | 410 | }
|
|
554 | 558 | // used for adding groups, assertions and quantifiers
|
555 | 559 |
|
556 | 560 | function decorate(x, options) {
|
557 |
| - // console.log({x, options}) |
558 | 561 | if(!options.condition || options.condition(x)) x.source = options.open + (x.source || '') + ')';
|
559 | 562 | if (options.suffix) x.source += options.suffix;
|
560 | 563 | return x
|
|
579 | 582 | // The recursive brain of compose-regexp
|
580 | 583 |
|
581 | 584 | function assemble(patterns, either, contextRequiresWrapping, initialCapIndex) {
|
582 |
| - // console.log({patterns}) |
583 | 585 | // this and [1] below could probably be simplified
|
584 | 586 | contextRequiresWrapping = contextRequiresWrapping || patterns.length > 1;
|
585 | 587 | return map.call(patterns, function processItem(item) {
|
|
616 | 618 | }
|
617 | 619 |
|
618 | 620 | function finalize(x, options) {
|
619 |
| - // console.trace({x}) |
620 |
| - // const {flags, direction} = options |
621 | 621 | options = options || {};
|
622 | 622 | var flags = hasOwn.call(options, 'flags') ? options.flagsOp(getFlags(), options.flags) : getFlags();
|
623 | 623 | var either = options.either;
|
|
0 commit comments