many {Ramble}R Documentation

many matches 0 or more of pattern p. In BNF notation, repetition occurs often enough to merit its own abbreviation. When zero or more repetitions of a phrase p are admissible, we simply write p*. The many combinator corresponds directly to this operator, and is defined in much the same way.

Description

This implementation of many differs from (Hutton92) due to the nature of R's data structures. Since R does not support the concept of a list of tuples, we must revert to using a list rather than a vector, since all values in an R vector must be the same datatype.

Usage

many(p)

Arguments

p

is the parser to match 0 or more times.

See Also

maybe, some

Examples

Digit <- function(...) {satisfy(function(x) {return(!!length(grep("[0-9]", x)))})}
many(Digit()) ("123abc")
many(Digit()) ("abc")

[Package Ramble version 0.1.1 Index]