aboutsummaryrefslogtreecommitdiff
path: root/compiler.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2020-09-28 15:13:54 -0700
committerBruce Hill <bruce@bruce-hill.com>2020-09-28 15:13:54 -0700
commit88571d7639d1bfa134b9b4f89ddd031b11fe8f69 (patch)
tree9cd12006b10ed1794139928b0490ceb6ca68a3eb /compiler.c
parent344c1b1709de522e07b97fe39afa96f46dd74515 (diff)
More intuitive escape sequences for string patterns
Diffstat (limited to 'compiler.c')
-rw-r--r--compiler.c6
1 files changed, 6 insertions, 0 deletions
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;