moka/lib/token.c

18 lines
310 B
C

#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;
}