2024-03-26 18:31:33 +00:00
|
|
|
#ifndef MK_TOKEN_H
|
|
|
|
#define MK_TOKEN_H
|
|
|
|
|
|
|
|
#include "commons.h"
|
|
|
|
|
|
|
|
#define TOKEN_KIND(G) \
|
|
|
|
G(TOKEN_INT), G(TOKEN_FLOAT), \
|
|
|
|
G(TOKEN_BOOL), G(TOKEN_STRING), \
|
2024-03-27 10:49:10 +00:00
|
|
|
G(TOKEN_SYMBOL), G(TOKEN_IDENT), \
|
2024-03-29 09:04:13 +00:00
|
|
|
G(TOKEN_OPAR), G(TOKEN_CPAR), \
|
|
|
|
G(TOKEN_EOF)
|
2024-03-26 18:31:33 +00:00
|
|
|
|
|
|
|
MK_ENUM_H(TokenKind, TOKEN_KIND);
|
|
|
|
|
|
|
|
struct token
|
|
|
|
{
|
|
|
|
TokenKind kind;
|
|
|
|
char* value;
|
|
|
|
int line;
|
|
|
|
};
|
|
|
|
|
|
|
|
void token_init(struct token* self,
|
|
|
|
TokenKind kind,
|
|
|
|
char const* value);
|
|
|
|
void token_free(struct token* self);
|
|
|
|
|
|
|
|
#endif
|