readme-thing/token.h

36 lines
568 B
C
Raw Normal View History

2021-07-14 08:15:46 -07:00
#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,
2021-07-14 08:15:46 -07:00
TT_WHITESPACE,
TT_NEWLINE,
TT_WORD,
TT_NUMBER,
TT_GT, // greater than; used for block quotes
2021-07-14 08:15:46 -07:00
} TokenType;
typedef struct Token {
TokenType type;
struct Token* next;
2021-07-14 08:15:46 -07:00
char* literal;
int line;
int column;
int length;
2021-07-14 08:15:46 -07:00
} Token;
char* TokenString(Token* t);
char* TokenTypeString(TokenType tt);
void FreeToken(Token* t);
2021-07-14 08:15:46 -07:00
#endif