raineorshine / solgraph

Visualize Solidity control flow for smart contract security analysis. :dollar: ⇆ :dollar:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parsing of solidity 0.5 contract fails

MariusVanDerWijden opened this issue · comments

Thank you for this tool!
I'm currently testing some new contracts with them and get a SyntaxError after the calldata token
I think the parser just does not expect a calldata token between the type and the name.

The contract code (line 139):
bytes calldata _sigA, bytes calldata _sigB) external
The error:
Parse error { SyntaxError: Expected ")", ",", comment, end of line, or whitespace but "_" found. Line: 139, Column: 24 at peg$buildStructuredError (/usr/local/lib/node_modules/solgraph/node_modules/solidity-parser-sc/build/parser.js:1376:12) at Object.peg$parse [as parse] (/usr/local/lib/node_modules/solgraph/node_modules/solidity-parser-sc/build/parser.js:15723:11) at Object.parse (/usr/local/lib/node_modules/solgraph/node_modules/solidity-parser-sc/index.js:34:23) at _default (/usr/local/lib/node_modules/solgraph/dist/index.js:83:21) at /usr/local/lib/node_modules/solgraph/dist/bin.js:29:34 at <anonymous> message: 'Expected ")", ",", comment, end of line, or whitespace but "_" found. Line: 139, Column: 24', expected: [ { type: 'other', description: 'whitespace' }, { type: 'other', description: 'end of line' }, { type: 'other', description: 'comment' }, { type: 'literal', text: ',', ignoreCase: false }, { type: 'other', description: 'whitespace' }, { type: 'other', description: 'end of line' }, { type: 'other', description: 'comment' }, { type: 'literal', text: ')', ignoreCase: false }, { type: 'other', description: 'whitespace' }, { type: 'other', description: 'end of line' }, { type: 'other', description: 'comment' }, { type: 'literal', text: ',', ignoreCase: false }, { type: 'other', description: 'whitespace' }, { type: 'other', description: 'end of line' }, { type: 'other', description: 'comment' }, { type: 'literal', text: ')', ignoreCase: false }, { type: 'other', description: 'whitespace' }, { type: 'other', description: 'end of line' }, { type: 'other', description: 'comment' }, { type: 'literal', text: ',', ignoreCase: false }, { type: 'other', description: 'whitespace' }, { type: 'other', description: 'end of line' }, { type: 'other', description: 'comment' }, { type: 'literal', text: ')', ignoreCase: false }, { type: 'other', description: 'whitespace' }, { type: 'other', description: 'end of line' }, { type: 'other', description: 'comment' }, { type: 'literal', text: ',', ignoreCase: false }, { type: 'other', description: 'whitespace' }, { type: 'other', description: 'end of line' }, { type: 'other', description: 'comment' }, { type: 'literal', text: ')', ignoreCase: false } ], found: '_', location: { start: { offset: 5047, line: 139, column: 24 }, end: { offset: 5048, line: 139, column: 25 } }, name: 'SyntaxError' }

The parser needs to be updated from solidity-parser-sc to solidity-parser-antlr. I don't have the time unfortunately but I would be happy to support a PR from anyone who is interested in contributing.

Should be fixed in v1.0.0 thanks to @yellowBirdy.

If it still doesn't work, please post your solidity file.