Commit 0178045f authored by Jamie A. Jennings's avatar Jamie A. Jennings

Codegen now called when an rplx object is created, instead of lazy approach we...

Codegen now called when an rplx object is created, instead of lazy approach we had before, where it would be delayed until the rplx object is used to do matching.
parent 769a56ba
......@@ -731,16 +731,17 @@ engine =
-- streamlined version of engine_match that does not need to check to see if the
-- expression is a string and compile it.
create_rplx = function(en, pattern)
return rplx.factory{ engine=en,
pattern=pattern,
match=function(self, input, start, encoder, t0, t1)
local ok, m, left, abend, t0, t1 =
engine_match(en, self, input, start, encoder, t0, t1)
return m, left, abend, t0, t1
end,
Cmatch=Cmatch,
};
end
pattern.peg:codegen()
return rplx.factory{ engine=en,
pattern=pattern,
match=function(self, input, start, encoder, t0, t1)
local ok, m, left, abend, t0, t1 =
engine_match(en, self, input, start, encoder, t0, t1)
return m, left, abend, t0, t1
end,
Cmatch=Cmatch,
};
end
rplx = recordtype.new("rplx",
{ pattern=recordtype.NIL;
......
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