Commit 1e20a1e7 authored by François Perrad's avatar François Perrad
Browse files

optimize some backtrack (early fail)

parent 6ed11090
Pipeline #431443 passed with stages
in 15 seconds
Revision history for lua-Silva
0.1.7
- optimize some backtrack (early fail)
0.1.6 Sat Oct 19 18:30:00 2019
- avoid string methods
- avoid string.match
......
......@@ -10,6 +10,7 @@ local char = string.char
local error = error
local tonumber = tonumber
local tostring = tostring
local find = string.find
local sub = string.sub
local gmatch = string.gmatch
local gsub = string.gsub
......@@ -157,6 +158,13 @@ local function match (s, ops)
local capture = {}
local query = false
if #ops > 1 and ops[#ops][1] == '0' then
local literal = ops[#ops][2]
if literal ~= sub(unescape(s, find(s, '?', 1, true)), -#literal) then
return
end
end
local function inner (i, ip)
for k = ip, #ops do
local op = ops[k]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment