aboutsummaryrefslogtreecommitdiff
path: root/bpeg.h
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2020-09-10 22:42:47 -0700
committerBruce Hill <bruce@bruce-hill.com>2020-09-10 22:42:47 -0700
commitb93d8979bd9ea4148ea7e1d08d00ca846e151cf1 (patch)
tree5762fbe37037115cdcee606b110000ce16232fcc /bpeg.h
parent95ec009a7c6cfb2ae43e63e25744ff5f76b88bf5 (diff)
Misc. tweaks and visualization changes, capitalized some rules
Diffstat (limited to 'bpeg.h')
-rw-r--r--bpeg.h21
1 files changed, 11 insertions, 10 deletions
diff --git a/bpeg.h b/bpeg.h
index 7836250..459bd65 100644
--- a/bpeg.h
+++ b/bpeg.h
@@ -19,16 +19,6 @@ const char *usage = (
" -s --slow\t run in slow mode for debugging\n"
" -r --replace <replacement> replace the input pattern with the given replacement\n"
" -g --grammar <grammar file> use the specified file as a grammar\n");
-/*
- * Pattern matching result object
- */
-typedef struct match_s {
- // Where the match starts and ends (end is after the last character)
- const char *start, *end;
- unsigned int is_capture:1, is_replacement:1;
- const char *name_or_replacement;
- struct match_s *child, *nextsibling;
-} match_t;
/*
* BPEG virtual machine opcodes
@@ -85,6 +75,17 @@ typedef struct vm_op_s {
} args;
} vm_op_t;
+/*
+ * Pattern matching result object
+ */
+typedef struct match_s {
+ // Where the match starts and ends (end is after the last character)
+ const char *start, *end;
+ unsigned int is_capture:1, is_replacement:1, is_ref:1;
+ const char *name_or_replacement;
+ struct match_s *child, *nextsibling;
+ vm_op_t *op;
+} match_t;
static inline const char *after_spaces(const char *str);
static match_t *free_match(match_t *m);