diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2021-08-01 12:40:27 -0700 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2021-08-01 12:40:27 -0700 |
| commit | 994c9c973e0fd771699c3a5c76bee11f9b744c84 (patch) | |
| tree | 8257c1abe2d18a50a46a1d712eadbd25fd7e4f8b /bp.c | |
| parent | cb9b4c40d87480bc794b90c2a36ed0f4c3240d8a (diff) | |
Changed how definitions work
Diffstat (limited to 'bp.c')
| -rw-r--r-- | bp.c | 17 |
1 files changed, 3 insertions, 14 deletions
@@ -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, "<pattern argument>", 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, "<word pattern>", flag, -1); |
