#NEWLINE# def runmain( lexer = None , data = None ) : #NEWLINE# #INDENT# if ( not data ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# filename = sys . argv [ 1 ] #NEWLINE# f = open ( filename ) #NEWLINE# data = f . read ( ) #NEWLINE# f . close ( ) #NEWLINE# #UNINDENT# except IndexError : #NEWLINE# #INDENT# sys . stdout . write ( 'Reading from standard input (type EOF to end):\n' ) #NEWLINE# data = sys . stdin . read ( ) #NEWLINE# #UNINDENT# #UNINDENT# if lexer : #NEWLINE# #INDENT# _input = lexer . input #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# _input = input #NEWLINE# #UNINDENT# _input ( data ) #NEWLINE# if lexer : #NEWLINE# #INDENT# _token = lexer . token #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# _token = token #NEWLINE# #UNINDENT# while 1 : #NEWLINE# #INDENT# tok = _token ( ) #NEWLINE# if ( not data ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# sys . stdout . write ( ( '(%s,%r,%d,%d)\n' % ( tok . type , tok . value , tok . lineno , tok . lexpos ) ) )