summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-09-12 20:42:02 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-09-12 20:42:02 -0700
commitf1043db26388b63e40933615284228099f3ad2fd (patch)
treea70aa49f413b4e156627ff09eb606450714fd1d5
parentbba32e4b7a4c936d45e43d7e4959d2a5bb92fba6 (diff)
downloadtxr-f1043db26388b63e40933615284228099f3ad2fd.tar.gz
txr-f1043db26388b63e40933615284228099f3ad2fd.tar.bz2
txr-f1043db26388b63e40933615284228099f3ad2fd.zip
regex: bug printing #/abc(def|ghi)/
This was broken by the July 16 commit "regex: don't print superfluous parens around classes", de26fc87792206ec866bb710818e68836276fa45. * regex.c (print_rec): If an (or ...) appears as a compound element, it must be rendered in parentheses; or_s must be handled here just like and_s. Prior to the faulty commit, this was implicitly true because the logic was inverted and wasn't ruling out or_s.
-rw-r--r--regex.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/regex.c b/regex.c
index aa57a326..31076795 100644
--- a/regex.c
+++ b/regex.c
@@ -2352,7 +2352,7 @@ static void print_rec(val exp, val stream, int *semi_flag)
for (; args; args = cdr(args)) {
val arg = car(args);
if (consp(arg) && (car(arg) == compl_s || car(arg) == and_s ||
- car(arg) == nongreedy_s))
+ car(arg) == or_s || car(arg) == nongreedy_s))
paren_print_rec(arg, stream, semi_flag);
else
print_rec(arg, stream, semi_flag);