Table of Contents

Class: PatternMatcher mudlib/utils.py

A finite state machine with no cycles.

FIXME - document this. currently it's only used in nomacs.py.

Methods   
__init__
add
apply
reset
state
  __init__ 
__init__ ( self )

  add 
add (
        self,
        s,
        v,
        )

Add a string pattern and a value to return if that pattern is matched.

  apply 
apply ( self,  tok )

If applying tok results in an acceptance, return the accept value. If rejected, raise a ValueError. Else return None (internal state is preserved across multiple calls to apply).

Exceptions   
ValueError, 'Reject'
  reset 
reset ( self )

Move the state machine back into the start state.

  state 
state ( self )

Returns the current state of the state machine.


Table of Contents

This document was automatically generated on Thu Jan 24 08:57:43 2002 by HappyDoc version 2.0