On 24.02.2010 10:28, Şemseddin Moldibi wrote:
> Hi,
> It is strange but if I put a trace on just before the
> parse/all line script gives an error, otherwise it prints just first val=
> ue.
>
> trace on
> parse/all text [some [opt #"," hex-num]]
>
>
> Match: (print hex-to-dec hex-digits)
> Input: ,$20,$33,$0102222
> ** Script Error: Trace:  "Invalid argument:" (string)
> Trace:  :arg1 (get-word)
> Invalid argument: scheme: console
>
>
> r: copy [] parse/all {$FA,$20,$33,$0102} [some
>    ["$" copy h to "," "," (append r to-integer debase/base h 16)]
> ]
> probe r
>
>    

This string you are parsing here does not include a comma as the last 
char, as your rule demands.
just look at my two former examples.
> runs well, but the last value is missing.
> {$FA,$20,$33,$0102,} works.
>
> Anyway, I got the idea :) thanks for all the replies.
>
>
>    
>> Hi Semseddin,
>>
>> SM>  is there anyone already write a parse rule to convert hexadecimal =
>>      
> to
>    
>> SM>  decimal? here is my situation,
>>
>> Others have responded, so I'll just add this version for consderation.=
>>      
>    
>> Feel free to post any questions about the naming conventions or
>> structure.
>>
>> -- Gregg
>>
>>
>> text: {$FA,$20,$33,$0102}
>>
>> hex-digit=3D: charset "0123456798ABCDEF"
>>
>> =3Dhex-digits: none
>> hex-digits=3D: [copy =3Dhex-digits some hex-digit=3D]
>>
>> =3Dhex-num: none
>> hex-num=3D: [#"$" hex-digits=3D actions/hex-num=3D]
>>
>> actions: [
>>      hex-num=3D (print hex-to-dec =3Dhex-digits)
>> ]
>>
>> hex-to-dec: func [hex-digits [string!]] [
>>      to integer! debase/base hex-digits 16
>> ]
>>
>> parse/all text [some [opt #"," hex-num=3D]]
>>
>>
>>
>>
>>
>>
>>      
>
> -- =
>
> =DDyi =E7al=FD=FEmalar,
>
> =DEemseddin Moldibi
>    

-- 
To unsubscribe from the list, just send an email to 
lists at rebol.com with unsubscribe as the subject.

Reply via email to