lua-users home
lua-l archive

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


On Sat, Aug 2, 2014 at 1:08 AM, Patrick Donnelly <batrick@batbytes.com> wrote:
> Hey all,
>
> Just thought I'd leave here a small success story. Today I merged a
> surprisingly small commit [1] that adds Lua's pattern matching to my
> research group's software project CCTools [2]. This was pleasantly
> simple; with only a small amount of preprocessor magic and defining
> luaL_error [3], I was able to add Lua's pattern matching code
> unmodified.
>
> Big thanks to the Lua authors for keeping the pattern matcher so well
> contained and uncoupled to Lua.
>
> [1] https://github.com/cooperative-computing-lab/cctools/commit/9fda9b1530f6946b22024c915384c9a4a5764e4b
> [2] https://github.com/cooperative-computing-lab/cctools
> [3] https://github.com/cooperative-computing-lab/cctools/commit/9fda9b1530f6946b22024c915384c9a4a5764e4b#diff-97e202fc9e79affdf0d247f0d7cf7f9eR9
>
> --
> Patrick Donnelly
>

As an aside it's perhaps worth noting that you're not the only one to
borrow the pattern matcher from Lua, though Mongrel2 removes captures
as well.

https://github.com/zedshaw/mongrel2/blob/master/src/pattern.c