raineorshine / solgraph

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Syntax Error on multi-variable assignments

shayanb opened this issue · comments

Fails to parse multi-variable assignments where at least one is skipped (not sure what it is called)

e.g

function test() returns (uint, uint, uint);

function test2() {
    (var1, ,var3) = test(); //it fails here!
}

Error trace:

Parse error
{ [SyntaxError: Expected "!", "(", "+", "++", "-", "--", "[", "delete", "false", "mapping", "new", "null", "this", "true", "typeof", "void", "{", "~", comment, end of line, identifier, number, regular expression, string or whitespace but "," found. Line: 172, Column: 41]
  message: 'Expected "!", "(", "+", "++", "-", "--", "[", "delete", "false", "mapping", "new", "null", "this", "true", "typeof", "void", "{", "~", comment, end of line, identifier, number, regular expression, string or whitespace but "," found. Line: 172, Column: 41',
  expected:
   [ { type: 'literal', value: '!', description: '"!"' },
     { type: 'literal', value: '(', description: '"("' },
     { type: 'literal', value: '+', description: '"+"' },
     { type: 'literal', value: '++', description: '"++"' },
     { type: 'literal', value: '-', description: '"-"' },
     { type: 'literal', value: '--', description: '"--"' },
     { type: 'literal', value: '[', description: '"["' },
     { type: 'literal', value: 'delete', description: '"delete"' },
     { type: 'literal', value: 'false', description: '"false"' },
     { type: 'literal', value: 'mapping', description: '"mapping"' },
     { type: 'literal', value: 'new', description: '"new"' },
     { type: 'literal', value: 'null', description: '"null"' },
     { type: 'literal', value: 'this', description: '"this"' },
     { type: 'literal', value: 'true', description: '"true"' },
     { type: 'literal', value: 'typeof', description: '"typeof"' },
     { type: 'literal', value: 'void', description: '"void"' },
     { type: 'literal', value: '{', description: '"{"' },
     { type: 'literal', value: '~', description: '"~"' },
     { type: 'other', description: 'comment' },
     { type: 'other', description: 'end of line' },
     { type: 'other', description: 'identifier' },
     { type: 'other', description: 'number' },
     { type: 'other', description: 'regular expression' },
     { type: 'other', description: 'string' },
     { type: 'other', description: 'whitespace' } ],
  found: ',',
  location:
   { start: { offset: 6084, line: 172, column: 41 },
     end: { offset: 6085, line: 172, column: 42 } },
  name: 'SyntaxError' }

This will get fixed in #17 or #20.

Fixed in v0.3.0