/* Frees the string that TOKEN contains. */
void
-token_destroy (struct token *token)
+token_uninit (struct token *token)
{
if (token != NULL)
ss_dealloc (&token->string);
char *
token_to_string (const struct token *token)
{
- const char *name;
-
switch (token->type)
{
case T_POS_NUM:
return number_token_to_string (token);
case T_ID:
+ case T_MACRO_ID:
+ case T_MACRO_PUNCT:
return ss_xstrdup (token->string);
case T_STRING:
return string_representation (token->string);
default:
- name = token_type_to_name (token->type);
- return name != NULL ? xstrdup (name) : NULL;
+ return xstrdup_if_nonnull (token_type_to_name (token->type));
}
}