# HG changeset patch # User Gaël Bonithon # Date 1646045309 -3600 # Node ID 5fbc41f7a8d198070c29e5adbaac345dad3ed3d8 # Parent 00ccd10a09e0bc5cc480ee1f2cf6b99227a259eb textscan: Reposition scan pointer after reading a single `.` (bug #60711). * oct-stream.cc (textscan::read_double): When a single `.` is encountered, it is indeed considered an invalid character. But it must also be put back because, unlike any other invalid character, it has caused an additional `get()` call above. This then allows the various tests for the presence of a delimiter on the next character to fail (e.g., in `textscan::read_format_once()` and `textscan_format_list::read_first_row()`), and thus finally allows `textscan()` builtin to exit correctly in error. * file-io.cc (Ftextscan): Add BIST. * doc/interpreter/contributors.in: Add new contributor to list in manual. diff -r 00ccd10a09e0 -r 5fbc41f7a8d1 doc/interpreter/contributors.in --- a/doc/interpreter/contributors.in Mon Feb 28 08:36:29 2022 +0100 +++ b/doc/interpreter/contributors.in Mon Feb 28 11:48:29 2022 +0100 @@ -34,6 +34,7 @@ David Billinghurst Don Bindner Jakub Bogusz +Gaël Bonithon Moritz Borgmann Paul Boven Richard Bovey diff -r 00ccd10a09e0 -r 5fbc41f7a8d1 libinterp/corefcn/file-io.cc --- a/libinterp/corefcn/file-io.cc Mon Feb 28 08:36:29 2022 +0100 +++ b/libinterp/corefcn/file-io.cc Mon Feb 28 11:48:29 2022 +0100 @@ -2328,6 +2328,8 @@ %! C = textscan ('5973459727478852968', '%u64'); %! assert (C{1}, uint64 (5973459727478852968)); +%!assert <*60711> (textscan('1,.,2', '%f', 'Delimiter', ','), {1}); + */ // These tests have end-comment sequences, so can't just be in a comment diff -r 00ccd10a09e0 -r 5fbc41f7a8d1 libinterp/corefcn/oct-stream.cc --- a/libinterp/corefcn/oct-stream.cc Mon Feb 28 08:36:29 2022 +0100 +++ b/libinterp/corefcn/oct-stream.cc Mon Feb 28 11:48:29 2022 +0100 @@ -2851,6 +2851,11 @@ if (i > 0) valid = true; // valid if at least one digit after '.' + else if (! valid) // if there was nothing before and after '.' + { + is.putback (ch); + ch = '.'; + } // skip remainder after '.', to field width, to look for exponent if (i == precision)