readme-thing/token.h

36 lines
568 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_TRIPLEBACKTICK,
TT_WHITESPACE,
TT_NEWLINE,
TT_WORD,
TT_NUMBER,
TT_GT, // greater than; used for block quotes
} TokenType;
typedef struct Token {
TokenType type;
struct Token* next;
char* literal;
int line;
int column;
int length;
} Token;
char* TokenString(Token* t);
char* TokenTypeString(TokenType tt);
void FreeToken(Token* t);
#endif