#NEWLINE# def writetab( self , tabfile , outputdir = '' ) : #NEWLINE# #INDENT# if isinstance ( tabfile , types . ModuleType ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# basetabfilename = tabfile . split ( '.' ) [ ( - 1 ) ] #NEWLINE# filename = ( os . path . join ( outputdir , basetabfilename ) + '.py' ) #NEWLINE# tf = open ( filename , 'w' ) #NEWLINE# tf . write ( ( "# %s.py. This file automatically created by PLY (version %s). Don't edit!\n" % ( tabfile , __version__ ) ) ) #NEWLINE# tf . write ( ( '_tabversion   = %s\n' % repr ( __version__ ) ) ) #NEWLINE# tf . write ( ( '_lextokens    = %s\n' % repr ( self . lextokens ) ) ) #NEWLINE# tf . write ( ( '_lexreflags   = %s\n' % repr ( self . lexreflags ) ) ) #NEWLINE# tf . write ( ( '_lexliterals  = %s\n' % repr ( self . lexliterals ) ) ) #NEWLINE# tf . write ( ( '_lexstateinfo = %s\n' % repr ( self . lexstateinfo ) ) ) #NEWLINE# tabre = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# initial = self . lexstatere [ 'INITIAL' ] #NEWLINE# initialfuncs = [ ] #NEWLINE# for part in initial : #NEWLINE# #INDENT# for f in part [ 1 ] : #NEWLINE# #INDENT# if ( f and f [ 0 ] ) : #NEWLINE# #INDENT# initialfuncs . append ( f ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# for ( key , lre ) in self . lexstatere . items ( ) : #NEWLINE# #INDENT# titem = [ ] #NEWLINE# for i in range ( len ( lre ) ) : #NEWLINE# #INDENT# titem . append ( ( self . lexstateretext [ key ] [ i ] , _funcs_to_names ( lre [ i ] [ 1 ] , self . lexstaterenames [ key ] [ i ] ) ) ) #NEWLINE# #UNINDENT# tabre [ key ] = titem #NEWLINE# #UNINDENT# tf . write ( ( '_lexstatere   = %s\n' % repr ( tabre ) ) ) #NEWLINE# tf . write ( ( '_lexstateignore = %s\n' % repr ( self . lexstateignore ) ) ) #NEWLINE# taberr = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( key , ef ) in self . lexstateerrorf . items ( ) : #NEWLINE# #INDENT# if ef : #NEWLINE# #INDENT# taberr [ key ] = ef . __name__ #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# taberr [ key ] = None #NEWLINE# #UNINDENT# #UNINDENT# tf . write ( ( '_lexstateerrorf = %s\n' % repr ( taberr ) ) ) #NEWLINE# tf . close ( )