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:
parent
f47023d9df
commit
94fc6745fa
3 changed files with 21 additions and 1 deletions
|
@ -23,6 +23,7 @@
|
||||||
LineParser::LineParser(bool bCommentBlock)
|
LineParser::LineParser(bool bCommentBlock)
|
||||||
{
|
{
|
||||||
m_bCommentBlock=bCommentBlock;
|
m_bCommentBlock=bCommentBlock;
|
||||||
|
m_incomment=false;
|
||||||
m_nt=m_eat=0;
|
m_nt=m_eat=0;
|
||||||
m_tokens=0;
|
m_tokens=0;
|
||||||
}
|
}
|
||||||
|
@ -32,6 +33,11 @@ LineParser::~LineParser()
|
||||||
freetokens();
|
freetokens();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool LineParser::inComment()
|
||||||
|
{
|
||||||
|
return m_incomment;
|
||||||
|
}
|
||||||
|
|
||||||
bool LineParser::InCommentBlock()
|
bool LineParser::InCommentBlock()
|
||||||
{
|
{
|
||||||
return m_bCommentBlock;
|
return m_bCommentBlock;
|
||||||
|
@ -140,6 +146,7 @@ void LineParser::freetokens()
|
||||||
int LineParser::doline(char *line, int ignore_escaping/*=0*/)
|
int LineParser::doline(char *line, int ignore_escaping/*=0*/)
|
||||||
{
|
{
|
||||||
m_nt=0;
|
m_nt=0;
|
||||||
|
m_incomment = false;
|
||||||
while (*line == ' ' || *line == '\t') line++;
|
while (*line == ' ' || *line == '\t') line++;
|
||||||
while (*line)
|
while (*line)
|
||||||
{
|
{
|
||||||
|
@ -159,7 +166,11 @@ int LineParser::doline(char *line, int ignore_escaping/*=0*/)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int lstate=0; // 1=", 2=`, 4='
|
int lstate=0; // 1=", 2=`, 4='
|
||||||
if (*line == ';' || *line == '#') break;
|
if (*line == ';' || *line == '#')
|
||||||
|
{
|
||||||
|
m_incomment = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
if (*line == '/' && *(line+1) == '*')
|
if (*line == '/' && *(line+1) == '*')
|
||||||
{
|
{
|
||||||
m_bCommentBlock = true;
|
m_bCommentBlock = true;
|
||||||
|
|
|
@ -23,6 +23,7 @@ class LineParser {
|
||||||
LineParser(bool bCommentBlock);
|
LineParser(bool bCommentBlock);
|
||||||
virtual ~LineParser();
|
virtual ~LineParser();
|
||||||
|
|
||||||
|
bool inComment();
|
||||||
bool InCommentBlock();
|
bool InCommentBlock();
|
||||||
int parse(char *line, int ignore_escaping=0); // returns -1 on error
|
int parse(char *line, int ignore_escaping=0); // returns -1 on error
|
||||||
int getnumtokens();
|
int getnumtokens();
|
||||||
|
@ -40,6 +41,7 @@ class LineParser {
|
||||||
int m_eat;
|
int m_eat;
|
||||||
int m_nt;
|
int m_nt;
|
||||||
bool m_bCommentBlock;
|
bool m_bCommentBlock;
|
||||||
|
bool m_incomment;
|
||||||
char **m_tokens;
|
char **m_tokens;
|
||||||
};
|
};
|
||||||
#endif//_LINEPARSE_H_
|
#endif//_LINEPARSE_H_
|
||||||
|
|
|
@ -287,7 +287,14 @@ int CEXEBuild::doParse(const char *str)
|
||||||
|
|
||||||
// keep waiting for more lines, if this line ends with a backslash
|
// keep waiting for more lines, if this line ends with a backslash
|
||||||
if (str[0] && CharPrev(str,str+strlen(str))[0] == '\\')
|
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;
|
return PS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
// parse before checking if the line should be ignored, so block comments won't be missed
|
// 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));
|
res=line.parse((char*)m_linebuild.get(),!strnicmp((char*)m_linebuild.get(),"!define",7));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue