Fix a nesting bug
Before, strings such as @n@!_filename@@m wouldn't be parsed correctly because of that '@@' in there.
This commit is contained in:
17
src/parse.c
17
src/parse.c
@@ -334,17 +334,18 @@ static int expandfile(struct expandfile *ret, char *filename, int level) {
|
||||
appendchar(ret->data, c);
|
||||
continue;
|
||||
}
|
||||
c = fgetc(file);
|
||||
if (c == EOF) {
|
||||
goto no_nest_end;
|
||||
}
|
||||
appendchar(ret->data, ESCAPE_CHAR);
|
||||
appendchar(ret->data, c);
|
||||
if (c != NEST_END) {
|
||||
continue;
|
||||
}
|
||||
c = fgetc(file);
|
||||
if (c == NEST_END) {
|
||||
appendchar(ret->data, c);
|
||||
break;
|
||||
}
|
||||
ungetc(c, file);
|
||||
do {
|
||||
c = fgetc(file);
|
||||
appendchar(ret->data, c);
|
||||
} while (c != ESCAPE_CHAR);
|
||||
}
|
||||
break;
|
||||
no_nest_end:
|
||||
fprintf(stderr, "Line %d: Unmatched nest start char\n", origline);
|
||||
|
||||
Reference in New Issue
Block a user