lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Thanks Tony. You are right.

This is my first PEG grammar and I don't see this detail. Change the order in Primary nonterminal solve my problem.

On Wed, Jun 1, 2011 at 3:05 PM, Tony Finch <dot@dotat.at> wrote:
Cleverton Hentz <cleverton_hentz@yahoo.com.br> wrote:
>
> I'm trying describe EBNF parser with lpeg library but my implementation of
> parser don't recognize some sentences.

The first alternative for Primary is TerminalString. This means that if
any other alternative starts with a TerminalString it cannot match, since
the Primary has already succeeded. For instance, a later alternative is
RepeatedSequence and many of its alternatives start with strings. Your
example should match a RepeatedSequence but cannot.

Tony.
--
f.anthony.n.finch  <dot@dotat.at>  http://dotat.at/
Rockall, Malin, Hebrides: South 5 to 7, occasionally gale 8 at first in
Rockall and Malin, veering west or northwest 4 or 5, then backing southwest 5
or 6 later. Rough or very rough. Occasional rain. Moderate or good,
occasionally poor.