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
210 Views Asked by manish RAI At
1
The
master
branch version on Github, which didn't make it into an official release yet, does include a column in thecoord
attribute of AST nodes.The
examples/explore_ast.py
example 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).