aboutsummaryrefslogtreecommitdiff
path: root/types.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-05-20 15:27:24 -0700
committerBruce Hill <bruce@bruce-hill.com>2021-05-20 15:27:24 -0700
commit655ed121289c0befa2c87f7a6a2db3409f54094c (patch)
treea575edd664c5feb418389fb2fb22c6d627b04927 /types.h
parenta0028e96055669ab83dd6ff9e14b0e728a121d7d (diff)
Mostly working version
Diffstat (limited to 'types.h')
-rw-r--r--types.h7
1 files changed, 5 insertions, 2 deletions
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 {