ConsenSysMesh / solidity-parser

Solidity Parser in Javascript
137 stars 53 forks source link

Error parsing struct instantiation #71

Closed travs closed 7 years ago

travs commented 7 years ago

When we try to instantiate a struct using curly braces there is a parsing error.

See the contrubute function in the solidity docs on structs.

Using this minimal example:

$ solidity-parser ballot.sol
Expected "!", "!=", "(", ")", "+", "++", "-", "--", "0", "<", "<=", "==", ">", ">=", "[", "^", "delete", "false", "hex", "mapping", "new", "this", "true", "v", "~", [1-9], comment, end of line, identifier,
 number, string, or whitespace but "{" found. Line: 9, Column: 22

Edit: A second example (larger contract) is over here: melonproject/protocol#28

travs commented 7 years ago

This issue should be solved with #72, but do you think we should do a patch version bump in this package before closing this issue? Will make it easier to convince truffle to include the updated version of solidity-parser

travs commented 7 years ago

Actually, still having an issue parsing in the case where there is a trailing comma after the last entry in the name-value list. See this updated example (line 11), which gives the error:

Expected comment, end of line, identifier, or whitespace but "}" found. Line: 12, Column: 5

This is the contract we are trying to parse, in case we want to test another example input.

travs commented 7 years ago

Excellent, these two issues are fixed. Thanks guys! 😄