From f1043db26388b63e40933615284228099f3ad2fd Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Tue, 12 Sep 2017 20:42:02 -0700 Subject: 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. --- regex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- cgit v1.2.3