From: Matthias Kruk Date: Sun, 7 Jun 2020 09:53:28 +0000 (+0900) Subject: lex: Add file attribute to tokens to identify the file a token came from X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=8c101ba896860db4d674495b636ae5622472413b;p=ccc lex: Add file attribute to tokens to identify the file a token came from --- 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;