readme-thing/token.h

39 lines
596 B
C

#ifndef TOKEN_H
#define TOKEN_H
typedef enum {
TT_ILLEGAL,
TT_EOF,
TT_HASH, // #
TT_ASTERISK,
TT_UNDERSCORE,
TT_DASH,
TT_PERIOD,
TT_BACKTICK,
TT_WHITESPACE,
TT_NEWLINE,
TT_WORD,
TT_NUMBER,
} TokenType;
typedef struct Token {
TokenType type;
char* literal;
int line;
int column;
char* printBuff;
} Token;
typedef struct TokenList {
Token* token;
struct TokenList* next;
} TokenList;
TokenList* TokenListAdd(TokenList* current, Token* next);
char* TokenString(Token* t);
char* TokenTypeString(TokenType tt);
#endif