Hi Kaspar,

I adapted the next code from the Partslet/example/JSON.rb:

rule(:number) {
(
str('-').maybe >> (
str('0') | (match('[1-9]') >> digit.repeat)
) >> (
str('.') >> digit.repeat(1)
).maybe >> (
match('[eE]') >> (str('+') | str('-')).maybe >> digit.repeat(1)
).maybe
).as(:number)
}

into:

rule(:float) {
       (
        str('-').maybe >> (
        ( match('[1-9]') >> digit.repeat)
        ) >> ( str('.') >> digit.repeat(1) )
        ).as(:float)
       }

because I needed only simple floating point numbers for a lineair 
genetic programming application.

Regards,

Thiel

Op 19-11-2012 17:25, Kaspar Schiess schreef:
> Hei Thiel,
>
> You're the second guy with this broken piece of code - can you tell me
> where you got it from? I would very much like to correct the source ;)
>
> kaspar
>
>

Reply via email to