Print user defined token type while pretty printing
The pretty printing format chosen is USER:<token name> We use the registry function `h_get_token_type_name` which returns 0 when no name has been defined. This will print (null) as a token name.
This commit is contained in:
parent
9030136d08
commit
2a6233b74f
1 changed files with 2 additions and 2 deletions
|
|
@ -67,11 +67,11 @@ void h_pprint(FILE* stream, const HParsedToken* tok, int indent, int delta) {
|
|||
}
|
||||
break;
|
||||
case TT_USER:
|
||||
fprintf(stream, "%*sUSER\n", indent, "");
|
||||
fprintf(stream, "%*sUSER:%s\n", indent, "", h_get_token_type_name(tok->token_type));
|
||||
break;
|
||||
default:
|
||||
if(tok->token_type > TT_USER) {
|
||||
fprintf(stream, "%*sUSER %d\n", indent, "", tok->token_type-TT_USER);
|
||||
fprintf(stream, "%*sUSER:%s %d\n", indent, "", h_get_token_type_name(tok->token_type), tok->token_type-TT_USER);
|
||||
} else {
|
||||
assert_message(0, "Should not reach here.");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue