aboutsummaryrefslogtreecommitdiff
path: root/types.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2020-09-12 18:20:13 -0700
committerBruce Hill <bruce@bruce-hill.com>2020-09-12 18:20:13 -0700
commitc18eb4c9968289c4808d70f7124c0b6bed5eb022 (patch)
tree97fdbee687e2e83f83403161365b90c99c102ee6 /types.h
parentc0125378b9ec96149aed3107bff719cd8a01b16d (diff)
Added backrefs
Diffstat (limited to 'types.h')
-rw-r--r--types.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/types.h b/types.h
index f8899b3..82c282c 100644
--- a/types.h
+++ b/types.h
@@ -7,7 +7,7 @@
#include <sys/types.h>
/*
- * BPEG virtual machine opcodes
+ * BPEG virtual machine opcodes (these must be kept in sync with the names in vm.c)
*/
enum VMOpcode {
VM_EMPTY = 0,
@@ -25,6 +25,7 @@ enum VMOpcode {
VM_CHAIN,
VM_REPLACE,
VM_REF,
+ VM_BACKREF,
};
/*
@@ -57,6 +58,7 @@ typedef struct vm_op_s {
struct vm_op_s *capture_pat;
char *name;
} capture;
+ void *backref;
struct vm_op_s *pat;
} args;
} vm_op_t;
@@ -81,8 +83,15 @@ typedef struct {
} def_t;
typedef struct {
+ size_t defcount, defcapacity;
def_t *definitions;
- size_t size, capacity;
+
+ size_t backrefcount, backrefcapacity;
+ struct {
+ const char *name;
+ match_t *capture;
+ vm_op_t *op;
+ } *backrefs;
} grammar_t;
#endif