Table of Contents

Class: MaxRepeat Martel/Expression.py

Greedy repeat: a* a{3,5} a+

Base Classes   
Expression
Methods   
__init__
__str__
_find_groups
_modify_leaves
_select_names
copy
features
group_names
  __init__ 
__init__ (
        self,
        expression,
        min_count=0,
        max_count=MAXREPEAT,
        )

(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__ 
__str__ ( self )

the corresponding pattern string

  _find_groups 
_find_groups ( self,  tag )

  _modify_leaves 
_modify_leaves ( self,  func )

  _select_names 
_select_names ( self,  names )

internal function: do not use

  copy 
copy ( self )

do a deep copy on this Expression tree

  features 
features ( self )

return a list of all features

  group_names 
group_names ( self )

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


Table of Contents

This document was automatically generated on Mon Jul 1 12:03:20 2002 by HappyDoc version 2.0.1