aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-07-16 15:46:16 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-07-16 15:46:16 -0400
commit27e61b3e185361e831bd10c02492971dc76029dd (patch)
tree88dc9583f1acb57cd93826d7137113ea552ad113
parentd3286a9229f7e93984261bac0cb0c77438a70665 (diff)
Exclude '}' from pattern source range for string literals
-rw-r--r--pattern.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/pattern.c b/pattern.c
index aa7850b..b737eab 100644
--- a/pattern.c
+++ b/pattern.c
@@ -355,6 +355,7 @@ static bp_pat_t *_bp_simplepattern(const char *str, const char *end, bool inside
str = next_char(str, end);
size_t len = (size_t)(str - litstart);
str = next_char(str, end);
+ if (c == '}') ++start; // Don't include the "}" in the pattern source range
return Pattern(BP_STRING, start, str, len, (ssize_t)len, .string=strndup(litstart, len));
}
// Not <pat>