Hi Joey,

Yes, precedence does matter. (to answer your subject first)

In fact, if you have an alternative between a parser that is easy to
satisfy (integer, say with the string '13') and a parser that is more
demanding (decimal, consuming '.2432' as well), the order does matter a
lot. Parslet (PEG parsers) will try alternatives from left to right
strictly, without magic. Once something can be matched, the alternative
is considered matched.

In your case, that would mean that the :number-rule always matches the
integer prefix of any decimal. No decimal can ever be matched with your
parser.

And finally: If that is on the website now, I am sure the input given is
always integer ;) Because it has never worked. It is a bug in
documentation (the worst kind of bugs). Would you care to correct it and
send me a patch?

regards,
kaspar

Reply via email to