lua-users home
lua-l archive

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


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