Mercurial > octave
comparison libinterp/corefcn/oct-stream.cc @ 28182:56349d9ca566
Fix textscan when literal and delimiter might be the same character (bug #58008).
* file-io.cc (Ftextscan): Add BIST test for bug #58008.
* oct-stream.cc (textscan::read_format_once): Skip delimiters at beginning of
text before trying to match new fmt element. However, if fmt element is a
literal which begins with a delimiter character, don't skip, because text
must match exactly.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 28 Mar 2020 15:59:47 -0700 |
parents | c20b7290c778 |
children | abcff237241f |
comparison
equal
deleted
inserted
replaced
28181:2a47c8633982 | 28182:56349d9ca566 |
---|---|
3498 out++; | 3498 out++; |
3499 | 3499 |
3500 elem = fmt_list.next (); | 3500 elem = fmt_list.next (); |
3501 char *pos = is.tellg (); | 3501 char *pos = is.tellg (); |
3502 | 3502 |
3503 // FIXME: these conversions "ignore delimiters". Should they include | 3503 // Skip delimiter before reading the next fmt conversion, |
3504 // delimiters at the start of the conversion, or can those be skipped? | 3504 // unless the fmt is a string literal which begins with a delimiter, |
3505 if (elem->type != textscan_format_elt::literal_conversion | 3505 // in which case the literal must match everything. Bug #58008 |
3506 // && elem->type != '[' && elem->type != '^' && elem->type != 'c' | 3506 if (elem->type != textscan_format_elt::literal_conversion) |
3507 ) | 3507 skip_delim (is); |
3508 else if (! is_delim (elem->text[0])) | |
3508 skip_delim (is); | 3509 skip_delim (is); |
3509 | 3510 |
3510 if (is.eof ()) | 3511 if (is.eof ()) |
3511 { | 3512 { |
3512 if (! done) | 3513 if (! done) |