Steve Hancock [Sat, 4 Mar 2023 15:41:59 +0000 (07:41 -0800)]
improve recombine operation, c200
This update consolidates the three possible optimization methods in the
recombine operation into a single, simpler method which can be
shown to run in linear time.
Steve Hancock [Mon, 20 Feb 2023 23:56:12 +0000 (15:56 -0800)]
remove unused vars
I found these with a utility I wrote to scan for unused vars. Most are
remnants from debugging, or variables that might have been useful but
were not actually used. I left a few unused hashes in the tokenizer which
might be useful in the future.
Steve Hancock [Fri, 10 Feb 2023 15:27:37 +0000 (07:27 -0800)]
simplify code for setting comma breakpoints, part 4
This completes restructuring of the complex code which
forms tables. The maximum McCabe number has been reduced from
about 140 to 54 by splitting it into several subs, without any
efficiency loss or change in function. This will simplify maintenance
and debugging.
Steve Hancock [Wed, 8 Feb 2023 14:54:35 +0000 (06:54 -0800)]
fix c186, c187
Allow more iterations in recombine operation when the number of lines
in the script increases significantly during formatting. In case c187,
the entire input script was a single very long line.
Steve Hancock [Sun, 5 Feb 2023 22:12:22 +0000 (14:12 -0800)]
Add INITIALIZER comments for globals
Skipping the re-initialization of a global control variable can cause
bugs which are extremely difficult to track down. So it helps to have comments
indicating where this occurs.
Steve Hancock [Sun, 5 Feb 2023 00:39:00 +0000 (16:39 -0800)]
avoid possibility of starting a random run twice
The GO.sh script is immediately moved to backup when a run starts.
That way it cannot be accidentally started again. Previously it was
moved to backup when a run ended.
Steve Hancock [Fri, 3 Feb 2023 22:09:59 +0000 (14:09 -0800)]
reduce max_mccabe
The Formatter routines with highest McCabe values are currently these.
It is difficult to reduce them without significantly slowing processing.
set_bond_strengthws 121
grind_batch_of_CODE 119
set_comma_breakpoints_final 119
set_whitespace_flags 117
process_line_inner_loop 114
break_lines_inner_loop 113
set_vertical_tightness_flags 104
weld_nested_containers 101
Steve Hancock [Sun, 29 Jan 2023 23:57:46 +0000 (15:57 -0800)]
fix b1447; improve sub set_whitespace_flags
This should have been two commits. The first, fix b1447, is just 1 line
and will influence almost no code. The second improves the efficiency
of sub set_whitespace flags, mostly by processing comments faster. It
also fixes a minor problem with marking a sub call for special
formatting when a side comment appears between the sub name and
opening paren (issue c182).
Steve Hancock [Fri, 20 Jan 2023 22:19:32 +0000 (14:19 -0800)]
issue c179, rt #145706, multi-line class statement
This update improves the ability to automatically identify
an older style class statement if it spans multiple lines.
This avoids a needless warning message and allows the default
to be --use-feature=class.
Steve Hancock [Sat, 14 Jan 2023 21:56:28 +0000 (13:56 -0800)]
add expected output check for run_convergence_tests.pl
This is a large database of weird test cases which had convergence
problems at one time in random testing. This is run after all
software updates, to be sure they all still converge.
This update adds a check for any changes in formatting.
Steve Hancock [Sat, 14 Jan 2023 14:44:16 +0000 (06:44 -0800)]
make similar line breaks for -wba='.' and -wbb='.' (c172, c174)
The goal of this change is to make switching from breaks before '.'s
to breaks after '.'s just move the dots from the end of
lines to the beginning of lines. To do this, some special rules for
breaking before '.'s were duplicated for breaking after '.'s.
Steve Hancock [Sat, 31 Dec 2022 17:24:04 +0000 (09:24 -0800)]
add --use-feature=class, part 1
This version adds option --use-feature='class' to format code using "use feature 'class'" (see rt145706). The main changes are:
'class' is treated as a generalization of 'package'. It is updated to accept
attributes and an optional BLOCK.
'method' is handled using the existing --sub-alias-list option,
i.e. --sub-alias-list=method
'field' is treated the same as 'my'
'ADJUST' is treated like 'BEGIN'
In a future update, the new option --use-feature="class" will be set
to be the default. That requires some additional updates to avoid
conflicts with older uses of these keywords.