diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2016-07-09 12:17:31 -0700 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2016-07-09 12:17:31 -0700 |
| commit | a5251a1c102334a5dcb07e4fcc2b676be55fe2be (patch) | |
| tree | 459d720365823b10473be028d25ad86b87b825f5 /src/ast_render.cpp | |
| parent | 100e8e15fa087be8975173c03a2f89b227b16730 (diff) | |
| download | zig-a5251a1c102334a5dcb07e4fcc2b676be55fe2be.tar.gz zig-a5251a1c102334a5dcb07e4fcc2b676be55fe2be.zip | |
parseh: support octal in C macro string literal
Diffstat (limited to 'src/ast_render.cpp')
| -rw-r--r-- | src/ast_render.cpp | 12 |
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: { |
