-
Notifications
You must be signed in to change notification settings - Fork 56
Add suport for parsing type name fragments #85
base: master
Are you sure you want to change the base?
Conversation
Appologies, I did not open an issue first. If you wish I can also open an issue and reference it here? |
Hi, I see 2273972 above, I wonder if you are working on any natspec related? I worked on it in the past, and it got merged (#71), but unfortunately, there were a few cases that I haven't tested so my changes got reverted. |
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