Preprocessor code in dead blocks need to be ignored even if it is invalid
Test case: !macro dummy p1 !macroend !if 0 ; The next line does not properly quote its string but it is not !else nor !endif so it has to be ignored !insertmacro dummy "bar' !endif git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6632 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
2a341bc918
commit
ce249976f7
4 changed files with 26 additions and 13 deletions
|
@ -150,7 +150,7 @@ double LineParser::gettoken_number(int token, int *success/*=0*/) const
|
|||
TCHAR* LineParser::gettoken_str(int token) const
|
||||
{
|
||||
token+=m_eat;
|
||||
if (token < 0 || token >= m_nt) return (TCHAR*)_T("");
|
||||
if (token < 0 || token >= m_nt) return (TCHAR*) _T("");
|
||||
return m_tokens[token];
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,8 @@ int LineParser::doline(TCHAR *line, int ignore_escaping/*=0*/)
|
|||
else line++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
int lstate=0; // 1=", 2=`, 4='
|
||||
if (*line == _T(';') || *line == _T('#'))
|
||||
{
|
||||
|
@ -213,7 +214,8 @@ int LineParser::doline(TCHAR *line, int ignore_escaping/*=0*/)
|
|||
m_incommentblock = true;
|
||||
line+=2;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
if (*line == _T('\"')) lstate=1;
|
||||
else if (*line == _T('\'')) lstate=2;
|
||||
else if (*line == _T('`')) lstate=4;
|
||||
|
@ -222,8 +224,10 @@ int LineParser::doline(TCHAR *line, int ignore_escaping/*=0*/)
|
|||
TCHAR *p = line;
|
||||
while (*line)
|
||||
{
|
||||
if (line[0] == _T('$') && line[1] == _T('\\')) {
|
||||
switch (line[2]) {
|
||||
if (line[0] == _T('$') && line[1] == _T('\\'))
|
||||
{
|
||||
switch (line[2])
|
||||
{
|
||||
case _T('"'):
|
||||
case _T('\''):
|
||||
case _T('`'):
|
||||
|
@ -247,8 +251,10 @@ int LineParser::doline(TCHAR *line, int ignore_escaping/*=0*/)
|
|||
int i;
|
||||
m_tokens[m_nt]=(TCHAR*)malloc((nc+1)*sizeof(TCHAR));
|
||||
for (i = 0; p < line; i++, p++) {
|
||||
if (!ignore_escaping && p[0] == _T('$') && p[1] == _T('\\')) {
|
||||
switch (p[2]) {
|
||||
if (!ignore_escaping && p[0] == _T('$') && p[1] == _T('\\'))
|
||||
{
|
||||
switch (p[2])
|
||||
{
|
||||
case _T('"'):
|
||||
case _T('\''):
|
||||
case _T('`'):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue