I do know that "coord" attribute of AST node gives the line number but by default it has column number set as None. Is there a way to set this to true column number?
Get column number of C construct in ast generated by pycparser
204 Views Asked by manish RAI At
1
The
masterbranch version on Github, which didn't make it into an official release yet, does include a column in thecoordattribute of AST nodes.The
examples/explore_ast.pyexample can show this in action, if you uncomment the line withshowcoord=True. Here's a dumped AST snippet:The
(at <none>:2:17)part means "at file<none>, line 2, column 17" (file is<none>because the example is just parsing from a string).