summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-03-15 12:50:30 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-03-15 12:50:30 -0700
commit122b39ad1a2404987157f78ff39a23a4ebb9bbad (patch)
treecd169fff6ee804115c907862e847890814e08335
parenta8b0e36b1760e51a8a3a25d4e22a325e407ef3d4 (diff)
downloadtxr-122b39ad1a2404987157f78ff39a23a4ebb9bbad.tar.gz
txr-122b39ad1a2404987157f78ff39a23a4ebb9bbad.tar.bz2
txr-122b39ad1a2404987157f78ff39a23a4ebb9bbad.zip
* parser.y (text): Allow the EMPTY token (the @(empty) syntax)
to be a text. * txr.1: Documented @(empty).
-rw-r--r--ChangeLog7
-rw-r--r--parser.y2
-rw-r--r--txr.16
3 files changed, 14 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index dd4e6787..491b7884 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-03-15 Kaz Kylheku <kaz@kylheku.com>
+
+ * parser.y (text): Allow the EMPTY token (the @(empty) syntax)
+ to be a text.
+
+ * txr.1: Documented @(empty).
+
2014-03-14 Kaz Kylheku <kaz@kylheku.com>
* parser.l (regex_parse, lisp_parse): Fix neglected handling of
diff --git a/parser.y b/parser.y
index efbc485b..19332684 100644
--- a/parser.y
+++ b/parser.y
@@ -334,7 +334,6 @@ else_clause_opt : ELSE newl
| { $$ = nil; }
;
-
line : elems_opt '\n' { $$ = $1; }
;
@@ -363,6 +362,7 @@ text : TEXT { $$ = rl(string_own($1), num(lineno)); }
| regex { $$ = cons(regex_compile(rest($1), nil),
rest($1));
rl($$, num(lineno)); }
+ | EMPTY { $$ = null_string; }
;
texts : text %prec LOW { $$ = rlcp(cons($1, nil), $1); }
diff --git a/txr.1 b/txr.1
index 86b30e8d..0c86dd5d 100644
--- a/txr.1
+++ b/txr.1
@@ -1315,6 +1315,12 @@ which translates to a combination of @(cases) and @(require)
Multiple clauses are applied to the same input. The one whose effect persists
is the one which maximizes or minimizes the length of a particular variable.
+.IP @(empty)
+The @(empty) directive matches the empty string. It is useful in certain
+situations, such as expressing an empty match in a directive that doesn't
+accept an empty clause. The @(empty) syntax has another meaning in
+@(output) clauses, in conjunctio with @(repeat).
+
.IP "@(define NAME ( ARGUMENTS ...))"
Introduces a function. Functions are discussed in the FUNCTIONS section below.