summaryrefslogtreecommitdiffstats
path: root/regex.c
diff options
context:
space:
mode:
Diffstat (limited to 'regex.c')
-rw-r--r--regex.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/regex.c b/regex.c
index 222b0923..f3b4ffc6 100644
--- a/regex.c
+++ b/regex.c
@@ -1773,8 +1773,14 @@ static void print_rec(val exp, val stream)
}
put_char(chr(']'), stream);
} else if (sym == compound_s) {
- while (args)
- print_rec(pop(&args), stream);
+ 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)
+ paren_print_rec(arg, stream);
+ else
+ print_rec(arg, stream);
+ }
} else if (sym == zeroplus_s || sym == oneplus_s || sym == optional_s) {
val arg = pop(&args);
if (consp(arg) && car(arg) != set_s && car(arg) != cset_s)