Skip to content

Releases: jcgoble3/lua-matchext

Bug fixes and minor improvements

Choose a tag to compare

@jcgoble3 jcgoble3 released this 12 May 07:48

This release (the first in a long time) pulls in all upstream changes in Lua 5.3.3 (5.3.4 had zero changes affecting pattern matching), including a fix for a bug involving gmatch and coroutines and removal of non-linear complexity limits.

As a side effect of bringing in these changes, the behavior of gmatch and gsub (including the table-return versions of those functions provided by this module) has changed with regard to empty matches. While I disagree with this change being made in a bugfix release, the Lua team is correct that it was technically undefined behavior, so is valid in a bugfix release.

Under the hood, the CI testing has been significantly improved, including the introduction of AppVeyor for testing on Windows. Finally, a number of unnecessary C standard library header includes have been removed from the main source file.

Minor rockspec update

Choose a tag to compare

@jcgoble3 jcgoble3 released this 13 Feb 07:42

Updated the detailed description in the rockspec; no code changes. If you've already installed v0.3.0-1, there is no need to update.

Escape function

Choose a tag to compare

@jcgoble3 jcgoble3 released this 11 Feb 07:11

Barring bugfixes, this will likely be the last release for a while, while I figure out how to implement some enhanced regex-style matching features.

New feature:

  • escape(s): escapes all ASCII non-alphanumeric non-control code characters in s

Bug fixed:

  • pattern ending in %B with exactly two arguments would attempt to match '\0' as the third argument; now an error is correctly thrown

Under-the-hood improvement:

  • method of storing whether gmatch wanted traditional or table results was changed from a separate upvalue to a field in the GMatchState struct upvalue
  • some leftover code from an earlier attempt at implementing the table functions with a userdata instead was removed

View all code changes since v0.2.0-1 here.

Fix for match tables

Choose a tag to compare

@jcgoble3 jcgoble3 released this 07 Feb 05:57

Fixes a bug in the expand() method of match tables, where a %n index could result in trying to add nil to the buffer if n was not a valid capture index. The method now checks the length of the table and throws an error if n exceeds the table length.

Match tables

Choose a tag to compare

@jcgoble3 jcgoble3 released this 07 Feb 05:43

This release adds three new matching functions (tmatch, tgmatch, and tgsub) that produce a table of match data rather than producing a separate result for each capture. Documentation has been added to the README file describing these functions and the layout of the match table.

Under the hood, the dependency on luaL_tolstring, for which a basic version had to be provided in the library for Lua 5.1 compatibility, was removed completely. Since the only two uses of it can only be called on a string or integer, all Lua versions now use the standard API function lua_tostring to handle that case.

Better testing, minor optimization

Choose a tag to compare

@jcgoble3 jcgoble3 released this 26 Jan 05:39

This release contains a minor optimization for Lua 5.1 only, for the specific case where the replacement string passed to gsub contains backreferences. Namely, since the backreferences can only refer to strings (normal captures) or integers (position captures), the call to the __tostring metamethod was removed from the function that coerced it to a string.

Additionally, this release includes an overhaul of the test script, which now uses busted.

Setup of rockspec for automatic deployment

Choose a tag to compare

@jcgoble3 jcgoble3 released this 25 Jan 04:42

This revision does nothing except add a basic test script and set things up for automated testing and LuaRocks deployment via Travis CI. There are no code changes in this revision.

Initial release

Choose a tag to compare

@jcgoble3 jcgoble3 released this 24 Jan 08:48

First release. Probably needs more testing, etc. I don't guarantee that this won't crash your system, although the testing I've done says it won't. (Tested on Ubuntu 14.04 with Lua 5.1, 5.2, and 5.3, and on Windows 10 with Lua 5.3.)

Feature(s):

  • %Bxyz: Same as %bxz, except y is interpreted as an escape character, causing the next character to be ignored.
  • Possibly more to come later; see the rockspec for details.