diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-03-09 01:17:36 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-03-09 01:17:36 -0500 |
| commit | 8624379c71d79f67032d7ff2fd71642c84c79621 (patch) | |
| tree | fb34094e6738e469808cfd4318c751af759f5555 /src/ast_render.cpp | |
| parent | dd34c217791a0949ef2b0531ce8e8d4691239c45 (diff) | |
| parent | a45807db22cf92167734d2055b836fa0aba8cf30 (diff) | |
| download | zig-8624379c71d79f67032d7ff2fd71642c84c79621.tar.gz zig-8624379c71d79f67032d7ff2fd71642c84c79621.zip | |
Merge pull request #2038 from ziglang/caching
breaking changes to zig build API and improved caching
Diffstat (limited to 'src/ast_render.cpp')
| -rw-r--r-- | src/ast_render.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/ast_render.cpp b/src/ast_render.cpp index 7b57841205..84a952fa99 100644 --- a/src/ast_render.cpp +++ b/src/ast_render.cpp @@ -317,7 +317,7 @@ static bool is_digit(uint8_t c) { static bool is_printable(uint8_t c) { static const uint8_t printables[] = - " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.~`!@#$%^&*()_-+=\\{}[];'\"?/<>,"; + " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.~`!@#$%^&*()_-+=\\{}[];'\"?/<>,:"; for (size_t i = 0; i < array_length(printables); i += 1) { if (c == printables[i]) return true; } @@ -328,9 +328,7 @@ static void string_literal_escape(Buf *source, Buf *dest) { buf_resize(dest, 0); for (size_t i = 0; i < buf_len(source); i += 1) { uint8_t c = *((uint8_t*)buf_ptr(source) + i); - if (is_printable(c)) { - buf_append_char(dest, c); - } else if (c == '\'') { + if (c == '\'') { buf_append_str(dest, "\\'"); } else if (c == '"') { buf_append_str(dest, "\\\""); @@ -350,6 +348,8 @@ static void string_literal_escape(Buf *source, Buf *dest) { buf_append_str(dest, "\\t"); } else if (c == '\v') { buf_append_str(dest, "\\v"); + } else if (is_printable(c)) { + buf_append_char(dest, c); } else { buf_appendf(dest, "\\x%x", (int)c); } @@ -470,6 +470,9 @@ static void render_node_extra(AstRender *ar, AstNode *node, bool grouped) { fprintf(ar->f, ", "); } } + if (node->data.fn_proto.is_var_args) { + fprintf(ar->f, ", ..."); + } fprintf(ar->f, ")"); if (node->data.fn_proto.align_expr) { fprintf(ar->f, " align("); |
