Wed 26 Oct 2011 12:22:00 AM UTC, original submission:
Txr will match input which is not terminated by a newline.
For example:
@(next :string "text")
@a
a="text"
From a tty stream on a Unix-like system, the same behavior can be obtained by typing "text" and then Ctrl-D twice.
However, if the input is empty, then binding fails:
@(next :string "")
@a
false
If a newline is added, everything is well:
@(next :string "n")
@a
a=""
The faiure happens if we given an empty file, or tty input:
$ txr -c '@a'
[Ctrl-D]
false
The thing is, it actually makes sense. If the input is zero characters long, that means the line does not contain any lines. Therefore it is wrong to obtain a match within a line.
However, the behavior may be confusing under @(next :string ""), where the user expects the "" to be an empty line of text and not a virtual file that contains no lines.
|