projects
/
cparser
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
11507d8
)
Before printing a token using its kind, check whether it has a symbol and print this...
author
Christoph Mallon
<christoph.mallon@gmx.de>
Sun, 13 May 2012 21:30:43 +0000
(23:30 +0200)
committer
Christoph Mallon
<christoph.mallon@gmx.de>
Mon, 14 May 2012 14:23:37 +0000
(16:23 +0200)
This makes a difference when there are different spellings for the same token.
token.c
patch
|
blob
|
history
diff --git
a/token.c
b/token.c
index
1aadc6b
..
c9b0de8
100644
(file)
--- a/
token.c
+++ b/
token.c
@@
-157,10
+157,15
@@
void print_token(FILE *f, const token_t *token)
print_stringrep(&token->string.string, f);
fputs("'", f);
break;
+
default:
- fputc('\'', f);
- print_token_kind(f, (token_kind_t)token->kind);
- fputc('\'', f);
+ if (token->base.symbol) {
+ fprintf(f, "'%s'", token->base.symbol->string);
+ } else {
+ fputc('\'', f);
+ print_token_kind(f, (token_kind_t)token->kind);
+ fputc('\'', f);
+ }
break;
}
}