Solidity: grammar.txt: missing rule for 'NEW Identifier()'

Created on 28 Oct 2017  路  4Comments  路  Source: ethereum/solidity

(I am currently trying to verify my Solidity LALR Parser project syparse with the examples in the Solidity documentation.)

The following example is taken from chapter Visibility and Getters (Getter Functions) in document contracts.rst:

    pragma solidity ^0.4.0;
    contract C {
        uint public data = 42;
    }
    contract Caller {
        C c = new C();
        function f() {
            uint local = c.data();
        }
    }

The existing grammar rule
NewExpression = 'new' TypeName
does not cover an expression like
'new' Identifier().

bug documentation

All 4 comments

It also lacks support for

uint[] memory x = new uint[](300);

I think it does cover new Identifier(). It's parsed as:

FunctionCall > NewExpression > UserDefinedTypeName > Identifier

new uint[](300) is specified and parsed as:

FunctionCall > NewExpression > ArrayTypeName > ElementaryTypeName

Thanks Frederico.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chriseth picture chriseth  路  3Comments

bshastry picture bshastry  路  3Comments

chriseth picture chriseth  路  3Comments

AnthonyAkentiev picture AnthonyAkentiev  路  3Comments

leviadam picture leviadam  路  4Comments