Here is my implementation :) (Before I noticed there was one on the
examples folder)

https://gist.github.com/1392475



On Tue, Nov 20, 2012 at 5:22 AM, Thiel Chang <[email protected]> wrote:
> 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