Martel :: Expression :: MaxRepeat :: Class MaxRepeat
[hide private]
[frames] | no frames]

Class MaxRepeat

source code

Expression --+
             |
            MaxRepeat

Instance Methods [hide private]
 
__init__(self, expression, min_count=0, max_count=MAXREPEAT)
(expression, min_count = 0, max_count = MAXREPEAT)
source code
 
group_names(self)
the list of group names used by this Expression and its children
source code
 
_find_groups(self, tag)
return a list of all groups matching the given tag
source code
 
features(self)
return a list of all features
source code
 
copy(self)
do a deep copy on this Expression tree
source code
 
_select_names(self, names)
internal function: do not use
source code
 
_modify_leaves(self, func)
internal function for manipulating the leaves of an expression
source code
 
__str__(self)
the corresponding pattern string
source code

Inherited from Expression: __add__, __or__, make_iterator, make_parser

Method Details [hide private]

__init__(self, expression, min_count=0, max_count=MAXREPEAT)
(Constructor)

source code 
(expression, min_count = 0, max_count = MAXREPEAT)

        Match the expression at least 'min_count' times and no more
        than 'max_count' times.  If max_count == MAXREPEAT then
        there is no fixed upper limit.

        min_count and max_count can be strings, in which case they are
        used as "named group repeats."  That is, they are taken to be
        group names and used to find the repeat counts during
        evaluation time.  The current implementation only understands
        named group repeats when min_count == max_count.

        The grouping is greedy.

        WARNING: There is no check to ensure that a match of 0 size is
        repeated indefinitely, as with "(a?)*" against the string "b".
        This will loop forever.

        WARNING: The current implementation does not support
        backtracking in MaxRepeats, so ".*
" will not match "
".
        Use a more explicit construct instead, like "[^
]*
".

        

group_names(self)

source code 

the list of group names used by this Expression and its children

Overrides: Expression.group_names

_find_groups(self, tag)

source code 

return a list of all groups matching the given tag

Overrides: Expression._find_groups
(inherited documentation)

features(self)

source code 

return a list of all features

Overrides: Expression.features

copy(self)

source code 

do a deep copy on this Expression tree

Overrides: Expression.copy

_select_names(self, names)

source code 

internal function: do not use

Overrides: Expression._select_names

_modify_leaves(self, func)

source code 

internal function for manipulating the leaves of an expression

This really needs to be some sort of visit pattern, but I'm not sure the best way to do it. THIS METHOD MAY CHANGE.

Overrides: Expression._modify_leaves
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

the corresponding pattern string

Overrides: Expression.__str__