#NEWLINE# def __init__( self , states , first ) : #NEWLINE# #INDENT# self . regexes = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# self . toks = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( state , rules ) in states . items ( ) : #NEWLINE# #INDENT# parts = [ ] #NEWLINE# for tok in rules : #NEWLINE# #INDENT# groupid = ( 't%d' % tok . id ) #NEWLINE# self . toks [ groupid ] = tok #NEWLINE# parts . append ( ( '(?P<%s>%s)' % ( groupid , tok . regex ) ) ) #NEWLINE# #UNINDENT# self . regexes [ state ] = re . compile ( '|' . join ( parts ) , ( re . MULTILINE | re . VERBOSE ) ) #NEWLINE# #UNINDENT# self . state = first