NAME¶
Parse::or - Create a new parser which is the combination of the arguments.
SYNOPSIS¶
Parser<a> or( Parser<a> x, Parser<a> y )
ARGUMENTS¶
x The first parser
y The second parser
DESCRIPTION¶
Create a new parser combining
x and
y
The new parser recognises a string which is recognised by either x or y.
-
-
decimal = or(Parse::digit,Parse::char@('.'));
// may be more clear in many situations to write this as
decimal = Parse::digit `or` Parse::char@('.');
As with Kaya's
|| operator, this uses short-circuit evaluation: if
x parses the String successfully,
y will not be used.
AUTHORS¶
Kaya standard library by Edwin Brady, Chris Morris and others
(kaya@kayalang.org). For further information see
http://kayalang.org/
LICENSE¶
The Kaya standard library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License (version
2.1 or any later version) as published by the Free Software Foundation.