summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2016-11-20 16:59:01 +0100
committertomsmeding <tom.smeding@gmail.com>2016-11-20 16:59:01 +0100
commite609a3d6a94163f0dfea814378cd4e2dbed3d8e8 (patch)
tree6cbf379d8be0b2b2be6174becbd01bcc405ee022
parent3b390967e7c2ee4ac6d1a67c77f40ed43005e012 (diff)
Fix String pretty-printing
-rw-r--r--ast.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/ast.cpp b/ast.cpp
index 88d716a..68d4d4b 100644
--- a/ast.cpp
+++ b/ast.cpp
@@ -199,9 +199,10 @@ ostream& operator<<(ostream &os,const AST &ast){
os<<'"';
for(char c : ast.strval){
switch(c){
- case 9: os<<"\\t"; break;
- case 10: os<<"\\n"; break;
- case 13: os<<"\\r"; break;
+ case '\t': os<<"\\t"; break;
+ case '\n': os<<"\\n"; break;
+ case '\r': os<<"\\r"; break;
+ case '"': os<<"\\\""; break;
default:
if(c>=32&&c<=126){
os<<c;