[cfe-dev] C++ new expression

Sebastian Redl sebastian.redl at getdesigned.at
Wed Nov 12 23:06:48 PST 2008


On Wed, 12 Nov 2008 17:06:40 -0800, "Eli Friedman" <eli.friedman at gmail.com>
wrote:
> On Wed, Nov 12, 2008 at 3:06 PM, Sebastian Redl
> <sebastian.redl at getdesigned.at> wrote:
>> Hi,
>>
>> I'm currently implementing parsing new and delete, and I need a bit of
>> help.
>> The grammar of new-expression means that at one point, I have to
>> distinguish between
>>
>> '(' expression-list ')' # new-placement
>> and
>> '(' type-id ')' # alternate form of specifying the type
>>
>> type-id is a normal C++ type-id, like it appears in cast expressions.
>> expression-list is an argument list as it appears in function calls.
>>
>> Is there anything already in the parser that helps me disambiguate
>> between the two?
> 
> ParseParenExpression should work, I think.

I've thought about it, but would it correctly handle the expression list?
Wouldn'it it parse it as a comma expression?

Guess I'll have to take a closer look at the code; if nothing else, I can
probably use it as a guideline for implementing my own stuff.

Sebastian



More information about the cfe-dev mailing list