lua-users home
lua-l archive

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


On 30.08.11 04:28, Patrick Donnelly wrote:
On Mon, Aug 29, 2011 at 10:07 PM, Jakub Piotr Cłapa<jpc-ml@zenburn.net>  wrote:
[1] may help.

[1] http://lua-users.org/lists/lua-l/2009-10/msg00774.html

Thanks. This is in fact one of the few things I have seen while googling for a solution. But IIUC for it to work I would have to alternate each character of each rule with an lpeg.Cmt checking i == #s.

I think I need a way to detect that lpeg tried to match beyond the end of the string. If it did (and I did not add lpeg.P(-1) at the end of the main rule) then I know that it failed because of too little data.

The problem with most "normal" solutions is that I after a match failure the capture is immediately unwound and I do not know anything about it. If I add an alternative then it will start from the beginning and a pattern concatenation will never be reached when something failes before it.

--
regards,
Jakub Piotr Cłapa