@@ -677,8 +677,8 @@ typedef struct pcre2_real_match_data {
677
677
678
678
#ifndef PCRE2_PCRE2TEST
679
679
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. */
682
682
683
683
typedef struct recurse_check {
684
684
struct recurse_check * prev ;
@@ -690,7 +690,7 @@ typedef struct parsed_recurse_check {
690
690
uint32_t * groupptr ;
691
691
} parsed_recurse_check ;
692
692
693
- /* Structure for building a cache when filling in recursion offsets. */
693
+ /* Structure for building a cache when filling in pattern recursion offsets. */
694
694
695
695
typedef struct recurse_cache {
696
696
PCRE2_SPTR group ;
@@ -757,7 +757,7 @@ typedef struct compile_block {
757
757
int max_lookbehind ; /* Maximum lookbehind encountered (characters) */
758
758
BOOL had_accept ; /* (*ACCEPT) encountered */
759
759
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 */
761
761
BOOL dupnames ; /* Duplicate names exist */
762
762
} compile_block ;
763
763
@@ -775,6 +775,7 @@ call within the pattern when running pcre2_dfa_match(). */
775
775
typedef struct dfa_recursion_info {
776
776
struct dfa_recursion_info * prevrec ;
777
777
PCRE2_SPTR subject_position ;
778
+ PCRE2_SPTR last_used_ptr ;
778
779
uint32_t group_num ;
779
780
} dfa_recursion_info ;
780
781
@@ -795,7 +796,7 @@ typedef struct heapframe {
795
796
PCRE2_SIZE length ; /* Used for character, string, or code lengths */
796
797
PCRE2_SIZE back_frame ; /* Amount to subtract on RRETURN */
797
798
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() */
799
800
uint32_t group_frame_type ; /* Type information for group frames */
800
801
uint32_t temp_32 [4 ]; /* Used for short-term 32-bit or BOOL values */
801
802
uint8_t return_id ; /* Where to go on in internal "return" */
@@ -828,14 +829,15 @@ typedef struct heapframe {
828
829
allows for exactly the right size ovector for the number of capturing
829
830
parentheses. (See also the comment for pcre2_real_match_data above.) */
830
831
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 */
839
841
} heapframe ;
840
842
841
843
/* This typedef is a check that the size of the heapframe structure is a
@@ -877,7 +879,7 @@ typedef struct match_block {
877
879
uint16_t name_count ; /* Number of names in name table */
878
880
uint16_t name_entry_size ; /* Size of entry in names table */
879
881
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 */
881
883
PCRE2_SPTR start_subject ; /* Start of the subject string */
882
884
PCRE2_SPTR check_subject ; /* Where UTF-checked from */
883
885
PCRE2_SPTR end_subject ; /* Usable end of the subject string */
@@ -889,7 +891,7 @@ typedef struct match_block {
889
891
PCRE2_SPTR nomatch_mark ; /* Mark pointer to pass back on failure */
890
892
PCRE2_SPTR verb_ecode_ptr ; /* For passing back info */
891
893
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 */
893
895
uint32_t moptions ; /* Match options */
894
896
uint32_t poptions ; /* Pattern options */
895
897
uint32_t skip_arg_count ; /* For counting SKIP_ARGs */
@@ -929,7 +931,7 @@ typedef struct dfa_match_block {
929
931
pcre2_callout_block * cb ; /* Points to a callout block */
930
932
void * callout_data ; /* To pass back to callouts */
931
933
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 */
933
935
} dfa_match_block ;
934
936
935
937
#endif /* PCRE2_PCRE2TEST */
0 commit comments