Support for escaping quotes using $" Source\lineparse.h Source\script.cpp

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@1802 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2002-11-21 19:09:02 +00:00
parent a33eb194d7
commit c0a2659a05
3 changed files with 26 additions and 2 deletions

View file

@ -119,6 +119,15 @@ class LineParser {
int nc=0;
while (*line)
{
if (line[0] == '$' && line[1] == '\\') {
switch (line[2]) {
case '"':
case '\'':
case '`':
nc += 3;
line += 3;
}
}
if (lstate==1 && *line =='\"') break;
if (lstate==2 && *line =='\'') break;
if (lstate==4 && *line =='`') break;
@ -128,8 +137,21 @@ class LineParser {
}
if (m_tokens)
{
char *p;
int i;
m_tokens[m_nt]=(char*)malloc(nc+1);
strncpy(m_tokens[m_nt],line-nc,nc);
for (i = 0, p = line - nc; p < line; i++, p++) {
if (p[0] == '$' && p[1] == '\\') {
switch (p[2]) {
case '"':
case '\'':
case '`':
p += 2;
}
}
m_tokens[m_nt][i] = *p;
}
//strncpy(m_tokens[m_nt],line-nc,nc);
m_tokens[m_nt][nc]=0;
}
m_nt++;

View file

@ -2427,7 +2427,7 @@ int CEXEBuild::doCommand(int which_token, LineParser &line, FILE *fp, const char
ent.offsets[4] |= (c) << 16;
}
}
SCRIPT_MSG("CreateShortCut: \"%s\"->\"%s\" %s icon:%s,%d, showmode=0x%X, hotkey=0x%X, comment=%s\n",
SCRIPT_MSG("CreateShortCut: \"%s\"->\"%s\" %s icon:%s,%d, showmode=0x%X, hotkey=0x%X, comment=%s\n",
line.gettoken_str(1),line.gettoken_str(2),line.gettoken_str(3),
line.gettoken_str(4),ent.offsets[4]&0xff,(ent.offsets[4]>>8)&0xff,ent.offsets[4]>>16,line.gettoken_str(8));
return add_entry(&ent);

View file

@ -10,6 +10,8 @@ DOCUMENTATION
* go over everything and search for mistakes :)
* write something about me and nsis 2 in the intro
EXAMPLES
* write an advanced paging example showing multiple components page with multiple instfiles pages