Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Questions about CastExprCtx used for parsing of cast-expressions

I have a question about org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.CastExprCtx and its 3 values. I copy the declaration + comment here so you don’t have to look it up.

/**
 * Information about the context in which a cast-_expression_ is parsed:
 * in a binary _expression_, in a binary _expression_ in a template-id, or elsewhere.
 */
protected static enum CastExprCtx {eDirectlyInBExpr, eInBExpr, eNotInBExpr}

It is passed to org.eclipse.cdt.internal.core.dom.parser.AbstractGNUSourceCodeParser.castExpression(CastExprCtx, ITemplateIdStrategy) which only checks for eDirectlyInBExpr. If that is the case and there is a rparen followed by a plus, minus, star or amper (e.g. ") + ") then an CastAmbiguityMarker is created. 

So as far as I found out only really eDirectlyInBExpr is used. eInBExpr is only used once and that is inside castExpression() itself (but it would not make a difference if eNotInBExpr would be passed). Can someone tell me (the best would be with an example) when each of the enum values would be used? Especially eInBExpr would be interesting. From the existance of this it seems that the parsing should be done different inside a binexp inside a template id but I could not find something like this implemented.

Back to the top