[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: LPEG: P(fct) seems not to consume input
- From: Dirk Laurie <dirk.laurie@...>
- Date: Thu, 1 Nov 2018 07:02:18 +0200
Op Do., 1 Nov. 2018 om 00:31 het Albert Chan <albertmcchan@yahoo.com> geskryf:
> that were a lpeg safety feature, by checking fixedlen(patt) > 0
> Since patt = P(fct) is matching pattern "", fixedlen = 0
>
> All this check is to avoid patt^n get into infinite loops.
>
> P(fct) does not know fct will skip forward.
No, it doesn't — but it is obvious and easy for P(fct) to call
fct("",1) and check that "false" is returned, and taking the message
"may accept empty string" literally, that's all that the xhwxk should
be worried about.
I have not yet had the temerity to look into the LPEG source, but this
time, I might.