From: Steve Hancock <perltidy@users.sourceforge.net> Date: Sun, 30 Oct 2022 14:01:06 +0000 (-0700) Subject: skip formatting and output verbatim on any brace errors X-Git-Tag: 20221112~17 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=6aadd1051dbc24f38c77c8c728b0412dfe5a626c;p=perltidy.git skip formatting and output verbatim on any brace errors --- diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index 4abea51a..4b88f2eb 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -5773,6 +5773,11 @@ sub finish_formatting { # The file has been tokenized and is ready to be formatted. # All of the relevant data is stored in $self, ready to go. + # Some of the code in sub break_lists is not robust enough to process code + # with arbitrary brace errors. The simplest fix is to just return the file + # verbatim if there are brace errors. This fixes issue c160. + $severe_error ||= get_saw_brace_error(); + # Check the maximum level. If it is extremely large we will give up and # output the file verbatim. Note that the actual maximum level is 1 # greater than the saved value, so we fix that here.