summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2012-03-31 16:00:52 -0700
committerKaz Kylheku <kaz@kylheku.com>2012-03-31 16:00:52 -0700
commit13a861377a55a77d2ad2072fd700b720aa71d4d0 (patch)
treebd4818196f87985f47169030885bdbd59ecddd16 /txr.1
parentb7f1f4c5bbea86e288b6a4d68595c1d2d07217bd (diff)
downloadtxr-13a861377a55a77d2ad2072fd700b720aa71d4d0.tar.gz
txr-13a861377a55a77d2ad2072fd700b720aa71d4d0.tar.bz2
txr-13a861377a55a77d2ad2072fd700b720aa71d4d0.zip
If one of the blocks which are subordinate to a @(trailer)
happen to request a successful termination by invoking @(accept) the position must not advance into the trailer material. * match.c (v_trailer): Added an unwind protect which detects that an accept is taking place and adjusts the return value to restrict the input position at the point given to trailer. (accept_fail): Use uw_block_return_proto instead of uw_block_return and pass the symbol as the protocol identifier. * unwind.c (uw_current_exit_point): New function. (uw_block_return): Function renamed to uw_block_return_proto; takes new parameter which is stored in the block structure. * unwind.h (struct uw_block): New member, protocol. (uw_block_return): Becomes an inline wrapper for uw_block_return_proto. (uw_block_return_proto, uw_current_exit_point): Declared. * txr.1: Interaction between @(trailer) and @(accept) documented.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.130
1 files changed, 30 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index 533bc464..89792af8 100644
--- a/txr.1
+++ b/txr.1
@@ -3040,6 +3040,36 @@ The second clause grabs four lines, which is the longest match.
And so, the next line of input available for matching is 5, which goes
to the @second variable.
+.SS Interaction between Trailer and Accept Directives
+
+If one of the clauses which follow a @(trailer) request a successful
+termination to an outer block via @(accept), then @(trailer) intercepts
+the transfer and adjusts the data extent to the position that it was given.
+
+Example:
+
+ Query: @(block)
+ @(trailer)
+ @line1
+ @line2
+ @(accept)
+ @(end)
+ @line3
+
+ Data: 1
+ 2
+ 3
+
+ Output: line1="1"
+ line2="2"
+ line3="1"
+
+The variable line3 is bound to 1 because although the @(accept) yields a data
+position which is advanced to the third line, this is intercepted by @(trailer)
+and adjusted back to the first line.
+
+Directives other than @(trailer) have no such special interaction with accept.
+
.SH FUNCTIONS
.SS Introduction