vyperlang / blackadder

MIT License
14 stars 5 forks source link

Use Vyper AST #7

Open fubuloubu opened 3 years ago

fubuloubu commented 3 years ago

Once the custom parser is implemented (per https://github.com/vyperlang/vyper/issues/1363), this tool using black directly will not work as well as it does now.

This tool could start down the path of using the Vyper AST classes to support the operation of this tool instead of the current shortcut of using black directly. This will enable it to be more future-proof as well, as it will not be dependent on the version of black used

spinoch commented 3 years ago

As a sidenote, when I wrote this I was initially looking into parsing the vyper code to vyper's AST and then have black deal with that, but there were too many differences between vyper's AST and Python's to do this easily. We may have to just re-write black to support Vyper's AST. I guess this shouldn't be too hard but will require some more effort than just using Regex.

fubuloubu commented 3 years ago

I guess this shouldn't be too hard but will require some more effort than just using Regex.

Yeah, that was my guess. I appreciate that this quick regex approach works well now, but future work needed.

spinoch commented 3 years ago

I'd argue this blocks all formatting-related issues we have (#1, #2, #3, #4, #5) atm