moka/lib/token.c

18 lines
310 B
C
Raw Normal View History

2024-03-26 18:31:33 +00:00
#include "token.h"
MK_ENUM_C(TokenKind, TOKEN_KIND);
void token_init(struct token* self, TokenKind kind, char const* value)
{
assert(self);
self->kind = kind;
self->value = strdup(value);
}
void token_free(struct token* self)
{
assert(self);
free(self->value);
self->value = NULL;
}