View source: R/parsers_basic.R
eof | R Documentation |
Tests whether the end of the input character vector has been reached,
which boils down to detection of character(0)
in the R
-element (see
succeed()
). Since the intended application of this parser is parsing of
text files the function has been called after the end of file (EOF) signal.
To indicate that an end of file has been detected, the R
-element side of
the parser output will be converted to an empty list.
eof()
A parser.
eof()(x): if x==null then succeed(x)(list()) else fail()(x)
(literal("a") %then% eof())("a") # success
# Notice the difference on the R-side with
literal("a")("a")
eof()(character(0)) # success
eof()("a") # failure
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.