From 655ed121289c0befa2c87f7a6a2db3409f54094c Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 20 May 2021 15:27:24 -0700 Subject: Mostly working version --- types.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'types.h') diff --git a/types.h b/types.h index dda89de..96e0727 100644 --- a/types.h +++ b/types.h @@ -9,6 +9,8 @@ #include "files.h" +#define UNBOUNDED(pat) ((pat)->max_matchlen == -1) + // BP virtual machine pattern types enum pattype_e { BP_ANYCHAR = 1, @@ -44,8 +46,9 @@ struct match_s; // forward declared to resolve circular struct defs typedef struct pat_s { enum pattype_e type; const char *start, *end; - // Length of the match, if constant, otherwise -1 - ssize_t len; + // The bounds of the match length (used for backtracking) + size_t min_matchlen; + ssize_t max_matchlen; // -1 means unbounded length union { const char *string; struct { -- cgit v1.2.3