identifies all nested pairs of containers. To qualify as a nested pair, the
closing container symbols must be immediately adjacent and the opening symbols
must either (1) be adjacent as in the above example, or (2) have an anonymous
-sub declaration following the outer opening container symbol, or (3) have an
-outer opening paren separated from the inner opening symbol by any single
-non-container symbol or something that looks like a function evaluation,
-as illustrated in the next examples.
+sub declaration following an outer opening container symbol which is not a
+code block brace, or (3) have an outer opening paren separated from the inner
+opening symbol by any single non-container symbol or something that looks like
+a function evaluation, as illustrated in the next examples.
Any container symbol may serve as both the inner container of one pair and as
the outer container of an adjacent pair. Consequently, any number of adjacent
my $i_save = $i;
while ( $i < $max_token_index ) {
+ my $last_tok_is_blank = $tok_is_blank;
if ($tok_is_blank) { $tok_is_blank = undef }
else { $i_save = $i }
# a # inside a prototype or signature can only start a comment
&& !$in_prototype_or_signature
)
- { # $#array
+ {
+ # A '#' starts a comment if it follows a space. For example,
+ # the following is equivalent to $ans=40.
+ # my $ #
+ # ans = 40;
+ if ($last_tok_is_blank) {
+ $id_scan_state = '';
+ $i = $i_save;
+ $type = 'i';
+ last;
+ }
+
+ # May be '$#' or '$#array'
$identifier .= $tok; # keep same state, a $ could follow
}
=head1 Issues fixed after release 20201001
+=item b<fix parsing problem with $#>
+
+A problem with parsing variables of the form $# and $#array was found in
+testing and fixed. For most variables the leading sigil may be separated from
+the remaining part of the identifier by whitespace. An exception is for a
+variable beginning with '$#'. If there is any space between the '$' and '#'
+then the '#' starts a comment. So the following snippet is has valid syntax
+and is equivalent to $ans=40;
+
+ my $ #
+ #
+ ans = 40;
+
+This was being misparsed and was fixed 17 Oct 2020.
+
=item b<fix missing line break for hash of subs with signatures>
During testing the following error was found and fixed.