octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

import data test failure : was Re Octave 3.8.1-rc4 release candidate ava


From: John D
Subject: import data test failure : was Re Octave 3.8.1-rc4 release candidate available for ftp
Date: Fri, 28 Feb 2014 18:17:20 -0500


On 02/27/2014 08:25 PM, Daniel J Sebald wrote:
> Rik,
> 
> This is something we worked on a while back...
> 
> On 02/27/2014 03:25 PM, John D wrote:
> 
>>    ***** test
>>   ## No separator, 1 column of data only
>>   A = [3.1;-7.2;0;0.012;6.5;128];
>>   fn  = tmpnam ();
>>   fid = fopen (fn, "w");
>>   fprintf (fid, "%f\n", A);
>>   fclose (fid);
>>   [a1,d1,h1] = importdata (fn, "");
>>   [a2,d2,h2] = importdata (fn);
>>   unlink (fn);
>>   assert (a1, A);
>>   assert (d1, "");
>>   assert (h1, 0);
>>   assert (a2, A);
>>   assert (d2, "");
>>   assert (h2, 0);
>> !!!!! test failed
>> regexp: invalid range in character class at position 4 of expression
>>
>> --
>>
>> If I change importdata.m importdata_ascii line 182
>> From: delim = regexp (row, '[+-\d.eE\*ij ]+([^+-\d.ij])[+-\d.ij]',
>>            'tokens', 'once');
>> To: delim = regexp (row, '[\+\-\d.eE\*ij ]+([^\+\-\d.ij])[\+\-\d.ij]',
>>            'tokens', 'once');
>>
>> It then passes
> 
> Good catch.  I wonder why there is an issue here on just OSX.  Is it 
> because + and - are not considered ASCII?  Different library version,
perhaps?
> 
The regexp should be changed as it is not compliant.  According to the PCRE
documentation:

"The minus (hyphen) character can be used to specify a range of characters
in a character class. For example, [d-m] matches any letter between d and m,
inclusive. If a minus character is required in a class, it must be escaped
with a backslash or appear in a position where it cannot be interpreted as
indicating a range, typically as the first or last character in the class."

Either the minus character should be escaped or the pattern should be
written with the '-' as the first character.  Right now it is trying to
construct a range from '+' to '\'.  In the same vein of using PCRE
correctly, one doesn't need to escape '*' when it is in a character class.

Perhaps the original reporter could try the following at line 182 of
importdata:

delim = regexp (row, '[-+\d.eE*ij ]+([^-+\d.ij])[-+\d.ij]',
                'tokens', 'once');

This change works on a Linux machine just fine, and should work on the Mac
as well.

--Rik


Changing the +/- as above works for me in both Windows on linux.
My linux version of pcre was 8.33, the mxe-octave version used for Windows
is 8.34.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]