standardese / cppast

Library to parse and work with the C++ AST
Other
1.7k stars 165 forks source link

Support print ast nodes as json #168

Closed LichKing-2234 closed 1 year ago

LichKing-2234 commented 1 year ago

In my case, I need the ast nodes to save as JSON files. I think this PR can help someone who needs JSON also.

foonathan commented 1 year ago

Thanks for the PR, but I don't want to integrate that into the tool.

If you need the AST as JSON, I'd recommend that you use clang directly. It has learned the ability to dump the AST as JSON using -ast-dump=json:

clang -Xclang -ast-dump=json -fsyntax-only <file>