mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-13 11:15:38 +02:00
partial fix for bug 252243 for LR parser
This commit is contained in:
parent
dae94a218c
commit
8fe659c7a4
2 changed files with 11 additions and 1 deletions
|
@ -95,7 +95,7 @@ public abstract class BaseExtensibleLanguage extends AbstractLanguage {
|
||||||
ILanguage gppLanguage = getParserLanguage() == ParserLanguage.CPP ? GPPLanguage.getDefault() : GCCLanguage.getDefault();
|
ILanguage gppLanguage = getParserLanguage() == ParserLanguage.CPP ? GPPLanguage.getDefault() : GCCLanguage.getDefault();
|
||||||
gtu = gppLanguage.getASTTranslationUnit(reader, scanInfo, fileCreator, index, options, log);
|
gtu = gppLanguage.getASTTranslationUnit(reader, scanInfo, fileCreator, index, options, log);
|
||||||
|
|
||||||
System.out.println("GPP AST:");
|
System.out.println(gppLanguage.getName() + " AST:");
|
||||||
ASTPrinter.print(gtu);
|
ASTPrinter.print(gtu);
|
||||||
System.out.println();
|
System.out.println();
|
||||||
}
|
}
|
||||||
|
|
|
@ -433,6 +433,8 @@ public abstract class BuildASTParserAction extends AbstractParserAction {
|
||||||
|
|
||||||
if(alternateExpr == null)
|
if(alternateExpr == null)
|
||||||
astStack.push(expr);
|
astStack.push(expr);
|
||||||
|
else if(isFunctionType(expr)) // bug 252243
|
||||||
|
astStack.push(alternateExpr);
|
||||||
else {
|
else {
|
||||||
IASTNode ambiguityNode = createAmbiguousExpression(expr, alternateExpr);
|
IASTNode ambiguityNode = createAmbiguousExpression(expr, alternateExpr);
|
||||||
setOffsetAndLength(ambiguityNode);
|
setOffsetAndLength(ambiguityNode);
|
||||||
|
@ -441,6 +443,14 @@ public abstract class BuildASTParserAction extends AbstractParserAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static boolean isFunctionType(IASTExpression expr) {
|
||||||
|
if(expr instanceof IASTTypeIdExpression) {
|
||||||
|
IASTTypeId typeId = ((IASTTypeIdExpression) expr).getTypeId();
|
||||||
|
return typeId.getAbstractDeclarator() instanceof IASTFunctionDeclarator;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lots of rules, no need to list them all.
|
* Lots of rules, no need to list them all.
|
||||||
|
|
Loading…
Add table
Reference in a new issue