summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-02-26 20:58:31 -0800
committerKaz Kylheku <kaz@kylheku.com>2012-02-26 20:58:31 -0800
commit73625e0ae9b4fde9c6ff64bd6dc22a1b7797be1a (patch)
tree44308c28567baad646762322f84bb501262ada66 /tests
parent7649d799041454321809da89a5716afc19c34f3d (diff)
downloadtxr-73625e0ae9b4fde9c6ff64bd6dc22a1b7797be1a.tar.gz
txr-73625e0ae9b4fde9c6ff64bd6dc22a1b7797be1a.tar.bz2
txr-73625e0ae9b4fde9c6ff64bd6dc22a1b7797be1a.zip
Fixing long-time (pre-GIT) bug. The object (nil) was stupidly used to
represent empty optional output clauses, distinguishing them from missing clauses. This creates an ambiguity, so that an @(output) block which puts out a single empty line is treated as empty. Present but empty clauses are now represented by t. * match.c (do_output_line): Check for t and bail. (do_output): Check for t instead of (nil) and bail. * parser.y (o_elems_opt2): Nonterminal deleted. (out_clauses_opt): Empty case generates nil. (req_parts_opt): o_elems_opt2 replaced by o_elems_opt. (repeat_rep_helper): Function now keeps track of which clauses were specified. For those that were specified, but empty, it substitutes t. * tests/008/empty-clauses.expected: New file. * tests/008/empty-clauses.txr: New file.
Diffstat (limited to 'tests')
-rw-r--r--tests/008/empty-clauses.expected6
-rw-r--r--tests/008/empty-clauses.txr18
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/008/empty-clauses.expected b/tests/008/empty-clauses.expected
new file mode 100644
index 00000000..b0cbdaf5
--- /dev/null
+++ b/tests/008/empty-clauses.expected
@@ -0,0 +1,6 @@
+
+b
+b
+fa
+b
+b
diff --git a/tests/008/empty-clauses.txr b/tests/008/empty-clauses.txr
new file mode 100644
index 00000000..486d42a2
--- /dev/null
+++ b/tests/008/empty-clauses.txr
@@ -0,0 +1,18 @@
+@(bind a ("a" "b"))
+@(output)
+@(repeat)
+@a
+@(first)
+
+@(end)
+@(repeat)
+@a
+@(first)
+@(end)
+@(repeat)
+@a
+@(first)
+f@a
+@(end)
+@(rep)@a@(first)@(end)
+@(end)