def allow_wrap_or_preserved_newline(self, token_text, force_linewrap = False):
        if self.opts.wrap_line_length > 0 and not force_linewrap:
            line = self.output_lines[-1]

            # never wrap the first token of a line.
            if len(line.text) > 0:
                proposed_line_length = len(''.join(line.text)) + len(token_text)
                if self.output_space_before_token:
                    proposed_line_length += 1

                if proposed_line_length >= self.opts.wrap_line_length:
                    force_linewrap = True

        if ((self.opts.preserve_newlines and self.input_wanted_newline) or force_linewrap) and not self.just_added_newline():
            self.append_newline(preserve_statement_flags = True)

            # Expressions and array literals already indent their contents.
            if not (self.is_array(self.flags.mode) or self.is_expression(self.flags.mode)):
                self.output_wrapped = True
dataset/ETHPy150Open Masood-M/yalih/jsbeautifier/build/lib.linux-i686-2.7/jsbeautifier/__init__.py/Beautifier.allow_wrap_or_preserved_newline/original