vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit b2937f9a5a7aa757bb741aa87fe917a01f77a436 parent 4811a653ca9ea10408bef8d2a79b3d24635d9a4d Author: S. Gilles <sgilles@math.umd.edu> Date: Fri, 24 Mar 2017 01:35:17 -0400 lexers: fix perl pattern for horrible regex lines Under presently-not-precise circumstances, regex patterns longer than a screenful can cause first_match_pos to be nil. In this sutation, evaluating `first_match_pos - 1' will be an error, so jump to matchless case. Diffstat:
| M | lua/lexers/perl.lua | | | 3 | +++ |
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/lua/lexers/perl.lua b/lua/lexers/perl.lua @@ -46,6 +46,9 @@ local literal_delimitted2 = P(function(input, index) -- for 2 delimiter sets patt = l.delimited_range(delimiter) end first_match_pos = lpeg.match(patt, input, index) + if not first_match_pos then + return #input + 1 + end final_match_pos = lpeg.match(patt, input, first_match_pos - 1) if not final_match_pos then -- using (), [], {}, or <> notation final_match_pos = lpeg.match(l.space^0 * patt, input, first_match_pos)