From 122b39ad1a2404987157f78ff39a23a4ebb9bbad Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 15 Mar 2014 12:50:30 -0700 Subject: * parser.y (text): Allow the EMPTY token (the @(empty) syntax) to be a text. * txr.1: Documented @(empty). --- ChangeLog | 7 +++++++ parser.y | 2 +- txr.1 | 6 ++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index dd4e6787..491b7884 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2014-03-15 Kaz Kylheku + + * parser.y (text): Allow the EMPTY token (the @(empty) syntax) + to be a text. + + * txr.1: Documented @(empty). + 2014-03-14 Kaz Kylheku * 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. -- cgit v1.2.3