summaryrefslogtreecommitdiffstats
path: root/regex.c
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
commit0f4d29d3662c4acb67df31481c2919c34ffb22f4 (patch)
treea70aa49f413b4e156627ff09eb606450714fd1d5 /regex.c
parenta05a064e31cc0da13d8eee2e7705f3ac7d08c46a (diff)
downloadtxr-0f4d29d3662c4acb67df31481c2919c34ffb22f4.tar.gz
txr-0f4d29d3662c4acb67df31481c2919c34ffb22f4.tar.bz2
txr-0f4d29d3662c4acb67df31481c2919c34ffb22f4.zip
regex: bug printing #/abc(def|ghi)/
This was broken by the July 16 commit "regex: don't print superfluous parens around classes", 2411f779f47c441659720ad0ddcabf91df1d2529. * 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.
Diffstat (limited to 'regex.c')
-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);