#current-input can be used like any other built-in
string source such as
so long as it is attached.
#current-input is attached if an input has been
established by a
do scan, a
repeat scan, or a
using input as. It is
also attached in the body of a string sink function. In contrast,
not attached in
process-startrule, or a
In all of these cases,
#current-input can be attached by processing an input using one of the methods
#current-input has the effect of consuming the remaining data from the source, unless
do scan, or
repeat scan), or on the left-hand side of
using input as, or
value string sourceargument.
#current-input, the original processing resumes and continues until
#current-inputis completely consumed.
The following code shows what happens when #current-input is
output or assigned to a variable:
process submit "Mary had a little lamb." find "Mary" white-space+ output #current-input find "lamb" output "Baa baa black sheep."
The program will output
had a little lamb.. It will not output
Baa baa black sheep.,
because after the pattern
"Mary" whitespace+ succeeds, the rest of the input is consumed by
output #current-input, so the rule
find "lamb" never fires.
Meanwhile, the following code shows what happens when
#current-input is used as the source for a
process submit "Mary had a little lamb." find "Mary" white-space+ output "David " repeat scan #current-input match "had" white-space+ output "stole " match "a" white-space+ output "my " again find "lamb" output "sheep"
This program will output
David stole my little sheep.. The characters
little lamb. were processed by the
find rules invoked by the original
had a were processed by the
repeat scan of
repeat scan exited when it failed to match
little lamb., leaving those characters unconsumed, and
available for processing by the original