aboutsummaryrefslogtreecommitdiff
path: root/sys/cmd/cc/lex.c
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2020-05-20 18:28:31 -0700
committerNicholas Noll <nbnoll@eml.cc>2020-05-20 18:28:31 -0700
commita9e3c42ac5696c56adaffbb4007e9d969563337b (patch)
treec061b3ac4e0469ef46d4b7a4dd7c66a2dd59330b /sys/cmd/cc/lex.c
parent25f01e69f946c37a74de8646a3cd047f849885bc (diff)
feat: prototype of AST
Diffstat (limited to 'sys/cmd/cc/lex.c')
-rw-r--r--sys/cmd/cc/lex.c10
1 files changed, 10 insertions, 0 deletions
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;