lua-users home
lua-l archive

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


2014-09-01 9:55 GMT+02:00 Sean Conner <sean@conman.org>:

> I often wished this were true of LPeg:
>
>         lpeg.match(pattern,subject[,init])
>
>                 pattern - LPeg expressoin
>                 subject - if string, use as input (what we have now)
>                           if function, call function to get input
>                           (much like how load() works)
>                 init    - where in input to start

At present LPeg can diagnose that a pattern is left recursive
and bail out instead of looping infinitely. If LPeg did the above,
it could in principle go into an infinite loop. On the other hand,
no more so than can load().

How hard would it be, having the code of load() as a model,
to patch LPeg so that it behaves as you describe?