aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'bootstrap/parse.c')
-rw-r--r--bootstrap/parse.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/bootstrap/parse.c b/bootstrap/parse.c
index 078e3dd..c018262 100644
--- a/bootstrap/parse.c
+++ b/bootstrap/parse.c
@@ -308,6 +308,8 @@ lex(struct parser *P) {
--P->expanno;
free(ep->args.d);
P->curexpan = ep->prev;
+ P->have_peektok = ep->have_peektok;
+ P->peektok = ep->peektok;
free(ep);
return lex(P);
}
@@ -2319,8 +2321,7 @@ parseexpandmacro(struct parser *P, const struct macro *macro) {
break;
}
}
- eatspaces(P);
- if (chrpeek(P) == '{') {
+ if (lexpeek(P).t == '{') {
for (int i = 0; i < macro->cs.n; ++i) {
c = macro->cs.d[i];
if (args.length == c.params.n - 1 && c.bodyarg) {
@@ -2375,6 +2376,9 @@ ok:
expan.name = macro->name;
expan.args.d = expanargs;
expan.args.n = c.params.n;
+ expan.peektok = P->peektok;
+ expan.have_peektok = P->have_peektok;
+ P->have_peektok = 0;
expan.toks = c.body;
++P->expanno;
P->curexpan = memcpy(xmalloc(sizeof expan), &expan, sizeof expan);