-
Notifications
You must be signed in to change notification settings - Fork 638
Open
Labels
Description
The following valid c99 code
char test()
{
char* tmp = "\07""7";
return tmp[0];
}
is wrongly parsed and returns a c_ast.Constant object with value '\077' which is incorrect. Same goes with hexadecimal.
The easy solution is to modify CParser.p_unified_string_literal by replacing
p[1].value = p[1].value[:-1] + p[2][1:]
by
p[1].value = p[1].value + p[2]
as simply removing double quotes it not a good idea. The modification would return a value of '\07""7' which is better but needs to be parsed to get each characters.
Another solution would be to have a list of strings for the value, but that would have way more impacts on other parts of the code (like the generator)