alt: 'alt' combinator is similar to alternation in BNF. the parser...

Description Usage Arguments Value See Also Examples

Description

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

Usage

1
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

1
(item() %alt% succeed("2")) ("abcdef")

Example output

$result
[1] "a"

$leftover
[1] "bcdef"

Ramble documentation built on May 1, 2019, 7:17 p.m.