void print_token(FILE *f, const token_t *token) { switch (token->type) { case T_IDENTIFIER: fprintf(f, "symbol '%s'", token->v.symbol->string); break; case T_INTEGER: fprintf(f, "integer number %d", token->v.intvalue); break; case T_STRING_LITERAL: fprintf(f, "string '%s'", token->v.string); break; default: print_token_type(f, token->type); break; } }
//Print the token information void print_token(Token token) { printf("%s:%d:%d, ", src_name, token_line_no, token_line_pos); print_token_type(token.type); printf("\ttoken: [%s]\n", token.string); }