From 88571d7639d1bfa134b9b4f89ddd031b11fe8f69 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Mon, 28 Sep 2020 15:13:54 -0700 Subject: More intuitive escape sequences for string patterns --- compiler.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'compiler.c') diff --git a/compiler.c b/compiler.c index a0ff087..60da7d8 100644 --- a/compiler.c +++ b/compiler.c @@ -395,6 +395,12 @@ vm_op_t *bpeg_stringpattern(file_t *f, const char *str) for (; *str; str++) { if (*str == '\\') { check(str[1], "Expected more string contents after backslash"); + const char *after_escape; + char e = unescapechar(&str[1], &after_escape); + if (e != str[1]) { + str = after_escape - 1; + continue; + } if (str[1] == '\\') { ++str; continue; -- cgit v1.2.3