raineorshine/solgraph

Parsing fails on pragma statement in solc 0.6.11

br4e opened this issue · 3 comments

br4e commented

Error parsing this line: pragma solidity =0.6.11;

>> solgraph contracts/Auctions.sol > graphics/Auctions.dot
Parse error
{ peg$SyntaxError: Expected "!=", "0", "<", "<=", "==", ">", ">=", "^", "v", [1-9], comment, end of line, or whitespace but "=" found. Line: 4, Column: 17
    at peg$buildStructuredError (/Users/milesminton/.config/yarn/global/node_modules/solidity-parser-sc/build/parser.js:1376:12)
    at Object.peg$parse [as parse] (/Users/milesminton/.config/yarn/global/node_modules/solidity-parser-sc/build/parser.js:15723:11)
    at Object.parse (/Users/milesminton/.config/yarn/global/node_modules/solidity-parser-sc/index.js:34:23)
    at _default (/Users/milesminton/.config/yarn/global/node_modules/solgraph/dist/index.js:91:21)
    at /Users/milesminton/.config/yarn/global/node_modules/solgraph/dist/bin.js:29:37
  message:
   'Expected "!=", "0", "<", "<=", "==", ">", ">=", "^", "v", [1-9], comment, end of line, or whitespace but "=" found. Line: 4, Column: 17',
  expected:
   [ { type: 'other', description: 'whitespace' },
     { type: 'other', description: 'end of line' },
     { type: 'other', description: 'comment' },
     { type: 'literal', text: '<=', ignoreCase: false },
     { type: 'literal', text: '>=', ignoreCase: false },
     { type: 'literal', text: '<', ignoreCase: false },
     { type: 'literal', text: '>', ignoreCase: false },
     { type: 'literal', text: '==', ignoreCase: false },
     { type: 'literal', text: '!=', ignoreCase: false },
     { type: 'literal', text: '^', ignoreCase: false },
     { type: 'other', description: 'whitespace' },
     { type: 'other', description: 'end of line' },
     { type: 'other', description: 'comment' },
     { type: 'literal', text: 'v', ignoreCase: false },
     { type: 'literal', text: '0', ignoreCase: false },
     { type: 'class',
       parts: [Array],
       inverted: false,
       ignoreCase: false } ],
  found: '=',
  location:
   { start: { offset: 99, line: 4, column: 17 },
     end: { offset: 100, line: 4, column: 18 } },
  name: 'SyntaxError' }
br4e commented

Removing the "=" from that line temporarily does work.

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

Fixed and published to v1.0.0