def handle_end_expr(self, token_text):
    while (self.flags.mode == MODE.Statement):
        self.restore_mode()
    if self.flags.multiline_frame:
        self.allow_wrap_or_preserved_newline(self.token_text, ((self.token_text == ']') and self.is_array(self.flags.mode) and (not self.opts.keep_array_indentation)))
    if self.opts.space_in_paren:
        if ((self.last_type == 'TK_START_EXPR') and (not self.opts.space_in_empty_paren)):
            self.output_space_before_token = False
            self.trim_output()
        else:
            self.output_space_before_token = True
    if ((self.token_text == ']') and self.opts.keep_array_indentation):
        self.append_token(token_text)
        self.restore_mode()
    else:
        self.restore_mode()
        self.append_token(token_text)
    self.remove_redundant_indentation(self.previous_flags)
    if (self.flags.do_while and (self.previous_flags.mode == MODE.Conditional)):
        self.previous_flags.mode = MODE.Expression
        self.flags.do_block = False
        self.flags.do_while = False
def handle_end_expr(self, token_text):
    while (self.flags.mode == MODE.Statement):
        self.restore_mode()
    if self.flags.multiline_frame:
        self.allow_wrap_or_preserved_newline(self.token_text, ((self.token_text == ']') and self.is_array(self.flags.mode) and (not self.opts.keep_array_indentation)))
    if self.opts.space_in_paren:
        if ((self.last_type == 'TK_START_EXPR') and (not self.opts.space_in_empty_paren)):
            self.output_space_before_token = False
            self.trim_output()
        else:
            self.output_space_before_token = True
    if ((self.token_text == ']') and self.opts.keep_array_indentation):
        self.append_token(token_text)
        self.restore_mode()
    else:
        self.restore_mode()
        self.append_token(token_text)
    self.remove_redundant_indentation(self.previous_flags)
    if (self.flags.do_while and (self.previous_flags.mode == MODE.Conditional)):
        self.previous_flags.mode = MODE.Expression
        self.flags.do_block = False
        self.flags.do_while = False