From f0214ff61b5a94b9629db6f43d7a5b010bd4ffbc Mon Sep 17 00:00:00 2001 From: lemon Date: Thu, 18 Aug 2022 09:47:54 +0200 Subject: fix bodyarg --- bootstrap/parse.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'bootstrap/parse.c') 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); -- cgit v1.2.3