From 238ab2afa74e3809818d6f60c1540b2158e15934 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 10 Sep 2020 22:50:49 -0700 Subject: Added flags for defining rules --- bpeg.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bpeg.c b/bpeg.c index 6607527..023aa4f 100644 --- a/bpeg.c +++ b/bpeg.c @@ -1120,6 +1120,12 @@ int main(int argc, char *argv[]) visualize_delay = 100000; } else if (streq(argv[i], "--grammar") || streq(argv[i], "-g")) { grammarfile = argv[++i]; + } else if (streq(argv[i], "--define") || streq(argv[i], "-d")) { + char *def = argv[++i]; + char *eq = strchr(def, '='); + check(eq, usage); + *eq = '\0'; + load_def(def, ++eq); } else if (pattern == NULL) { pattern = argv[i]; } else if (infile == NULL) { -- cgit v1.2.3