aboutsummaryrefslogtreecommitdiff
path: root/match.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2021-07-30 19:24:35 -0700
committerBruce Hill <bruce@bruce-hill.com>2021-07-30 19:24:35 -0700
commitba6ee18ded5e76e852dd7eab89e6cc2b420b42d2 (patch)
tree8a238dbfcf91766ee3b882d8c87a9587ca107119 /match.c
parent18e8a131f58a54008512b05062382900027bf1d9 (diff)
Added strict mode for upto operator: ..=Abc
Diffstat (limited to 'match.c')
-rw-r--r--match.c4
1 files changed, 2 insertions, 2 deletions
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);