diff options
author | Florian Ragwitz <rafl@debian.org> | 2010-09-30 01:45:16 +0200 |
---|---|---|
committer | Florian Ragwitz <rafl@debian.org> | 2010-09-30 01:45:16 +0200 |
commit | b7f4cd045844046472b87b9aed90518bfb96818c (patch) | |
tree | e93d836dfc6942c5011cbab8dcc86d268d329afb | |
parent | 5233ad255ae7fe1debb56a6b67e408e699ea4fe0 (diff) | |
download | perl-b7f4cd045844046472b87b9aed90518bfb96818c.tar.gz |
Document why we're not using the save stack
-rw-r--r-- | regexec.c | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -3977,6 +3977,20 @@ S_regmatch(pTHX_ regmatch_info *reginfo, regnode *prog) char *saved_regeol = PL_regeol; struct re_save_state saved_state; + /* To not corrupt the existing regex state while executign the + * eval we would normally put it on the save stack, like with + * save_re_context. However, re-evals have a weird scoping so we + * can't just add ENTER/LEAVE here. With that, things like + * + * (?{$a=2})(a(?{local$a=$a+1}))*aak*c(?{$b=$a}) + * + * would break, as they expect the localisation to be unwound + * only when the re-engine backtracks through the bit that + * localised it. + * + * What we do instead is just saving the state in a local c + * variable. + */ Copy(&PL_reg_state, &saved_state, 1, struct re_save_state); n = ARG(scan); |