pycparserext
pycparserext copied to clipboard
Cannot traverse nodes using NodeVisitor, FuncDeclExt is not iterable
Using GnuCParser() and subclassing c_ast.NodeVisitor, I cannot traverse the nodes as in the FuncDefs example in https://github.com/eliben/pycparser/blob/master/examples/func_defs.py
It results in the following error:
Traceback (most recent call last):
[...]
File "main_script.py", line 77, in verify
FuncDefVisitor().visit(self.ast)
File "/path/venv/lib/python3.6/site-packages/pycparser/c_ast.py", line 158, in visit
return visitor(node)
File "/path/venv/lib/python3.6/site-packages/pycparser/c_ast.py", line 165, in generic_visit
self.visit(c)
File "/path/venv/lib/python3.6/site-packages/pycparser/c_ast.py", line 158, in visit
return visitor(node)
File "/path/venv/lib/python3.6/site-packages/pycparser/c_ast.py", line 165, in generic_visit
self.visit(c)
File "/path/venv/lib/python3.6/site-packages/pycparser/c_ast.py", line 158, in visit
return visitor(node)
File "/path/venv/lib/python3.6/site-packages/pycparser/c_ast.py", line 164, in generic_visit
for c in node:
TypeError: 'FuncDeclExt' object is not iterable
I'd be happy to review a PR fixing that.
I can try and implement a fix, but it's still not super clear to me how these functions interact with the code path.
@inducer Can you actually reopen this issue? I think #46 needs to be done for all of the classes in ext_c_parser.py that subclass c_ast.Node
Sure, thanks.