diff options
| author | S. Gilles <sgilles@math.umd.edu> | 2017-03-24 01:35:17 -0400 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2017-03-24 13:51:29 +0100 |
| commit | 9308e373844377f0db1f4f0d24d963dbd67c63ba (patch) | |
| tree | 3372ba39c2e3b668fefad8dcd764520af3b40c98 /lua/lexers | |
| parent | d555c905bfd2aed879a912da7b4446b6374981ee (diff) | |
| download | vis-9308e373844377f0db1f4f0d24d963dbd67c63ba.tar.gz vis-9308e373844377f0db1f4f0d24d963dbd67c63ba.tar.xz | |
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 (limited to 'lua/lexers')
| -rw-r--r-- | lua/lexers/perl.lua | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/lua/lexers/perl.lua b/lua/lexers/perl.lua index 58c121c..b490c7f 100644 --- 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) |
