ConsenSysMesh / solidity-parser

Solidity Parser in Javascript
137 stars 53 forks source link

Allow "return" keyword to be used as assembly opcode #82

Closed cgewecke closed 7 years ago

cgewecke commented 7 years ago

List of opcodes in the Solidity docs: return looks like the only case that conflicts with the parser's keyword list.

PR:

Gist of AST output with this change.

Resolves #81

cgewecke commented 7 years ago

@federicobond Do you think we should we distinguish between Identifiers and those types at the node level or lump everything in as an Identifier?

federicobond commented 7 years ago

AFAIK, those are all identifiers under the inline assembly grammar. We should fake that when combining both grammars into a single parser.

cgewecke commented 7 years ago

@federicobond I believe if everything is an identifier then the byte and address cases are handled without adding anything. I've update the gist to show output for those with the current rule and added examples to the test.

The return op code was problematic because it's a keyword and is forbidden from being parsed as an Identifier.

cgewecke commented 7 years ago

Just fixed a typo in the gist - everything's an identifier. I have to abandon computer for the rest of the day - if there are additional revisions I'll submit them in tomorrow am. Thanks for reviewing this Federico.