]> git.donarmstrong.com Git - perltidy.git/commitdiff
Update tokenizer recognition of indirect object
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 1 Mar 2021 15:32:52 +0000 (07:32 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 1 Mar 2021 15:32:52 +0000 (07:32 -0800)
bin/perltidy
lib/Perl/Tidy/Tokenizer.pm
local-docs/BugLog.pod

index 830070286efbce65af723eb0daa309914359e47d..3008a553c9df25be74d860a2c5e1f3d562339fc9 100755 (executable)
@@ -2865,7 +2865,12 @@ example:
 
 To simplify input even further for the case in which both opening and closing
 non-block containers are stacked, the flag B<-sac> or B<--stack-all-containers>
-is an abbreviation for B<-sot -sot>.
+is an abbreviation for B<-sot -sct>.
+
+Please note that if both opening and closing tokens are to be stacked, then the
+newer flag B<-weld-nested-containers> may be preferable because it insures that
+stacking is always done symmetrically.  It does this by working on formatting
+globally rather than locally, as the B<-sot> and B<-sct> flags do.
 
 =item B<-dnl>,  B<--delete-old-newlines>
 
index d45cc405ae583d50c6f109b10eb20122c7147eb1..df08f0d4e2c8570580911b0474e47083c2866040 100644 (file)
@@ -6167,8 +6167,9 @@ sub scan_bare_identifier_do {
 
                 # may not be indirect object unless followed by a space;
                 # updated 2021-01-16 to consider newline to be a space.
+                # updated for case b990 to look for either ';' or space
                 if ( pos($input_line) == length($input_line)
-                    || $input_line =~ m/\G\s+/gc )
+                    || $input_line =~ m/\G[;\s]/gc )
                 {
                     $type = 'Y';
 
index 1a3c3fd83796c40c0d827996c2700120de21a93b..286e234ddd7bb845db32e95879418c1a6947a751 100644 (file)
@@ -2,6 +2,38 @@
 
 =over 4
 
+=item B<Update tokenizer recognition of indirect object>
+
+This is the parameter file b990.pro:
+    --noadd-whitespace
+    --continuation-indentation=0
+    --maximum-line-length=7
+    --space-terminal-semicolon
+
+Applying perltidy -pro=b990.pro to the following snippet gave two states
+
+    # State 1
+    print
+    H;
+
+    # State 2
+    print H
+    ;
+
+The tokenizer was alternately parsing 'H' as either possble indirect object, 'Z',
+or indirect object, 'Y'.  Two fixes were tested. The first was to modify
+the tokenizer to recognize a ';' as well as a space as a direct object
+terminator. An alternative fix is to not allowing a break before type 'Y'
+so that the tokenizer kept parsing as type 'Y'.  Both fixes work, but the latter fix
+would change existing formatting by the -extrude option, so the first fix was
+used.  With this fix, the stable state is 'State 1' above.
+
+This update is a generalization of the update L<Fixed blinker related to line break at indirect object>
+of 16 Jan 2021.
+
+This fixes case b990.
+1 Mar 2021.
+
 =item B<Do not start a batch with a blank token>
 
 Perltidy does final formatting in discrete batches of tokens, where a batch is
@@ -37,7 +69,7 @@ as requested with the -okw flag.
 
 This update fixes cases b149 b888 b984 b985 b986 b987.
 
-28 Feb 2021.
+28 Feb 2021, 8aaf599.
 
 =item B<Avoid double spaces in -csc text output>