An abbreviation for orP(p,q) is p|q.
In case of ambiguity, the value returned by the left-most accepting parser is provided.
If one of the arguments is a string then constParser is used to convert it into a parser.
In an efficient grammar, the first token presented to r will be acceptable to at most one of the input parsers, and then the parser returned by r will be the parser returned by the single accepting input parser.
|
|
|
../../../../../Macaulay2/packages/Parsing.m2:84:25-89:45: --source code:
Parser | Parser := (p,q) -> new Parser from ( c -> (
p' := p c;
q' := q c;
if p' === null then q'
else if q' === null then p'
else if c === null then p' else p'|q'))
The object orP is a function closure.