[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [ANN] matchext 0.1.0 - fork and extension of Lua 5.3 pattern matching
- From: Jay Carlson <nop@...>
- Date: Sun, 24 Jan 2016 09:17:18 -0500
[offlist]
Thank you for following up on this. It builds cleanly on OS X 10.11 Xcode 7.2, although I haven't really tested it. (Add a test suite to the wish list. :-)
IMO, the most important feature for a Unicode pattern matcher is for "." and inverted ranges to match either whole codepoints or nothing. I think that would mean: given valid utf8 patterns and haystacks, no invalid utf8 can be output. "First, do no harm..."
I think the slnunicode package has a Unicode-aware pattern matcher, if you want other ideas.
Jay
> On 2016-01-24, at 4:44 AM, Jonathan Goble <jcgoble3@gmail.com> wrote:
>
> Following the discussion earlier this month [1] regarding my proposal
> for a pattern token for a balanced string with an escape character, I
> have now packaged the feature into a standalone module. Install with:
>
> luarocks install matchext
>
> `require`ing the module returns a table with five functions: "find",
> "match", "gmatch", and "gsub", which do what you expect but with the
> new feature, and "monkeypatch". Calling "monkeypatch" (which takes no
> arguments) will copy the four other functions into the standard
> "string" table, replacing the stock functions and allowing them to be
> used as methods on a string. The stock matching functions will remain
> available in the "string.original" subtable (which is created by the
> call to "monkeypatch"). The module does not do any automatic
> monkey-patching.
>
> I have tested that this compiles and runs in Lua 5.1, 5.2, and 5.3 on
> Ubuntu 14.04 using gcc, and on Lua 5.3 on Windows 10 using Visual
> Studio 2015. However, I have not extensively tested every aspect of
> it. In case it doesn't compile or run properly for you (keep in mind
> that I'm a noob when it comes to coding in C), bug reports (and pull
> requests, if you feel so inclined) are welcome at the GitHub
> repository. [2]
>
> I hope to add additional features to this in the future (see the
> LuaRocks page [3] for more details), but I make no guarantees.
>
> [1] http://lua-users.org/lists/lua-l/2016-01/threads.html#00013
> [2] https://github.com/jcgoble3/lua-matchext
> [3] https://luarocks.org/modules/jcgoble3/matchext
>