From a9e3c42ac5696c56adaffbb4007e9d969563337b Mon Sep 17 00:00:00 2001 From: Nicholas Noll Date: Wed, 20 May 2020 18:28:31 -0700 Subject: feat: prototype of AST --- sys/cmd/cc/lex.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sys/cmd/cc/lex.c') diff --git a/sys/cmd/cc/lex.c b/sys/cmd/cc/lex.c index 7a08373..e35ea7e 100644 --- a/sys/cmd/cc/lex.c +++ b/sys/cmd/cc/lex.c @@ -636,6 +636,16 @@ Dispatch: sym = lookup(&lx->sym, tok.val.s); if (sym && ((uintptr)sym->name != (uintptr)lx->io->path)) { + if ((uintptr)sym == lx->macline) { + tok.kind = Alit | Vint; + tok.val.i = lx->pos.line; + goto Return; + } + if ((uintptr)sym == lx->macfile) { + tok.kind = Alit | Vstr; + tok.val.s = lx->pos.path; + goto Return; + } io = makeio(sym->name); io->rdr.end += expandmacro(lx, sym, io->b); *io->rdr.end++ = EOF; -- cgit v1.2.1