fixed bug #1554178 - Compiler ignores next line after comment line ends with \

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4876 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2007-01-24 13:24:28 +00:00
parent f47023d9df
commit 94fc6745fa
3 changed files with 21 additions and 1 deletions

View file

@ -23,6 +23,7 @@
LineParser::LineParser(bool bCommentBlock)
{
m_bCommentBlock=bCommentBlock;
m_incomment=false;
m_nt=m_eat=0;
m_tokens=0;
}
@ -32,6 +33,11 @@ LineParser::~LineParser()
freetokens();
}
bool LineParser::inComment()
{
return m_incomment;
}
bool LineParser::InCommentBlock()
{
return m_bCommentBlock;
@ -140,6 +146,7 @@ void LineParser::freetokens()
int LineParser::doline(char *line, int ignore_escaping/*=0*/)
{
m_nt=0;
m_incomment = false;
while (*line == ' ' || *line == '\t') line++;
while (*line)
{
@ -159,7 +166,11 @@ int LineParser::doline(char *line, int ignore_escaping/*=0*/)
}
else {
int lstate=0; // 1=", 2=`, 4='
if (*line == ';' || *line == '#') break;
if (*line == ';' || *line == '#')
{
m_incomment = true;
break;
}
if (*line == '/' && *(line+1) == '*')
{
m_bCommentBlock = true;

View file

@ -23,6 +23,7 @@ class LineParser {
LineParser(bool bCommentBlock);
virtual ~LineParser();
bool inComment();
bool InCommentBlock();
int parse(char *line, int ignore_escaping=0); // returns -1 on error
int getnumtokens();
@ -40,6 +41,7 @@ class LineParser {
int m_eat;
int m_nt;
bool m_bCommentBlock;
bool m_incomment;
char **m_tokens;
};
#endif//_LINEPARSE_H_

View file

@ -287,7 +287,14 @@ int CEXEBuild::doParse(const char *str)
// 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;
}
// parse before checking if the line should be ignored, so block comments won't be missed
res=line.parse((char*)m_linebuild.get(),!strnicmp((char*)m_linebuild.get(),"!define",7));