View source: R/parsers_derived.R
Ignore | R Documentation |
Sometimes, a parser has found the end of the text that needs to be parsed and
all following lines can be ignored. Ignore
will read and discard all
following lines until the end of the file, empty or not. So, this parser will
consume all elements until the end of the input vector.
Ignore()
This parser is identical to
zero_or_more(satisfy(function(x) TRUE))
A parser.
starts_with_a <- function(x) grepl("^a",x)
p <- function() {
one_or_more(satisfy(starts_with_a)) %then%
(literal("~End") %ret% NULL) %then%
Ignore() %then%
eof()
}
p()(c("ab","abc","~End","boring stuff","more stuff"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.