Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
regcomp.c: track last close *op*, not just its index in study_chunk()
In the study_data_t struct the member last_closep is a pointer to a SSize_t which is used to store the arg (which buffer slot it represents, eg, $1 or $3 at the perl level) from the last close regop we encountered during the scan process. The arg might be duplicated between different opcodes in the face of branch-reset /(?| (...) | (...) )/ where both capture buffers map to the same perl variable (eg, $1). This patches adds a new, very similar member, regnode **last_close_opp, which tracks the close op itself instead of its arg. In a future commit we could replace last_closep entirely, and extract the comparable value from the regnode pointed to by last_close_opp when needed, but for this patch I am sticking with tracking both at the same time as it is simpler and safer. This enables us to detect if someone has used parens inside of a parenthesized construct reliably in the fact of branch reset. This is in preparation for dealing with experimental variable length warnings properly, which will come in a subsequent patch. It also should help long run to fixing other bugs related to branch-reset. NB: Really a bunch of this should turn into some kind of macro to simplify the code and ensure that this is done reliably without a lot of repeated similar but not quite identical logic. But that too is not appropriate for this PR.
- Loading branch information
Showing
1 changed file
with
31 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters