Learn R Programming

parcr (version 0.5.3)

Ignore: Ignore all until the end

Description

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.

Usage

Ignore()

Arguments

Value

A parser.

Details

This parser is identical to


zero_or_more(satisfy(function(x) TRUE)) 

Examples

Run this code

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"))

Run the code above in your browser using DataLab