1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

partial fix for bug 252243 for LR parser

This commit is contained in:
Mike Kucera 2009-03-30 15:59:54 +00:00
parent dae94a218c
commit 8fe659c7a4
2 changed files with 11 additions and 1 deletions

View file

@ -95,7 +95,7 @@ public abstract class BaseExtensibleLanguage extends AbstractLanguage {
ILanguage gppLanguage = getParserLanguage() == ParserLanguage.CPP ? GPPLanguage.getDefault() : GCCLanguage.getDefault();
gtu = gppLanguage.getASTTranslationUnit(reader, scanInfo, fileCreator, index, options, log);
System.out.println("GPP AST:");
System.out.println(gppLanguage.getName() + " AST:");
ASTPrinter.print(gtu);
System.out.println();
}

View file

@ -433,13 +433,23 @@ public abstract class BuildASTParserAction extends AbstractParserAction {
if(alternateExpr == null)
astStack.push(expr);
else if(isFunctionType(expr)) // bug 252243
astStack.push(alternateExpr);
else {
IASTNode ambiguityNode = createAmbiguousExpression(expr, alternateExpr);
setOffsetAndLength(ambiguityNode);
astStack.push(ambiguityNode);
}
}
private static boolean isFunctionType(IASTExpression expr) {
if(expr instanceof IASTTypeIdExpression) {
IASTTypeId typeId = ((IASTTypeIdExpression) expr).getTypeId();
return typeId.getAbstractDeclarator() instanceof IASTFunctionDeclarator;
}
return false;
}
/**