Skip Menu |
 

This queue is for tickets about the Fortran-Format CPAN distribution.

Report information
The Basics
Id: 69781
Status: new
Priority: 0/
Queue: Fortran-Format

People
Owner: Nobody in particular
Requestors: jini.zh [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.90
Fixed in: (no value)



MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Mailer: MIME-tools 5.427 (Entity 5.427)
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 1318
Download (untitled) / with headers
text/plain 1.2k
perl -MFortran::Format -le 'print join "\t", Fortran::Format->new("E5.1,E5.1")->read("1.1E12.2E2", 1, 1)' Fortran::Format parse error: invalid or unimplemented token: .; pos=7 E5.1,E5.1 ^ called at -e line 1 Expected output: 11 220 The problem is that the format parser ignores commas, and the format string in this example is parsed as "E5.1E5,.1", with second "E" being treated as modification to the number of digits in the exponent of the first "E". Here is the solution: diff --git a/Format.pm b/Format.pm index 82e0c65..46c5a73 100644 --- a/Format.pm +++ b/Format.pm @@ -460,7 +460,6 @@ sub tokenize { $state = 3, next if $char =~ /\d/; # number $state = 5, next if $char =~ /[+-]/; # sign next if $char eq ' '; # skip space - next if $char eq ','; # skip comma push @toks, {tok => $tok, pos => $tok_pos}; } elsif ($state == 1) { $tok .= $char; # string contents @@ -1333,6 +1332,8 @@ sub parse { $tokenizer, writer => $self->writer ); + } elsif ($tok eq ',') { # token separator + # skip it } else { die "invalid or unimplemented token: $tok\n"; }


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.