lua-users home
lua-l archive

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

It was thus said that the Great Dirk Laurie once stated:
> 2013/5/1 Pierre-Yves Gérardy <>:
> > This has to be refined.
> The current version, incorporating all those points, is available at
> Download lua-brief.html, don't open it, it opens as HTML source.

  And I have a few examples of LPeg use here:

  Start with ip.lua, specifically IPv4.  It's probably the easiest
production to start with (it matches an IPv4 address, and returns it as a
four-byte network address in network byte order).  The IPv6 production looks
intimidating, but it's really quite straightforward, if a bit of a
brute-force parsing of IPv6 addresses (it returns a 16-byte address in
network-byte order).

  Both email.lua and json.lua use the re module extensively.  I find re to
be a bit more readable than raw LPeg but that's me.