summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Silverstone <dsilvers@digital-scurf.org>2013-05-23 22:08:01 +0100
committerDaniel Silverstone <dsilvers@digital-scurf.org>2013-05-23 22:08:01 +0100
commitd7f61fb014c80b2398d0ad58ba60ecc03e08ef9e (patch)
tree59d45afa6bc50da878f92eeb8df8106ad88f958e
parent69fb628e6211602ee9e3826f66b144483e42bf26 (diff)
downloadgitano-d7f61fb014c80b2398d0ad58ba60ecc03e08ef9e.tar.gz
LACE: Add PCRE support to simple matcherdsilvers/revamp-patterns
This adds PCRE support to the simple matcher. In order for this to work, lrexlib is required (lua-rex-pcre in Debian/Ubuntu).
-rw-r--r--lib/gitano/lace.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/gitano/lace.lua b/lib/gitano/lace.lua
index 7fc1be5..97ed91b 100644
--- a/lib/gitano/lace.lua
+++ b/lib/gitano/lace.lua
@@ -9,6 +9,8 @@ local util = require 'gitano.util'
local gall = require 'gall'
local log = require 'gitano.log'
+local pcre = require "rex_pcre"
+
local function _loader(ctx, _name)
local global_name = _name:match("^global:(.+)$")
local name, tree, sha = global_name or _name
@@ -56,7 +58,10 @@ local match_types = {
end,
pattern = function(want, have)
return (have:match(want) ~= nil)
- end
+ end,
+ pcre = function(want, have)
+ return (pcre.match(have, want) ~= nil)
+ end
}
do