Closed sebastien-rosset closed 2 months ago
Just from a quick look: are you sure your test escapes these strings properly?
Don't forget that Python does its own escaping when it sees \"
, unless you're in a raw string like r'''...
Removing this from the picture, consider:
$ cat /tmp/2.c
void foo() {
char* s = "hello \"world\"";
}
$ python3 examples/dump_ast.py /tmp/2.c
FileAST:
FuncDef:
Decl: foo, [], [], [], []
FuncDecl:
TypeDecl: foo, [], None
IdentifierType: ['void']
Compound:
Decl: s, [], [], [], []
PtrDecl: []
TypeDecl: s, [], None
IdentifierType: ['char']
Constant: string, "hello \"world\""
Looks alright, I think?
You are right, it looks like there was an issue with escaping.
It looks like there is a problem parsing strings that contains escaped double quotes, as shown in the test below.