Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Throw error when meet abstract contract. #42

Closed
CyberFork opened this issue Sep 8, 2020 · 3 comments
Closed

Throw error when meet abstract contract. #42

CyberFork opened this issue Sep 8, 2020 · 3 comments
Labels

Comments

@CyberFork
Copy link

CyberFork commented Sep 8, 2020

`
abstract contract Context {
function _msgSender() internal view virtual returns (address payable) {
return msg.sender;
}

function _msgData() internal view virtual returns (bytes memory) {
    this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691
    return msg.data;
}

}
`
Parse error
{ SyntaxError: Expected "contract", "import", "interface", "library", "pragma", comment, end of input, end of line, or whitespace but "a" found. Line: 20, Column: 1
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:91:21)
at /usr/local/lib/node_modules/solgraph/dist/bin.js:29:37
message:
'Expected "contract", "import", "interface", "library", "pragma", comment, end of input, end of line, or whitespace but "a" found. Line: 20, Column: 1',
expected:
[ { type: 'other', description: 'whitespace' },
{ type: 'other', description: 'end of line' },
{ type: 'other', description: 'comment' },
{ type: 'literal', text: 'pragma', ignoreCase: false },
{ type: 'literal', text: 'pragma', ignoreCase: false },
{ type: 'literal', text: 'pragma', ignoreCase: false },
{ type: 'literal', text: 'import', ignoreCase: false },
{ type: 'literal', text: 'import', ignoreCase: false },
{ type: 'literal', text: 'import', ignoreCase: false },
{ type: 'literal', text: 'contract', ignoreCase: false },
{ type: 'literal', text: 'interface', ignoreCase: false },
{ type: 'literal', text: 'library', ignoreCase: false },
{ type: 'other', description: 'whitespace' },
{ type: 'other', description: 'end of line' },
{ type: 'other', description: 'comment' },
{ type: 'end' } ],
found: 'a',
location:
{ start: { offset: 290, line: 20, column: 1 },
end: { offset: 291, line: 20, column: 2 } },
name: 'SyntaxError' }

@raineorshine
Copy link
Owner

The parser needs to be updated from solidity-parser-sc to solidity-parser-antlr or another parser that supports abstract contract syntax. I'm not actively working on this project any more but I would be happy to accept a PR.

@hawks-vision
Copy link

hey I'm facing the same challenge is there any link that i can refer to

@raineorshine
Copy link
Owner

Fixed in v1.0.0. Special thanks to @yellowBirdy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants