#NEWLINE# def extractInformationFromTreeNodeStream( self , nodes ) : #NEWLINE# #INDENT# from antlr3.tree import Tree , CommonTree #NEWLINE# from antlr3.tokens import CommonToken #NEWLINE# self . node = nodes . LT ( 1 ) #NEWLINE# adaptor = nodes . adaptor #NEWLINE# payload = adaptor . getToken ( self . node ) #NEWLINE# if ( payload is not None ) : #NEWLINE# #INDENT# self . token = payload #NEWLINE# if ( payload . line <= 0 ) : #NEWLINE# #INDENT# i = ( - 1 ) #NEWLINE# priorNode = nodes . LT ( i ) #NEWLINE# while ( priorNode is not None ) : #NEWLINE# #INDENT# priorPayload = adaptor . getToken ( priorNode ) #NEWLINE# if ( ( priorPayload is not None ) and ( priorPayload . line > 0 ) ) : #NEWLINE# #INDENT# self . line = priorPayload . line #NEWLINE# self . charPositionInLine = priorPayload . charPositionInLine #NEWLINE# self . approximateLineInfo = True #NEWLINE# break #NEWLINE# #UNINDENT# i -= 1 #NEWLINE# priorNode = nodes . LT ( i ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# self . line = payload . line #NEWLINE# self . charPositionInLine = payload . charPositionInLine #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( self . node , Tree ) : #NEWLINE# #INDENT# self . line = self . node . line #NEWLINE# self . charPositionInLine = self . node . charPositionInLine #NEWLINE# if isinstance ( self . node , CommonTree ) : #NEWLINE# #INDENT# self . token = self . node . token #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# type = adaptor . getType ( self . node ) #NEWLINE# text = adaptor . getText ( self . node ) #NEWLINE# self . token = CommonToken ( type = type , text = text )