Print values in debug mode

This commit is contained in:
Nikita Ivanov 2022-06-11 13:22:45 +05:00
parent 6b5b6bc91c
commit 8ee70e735e
No known key found for this signature in database
GPG Key ID: 6E656AC5B97B5133

View File

@ -261,7 +261,18 @@ static int parse(void)
next_token();
if (token.type == TOK_EOF)
break;
printf("%s\n", lexer_token_type_str(token.type));
printf("%s", lexer_token_type_str(token.type));
switch (token.type) {
case TOK_INT:
printf(": %d\n", token.val.i);
break;
case TOK_STR:
printf(": %s\n", token.val.s);
break;
default:
puts("");
break;
}
}
#endif