Package Martel :: Module Expression :: Class Alt
[hide private]
[frames] | no frames]

Class Alt

source code

Expression --+    
             |    
ExpressionList --+
                 |
                Alt

An Expression tree with a list of alternate matches.

Instance Methods [hide private]
 
__init__(self, expressions)
(expressions)
source code
 
__or__(self, other)
returns an Expression matching this Expression or (if that fails) the other one
source code
 
__str__(self)
the corresponding pattern string
source code

Inherited from ExpressionList: copy, features, group_names

Inherited from Expression: __add__, make_iterator, make_parser

Method Details [hide private]

__init__(self, expressions)
(Constructor)

source code 

(expressions)

Match one of a list of alternate expressions. The expressions are tested in their input order.

For example, Alt( (exp1, exp2, exp3) ) means try to match exp1, and if that fails try to match exp2, and if that fails, try to match exp3. If *that* fails, the match failed.

__or__(self, other)
(Or operator)

source code 

returns an Expression matching this Expression or (if that fails) the other one

Overrides: Expression.__or__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

the corresponding pattern string

Overrides: Expression.__str__