diff options
Diffstat (limited to 'match.h')
| -rw-r--r-- | match.h | 26 |
1 files changed, 25 insertions, 1 deletions
@@ -8,7 +8,31 @@ #include <stdio.h> #include "files.h" -#include "types.h" +#include "pattern.h" +#include "definitions.h" + +struct match_s; // forward declared to resolve circular struct defs + +typedef struct { + struct match_s **home, *next; +} match_dll_t; + +// #define MATCH_FROM(node, name) ((match_t*)((char*)node + (size_t)(&((match_t*)0)->name))) + +// +// Pattern matching result object +// +typedef struct match_s { + // Where the match starts and ends (end is after the last character) + const char *start, *end; + pat_t *pat; + // Intrusive linked list nodes for garbage collection and cache buckets: + match_dll_t gc, cache; + size_t defs_id; + int refcount; + struct match_s **children; + struct match_s *_children[3]; +} match_t; __attribute__((returns_nonnull)) match_t *new_match(def_t *defs, pat_t *pat, const char *start, const char *end, match_t *children[]); |
