From ba6ee18ded5e76e852dd7eab89e6cc2b420b42d2 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Fri, 30 Jul 2021 19:24:35 -0700 Subject: Added strict mode for upto operator: ..=Abc --- match.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'match.c') diff --git a/match.c b/match.c index 8bcead7..b594c80 100644 --- a/match.c +++ b/match.c @@ -348,7 +348,7 @@ static match_t *match(def_t *defs, file_t *f, const char *str, pat_t *pat, bool } return new_match(defs, pat, str, str, NULL); } - case BP_UPTO: { + case BP_UPTO: case BP_UPTO_STRICT: { match_t *m = new_match(defs, pat, str, str, NULL); pat_t *target = deref(defs, pat->args.multiple.first), *skip = deref(defs, pat->args.multiple.second); @@ -387,7 +387,7 @@ static match_t *match(def_t *defs, file_t *f, const char *str, pat_t *pat, bool // This isn't in the for() structure because there needs to // be at least once chance to match the pattern, even if // we're at the end of the string already (e.g. "..$"). - if (str < f->end && *str != '\n') + if (str < f->end && *str != '\n' && pat->type != BP_UPTO_STRICT) str = next_char(f, str); } recycle_if_unused(&m); -- cgit v1.2.3