summaryrefslogtreecommitdiff
path: root/Token.c
diff options
context:
space:
mode:
Diffstat (limited to 'Token.c')
-rw-r--r--Token.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/Token.c b/Token.c
index 85d65cf..d23e885 100644
--- a/Token.c
+++ b/Token.c
@@ -4,21 +4,16 @@
void token_free(Token *tok)
{
- switch (tok->type) {
- case TOK_WORD:
- if (tok != NULL && tok->v.s != NULL)
- free(tok->v.s);
- default:
- break;
- }
+ if (tok != NULL && tok->s != NULL)
+ free(tok->s);
}
void token_print(const Token *tok)
{
printf("%u:%u\t", tok->line, tok->column);
switch (tok->type) {
- case TOK_WORD: printf("TOK_WORD %s\n", tok->v.s); break;
- case TOK_STRING: printf("TOK_STRING \"%s\"\n", tok->v.s); break;
+ case TOK_WORD: printf("TOK_WORD %s\n", tok->s); break;
+ case TOK_STRING: printf("TOK_STRING \"%s\"\n", tok->s); break;
case TOK_INTEGER: printf("TOK_INTEGER %d\n", tok->v.i); break;
case TOK_PAREN_OPEN: printf("TOK_PAREN_OPEN\n"); break;
case TOK_PAREN_CLOS: printf("TOK_PAREN_CLOS\n"); break;