# Basic data structures...
$self->[_rlines_] = []; # = ref to array of lines of the file
$self->[_rlines_new_] = []; # = ref to array of output lines
- # (FOR FUTURE DEVELOPMENT)
+
# 'rLL' = reference to the liner array of all tokens in the file.
# 'LL' stands for 'Linked List'. Using a linked list was a disaster, but
# 'LL' stuck because it is easy to type.
$binary_ws_rules{'i'}{'Q'} = WS_YES;
$binary_ws_rules{'n'}{'('} = WS_YES; # occurs in 'use package n ()'
- # FIXME: we could to split 'i' into variables and functions
- # and have no space for functions but space for variables. For now,
- # I have a special patch in the special rules below
$binary_ws_rules{'i'}{'('} = WS_NO;
$binary_ws_rules{'w'}{'('} = WS_NO;
# &{ $_->[1] }( delete $_[$#_]{ $_->[0] } );
# At present, the above & block is marked as type L/R so this case
# won't go through here.
- if ( $last_type eq '}' ) { $ws = WS_YES }
+ if ( $last_type eq '}' && $last_token ne ')' ) { $ws = WS_YES }
# NOTE: some older versions of Perl had occasional problems if
# spaces are introduced between keywords or functions and opening
# arrow. The point is, it is best to mark function call parens
# right here before that happens.
# Patch: added 'C' to prevent blinker, case b934, i.e. 'pi()'
+ # NOTE: this would be the place to allow spaces between repeated
+ # parens, like () () (), as in case c017, but I decided that would
+ # not be a good idea.
elsif (( $last_type =~ /^[wCUG]$/ )
- || ( $last_type =~ /^[wi]$/ && $last_token =~ /^(\&|->)/ ) )
+ || ( $last_type =~ /^[wi]$/ && $last_token =~ /^([\&]|->)/ ) )
{
- $ws = WS_NO unless ($rOpts_space_function_paren);
+ $ws = $rOpts_space_function_paren ? WS_YES : WS_NO;
$set_container_ws_by_keyword->( $last_token, $seqno );
$ris_function_call_paren->{$seqno} = 1;
}
# space between something like $i and ( in <<snippets/space2.in>>
# for $i ( 0 .. 20 ) {
- # FIXME: eventually, type 'i' needs to be split into multiple
+ # FIXME: eventually, type 'i' could be split into multiple
# token types so this can be a hardwired rule.
elsif ( $last_type eq 'i' && $last_token =~ /^[\$\%\@]/ ) {
$ws = WS_YES;
if (
$expecting == OPERATOR
- # be sure this is not a method call of the form
+ # Be sure this is not a method call of the form
# &method(...), $method->(..), &{method}(...),
# $ref[2](list) is ok & short for $ref[2]->(list)
# NOTE: at present, braces in something like &{ xxx }
- # are not marked as a block, we might have a method call
- && $last_nonblank_token !~ /^([\]\}\&]|\-\>)/
+ # are not marked as a block, we might have a method call.
+ # Added ')' to fix case c017, something like ()()()
+ && $last_nonblank_token !~ /^([\]\}\)\&]|\-\>)/
)
{
if ( $next_nonblank_token ne ')' ) {
my $hint;
- # FIXME: this gives an error parsing something like
- # $subsubs[0]()(0);
- # which is a valid syntax (see subsub.t). We may
- # need to revise this coding.
error_if_expecting_OPERATOR('(');
if ( $last_nonblank_type eq 'C' ) {
=over 4
+=item B<Remove incorrect warning at repeated function paren call>
+
+This update removes an incorrect error messagge at the construct ')('. To illustrate,
+the following is a valid program:
+
+ my @words = qw(To view this email as a web page go here);
+ my @subs;
+ push @subs, sub { my $i=shift; $i %= @words; print "$words[$i] "; return $subs[0]};
+ $subs[0](0)(1)(2)(3)(4)(5)(6)(7)(8)(9)(10)(11);
+ print "\n";
+
+However perltidy was giving an error message at the ')(' combination, which is
+unusual in perl scripts. This update fixes this.
+
+These are function call parens, so logically they should be under control of
+the -sfp or --space-function-parens parameter. I wrote a patch to do this, but
+decided not to implement it. The reason is that, as noted in the manual,
+subtle errors in perl scripts can occur when spaces are placed before parens.
+So, to avoid possible problems, the -sfp parameter will be restricted to spaces
+between a bareword [assumed to be a function] and a paren.
+
+This update is in Tokenizer.pm and fixes case c017.
+
+6 Jun 2021.
+
=item B<Add warning when lexical sub names match some builtins>
This update adds a warning when lexical subs have names which match some builtin