complain("Repeated ','s \n");
}
+ # Note that we have to check both token and type here because a
+ # comma following a qw list can have last token='(' but type = 'q'
+ elsif ( $last_nonblank_token eq '(' && $last_nonblank_type eq '{' )
+ {
+ warning("Unexpected leading ',' after a '('\n");
+ }
+
# patch for operator_expected: note if we are in the list (use.t)
if ( $statement_type eq 'use' ) { $statement_type = '_use' }
-## FIXME: need to move this elsewhere, perhaps check after a '('
-## elsif ($last_nonblank_token eq '(') {
-## warning("Leading ','s illegal in some versions of perl\n");
-## }
+
},
';' => sub {
$context = UNKNOWN_CONTEXT;
# ATTRS: for a '{' following an attribute list, reset
# things to look like we just saw the sub name
- # FIXME: need to end with \b here??
- if ( $statement_type =~ /^sub/ ) {
+ if ( $statement_type =~ /^sub\b/ ) {
$last_nonblank_token = $statement_type;
$last_nonblank_type = 'i';
$statement_type = "";
'&&' => sub {
error_if_expecting_TERM()
if ( $expecting == TERM && $last_nonblank_token ne ',' ); #c015
- },
+ },
'||' => sub {
error_if_expecting_TERM()
if ( $expecting == TERM && $last_nonblank_token ne ',' ); #c015
- },
+ },
'//' => sub {
error_if_expecting_TERM()
}
}
- # FIXME: Patch: mark something like x4 as an integer for now
+ # NOTE: mark something like x4 as an integer for now
# It gets fixed downstream. This is easier than
# splitting the pretoken.
else {
}
}
- # FIXME: could check for error in which next token is
- # not a word (number, punctuation, ..)
else {
$is_constant{$current_package}{$next_nonblank_token}
= 1;
# msg = a warning or diagnostic message
# USES GLOBAL VARIABLES: $last_nonblank_token
- # FIXME: this needs to be rewritten
-
my ( $i, $rtokens, $rtoken_map, $max_token_index ) = @_;
my $is_pattern = 0;
my $msg = "guessing that ? after $last_nonblank_token starts a ";
# handle v-string without leading 'v' character ('Two Dot' rule)
# (vstring.t)
- # TODO: v-strings may contain underscores
+ # Here is the format prior to including underscores:
+ ## if ( $input_line =~ /\G((\d+)?\.\d+(\.\d+)+)/g ) {
pos($input_line) = $pos_beg;
- if ( $input_line =~ /\G((\d+)?\.\d+(\.\d+)+)/g ) {
+ if ( $input_line =~ /\G((\d[_\d]*)?\.[\d_]+(\.[\d_]+)+)/g ) {
$pos = pos($input_line);
my $numc = $pos - $pos_beg;
$number = substr( $input_line, $pos_beg, $numc );
=over 4
+=item B<add v-string underscores; warn of leading commas>
+
+This update cleans up a couple of open issues in the tokenizer.
+
+A warning message will be produced for a list which begins with a comma:
+
+ my %string = (
+ , "saddr", $stest, "daddr",
+ $dtest, "source", $sname, "dest")
+
+This warning had been temporarily deactivated.
+
+Underscores in v-strings without a leading 'v' are now parsed correctly.
+
+Several comments have been updated.
+
+31 May 2021.
+
=item B<Fix parsing error at operator following a comma>
The following lines are syntactically correct but some were producing a
This has been fixed. This fixes case c015.
-27 May 2021.
+27 May 2021, b537a72.
=item B<Added optional o in octal number definitions>