@@ -677,8 +677,8 @@ typedef struct pcre2_real_match_data {
677677
678678#ifndef PCRE2_PCRE2TEST
679679
680- /* Structures for checking for mutual recursion when scanning compiled or
681- parsed code. */
680+ /* Structures for checking for mutual function recursion when scanning compiled
681+ or parsed code. */
682682
683683typedef struct recurse_check {
684684 struct recurse_check * prev ;
@@ -690,7 +690,7 @@ typedef struct parsed_recurse_check {
690690 uint32_t * groupptr ;
691691} parsed_recurse_check ;
692692
693- /* Structure for building a cache when filling in recursion offsets. */
693+ /* Structure for building a cache when filling in pattern recursion offsets. */
694694
695695typedef struct recurse_cache {
696696 PCRE2_SPTR group ;
@@ -757,7 +757,7 @@ typedef struct compile_block {
757757 int max_lookbehind ; /* Maximum lookbehind encountered (characters) */
758758 BOOL had_accept ; /* (*ACCEPT) encountered */
759759 BOOL had_pruneorskip ; /* (*PRUNE) or (*SKIP) encountered */
760- BOOL had_recurse ; /* Had a recursion or subroutine call */
760+ BOOL had_recurse ; /* Had a pattern recursion or subroutine call */
761761 BOOL dupnames ; /* Duplicate names exist */
762762} compile_block ;
763763
@@ -775,6 +775,7 @@ call within the pattern when running pcre2_dfa_match(). */
775775typedef struct dfa_recursion_info {
776776 struct dfa_recursion_info * prevrec ;
777777 PCRE2_SPTR subject_position ;
778+ PCRE2_SPTR last_used_ptr ;
778779 uint32_t group_num ;
779780} dfa_recursion_info ;
780781
@@ -795,7 +796,7 @@ typedef struct heapframe {
795796 PCRE2_SIZE length ; /* Used for character, string, or code lengths */
796797 PCRE2_SIZE back_frame ; /* Amount to subtract on RRETURN */
797798 PCRE2_SIZE temp_size ; /* Used for short-term PCRE2_SIZE values */
798- uint32_t rdepth ; /* "Recursion " depth */
799+ uint32_t rdepth ; /* Function "recursion " depth within pcre2_match() */
799800 uint32_t group_frame_type ; /* Type information for group frames */
800801 uint32_t temp_32 [4 ]; /* Used for short-term 32-bit or BOOL values */
801802 uint8_t return_id ; /* Where to go on in internal "return" */
@@ -828,14 +829,15 @@ typedef struct heapframe {
828829 allows for exactly the right size ovector for the number of capturing
829830 parentheses. (See also the comment for pcre2_real_match_data above.) */
830831
831- PCRE2_SPTR eptr ; /* MUST BE FIRST */
832- PCRE2_SPTR start_match ; /* Can be adjusted by \K */
833- PCRE2_SPTR mark ; /* Most recent mark on the success path */
834- uint32_t current_recurse ; /* Current (deepest) recursion number */
835- uint32_t capture_last ; /* Most recent capture */
836- PCRE2_SIZE last_group_offset ; /* Saved offset to most recent group frame */
837- PCRE2_SIZE offset_top ; /* Offset after highest capture */
838- PCRE2_SIZE ovector [131072 ]; /* Must be last in the structure */
832+ PCRE2_SPTR eptr ; /* MUST BE FIRST */
833+ PCRE2_SPTR start_match ; /* Can be adjusted by \K */
834+ PCRE2_SPTR mark ; /* Most recent mark on the success path */
835+ PCRE2_SPTR recurse_last_used ; /* Last character used at time of pattern recursion */
836+ uint32_t current_recurse ; /* Group number of current (deepest) pattern recursion */
837+ uint32_t capture_last ; /* Most recent capture */
838+ PCRE2_SIZE last_group_offset ; /* Saved offset to most recent group frame */
839+ PCRE2_SIZE offset_top ; /* Offset after highest capture */
840+ PCRE2_SIZE ovector [131072 ]; /* Must be last in the structure */
839841} heapframe ;
840842
841843/* This typedef is a check that the size of the heapframe structure is a
@@ -877,7 +879,7 @@ typedef struct match_block {
877879 uint16_t name_count ; /* Number of names in name table */
878880 uint16_t name_entry_size ; /* Size of entry in names table */
879881 PCRE2_SPTR name_table ; /* Table of group names */
880- PCRE2_SPTR start_code ; /* For use when recursing */
882+ PCRE2_SPTR start_code ; /* For use in pattern recursion */
881883 PCRE2_SPTR start_subject ; /* Start of the subject string */
882884 PCRE2_SPTR check_subject ; /* Where UTF-checked from */
883885 PCRE2_SPTR end_subject ; /* Usable end of the subject string */
@@ -889,7 +891,7 @@ typedef struct match_block {
889891 PCRE2_SPTR nomatch_mark ; /* Mark pointer to pass back on failure */
890892 PCRE2_SPTR verb_ecode_ptr ; /* For passing back info */
891893 PCRE2_SPTR verb_skip_ptr ; /* For passing back a (*SKIP) name */
892- uint32_t verb_current_recurse ; /* Current recurse when (*VERB) happens */
894+ uint32_t verb_current_recurse ; /* Current recursion group when (*VERB) happens */
893895 uint32_t moptions ; /* Match options */
894896 uint32_t poptions ; /* Pattern options */
895897 uint32_t skip_arg_count ; /* For counting SKIP_ARGs */
@@ -929,7 +931,7 @@ typedef struct dfa_match_block {
929931 pcre2_callout_block * cb ; /* Points to a callout block */
930932 void * callout_data ; /* To pass back to callouts */
931933 int (* callout )(pcre2_callout_block * ,void * ); /* Callout function or NULL */
932- dfa_recursion_info * recursive ; /* Linked list of recursion data */
934+ dfa_recursion_info * recursive ; /* Linked list of pattern recursion data */
933935} dfa_match_block ;
934936
935937#endif /* PCRE2_PCRE2TEST */
0 commit comments