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

Class MaxRepeat

Expression --+
             |
            MaxRepeat


Method Summary
  __init__(self, expression, min_count, max_count)
(expression, min_count = 0, max_count = MAXREPEAT) Match the expression at least 'min_count' times and no more than 'max_count' times.
  __str__(self)
the corresponding pattern string
  copy(self)
do a deep copy on this Expression tree
  features(self)
return a list of all features
  group_names(self)
the list of group names used by this Expression and its children
  _find_groups(self, tag)
return a list of all groups matching the given tag
  _modify_leaves(self, func)
internal function for manipulating the leaves of an expression
  _select_names(self, names)
internal function: do not use
    Inherited from Expression
  __add__(self, other)
returns an Expression to match this Expression then the other one
  __or__(self, other)
returns an Expression matching this Expression or (if that fails) the other one
  make_iterator(self, tag, debug_level)
create an iterator for this regexp; the 'tag' defines a record
  make_parser(self, debug_level)
create a SAX compliant parser for this regexp

Method Details

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

(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 "[^
]*
".

__str__(self)
(Informal representation operator)

the corresponding pattern string
Overrides:
Martel.Expression.Expression.__str__

copy(self)

do a deep copy on this Expression tree
Overrides:
Martel.Expression.Expression.copy

features(self)

return a list of all features
Overrides:
Martel.Expression.Expression.features

group_names(self)

the list of group names used by this Expression and its children
Overrides:
Martel.Expression.Expression.group_names

_find_groups(self, tag)

return a list of all groups matching the given tag
Overrides:
Martel.Expression.Expression._find_groups (inherited documentation)

_modify_leaves(self, func)

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:
Martel.Expression.Expression._modify_leaves (inherited documentation)

_select_names(self, names)

internal function: do not use
Overrides:
Martel.Expression.Expression._select_names

Generated by Epydoc 2.1 on Thu Aug 10 20:05:53 2006 http://epydoc.sf.net