aboutsummaryrefslogtreecommitdiff
path: root/src/ast_render.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ast_render.cpp')
-rw-r--r--src/ast_render.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/ast_render.cpp b/src/ast_render.cpp
index 36cb90793d..3ce435a959 100644
--- a/src/ast_render.cpp
+++ b/src/ast_render.cpp
@@ -251,7 +251,7 @@ static bool is_digit(uint8_t c) {
}
static bool is_printable(uint8_t c) {
- return is_alpha_under(c) || is_digit(c);
+ return is_alpha_under(c) || is_digit(c) || c == ' ';
}
static void string_literal_escape(Buf *source, Buf *dest) {
@@ -463,10 +463,14 @@ static void render_node(AstRender *ar, AstNode *node) {
}
break;
case NodeTypeStringLiteral:
- if (node->data.string_literal.c) {
- fprintf(ar->f, "c");
+ {
+ if (node->data.string_literal.c) {
+ fprintf(ar->f, "c");
+ }
+ Buf tmp_buf = BUF_INIT;
+ string_literal_escape(&node->data.string_literal.buf, &tmp_buf);
+ fprintf(ar->f, "\"%s\"", buf_ptr(&tmp_buf));
}
- fprintf(ar->f, "\"%s\"", buf_ptr(&node->data.string_literal.buf));
break;
case NodeTypeCharLiteral:
{