lua-users home
lua-l archive

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


I want to write a non-trivial grammar in, hopefully, LPEG. The big
stumbling block I can see is that handling incorrect input files appears
to be quite hard in LPEG --- the grammar will just fail to match, rather
than producing a diagnostic, recovering, and continuing to parse.

I've seen some references on the mailing list to a few techniques for
doing error handling, which basically boil down to having a grammar
which can stop matching before the end of the file; by looking to see
how much of the grammar matched, you can tell where it failed. But that
doesn't really work for me, because I'm going to have some deeply nested
patterns.

Are there any good techniques for handling this in a sensible way?

-- 
┌─── dg@cowlark.com ───── http://www.cowlark.com ─────
│
│ "Home is where, when you have to go there, they have to take you in."
│ --- Cordelia Naismith (via Robert Frost)

Attachment: signature.asc
Description: OpenPGP digital signature