mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-03-07 17:46:58 +08:00
preproc: fix exit conditions for indirection loop
When locating the end of a %[...] construct, we need to end up with the pointer pointing to the terminating character. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
parent
ca544db4b6
commit
ec03301eb4
@ -810,26 +810,25 @@ static Token *tokenize(char *line)
|
||||
int lvl = 1;
|
||||
line += 2; /* Skip the leading %[ */
|
||||
p++;
|
||||
while (lvl && (c = *p)) {
|
||||
while (lvl && (c = *p++)) {
|
||||
switch (c) {
|
||||
case ']':
|
||||
lvl--;
|
||||
break;
|
||||
case '%':
|
||||
p++;
|
||||
if (*p == '[')
|
||||
lvl++;
|
||||
break;
|
||||
case '\'':
|
||||
case '\"':
|
||||
case '`':
|
||||
p = nasm_skip_string(p);
|
||||
p = nasm_skip_string(p)+1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
p--;
|
||||
if (*p)
|
||||
*p++ = '\0';
|
||||
type = TOK_INDIRECT;
|
||||
|
Loading…
Reference in New Issue
Block a user