]> git.corax.cc Git - ccc/commitdiff
lex: Add file attribute to tokens to identify the file a token came from
authorMatthias Kruk <m@m10k.eu>
Sun, 7 Jun 2020 09:53:28 +0000 (18:53 +0900)
committerMatthias Kruk <m@m10k.eu>
Sun, 7 Jun 2020 09:53:28 +0000 (18:53 +0900)
src/token.c
src/token.h

index 03b1bdbc7df095cbcbb03a42e03ee9b857be238c..3baa0e39e214d21cace1e2e98f02a441b3ef658d 100644 (file)
@@ -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;
index c40efe302bb7eb2e62cd71c0ace692f0b32d9da9..87cb8ab28ad8ebb8ced6f5172a0b021226bd2be7 100644 (file)
@@ -92,6 +92,7 @@ typedef enum {
 } token_type_t;
 
 struct token {
+       const char   *file;
        int          line;
        int          column;
        token_type_t type;