cpp: fix dumping strings and chars
authorMichael Wallner <mike@php.net>
Fri, 7 Jul 2017 07:23:17 +0000 (09:23 +0200)
committerMichael Wallner <mike@php.net>
Fri, 7 Jul 2017 07:23:17 +0000 (09:23 +0200)
src/types/cpp_macro_decl.c

index 42ed0f4208bbad931b8879dc6b575e370cc048e4..e540131243761d44281744acddfbb7190ca249a9 100644 (file)
@@ -83,7 +83,16 @@ void psi_cpp_macro_decl_dump(int fd, struct psi_cpp_macro_decl *macro)
                struct psi_token *tok;
 
                while (psi_plist_get(macro->tokens, i++, &tok)) {
-                       dprintf(fd, " %s", tok->text);
+                       switch (tok->type) {
+                       case PSI_T_QUOTED_STRING:
+                               dprintf(fd, " \"%s\"", tok->text);
+                               break;
+                       case PSI_T_QUOTED_CHAR:
+                               dprintf(fd, " '%s'", tok->text);
+                               break;
+                       default:
+                               dprintf(fd, " %s", tok->text);
+                       }
                }
        }
 }