#NEWLINE# def __init__( self , editwin , index ) : #NEWLINE# #INDENT# 'To initialize, analyze the surroundings of the given index.' #NEWLINE# self . editwin = editwin #NEWLINE# self . text = text = editwin . text #NEWLINE# parser = PyParse . Parser ( editwin . indentwidth , editwin . tabwidth ) #NEWLINE# def index2line( index ) : #NEWLINE# #INDENT# return int ( float ( index ) ) #NEWLINE# #UNINDENT# lno = index2line ( text . index ( index ) ) #NEWLINE# if ( not editwin . context_use_ps1 ) : #NEWLINE# #INDENT# for context in editwin . num_context_lines : #NEWLINE# #INDENT# startat = max ( ( lno - context ) , 1 ) #NEWLINE# startatindex = ( repr ( startat ) + '.0' ) #NEWLINE# stopatindex = ( '%d.end' % lno ) #NEWLINE# parser . set_str ( ( text . get ( startatindex , stopatindex ) + ' \n' ) ) #NEWLINE# bod = parser . find_good_parse_start ( editwin . _build_char_in_string_func ( startatindex ) ) #NEWLINE# if ( ( bod is not None ) or ( startat == 1 ) ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# parser . set_lo ( ( bod or 0 ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# r = text . tag_prevrange ( 'console' , index ) #NEWLINE# if r : #NEWLINE# #INDENT# startatindex = r [ 1 ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# startatindex = '1.0' #NEWLINE# #UNINDENT# stopatindex = ( '%d.end' % lno ) #NEWLINE# parser . set_str ( ( text . get ( startatindex , stopatindex ) + ' \n' ) ) #NEWLINE# parser . set_lo ( 0 ) #NEWLINE# #UNINDENT# self . rawtext = parser . str [ : ( - 2 ) ] #NEWLINE# self . stopatindex = stopatindex #NEWLINE# self . bracketing = parser . get_last_stmt_bracketing ( ) #NEWLINE# self . isopener = [ ( ( i > 0 ) and ( self . bracketing [ i ] [ 1 ] > self . bracketing [ ( i - 1 ) ] [ 1 ] ) ) for i in range ( len ( self . bracketing ) ) ] #NEWLINE# self . set_index ( index )