Closed id-aaryan closed 5 months ago
I'm almost certain you're hitting the issue described in https://eli.thegreenplace.net/2011/05/02/the-context-sensitivity-of-cs-grammar-revisited/ and then https://eli.thegreenplace.net/2015/on-parsing-c-type-declarations-and-fake-headers/
Please create a minimal reproducer if you think otherwise.
Let's take the following C code:
In this case, PyCParser parser the file, and creates an AST that represents the line
isdn_net_phone *n;
as the following:BinaryOp(op='*', left=ID(name='isdn_net_phone' ), right=ID(name='n' ) )
I have a function that adds fake typedefs to the top of my file - I needed more than what is provided in using_gcc_E_libc.py. However, the main issue is that here the parser treats the line of code as a normal action, i.e., BinaryOp, whereas this line is merely an instantiation of the
isdn_net_phone *
object.If you don't know how to fix it and want a spare set of eyes to help out, I'd be more than happy to take a look, but just wanted to know whether this is a known bug. And, also if I am using the tool incorrectly, please let me know.
Thanks