const symbol_t *symbol = token_symbols[token_type];
if(symbol != NULL) {
- fprintf(f, "%s", symbol->string);
+ fputs(symbol->string, f);
} else {
if(token_type >= 0 && token_type < 256) {
- fprintf(f, "%c", token_type);
+ fputc(token_type, f);
return;
}
fputs("unknown token", f);
{
switch(token->type) {
case T_IDENTIFIER:
- fprintf(f, "symbol %s", token->v.symbol->string);
+ fprintf(f, "identifier '%s'", token->v.symbol->string);
break;
case T_INTEGER:
- fprintf(f, "integer number %lld", token->v.intvalue);
+ fprintf(f, "integer number '%lld'", token->v.intvalue);
break;
case T_FLOATINGPOINT:
- fprintf(f, "floatingpointer number %LF", token->v.floatvalue);
+ fprintf(f, "floating-point number '%LF'", token->v.floatvalue);
break;
case T_STRING_LITERAL:
fprintf(f, "string \"%s\"", token->v.string.begin);
break;
default:
+ fputc('\'', f);
print_token_type(f, (token_type_t)token->type);
+ fputc('\'', f);
break;
}
}
const symbol_t *symbol = pp_token_symbols[token_type];
if (symbol != NULL) {
- fprintf(f, "%s", symbol->string);
+ fputs(symbol->string, f);
} else {
if(token_type >= 0 && token_type < 256) {
- fprintf(f, "%c", token_type);
+ fputc(token_type, f);
return;
}
fputs("unknown token", f);
{
switch((preprocessor_token_type_t) token->type) {
case TP_IDENTIFIER:
- fprintf(f, "symbol %s", token->v.symbol->string);
+ fprintf(f, "identifier '%s'", token->v.symbol->string);
break;
case TP_NUMBER:
- fprintf(f, "number %s", token->v.string.begin);
+ fprintf(f, "number '%s'", token->v.string.begin);
break;
case TP_STRING_LITERAL:
fprintf(f, "string \"%s\"", token->v.string.begin);