Learn R Programming

Ramble (version 0.1.1)

alt: alt combinator is similar to alternation in BNF. the parser (alt(p1, p2)) recognises anything that p1 or p2 would. The approach taken in this parser follows (Fairbairn86), in which either is interpretted in a sequential (or exclusive) manner, returning the result of the first parser to succeed, and failure if neither does.

Description

%alt% is the infix notation for the alt function, and it is the preferred way to use the alt operator.

Usage

alt(p1, p2)

Arguments

p1
the first parser
p2
the second parser

Value

Returns the first parser if it suceeds otherwise the second parser

See Also

then

Examples

Run this code
(item() %alt% succeed("2")) ("abcdef")

Run the code above in your browser using DataLab