Plex question (self.answered so ignore)

matthew matthew at newsgroups.com
Mon Mar 31 02:54:54 CEST 2003


self.state_name.

matthew wrote:
> Hi,
> 
> I'm using Greg Ewing's Plex (v.cool) but for the life of me I can't 
> figure out how to get the name of the current state. Any help much 
> appreciated. Thanks. matthew.
> 
> class PPF_Scanner(Scanner):
> 
> def event_end(self, scanner):
>     <I want to use state name as an index to lists of callbacks>
>     for func in callbacks[current_state_name]:
>         etc...
>     self.begin('')
> 
> try:
>         lexicon = Lexicon([
>         # EVENT: Position
>         (Str("(0)"),    Begin('position')),
>             State('position', [
>                 (Any("XxYy") + coordinate,     set_coordinate),
>                 (Any("Tt") + turret_pos,    set_turret_position),
>                 (whitespace,    IGNORE),
>                 (eoln,            event_end)
>             ]), etc...
> 





More information about the Python-list mailing list