[Issue 9232] Parsing error on some templated methods calls

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 28 07:03:45 PST 2012


http://d.puremagic.com/issues/show_bug.cgi?id=9232


Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement


--- Comment #1 from Kenji Hara <k.hara.pg at gmail.com> 2012-12-28 07:03:44 PST ---
This is an enhancement request against language syntax.

---

>  (foo).bar!int();   // Error: found '!' when expecting ';' following

In current, "(foo).bar" matches UnaryExpression "(Type) . identifier".
http://dlang.org/expression#UnaryExpression

("foo" is parsed as TypeIdentifier, and in semantic analysis phase, it will be
finally analyzed as an expression.)

Then, the remaining portions "!int();" don't match anything in the grammar.

---

To allow it, we should add a case to UnaryExpression like follows:

UnaryExpression:
    & UnaryExpression
    ++ UnaryExpression
    -- UnaryExpression
    * UnaryExpression
    - UnaryExpression
    + UnaryExpression
    ! UnaryExpression
    ComplementExpression
    ( Type ) . Identifier
    ( Type ) . TemplateInstance       // new!
    NewExpression
    DeleteExpression
    CastExpression
    PowExpression

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list