From 2411f779f47c441659720ad0ddcabf91df1d2529 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 16 Jul 2017 17:54:18 -0700 Subject: regex: don't print superfluous parens around classes. * regex.c (print_rec): Switching from negative tests to positive: print parens around elements of a compound which have a lower precedence. The previously incorrectly omitted set and cset remain unmentioned, so under this inversion of logic, they print without parentheses. --- regex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'regex.c') diff --git a/regex.c b/regex.c index 705ac26d..e61d29d3 100644 --- a/regex.c +++ b/regex.c @@ -2251,8 +2251,8 @@ static void print_rec(val exp, val stream, int *semi_flag) } else if (sym == compound_s) { for (; args; args = cdr(args)) { val arg = car(args); - if (consp(arg) && car(arg) != zeroplus_s && car(arg) != oneplus_s && - car(arg) != optional_s && car (arg) != compound_s) + if (consp(arg) && (car(arg) == compl_s || car(arg) == and_s || + car(arg) == nongreedy_s)) paren_print_rec(arg, stream, semi_flag); else print_rec(arg, stream, semi_flag); -- cgit v1.2.3