[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Literate Patterns
- From: David Manura <dm.lua@...>
- Date: Wed, 14 Jul 2010 20:20:09 -0400
On Wed, Jul 14, 2010 at 12:11 PM, RJ Russell <russellsprouts2@gmail.com> wrote:
> --EXAMPLE USAGE
> --%s*()([%$_%a][%$%w_]*)
> local identifiers=string.pattern.
> any'space'.
> capturepos.
> capture.
> set('$','_','letters').
> set('$','_','word').any.
> endcapture.
> endpattern()
The pattern of simulating nested syntax with a linear chain of
function is a bit hackish for me. I'd prefer something like
string.pattern [[
space anytimes capturepos
capture
set '$' '_' letters end
set '$' '_' word end anytimes
end
]]
See also the approach in [1].
[1] http://lua-users.org/wiki/ExPattern