From 2a6233b74f55b832a28049b2840b55c17ff5f8da Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicolas=20L=C3=A9veill=C3=A9?= <nicolas@uucidl.com>
Date: Sat, 1 Aug 2015 13:41:04 +0200
Subject: [PATCH] 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.
---
 src/pprint.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pprint.c b/src/pprint.c
index 8abbf5a7..a91d9d84 100644
--- a/src/pprint.c
+++ b/src/pprint.c
@@ -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.");
     }
-- 
GitLab