Fixed comment handling.
git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@4328 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
parent
b8991b1482
commit
174feaed16
3 changed files with 368 additions and 324 deletions
|
@ -391,6 +391,14 @@ cfg.Add(
|
|||
)
|
||||
)
|
||||
|
||||
cfg.Add(
|
||||
BoolOption(
|
||||
'NSIS_FIX_COMMENT_HANDLING',
|
||||
'fixes comment handling',
|
||||
'yes'
|
||||
)
|
||||
)
|
||||
|
||||
### Generate help
|
||||
|
||||
Help(cfg.GenerateHelpText(defenv))
|
||||
|
@ -458,3 +466,4 @@ AddBoolDefine('NSIS_FIX_DEFINES_IN_STRINGS')
|
|||
AddBoolDefine('NSIS_SUPPORT_STANDARD_PREDEFINES')
|
||||
AddBoolDefine('NSIS_LOCKWINDOW_SUPPORT')
|
||||
AddBoolDefine('NSIS_CONFIG_PLUGIN_SUPPORT')
|
||||
AddBoolDefine('NSIS_FIX_COMMENT_HANDLING')
|
||||
|
|
|
@ -224,6 +224,10 @@ CEXEBuild::CEXEBuild() :
|
|||
// Added by Sunil Kamath 11 June 2003
|
||||
definedlist.add("NSIS_SUPPORT_STANDARD_PREDEFINES");
|
||||
#endif
|
||||
#ifdef NSIS_FIX_COMMENT_HANDLING
|
||||
// Added by Sunil Kamath 15 October 2005
|
||||
definedlist.add("NSIS_FIX_COMMENT_HANDLING");
|
||||
#endif
|
||||
|
||||
// no more optional
|
||||
definedlist.add("NSIS_SUPPORT_NAMED_USERVARS");
|
||||
|
|
|
@ -124,6 +124,7 @@ void LineParser::freetokens()
|
|||
int LineParser::doline(char *line, int ignore_escaping/*=0*/)
|
||||
{
|
||||
m_nt=0;
|
||||
#ifndef NSIS_FIX_COMMENT_HANDLING
|
||||
if ( m_bCommentBlock )
|
||||
{
|
||||
while ( *line )
|
||||
|
@ -137,17 +138,40 @@ int LineParser::doline(char *line, int ignore_escaping/*=0*/)
|
|||
line++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
while (*line == ' ' || *line == '\t') line++;
|
||||
while (*line)
|
||||
{
|
||||
#ifdef NSIS_FIX_COMMENT_HANDLING
|
||||
if ( m_bCommentBlock )
|
||||
{
|
||||
while ( *line )
|
||||
{
|
||||
if ( *line == '*' && *(line+1) == '/' )
|
||||
{
|
||||
m_bCommentBlock=false; // Found end of comment block
|
||||
line+=2;
|
||||
while (*line == ' ' || *line == '\t') line++;
|
||||
break;
|
||||
}
|
||||
else line++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
#endif
|
||||
int lstate=0; // 1=", 2=`, 4='
|
||||
if (*line == ';' || *line == '#') break;
|
||||
if (*line == '/' && *(line+1) == '*')
|
||||
{
|
||||
m_bCommentBlock = true;
|
||||
line+=2;
|
||||
#ifndef NSIS_FIX_COMMENT_HANDLING
|
||||
return doline(line, ignore_escaping);
|
||||
#endif
|
||||
}
|
||||
#ifdef NSIS_FIX_COMMENT_HANDLING
|
||||
else {
|
||||
#endif
|
||||
if (*line == '\"') lstate=1;
|
||||
else if (*line == '\'') lstate=2;
|
||||
else if (*line == '`') lstate=4;
|
||||
|
@ -170,6 +194,9 @@ int LineParser::doline(char *line, int ignore_escaping/*=0*/)
|
|||
if (lstate==2 && *line =='\'') break;
|
||||
if (lstate==4 && *line =='`') break;
|
||||
if (!lstate && (*line == ' ' || *line == '\t')) break;
|
||||
#ifdef NSIS_FIX_COMMENT_HANDLING
|
||||
if (!lstate && (*line == ';' || *line == '#' || (*line == '/' && *(line+1) == '*'))) break;
|
||||
#endif
|
||||
line++;
|
||||
nc++;
|
||||
}
|
||||
|
@ -197,6 +224,10 @@ int LineParser::doline(char *line, int ignore_escaping/*=0*/)
|
|||
else return -2;
|
||||
}
|
||||
while (*line == ' ' || *line == '\t') line++;
|
||||
#ifdef NSIS_FIX_COMMENT_HANDLING
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue