lua-users home
lua-l archive

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


Slightly off topic, but since it's been brought up a few times in this thread... Has anyone out there written a "human-readable" patch/wrapper for LPEG? Every time I try to look at a non-trivial example, my brain starts to melt.

On Wed, Jul 15, 2015 at 5:14 AM, Dirk Laurie <dirk.laurie@gmail.com> wrote:
2015-07-15 11:26 GMT+02:00 John Hind <john.hind@zen.co.uk>:
>
> "%f[set], a frontier pattern; such item matches an empty string at any
> position such that the next character belongs to set and the previous
> character does not belong to set. The set set is interpreted as previously
> described. The beginning and the end of the subject are handled as if they
> were the character '\0'."
>
> Here the beginning and end are not just character classes but are
> (unnecessarily) given an explicit byte encoding breaking the "8-bit clean"
> rule for strings. There would be no need for them to have byte encodings if
> beginning and end were separate character classes.
>
> Having explicit and distinct character classes for "beginning of subject"
> and "end of subject" would regularise and formalise the conceptual framework
> as well as adding practical expressiveness.

Something like this: "%F[bos][set][eos]"?

At some stage, LPEG becomes the proper tool to use, rather than
duplicating its advanced features in the string library.




--
Brigham Toskin