summaryrefslogtreecommitdiffstats
path: root/regex.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-01-12 20:42:46 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-01-12 20:42:46 -0800
commit2f2d54535220da098bd5f470fa8b28684dcc1534 (patch)
tree2b41299a1626ab8536f887e5e5407ba8ece4368d /regex.c
parente8a6a7a53407fd4c4adc37e8013baf9bc2e4d553 (diff)
downloadtxr-2f2d54535220da098bd5f470fa8b28684dcc1534.tar.gz
txr-2f2d54535220da098bd5f470fa8b28684dcc1534.tar.bz2
txr-2f2d54535220da098bd5f470fa8b28684dcc1534.zip
Regex printing not escaping [ and ].
* regex.c (print_rec): Handle '[' and ']' in backslash-adding switch.
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/regex.c b/regex.c
index 9e770ba3..1b2fbad2 100644
--- a/regex.c
+++ b/regex.c
@@ -2087,7 +2087,8 @@ static void print_rec(val exp, val stream, int *semi_flag)
switch (ch) {
case '?': case '.': case '*': case '+':
case '(': case ')': case '|': case '~':
- case '&': case '%': case '/': case '\\':
+ case '&': case '%': case '/':
+ case '[': case ']': case '\\':
putc_clear_flag(chr('\\'), stream, semi_flag);
put_char(exp, stream);
break;