1Parse.or(3kaya) Kaya module reference Parse.or(3kaya)
2
3
4
6 Parse::or - Create a new parser which is the combination of the argu‐
7 ments.
8
10 Parser<a> or( Parser<a> x, Parser<a> y )
11
13 x The first parser
14
15 y The second parser
16
18 Create a new parser combining x and y
19 The new parser recognises a string which is recognised by either x or
20 y.
21
22
23 decimal = or(Parse::digit,Parse::char@('.'));
24 // may be more clear in many situations to write this as
25 decimal = Parse::digit `or` Parse::char@('.');
26
27 As with Kaya's || operator, this uses short-circuit evaluation: if x
28 parses the String successfully, y will not be used.
29
31 Kaya standard library by Edwin Brady, Chris Morris and others
32 (kaya@kayalang.org). For further information see http://kayalang.org/
33
35 The Kaya standard library is free software; you can redistribute it
36 and/or modify it under the terms of the GNU Lesser General Public
37 License (version 2.1 or any later version) as published by the Free
38 Software Foundation.
39
40
41
42Kaya December 2010 Parse.or(3kaya)