From 63d000e9c5d13ed68dde3a711e394882d12c1c13 Mon Sep 17 00:00:00 2001 From: kichik Date: Sun, 18 Nov 2007 19:19:55 +0000 Subject: [PATCH] implemented RFE #1686589 and fixed bug #1701051 - improve warning for backslash line end in comment git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5380 212acab6-be3b-0410-9dea-997c60f758d6 --- Source/script.cpp | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/Source/script.cpp b/Source/script.cpp index e291e1f4..5061fb8d 100644 --- a/Source/script.cpp +++ b/Source/script.cpp @@ -285,16 +285,26 @@ int CEXEBuild::doParse(const char *str) if (m_linebuild.getlen()>1) m_linebuild.resize(m_linebuild.getlen()-2); + // warn of comment with line-continuation + if (m_linebuild.getlen()) + { + LineParser prevline(inside_comment); + prevline.parse((char*)m_linebuild.get()); + LineParser thisline(inside_comment); + thisline.parse((char*)str); + + if (prevline.inComment() && !thisline.inComment()) + { + warning_fl("comment contains line-continuation character, following line will be ignored"); + } + } + + // add new line to line buffer m_linebuild.add(str,strlen(str)+1); // keep waiting for more lines, if this line ends with a backslash if (str[0] && CharPrev(str,str+strlen(str))[0] == '\\') { - line.parse((char*)m_linebuild.get()); - if (line.inComment()) - { - warning_fl("comment contains line-continuation character, following line will be ignored"); - } return PS_OK; }