diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/LexLua.cxx | 22 |
1 files 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; } } |