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
    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

Generated by Epydoc 2.1 on Mon Aug 27 16:13:10 2007 http://epydoc.sf.net