- Notifications
You must be signed in to change notification settings - Fork5
Commita43b4ab
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 parent8d7396e commita43b4ab
3 files changed
+10
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
951 | 951 | | |
952 | 952 | | |
953 | 953 | | |
954 | | - | |
| 954 | + | |
955 | 955 | | |
956 | 956 | | |
957 | 957 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
490 | 490 | | |
491 | 491 | | |
492 | 492 | | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
0 commit comments
Comments
(0)