skopy/lib/include/token.h

32 lines
575 B
C
Raw Normal View History

2024-03-31 21:10:56 +00:00
#ifndef SK_TOKEN_H
#define SK_TOKEN_H
#include "commons.h"
#define TOKEN_KIND(G) \
G(TOKEN_ROOT), \
2024-03-31 23:32:47 +00:00
G(TOKEN_INT), \
G(TOKEN_ADD), G(TOKEN_SUB), \
G(TOKEN_MUL), G(TOKEN_DIV), G(TOKEN_MOD), \
G(TOKEN_POW), G(TOKEN_OPAR), G(TOKEN_CPAR)
2024-03-31 21:10:56 +00:00
SK_ENUM_H(TokenKind, TOKEN_KIND);
struct token
{
TokenKind kind;
char* value;
int line;
};
void token_init(struct token* self,
TokenKind kind,
char const* value,
int line);
2024-03-31 23:32:47 +00:00
2024-03-31 21:10:56 +00:00
void token_free(struct token* self);
void token_str(struct token* self, struct str* dest);
#endif