예제 #1
0
파일: token.c 프로젝트: MatzeB/fluffy
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;
	}
}
예제 #2
0
파일: dbg-aid.c 프로젝트: wonderchang/vcc
//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);
}