duaraghav8 / solparse

Solidity Parser for Solium
https://www.npmjs.com/package/solparse
29 stars 15 forks source link

EnumDeclaration shouldn't end with ; #8

Closed area closed 8 years ago

area commented 8 years ago

Invalid, and currently parsed as correct: enum { Test1, Test2 };

Valid: enum { Test1, Test2 }

This can be seen by simply trying to compile a contract containing an enum with solc.

duaraghav8 commented 8 years ago

solved in v1.0.13

Thanks for pointing this out =)

area commented 8 years ago

I'm afraid v1.0.13 still doesn't work for me. I have to remove EOS_NO_SEMICOLON from the EnumDeclaration statement and rebuild to get a contract with an enum to parse correctly.

duaraghav8 commented 8 years ago

My interpretation is:

enum Foo {bar, baz} and

contract Lorem {
    enum Foo {bar, baz}
}

should be correctly parsed by solparse. But the parser should throw an error if we append a semicolon in the end like enum Foo {bar, baz};

Currently, v1.0.13 is doing this as expected (I tried it on other machines)

Could you paste your solidity code that didn't get parsed correctly and tell me what you expected vs. what you got?

area commented 8 years ago

Trying to parse the contract

contract Lorem{
   enum Foo {bar, baz}

   bytes32 x;
}

fails with

throw e;
      ^
SyntaxError: Expected "/*", "//", comment, end of line or whitespace but "b" found. Line: 4, Column: 4
duaraghav8 commented 8 years ago

I've published v1.0.15. Though it needs more testing, it should solve the problem we've discussed. But let me know if it doesn't work out

area commented 8 years ago

This now works for me, so I'm happy for this to be closed unless you want it left open to remind you about the further testing.

duaraghav8 commented 8 years ago

awesome! I'm keeping it open for testing reminder:)