Hi,

I am trying to parse the next inputs:

pp Parser.new.float.parse_with_debug('12.3')
Output:  {:float=>"12.3"@0}

pp Parser.new.factor.parse_with_debug('12.3')
Output:  Don't know what to do with ".3" at line 1 char 3.

with the following rules:

rule(:factor)   { ( space? >> lpar.as(:lpar) >>  space? >> aex.as(:aex) 
 >> space? >>
                    rpar.as(:rpar) ) | integer | identifier |  float | 
epsilon }

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

Why does the parse statement: 
Parser.new.factor.parse_with_debug('12.3')      gives a different result ?

Can anyone tell me why?

Thanks in advance,

Thiel



Reply via email to