From 8c101ba896860db4d674495b636ae5622472413b Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Sun, 7 Jun 2020 18:53:28 +0900 Subject: [PATCH] lex: Add file attribute to tokens to identify the file a token came from --- src/token.c | 1 + src/token.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/token.c b/src/token.c index 03b1bdb..3baa0e3 100644 --- a/src/token.c +++ b/src/token.c @@ -14,6 +14,7 @@ struct token *token_new(const token_type_t type, const int line, const int col) if(tok) { memset(tok, 0, sizeof(*tok)); + tok->file = "(stdin)"; tok->type = type; tok->line = line; tok->column = col; diff --git a/src/token.h b/src/token.h index c40efe3..87cb8ab 100644 --- a/src/token.h +++ b/src/token.h @@ -92,6 +92,7 @@ typedef enum { } token_type_t; struct token { + const char *file; int line; int column; token_type_t type; -- 2.47.3