question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Fantastic, I have been looking for s.th. like this for a long time; really happy solgraph was mentioned in Hudson Jameson’s DevCon3 talk last week.

Small issue - I get parser errors for some contracts.

How to replicate:

git clone https://github.com/raiden-network/raiden
cd raiden/raiden/smart_contracts/
find . -type f -name "*.sol" -printf "solgraph %p > %p.dot\n" | bash
find . -type f -name "*.dot" -printf "dot -Tpng %p > %p.png\n" | bash

8 out of the 10 contracts are fine, but for two of them (ChannelManagerContract.sol & Token.sol) I get these parser errors:

Parse error
{ SyntaxError: Expected "contract", "import", "library", "pragma", comment, end of input, end of line, or whitespace but "i" found. Line: 3, Column: 1
    at peg$buildStructuredError (/usr/lib/node_modules/solgraph/node_modules/solidity-parser/build/parser.js:1272:12)
    at Object.peg$parse [as parse] (/usr/lib/node_modules/solgraph/node_modules/solidity-parser/build/parser.js:13858:11)
    at Object.parse (/usr/lib/node_modules/solgraph/node_modules/solidity-parser/index.js:34:23)
    at exports.default (/usr/lib/node_modules/solgraph/dist/index.js:70:21)
    at /usr/lib/node_modules/solgraph/dist/bin.js:37:35
  message: 'Expected "contract", "import", "library", "pragma", comment, end of input, end of line, or whitespace but "i" found. Line: 3, 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: 'import', ignoreCase: false },
     { type: 'literal', text: 'import', ignoreCase: false },
     { type: 'literal', text: 'import', ignoreCase: false },
     { type: 'literal', text: 'contract', 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: 'i',
  location: 
   { start: { offset: 26, line: 3, column: 1 },
     end: { offset: 27, line: 3, column: 2 } },
  name: 'SyntaxError' }

Parse error
{ SyntaxError: Expected comment, end of line, identifier, or whitespace but "," found. Line: 104, Column: 28
    at peg$buildStructuredError (/usr/lib/node_modules/solgraph/node_modules/solidity-parser/build/parser.js:1272:12)
    at Object.peg$parse [as parse] (/usr/lib/node_modules/solgraph/node_modules/solidity-parser/build/parser.js:13858:11)
    at Object.parse (/usr/lib/node_modules/solgraph/node_modules/solidity-parser/index.js:34:23)
    at exports.default (/usr/lib/node_modules/solgraph/dist/index.js:70:21)
    at /usr/lib/node_modules/solgraph/dist/bin.js:37:35
  message: 'Expected comment, end of line, identifier, or whitespace but "," found. Line: 104, Column: 28',
  expected: 
   [ { type: 'other', description: 'whitespace' },
     { type: 'other', description: 'end of line' },
     { type: 'other', description: 'comment' },
     { type: 'other', description: 'identifier' } ],
  found: ',',
  location: 
   { start: { offset: 3407, line: 104, column: 28 },
     end: { offset: 3408, line: 104, column: 29 } },
  name: 'SyntaxError' }

These are all the images of those contracts which succeed getting parsed: raiden-solidity-solgraph-for-printing.pdf Really great, thanks a lot!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
raineorshinecommented, Jun 15, 2018

Thank you! This should be remedied as soon as we upgrade to the latest version of solidity.

1reaction
drandreaskruegercommented, Aug 21, 2018

this now seems to work fine:

git clone https://github.com/raiden-network/raiden-contracts raiden-network_raiden-contracts
cd raiden-network_raiden-contracts/raiden_contracts/contracts/
find . -type f -name "*.sol" -printf "solgraph %p > %p.dot\n" | bash
find . -type f -name "*.dot" -printf "dot -Tpng %p > %p.png\n" | bash

and there is one png file for each sol file:

find . -type f -name "*.sol" | wc
     17      17     442
find . -type f -name "*.png" | wc
     17      17     578
Read more comments on GitHub >

github_iconTop Results From Across the Web

Parse Error: What It Is and How to Fix It - Lifewire
A parse error is an error message you sometimes get on Android devices when an app fails to install. The message itself is...
Read more >
6 Methods to Fix Parse Error on Your Android Device - MiniTool
The Parse Error is an error message you may receive on your Android phone when an application fails to install. This error message...
Read more >
What is a parse error? - Quora
A parse error in a piece of computer code, also known as a syntax error, prevents your program from compiling. Parse errors happen...
Read more >
Formula Parse Errors In Google Sheets And How To Fix Them
Before we get into the different types of errors, you might be wondering what does formula parse error mean? Essentially, it means Google...
Read more >
What is a Parse Error? - IONOS Help
If the PHP code contains a syntax error, the PHP parser cannot interpret the code and stops working. For example, a syntax error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found