]> git.donarmstrong.com Git - perltidy.git/commitdiff
initialize global var %matching_token in BEGIN block
authorSteve Hancock <perltidy@users.sourceforge.net>
Sun, 5 Feb 2023 15:32:52 +0000 (07:32 -0800)
committerSteve Hancock <perltidy@users.sourceforge.net>
Sun, 5 Feb 2023 15:32:52 +0000 (07:32 -0800)
lib/Perl/Tidy/Formatter.pm

index ee11a84f71adc5091e2c276500200f7fa3f20a23..37d61b2859c447e67fdfc1bf2b257a07b434e893 100644 (file)
@@ -258,6 +258,7 @@ my (
     %is_counted_type,
     %is_opening_sequence_token,
     %is_closing_sequence_token,
+    %matching_token,
     %is_container_label_type,
     %is_die_confess_croak_warn,
     %is_my_our_local,
@@ -312,7 +313,6 @@ my (
     %space_after_keyword,
 
     %tightness,
-    %matching_token,
 
     %opening_vertical_tightness,
     %closing_vertical_tightness,
@@ -723,6 +723,18 @@ BEGIN {
     @q = qw< } ) ] : >;
     @is_closing_sequence_token{@q} = (1) x scalar(@q);
 
+    %matching_token = (
+        '{' => '}',
+        '(' => ')',
+        '[' => ']',
+        '?' => ':',
+
+        '}' => '{',
+        ')' => '(',
+        ']' => '[',
+        ':' => '?',
+    );
+
     # a hash needed by sub break_lists for labeling containers
     @q = qw( k => && || ? : . );
     @is_container_label_type{@q} = (1) x scalar(@q);
@@ -1664,17 +1676,6 @@ EOM
         '[' => $rOpts->{'square-bracket-tightness'},
         ']' => $rOpts->{'square-bracket-tightness'},
     );
-    %matching_token = (
-        '{' => '}',
-        '(' => ')',
-        '[' => ']',
-        '?' => ':',
-
-        '}' => '{',
-        ')' => '(',
-        ']' => '[',
-        ':' => '?',
-    );
 
     if ( $rOpts->{'ignore-old-breakpoints'} ) {