[Cuis] CSV Parser in Cuis available // issue about parsing hexadecimal number with lower case letters

Juan Vuletich juan at jvuletich.org
Wed May 13 19:49:34 CDT 2015


Hi Folks,

On 5/13/2015 5:08 PM, H. Hirzel wrote:
> P.S. The description of the NeoNumberParser
>
> https://github.com/hhzl/Cuis-NeoCSV/blob/master/Neo-CSV-Core.pck.st#L69
>

According to that syntax definition, 'e-', 'e+', 'E-', 'E+' are ok, but 
'e' and 'E' could mean both exponent and digit.

For instance '1e3' could mean 1000 or it could mean 483 if in base 16. 
Same goes for '1E3'. Cuis (like Smalltalk-80) supports uppercase for 
digits and lowercase for exp.

I tried to find a spec  for numbers in CSV, but googling a bit I 
couldn't find any.

If the ambiguity can be solved someway in NeoCSV, I'd like the 
NeoNumberParser to handle it, without affecting the Cuis defaults. 
Unless the solution to the ambiguity is so compelling that I can't 
resist using it in Cuis too.

Thanks,
Juan Vuletich

> On 5/13/15, H. Hirzel<hannes.hirzel at gmail.com>  wrote:
>> Hello Juan and Sven
>>
>> About the Cuis port of NeoCSV.
>>
>> I think for this failing test
>>
>> (1 out of 50 here
>> https://github.com/hhzl/Cuis-NeoCSV/blob/master/Neo-CSV-Tests.pck.st#L635
>> )
>>
>> we have to involve Sven van Caekenberghe, the author of the package in
>> the discussion.
>>
>> The NeoCSV package has its own number parser called  NeoNumberParser
>> to make it independent. And as you write that parser relies on $b
>> digitValue = 11 by the underlying Smalltalk core.
>>
>> So the answer is yes, if Cuis has $b digitValue = 11, the tests Sven
>> requires will work unchanged.
>>
>> However maybe he is willing not to require that parsing lower case
>> letters a..f in hexadecimal is required, as you, Juan, write that this
>> leads to ambiguity.
>>
>> So we have three options
>>
>> 1) Sven removes
>>
>> self
>> assert:
>> (NeoNumberParser
>> parse: '7b'
>> base: 16)
>> equals: 123.
>>
>> from the test to facilitate future ports (there will be soon another
>> one as he has updated the package last week end.
>>
>>
>> 2) Cuis adopts
>>          $b digitValue = 11
>>
>>
>> 3) When porting I remove the requirement self
>> assert:
>> (NeoNumberParser
>> parse: '7b'
>> base: 16)
>> equals: 123.
>>
>> from the test.
>>
>>
>> I tend to prefer option 1 or 2.
>>
>> What do you think?
>>
>> Kind regards
>>
>> Hannes
>>
>>
>> cc: to Sven
>>
>> On 5/13/15, Juan Vuletich<juan at jvuletich.org>  wrote:
>>> Cool Hannes!
>>>
>>> I see that #testHexadecimalIntegers is failing. Does changing
>>> #digitValue so that $b digitValue = 11 fix this? If so, do you think
>>> that changing this behavior is risky for the regular Cuis parser? Or
>>> maybe an alternative is to change senders, and add a new method
>>> #caseInsensitiveDigitValue or similar?
>>>
>>> Thanks,
>>> Juan Vuletich
>>>
>>> On 5/9/2015 5:26 PM, H. Hirzel wrote:
>>>> Hello
>>>>
>>>> I have ported the NeoCSV package from Pharo 4.0
>>>>
>>>> Neo-CSV-Core (SvenVanCaekenberghe.21)
>>>>
>>>> Neo-CSV-Tests (SvenVanCaekenberghe.18)
>>>>
>>>>
>>>> It is available here
>>>>
>>>>       https://github.com/hhzl/Cuis-NeoCSV
>>>>
>>>> For it to work it needs the attached changeset for Cuis core.
>>>> Discussion of the addition in another thread.
>>>>
>>>>
>>>> Regards
>>>>
>>>> Hannes Hirzel
>>>





More information about the Cuis mailing list