[code] [scintillua] LPeg update

From: Mitchell <m.att.foicica.com>
Date: Sat, 19 Jul 2014 22:28:40 -0400 (EDT)


Even though LPeg v0.12 has been around for a year, Scintillua has been
stuck on v0.10 due to a "loop body may accept empty string" error caused
by a potential upgrade to 0.12.

After digging into this further, I've been able to identify the problem.
It is caused by a pattern that consists of only an `lpeg.P(function() ...
end)` construct, since LPeg v0.12's compiler treats such patterns as
"nullable" (meaning they can match the empty string). The solution is to
use `lpeg.Cmt(patt, function() ... end)`, which matches a candidate chunk
of text and then calls the given function to verify the match. Here's an
example in the Lua lexer and matching long strings[1].

I've fixed the affected lexers accordingly and Scintillua hg now utilizes
LPeg v0.12. (I think the lexers are backwards compatible with v0.10 if
your application wants to remain on that version.) This will show up in
tonight's nightly build.

Users with custom lexers may have to update those lexers with a similar
fix to [1] mentioned above. You can see the entire changeset here[2]. The
Markdown and reST lexers also had `lpeg.P()` to `lpeg.Cmt()` conversions.

This change also affects lexers used with Textadept starting with
tonight's nighly build.


[1]: http://foicica.com/hg/scintillua/diff/bfe6008eb013/lexers/lua.lua
[2]: http://foicica.com/hg/scintillua/rev/bfe6008eb013

You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Sat 19 Jul 2014 - 22:28:40 EDT

This archive was generated by hypermail 2.2.0 : Sun 20 Jul 2014 - 06:46:10 EDT