From 2c5b647c3ccfa9a6ba413687006ed46744e8a921 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Sat, 8 Jun 2002 05:22:55 +0000 Subject: Patch from Philippe to fix multiline string handling. --- src/LexLua.cxx | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/LexLua.cxx b/src/LexLua.cxx index 23a999fa9..fc9607e25 100644 --- a/src/LexLua.cxx +++ b/src/LexLua.cxx @@ -81,17 +81,19 @@ static void ColouriseLuaDoc( sc.SetState(SCE_LUA_COMMENTLINE); } for (; sc.More(); sc.Forward()) { - // Handle line continuation generically. - if (sc.ch == '\\') { - if (sc.Match("\\\n")) { - sc.Forward(); - sc.Forward(); - continue; - } - if (sc.Match("\\\r\n")) { - sc.Forward(); - sc.Forward(); + if (sc.atLineStart && (sc.state == SCE_LUA_STRING)) { + // Prevent SCE_LUA_STRINGEOL from leaking back to previous line + sc.SetState(SCE_LUA_STRING); + } + + // Handle string line continuation + if ((sc.state == SCE_LUA_STRING || sc.state == SCE_LUA_CHARACTER) && + sc.ch == '\\') { + if (sc.chNext == '\n' || sc.chNext == '\r') { sc.Forward(); + if (sc.ch == '\r' && sc.chNext == '\n') { + sc.Forward(); + } continue; } } -- cgit v1.2.3