From 994c9c973e0fd771699c3a5c76bee11f9b744c84 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 1 Aug 2021 12:40:27 -0700 Subject: Changed how definitions work --- bp.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'bp.c') diff --git a/bp.c b/bp.c index c9eb009..b909c2b 100644 --- a/bp.c +++ b/bp.c @@ -546,20 +546,9 @@ int main(int argc, char *argv[]) defs = load_grammar(defs, f); // Keep in memory for debug output } else if (FLAG("-p") || FLAG("--pattern")) { file_t *arg_file = spoof_file(&loaded_files, "", flag, -1); - for (const char *str = arg_file->start; str < arg_file->end; ) { - def_t *d = bp_definition(defs, arg_file, str); - if (d) { - defs = d; - str = after_spaces(d->pat->end); - } else { - pat_t *p = bp_pattern(arg_file, str); - if (!p) - file_err(arg_file, str, arg_file->end, - "Failed to compile this part of the argument"); - pattern = chain_together(arg_file, pattern, p); - str = after_spaces(p->end); - } - } + pat_t *p = bp_pattern(arg_file, arg_file->start); + if (!p) file_err(arg_file, arg_file->start, arg_file->end, "Failed to compile this part of the argument"); + pattern = chain_together(arg_file, pattern, p); } else if (FLAG("-w") || FLAG("--word")) { check_nonnegative(asprintf(&flag, "\\|%s\\|", flag), "Could not allocate memory"); file_t *arg_file = spoof_file(&loaded_files, "", flag, -1); -- cgit v1.2.3