- Notifications
You must be signed in to change notification settings - Fork4.9k
Commitf69c01f
committed
Fix enforcement of restrictions inside regexp lookaround constraints.
Lookahead and lookbehind constraints aren't allowed to contain backrefs,and parentheses within them are always considered non-capturing. Or sosays the manual. But the regexp parser forgot about these rules onceinside a parenthesized subexpression, so that constructs like (\w)(?=(\1))were accepted (but then not correctly executed --- a case like this actedlike (\w)(?=\w), without any enforcement that the two \w's match the sametext). And in (?=((foo))) the innermost parentheses would be counted ascapturing parentheses, though no text would ever be captured for them.To fix, properly pass down the "type" argument to the recursive invocationof parse().Back-patch to all supported branches; it was agreed that silentmisexecution of such patterns is worse than throwing an error, even thoughnew errors in minor releases are generally not desirable.1 parent788e35a commitf69c01f
3 files changed
+10
-1
lines changedLines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
944 | 944 |
| |
945 | 945 |
| |
946 | 946 |
| |
947 |
| - | |
| 947 | + | |
948 | 948 |
| |
949 | 949 |
| |
950 | 950 |
| |
|
Lines changed: 5 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
321 | 321 |
| |
322 | 322 |
| |
323 | 323 |
| |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + |
Lines changed: 4 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
82 | 82 |
| |
83 | 83 |
| |
84 | 84 |
| |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + |
0 commit comments
Comments
(0)