'To initialize, analyze the surroundings of the given index.'

def __init__(self, editwin, index):

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