parseh: support octal in C macro string literal

This commit is contained in:
Andrew Kelley
2016-07-09 12:17:31 -07:00
parent 100e8e15fa
commit a5251a1c10
4 changed files with 79 additions and 6 deletions

View File

@@ -1731,6 +1731,15 @@ struct type {
)SOURCE", 2, R"(export struct struct_type {
@"defer": c_int,
})", R"(pub const @"type" = struct_type;)");
add_parseh_case("macro defines string literal with octal", R"SOURCE(
#define FOO "aoeu\023 derp"
#define FOO2 "aoeu\0234 derp"
#define FOO_CHAR '\077'
)SOURCE", 3,
R"(pub const FOO = c"aoeu\x13 derp")",
R"(pub const FOO2 = c"aoeu\x134 derp")",
R"(pub const FOO_CHAR = '\x3f')");
}
static void run_self_hosted_test(bool is_release_mode) {