Open cd1m0 opened 5 years ago
Appologies, I did not open an issue first. If you wish I can also open an issue and reference it here?
Hi, I see https://github.com/federicobond/solidity-parser-antlr/pull/85/commits/2273972a655e10cf53c8ac8a9ded5c1f9e87fca6 above, I wonder if you are working on any natspec related? I worked on it in the past, and it got merged (https://github.com/federicobond/solidity-parser-antlr/pull/71), but unfortunately, there were a few cases that I haven't tested so my changes got reverted. Since that time, and because I want to use solidity-parser-antlr for everything in my solidity documentation tool (https://github.com/HQ20/soldoc) I decided to fork and make it work. That was when I realized the limitations. See here https://github.com/obernardovieira/solidity-parser-antlr I'm very proud of it and planning to open a PR. If there's any chance that we merge our work or see wht fits best. I would appreciate a lot :+1: thanks for your time
In the process of introspecting solc's ast, we have a use case to parse the type strings embedded in some nodes. It seems that this can be perfectly solved using the solidity-parser-antlr. This PR propses a small new entry point to the parser:
function parseType(input, options) {
That is almost identical to
parse()
, but parses strings representing just typeName fragments, instead of whole contracts.So for example one could run:
The PR also adds several tests for common solidity types in test/index.js and fixes 2 small lint issues.
Thank you for considering this!
Best ~Dimo