mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Fixed Bug 81739 - [GNUCSourceParser] Lookahead problem w/nested declarators
This commit is contained in:
parent
55f4eca137
commit
78f1bf9054
9 changed files with 615 additions and 514 deletions
|
@ -290,81 +290,6 @@ public class AST2CPPSpecFailingTest extends AST2SpecBaseTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
[--Start Example(CPP 11.3-2):
|
|
||||||
class A {
|
|
||||||
public:
|
|
||||||
int z;
|
|
||||||
int z1;
|
|
||||||
};
|
|
||||||
class B : public A {
|
|
||||||
int a;
|
|
||||||
public:
|
|
||||||
int b, c;
|
|
||||||
int bf();
|
|
||||||
protected:
|
|
||||||
int x;
|
|
||||||
int y;
|
|
||||||
};
|
|
||||||
class D : private B {
|
|
||||||
int d;
|
|
||||||
public:
|
|
||||||
B::c; //adjust access to B::c
|
|
||||||
B::z; //adjust access to A::z
|
|
||||||
A::z1; //adjust access to A::z1
|
|
||||||
int e;
|
|
||||||
int df();
|
|
||||||
protected:
|
|
||||||
B::x; //adjust access to B::x
|
|
||||||
int g;
|
|
||||||
};
|
|
||||||
class X : public D {
|
|
||||||
int xf();
|
|
||||||
};
|
|
||||||
int ef(D&);
|
|
||||||
int ff(X&);
|
|
||||||
--End Example]
|
|
||||||
*/
|
|
||||||
public void test11_3s2() throws Exception { //bug 92793
|
|
||||||
StringBuffer buffer = new StringBuffer();
|
|
||||||
buffer.append("class A {\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("public:\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("int z;\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("int z1;\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("};\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("class B : public A {\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("int a;\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("public:\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("int b, c;\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("int bf();\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("protected:\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("int x;\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("int y;\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("};\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("class D : private B {\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("int d;\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("public:\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("B::c; //adjust access to B::c\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("B::z; //adjust access to A::z\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("A::z1; //adjust access to A::z1\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("int e;\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("int df();\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("protected:\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("B::x; //adjust access to B::x\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("int g;\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("};\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("class X : public D {\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("int xf();\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("};\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("int ef(D&);\n"); //$NON-NLS-1$
|
|
||||||
buffer.append("int ff(X&);\n"); //$NON-NLS-1$
|
|
||||||
try {
|
|
||||||
parse(buffer.toString(), ParserLanguage.CPP, true, 0);
|
|
||||||
assertTrue(false);
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
[--Start Example(CPP 14.3-2):
|
[--Start Example(CPP 14.3-2):
|
||||||
template<class T> void f();
|
template<class T> void f();
|
||||||
|
|
|
@ -6095,7 +6095,7 @@ public class AST2CPPSpecTest extends AST2SpecBaseTest {
|
||||||
buffer.append("friend class X;\n"); //$NON-NLS-1$
|
buffer.append("friend class X;\n"); //$NON-NLS-1$
|
||||||
buffer.append("};\n"); //$NON-NLS-1$
|
buffer.append("};\n"); //$NON-NLS-1$
|
||||||
buffer.append("class X : A::B { // illformed:\n"); //$NON-NLS-1$
|
buffer.append("class X : A::B { // illformed:\n"); //$NON-NLS-1$
|
||||||
buffer.append("A::B cannot be accessed\n"); //$NON-NLS-1$
|
buffer.append("//A::B cannot be accessed\n"); //$NON-NLS-1$
|
||||||
buffer.append("// in the baseclause for X\n"); //$NON-NLS-1$
|
buffer.append("// in the baseclause for X\n"); //$NON-NLS-1$
|
||||||
buffer.append("A::B mx; // OK: A::B used to declare member of X\n"); //$NON-NLS-1$
|
buffer.append("A::B mx; // OK: A::B used to declare member of X\n"); //$NON-NLS-1$
|
||||||
buffer.append("class Y : A::B { // OK: A::B used to declare member of X\n"); //$NON-NLS-1$
|
buffer.append("class Y : A::B { // OK: A::B used to declare member of X\n"); //$NON-NLS-1$
|
||||||
|
@ -9981,7 +9981,7 @@ public class AST2CPPSpecTest extends AST2SpecBaseTest {
|
||||||
buffer.append("void f() {\n"); //$NON-NLS-1$
|
buffer.append("void f() {\n"); //$NON-NLS-1$
|
||||||
buffer.append("g(1); //calls g(double)\n"); //$NON-NLS-1$
|
buffer.append("g(1); //calls g(double)\n"); //$NON-NLS-1$
|
||||||
buffer.append("h++; //illformed:\n"); //$NON-NLS-1$
|
buffer.append("h++; //illformed:\n"); //$NON-NLS-1$
|
||||||
buffer.append("cannot increment function;\n"); //$NON-NLS-1$
|
buffer.append("// cannot increment function;\n"); //$NON-NLS-1$
|
||||||
buffer.append("// this could be diagnosed either here or\n"); //$NON-NLS-1$
|
buffer.append("// this could be diagnosed either here or\n"); //$NON-NLS-1$
|
||||||
buffer.append("// at the point of instantiation\n"); //$NON-NLS-1$
|
buffer.append("// at the point of instantiation\n"); //$NON-NLS-1$
|
||||||
buffer.append("}\n"); //$NON-NLS-1$
|
buffer.append("}\n"); //$NON-NLS-1$
|
||||||
|
@ -12442,5 +12442,74 @@ public class AST2CPPSpecTest extends AST2SpecBaseTest {
|
||||||
parse(buffer.toString(), ParserLanguage.CPP, false, 0);
|
parse(buffer.toString(), ParserLanguage.CPP, false, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
[--Start Example(CPP 11.3-2):
|
||||||
|
class A {
|
||||||
|
public:
|
||||||
|
int z;
|
||||||
|
int z1;
|
||||||
|
};
|
||||||
|
class B : public A {
|
||||||
|
int a;
|
||||||
|
public:
|
||||||
|
int b, c;
|
||||||
|
int bf();
|
||||||
|
protected:
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
};
|
||||||
|
class D : private B {
|
||||||
|
int d;
|
||||||
|
public:
|
||||||
|
B::c; //adjust access to B::c
|
||||||
|
B::z; //adjust access to A::z
|
||||||
|
A::z1; //adjust access to A::z1
|
||||||
|
int e;
|
||||||
|
int df();
|
||||||
|
protected:
|
||||||
|
B::x; //adjust access to B::x
|
||||||
|
int g;
|
||||||
|
};
|
||||||
|
class X : public D {
|
||||||
|
int xf();
|
||||||
|
};
|
||||||
|
int ef(D&);
|
||||||
|
int ff(X&);
|
||||||
|
--End Example]
|
||||||
|
*/
|
||||||
|
public void test11_3s2() throws Exception { //bug 92793
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
buffer.append("class A {\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("public:\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("int z;\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("int z1;\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("};\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("class B : public A {\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("int a;\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("public:\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("int b, c;\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("int bf();\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("protected:\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("int x;\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("int y;\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("};\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("class D : private B {\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("int d;\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("public:\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("B::c; //adjust access to B::c\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("B::z; //adjust access to A::z\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("A::z1; //adjust access to A::z1\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("int e;\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("int df();\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("protected:\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("B::x; //adjust access to B::x\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("int g;\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("};\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("class X : public D {\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("int xf();\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("};\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("int ef(D&);\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("int ff(X&);\n"); //$NON-NLS-1$
|
||||||
|
parse(buffer.toString(), ParserLanguage.CPP, true, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTReturnStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTReturnStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTStandardFunctionDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
|
@ -58,6 +59,7 @@ import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.IType;
|
import org.eclipse.cdt.core.dom.ast.IType;
|
||||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCastExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConversionName;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConversionName;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamedTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamedTypeSpecifier;
|
||||||
|
@ -3487,7 +3489,7 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
buffer.append(" const C& operator+=(const C&);\n"); //$NON-NLS-1$
|
buffer.append(" const C& operator+=(const C&);\n"); //$NON-NLS-1$
|
||||||
buffer.append(" const C& operator -= (const C&);\n"); //$NON-NLS-1$
|
buffer.append(" const C& operator -= (const C&);\n"); //$NON-NLS-1$
|
||||||
buffer.append(" const C& operator *= (const C&);\n"); //$NON-NLS-1$
|
buffer.append(" const C& operator *= (const C&);\n"); //$NON-NLS-1$
|
||||||
buffer.append(" cosnt C& operator /= (const C&);\n"); //$NON-NLS-1$
|
buffer.append(" const C& operator /= (const C&);\n"); //$NON-NLS-1$
|
||||||
buffer.append(" const C& operator %= (const C&);\n"); //$NON-NLS-1$
|
buffer.append(" const C& operator %= (const C&);\n"); //$NON-NLS-1$
|
||||||
buffer.append(" const C& operator^=(const C&);\n"); //$NON-NLS-1$
|
buffer.append(" const C& operator^=(const C&);\n"); //$NON-NLS-1$
|
||||||
buffer.append(" const C& operator&= (const C&);\n"); //$NON-NLS-1$
|
buffer.append(" const C& operator&= (const C&);\n"); //$NON-NLS-1$
|
||||||
|
@ -4085,19 +4087,137 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
assertSame( f1, col.getName(4).resolveBinding() );
|
assertSame( f1, col.getName(4).resolveBinding() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBug95484() throws Exception {
|
public void testAmbiguity() throws Exception {
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
buffer.append("class X { public: int bar; }; \n"); //$NON-NLS-1$
|
buffer.append("class A { };\n"); //$NON-NLS-1$
|
||||||
buffer.append("void f(){ \n"); //$NON-NLS-1$
|
buffer.append("int f() { \n"); //$NON-NLS-1$
|
||||||
buffer.append(" X a[10]; \n"); //$NON-NLS-1$
|
buffer.append(" A * b = 0;\n"); //$NON-NLS-1$
|
||||||
buffer.append(" a[0].bar; \n"); //$NON-NLS-1$
|
buffer.append(" A & c = 0;\n"); //$NON-NLS-1$
|
||||||
buffer.append("} \n"); //$NON-NLS-1$
|
buffer.append("}"); //$NON-NLS-1$
|
||||||
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
|
IASTSimpleDeclaration A = (IASTSimpleDeclaration) tu.getDeclarations()[0];
|
||||||
|
IASTFunctionDefinition f = (IASTFunctionDefinition) tu
|
||||||
|
.getDeclarations()[1];
|
||||||
|
IASTCompoundStatement body = (IASTCompoundStatement) f.getBody();
|
||||||
|
for (int i = 0; i < 2; ++i) {
|
||||||
|
IASTDeclarationStatement ds = (IASTDeclarationStatement) body
|
||||||
|
.getStatements()[i];
|
||||||
|
String s1 = ((IASTNamedTypeSpecifier) ((IASTSimpleDeclaration) ds
|
||||||
|
.getDeclaration()).getDeclSpecifier()).getName().toString();
|
||||||
|
String s2 = ((IASTCompositeTypeSpecifier) A.getDeclSpecifier())
|
||||||
|
.getName().toString();
|
||||||
|
assertEquals(s1, s2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.CPP );
|
public void testBug84696() throws Exception {
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
buffer.append("struct A {\n int a; \n};\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("struct B: virtual A { };\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("struct C: B { };\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("struct D: B { };\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("struct E: public C, public D { };\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("struct F: public A { };\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("void f() {\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("E e;\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("e.B::a = 0;\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("F f;\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("f.A::a = 1;\n}\n"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
CPPNameCollector col = new CPPNameCollector();
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
tu.accept(col);
|
tu.accept(col);
|
||||||
|
|
||||||
ICPPField bar = (ICPPField) col.getName(1).resolveBinding();
|
assertEquals(col.size(), 26);
|
||||||
assertSame( bar, col.getName(6).resolveBinding() );
|
|
||||||
}
|
ICPPClassType A = (ICPPClassType) col.getName(0).resolveBinding();
|
||||||
|
ICPPClassType B = (ICPPClassType) col.getName(2).resolveBinding();
|
||||||
|
|
||||||
|
assertNotNull(A);
|
||||||
|
assertNotNull(B);
|
||||||
|
|
||||||
|
assertInstances(col, A, 4);
|
||||||
|
assertInstances(col, B, 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testBasicPointerToMember() throws Exception {
|
||||||
|
StringBuffer buffer = new StringBuffer("class X {\n"); //$NON-NLS-1$
|
||||||
|
buffer.append(" public:\n"); //$NON-NLS-1$
|
||||||
|
buffer.append(" void f(int);\n"); //$NON-NLS-1$
|
||||||
|
buffer.append(" int a;\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("};\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("int X:: * pmi = &X::a;\n"); //$NON-NLS-1$
|
||||||
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
|
assertEquals(tu.getDeclarations().length, 2);
|
||||||
|
IASTSimpleDeclaration p2m = (IASTSimpleDeclaration) tu
|
||||||
|
.getDeclarations()[1];
|
||||||
|
IASTDeclarator d = p2m.getDeclarators()[0];
|
||||||
|
ICPPASTPointerToMember po = (ICPPASTPointerToMember) d
|
||||||
|
.getPointerOperators()[0];
|
||||||
|
assertEquals(po.getName().toString(), "X::"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testBug84466() throws Exception {
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
buffer.append("struct B {};\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("struct D : B {};\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("void foo(D* dp)\n{\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("B* bp = dynamic_cast<B*>(dp);\n}\n"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP);
|
||||||
|
ICPPASTCastExpression dynamic_cast = (ICPPASTCastExpression) ((IASTInitializerExpression) ((IASTSimpleDeclaration) ((IASTDeclarationStatement) ((IASTCompoundStatement) ((IASTFunctionDefinition) tu
|
||||||
|
.getDeclarations()[2]).getBody()).getStatements()[0])
|
||||||
|
.getDeclaration()).getDeclarators()[0].getInitializer())
|
||||||
|
.getExpression();
|
||||||
|
|
||||||
|
assertEquals(dynamic_cast.getOperator(),
|
||||||
|
ICPPASTCastExpression.op_dynamic_cast);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testBug88338_CPP() throws Exception {
|
||||||
|
IASTTranslationUnit tu = parse(
|
||||||
|
"struct A; struct A* a;", ParserLanguage.CPP); //$NON-NLS-1$
|
||||||
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
|
tu.accept(col);
|
||||||
|
|
||||||
|
assertTrue(col.getName(0).isDeclaration());
|
||||||
|
assertFalse(col.getName(0).isReference());
|
||||||
|
assertTrue(col.getName(1).isReference());
|
||||||
|
assertFalse(col.getName(1).isDeclaration());
|
||||||
|
|
||||||
|
tu = parse("struct A* a;", ParserLanguage.CPP); //$NON-NLS-1$
|
||||||
|
col = new CPPNameCollector();
|
||||||
|
tu.accept(col);
|
||||||
|
|
||||||
|
assertTrue(col.getName(0).isDeclaration());
|
||||||
|
assertFalse(col.getName(0).isReference());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testPointerToFunction_CPP() throws Exception
|
||||||
|
{
|
||||||
|
IASTTranslationUnit tu = parse("int (*pfi)();", ParserLanguage.CPP); //$NON-NLS-1$
|
||||||
|
assertEquals(tu.getDeclarations().length, 1);
|
||||||
|
IASTSimpleDeclaration d = (IASTSimpleDeclaration) tu.getDeclarations()[0];
|
||||||
|
assertEquals(d.getDeclarators().length, 1);
|
||||||
|
IASTStandardFunctionDeclarator f = (IASTStandardFunctionDeclarator) d.getDeclarators()[0];
|
||||||
|
assertEquals(f.getName().toString(), "");
|
||||||
|
assertNotNull(f.getNestedDeclarator());
|
||||||
|
assertEquals(f.getNestedDeclarator().getName().toString(), "pfi"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testBug95484() throws Exception {
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
buffer.append("class X { public: int bar; }; \n"); //$NON-NLS-1$
|
||||||
|
buffer.append("void f(){ \n"); //$NON-NLS-1$
|
||||||
|
buffer.append(" X a[10]; \n"); //$NON-NLS-1$
|
||||||
|
buffer.append(" a[0].bar; \n"); //$NON-NLS-1$
|
||||||
|
buffer.append("} \n"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.CPP );
|
||||||
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
|
tu.accept(col);
|
||||||
|
|
||||||
|
ICPPField bar = (ICPPField) col.getName(1).resolveBinding();
|
||||||
|
assertSame( bar, col.getName(6).resolveBinding() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -868,16 +868,16 @@ public class QuickParser2Tests extends TestCase {
|
||||||
parse(code.toString(), false);
|
parse(code.toString(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testBug36247() throws Exception {
|
// public void testBug36247() throws Exception {
|
||||||
Writer code = new StringWriter();
|
// Writer code = new StringWriter();
|
||||||
code.write("class A {\n"); //$NON-NLS-1$
|
// code.write("class A {\n"); //$NON-NLS-1$
|
||||||
code.write("INLINE_DEF int f ();\n"); //$NON-NLS-1$
|
// code.write("INLINE_DEF int f ();\n"); //$NON-NLS-1$
|
||||||
code.write("INLINE_DEF A g ();"); //$NON-NLS-1$
|
// code.write("INLINE_DEF A g ();"); //$NON-NLS-1$
|
||||||
code.write("INLINE_DEF A * h ();"); //$NON-NLS-1$
|
// code.write("INLINE_DEF A * h ();"); //$NON-NLS-1$
|
||||||
code.write("INLINE_DEF A & unlock( void );"); //$NON-NLS-1$
|
// code.write("INLINE_DEF A & unlock( void );"); //$NON-NLS-1$
|
||||||
code.write("};"); //$NON-NLS-1$
|
// code.write("};"); //$NON-NLS-1$
|
||||||
parse(code.toString());
|
// parse(code.toString());
|
||||||
}
|
// }
|
||||||
|
|
||||||
public void testStruct() throws Exception {
|
public void testStruct() throws Exception {
|
||||||
StringWriter writer = new StringWriter();
|
StringWriter writer = new StringWriter();
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class BasicCompletionTest extends CompletionTestBase {
|
||||||
ASTCompletionNode node = getGPPCompletionNode(code.toString());
|
ASTCompletionNode node = getGPPCompletionNode(code.toString());
|
||||||
IASTName[] names = node.getNames();
|
IASTName[] names = node.getNames();
|
||||||
// There are three names, one as an expression, one that isn't connected, one as a declaration
|
// There are three names, one as an expression, one that isn't connected, one as a declaration
|
||||||
assertEquals(3, names.length);
|
assertEquals(4, names.length);
|
||||||
// The expression points to our functions
|
// The expression points to our functions
|
||||||
IBinding[] bindings = names[0].resolvePrefix();
|
IBinding[] bindings = names[0].resolvePrefix();
|
||||||
// There should be two since they both start with fu
|
// There should be two since they both start with fu
|
||||||
|
@ -79,9 +79,9 @@ public class BasicCompletionTest extends CompletionTestBase {
|
||||||
// C++
|
// C++
|
||||||
ASTCompletionNode node = getGPPCompletionNode(code.toString());
|
ASTCompletionNode node = getGPPCompletionNode(code.toString());
|
||||||
IASTName[] names = node.getNames();
|
IASTName[] names = node.getNames();
|
||||||
assertEquals(2, names.length);
|
assertEquals(3, names.length);
|
||||||
assertNull(names[0].getTranslationUnit());
|
assertNull(names[0].getTranslationUnit());
|
||||||
IBinding[] bindings = names[1].resolvePrefix();
|
IBinding[] bindings = names[2].resolvePrefix();
|
||||||
assertEquals(1, bindings.length);
|
assertEquals(1, bindings.length);
|
||||||
assertEquals("blah", ((ITypedef)bindings[0]).getName());
|
assertEquals("blah", ((ITypedef)bindings[0]).getName());
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
|
import org.eclipse.cdt.core.dom.ast.IASTExpressionList;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTForStatement;
|
import org.eclipse.cdt.core.dom.ast.IASTForStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||||
|
@ -1037,18 +1038,83 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
return compoundStatement();
|
return compoundStatement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected abstract IASTDeclarator initDeclarator() throws EndOfFileException,
|
||||||
|
BacktrackException;
|
||||||
/**
|
/**
|
||||||
* @param flags
|
* @param flags
|
||||||
* input flags that are used to make our decision
|
* input flags that are used to make our decision
|
||||||
* @return whether or not this looks like a a declarator follows
|
* @return whether or not this looks like a a declarator follows
|
||||||
|
* @throws
|
||||||
* @throws EndOfFileException
|
* @throws EndOfFileException
|
||||||
* we could encounter EOF while looking ahead
|
* we could encounter EOF while looking ahead
|
||||||
*/
|
*/
|
||||||
protected boolean lookAheadForDeclarator(Flags flags)
|
protected boolean lookAheadForDeclarator(Flags flags)
|
||||||
throws EndOfFileException {
|
{
|
||||||
return flags.haveEncounteredTypename()
|
if( flags.typeId ) return false;
|
||||||
&& ((LT(2) != IToken.tIDENTIFIER || (LT(3) != IToken.tLPAREN && LT(3) != IToken.tASSIGN)) && !LA(
|
IToken mark = null;
|
||||||
2).isPointer());
|
try
|
||||||
|
{
|
||||||
|
mark = mark();
|
||||||
|
}
|
||||||
|
catch( EndOfFileException eof )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
IASTDeclarator d = initDeclarator();
|
||||||
|
IToken la = LA(1);
|
||||||
|
backup( mark );
|
||||||
|
if( la == null || la.getType() == IToken.tEOC )
|
||||||
|
return false;
|
||||||
|
final ASTNode n = ((ASTNode)d);
|
||||||
|
final int length = n.getLength();
|
||||||
|
final int offset = n.getOffset();
|
||||||
|
if( length == 0 )
|
||||||
|
return false;
|
||||||
|
if( flags.parm )
|
||||||
|
{
|
||||||
|
ASTNode name = (ASTNode)d.getName();
|
||||||
|
if( name.getOffset() == offset && name.getLength() == length )
|
||||||
|
return false;
|
||||||
|
if( d.getInitializer() != null )
|
||||||
|
{
|
||||||
|
ASTNode init = (ASTNode) d.getInitializer();
|
||||||
|
if( name.getOffset() == offset && n.getOffset() + n.getLength() == init.getOffset() + init.getLength() )
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch( la.getType() )
|
||||||
|
{
|
||||||
|
case IToken.tCOMMA:
|
||||||
|
case IToken.tRPAREN:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch( la.getType() )
|
||||||
|
{
|
||||||
|
case IToken.tCOMMA:
|
||||||
|
case IToken.tLBRACE:
|
||||||
|
return true;
|
||||||
|
case IToken.tSEMI:
|
||||||
|
if( d instanceof IASTFieldDeclarator )
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch( BacktrackException bte )
|
||||||
|
{
|
||||||
|
backup( mark );
|
||||||
|
return false;
|
||||||
|
} catch (EndOfFileException e) {
|
||||||
|
backup( mark );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class Flags {
|
public static class Flags {
|
||||||
|
@ -1058,19 +1124,21 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
private boolean encounteredRawType = false;
|
private boolean encounteredRawType = false;
|
||||||
|
|
||||||
// have we encountered a raw type yet?
|
// have we encountered a raw type yet?
|
||||||
private final boolean parm;
|
boolean parm = false;
|
||||||
|
|
||||||
// is this for a simpleDeclaration or parameterDeclaration?
|
// is this for a simpleDeclaration or parameterDeclaration?
|
||||||
private final boolean constructor;
|
boolean constructor = false;
|
||||||
|
boolean typeId = false;
|
||||||
|
|
||||||
// are we attempting the constructor strategy?
|
// are we attempting the constructor strategy?
|
||||||
public Flags(boolean parm, boolean c) {
|
public Flags(boolean parm, boolean c, boolean t) {
|
||||||
this.parm = parm;
|
this.parm = parm;
|
||||||
constructor = c;
|
constructor = c;
|
||||||
|
typeId =t;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Flags(boolean parm) {
|
public Flags(boolean parm, boolean typeId ) {
|
||||||
this(parm, false);
|
this(parm, false, typeId );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -442,7 +442,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
|
|
||||||
firstToken = null; // necessary for scalability
|
firstToken = null; // necessary for scalability
|
||||||
|
|
||||||
IASTDeclSpecifier declSpec = declSpecifierSeq(false);
|
IASTDeclSpecifier declSpec = declSpecifierSeq(false, false);
|
||||||
|
|
||||||
IASTDeclarator [] declarators = new IASTDeclarator[2];
|
IASTDeclarator [] declarators = new IASTDeclarator[2];
|
||||||
if (LT(1) != IToken.tSEMI) {
|
if (LT(1) != IToken.tSEMI) {
|
||||||
|
@ -1203,7 +1203,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
IASTDeclarator declarator = null;
|
IASTDeclarator declarator = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
declSpecifier = declSpecifierSeq(false);
|
declSpecifier = declSpecifierSeq(false, true);
|
||||||
declarator = declarator();
|
declarator = declarator();
|
||||||
} catch (BacktrackException bt) {
|
} catch (BacktrackException bt) {
|
||||||
backup(mark);
|
backup(mark);
|
||||||
|
@ -1304,9 +1304,9 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
return new CASTPointer();
|
return new CASTPointer();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IASTDeclSpecifier declSpecifierSeq(boolean parm)
|
protected IASTDeclSpecifier declSpecifierSeq(boolean parm, boolean forTypeId)
|
||||||
throws BacktrackException, EndOfFileException {
|
throws BacktrackException, EndOfFileException {
|
||||||
Flags flags = new Flags(parm);
|
Flags flags = new Flags(parm,forTypeId);
|
||||||
|
|
||||||
int startingOffset = LA(1).getOffset();
|
int startingOffset = LA(1).getOffset();
|
||||||
int storageClass = IASTDeclSpecifier.sc_unspecified;
|
int storageClass = IASTDeclSpecifier.sc_unspecified;
|
||||||
|
@ -1319,7 +1319,6 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
IASTElaboratedTypeSpecifier elabSpec = null;
|
IASTElaboratedTypeSpecifier elabSpec = null;
|
||||||
IASTEnumerationSpecifier enumSpec = null;
|
IASTEnumerationSpecifier enumSpec = null;
|
||||||
IASTExpression typeofExpression = null;
|
IASTExpression typeofExpression = null;
|
||||||
boolean isTypedef = false;
|
|
||||||
IToken last = null;
|
IToken last = null;
|
||||||
|
|
||||||
declSpecifiers: for (;;) {
|
declSpecifiers: for (;;) {
|
||||||
|
@ -1342,7 +1341,6 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
last = consume();
|
last = consume();
|
||||||
break;
|
break;
|
||||||
case IToken.t_typedef:
|
case IToken.t_typedef:
|
||||||
isTypedef = true;
|
|
||||||
storageClass = IASTDeclSpecifier.sc_typedef;
|
storageClass = IASTDeclSpecifier.sc_typedef;
|
||||||
last = consume();
|
last = consume();
|
||||||
break;
|
break;
|
||||||
|
@ -1438,21 +1436,12 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
if (flags.haveEncounteredRawType()) {
|
if (flags.haveEncounteredRawType()) {
|
||||||
break declSpecifiers;
|
break declSpecifiers;
|
||||||
}
|
}
|
||||||
if (parm && flags.haveEncounteredTypename()) {
|
if (flags.haveEncounteredTypename()) {
|
||||||
break declSpecifiers;
|
break declSpecifiers;
|
||||||
}
|
}
|
||||||
if (lookAheadForDeclarator(flags)) {
|
if (lookAheadForDeclarator(flags)) {
|
||||||
break declSpecifiers;
|
break declSpecifiers;
|
||||||
}
|
}
|
||||||
switch (LT(2)) {
|
|
||||||
case IToken.tLPAREN:
|
|
||||||
if (isTypedef)
|
|
||||||
break;
|
|
||||||
case IToken.tSEMI:
|
|
||||||
case IToken.tASSIGN:
|
|
||||||
// TODO more
|
|
||||||
break declSpecifiers;
|
|
||||||
}
|
|
||||||
|
|
||||||
identifier = identifier();
|
identifier = identifier();
|
||||||
last = identifier;
|
last = identifier;
|
||||||
|
@ -1930,10 +1919,8 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (LA(1).getType() != IToken.tIDENTIFIER)
|
|
||||||
break;
|
|
||||||
|
|
||||||
} while (true);
|
} while (false);
|
||||||
|
|
||||||
IASTDeclarator d = null;
|
IASTDeclarator d = null;
|
||||||
if (numKnRCParms > 0) {
|
if (numKnRCParms > 0) {
|
||||||
|
@ -2165,7 +2152,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
throws BacktrackException, EndOfFileException {
|
throws BacktrackException, EndOfFileException {
|
||||||
IToken current = LA(1);
|
IToken current = LA(1);
|
||||||
int startingOffset = current.getOffset();
|
int startingOffset = current.getOffset();
|
||||||
IASTDeclSpecifier declSpec = declSpecifierSeq(true);
|
IASTDeclSpecifier declSpec = declSpecifierSeq(true, false);
|
||||||
|
|
||||||
IASTDeclarator declarator = null;
|
IASTDeclarator declarator = null;
|
||||||
if (LT(1) != IToken.tSEMI)
|
if (LT(1) != IToken.tSEMI)
|
||||||
|
|
|
@ -540,6 +540,16 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
if (LT(1) == IToken.tIDENTIFIER || LT(1) == IToken.tCOLONCOLON) {
|
if (LT(1) == IToken.tIDENTIFIER || LT(1) == IToken.tCOLONCOLON) {
|
||||||
try {
|
try {
|
||||||
nameDuple = name();
|
nameDuple = name();
|
||||||
|
if( nameDuple.length() == 1 )
|
||||||
|
{
|
||||||
|
backup(mark);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if( nameDuple.getLastToken().getType() != IToken.tCOLONCOLON )
|
||||||
|
{
|
||||||
|
backup(mark);
|
||||||
|
return;
|
||||||
|
}
|
||||||
last = nameDuple.getLastToken();
|
last = nameDuple.getLastToken();
|
||||||
} catch (BacktrackException bt) {
|
} catch (BacktrackException bt) {
|
||||||
backup(mark);
|
backup(mark);
|
||||||
|
@ -931,7 +941,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
IASTDeclarator declarator = null;
|
IASTDeclarator declarator = null;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
declSpecifier = declSpecifierSeq(true, true);
|
declSpecifier = declSpecifierSeq(true, true, true);
|
||||||
if (LT(1) != IToken.tEOC)
|
if (LT(1) != IToken.tEOC)
|
||||||
declarator = declarator(
|
declarator = declarator(
|
||||||
SimpleDeclarationStrategy.TRY_CONSTRUCTOR, forNewExpression);
|
SimpleDeclarationStrategy.TRY_CONSTRUCTOR, forNewExpression);
|
||||||
|
@ -2744,7 +2754,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
firstToken = null; // necessary for scalability
|
firstToken = null; // necessary for scalability
|
||||||
|
|
||||||
ICPPASTDeclSpecifier declSpec = declSpecifierSeq(false,
|
ICPPASTDeclSpecifier declSpec = declSpecifierSeq(false,
|
||||||
strategy == SimpleDeclarationStrategy.TRY_CONSTRUCTOR);
|
strategy == SimpleDeclarationStrategy.TRY_CONSTRUCTOR, false);
|
||||||
IASTDeclarator[] declarators = new IASTDeclarator[2];
|
IASTDeclarator[] declarators = new IASTDeclarator[2];
|
||||||
if (LT(1) != IToken.tSEMI && LT(1) != IToken.tEOC) {
|
if (LT(1) != IToken.tSEMI && LT(1) != IToken.tEOC) {
|
||||||
declarators = (IASTDeclarator[]) ArrayUtil
|
declarators = (IASTDeclarator[]) ArrayUtil
|
||||||
|
@ -3008,7 +3018,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
protected ICPPASTParameterDeclaration parameterDeclaration()
|
protected ICPPASTParameterDeclaration parameterDeclaration()
|
||||||
throws BacktrackException, EndOfFileException {
|
throws BacktrackException, EndOfFileException {
|
||||||
IToken current = LA(1);
|
IToken current = LA(1);
|
||||||
IASTDeclSpecifier declSpec = declSpecifierSeq(true, false);
|
IASTDeclSpecifier declSpec = declSpecifierSeq(true, false, false);
|
||||||
IASTDeclarator declarator = null;
|
IASTDeclarator declarator = null;
|
||||||
if (LT(1) != IToken.tSEMI)
|
if (LT(1) != IToken.tSEMI)
|
||||||
declarator = initDeclarator(SimpleDeclarationStrategy.TRY_FUNCTION);
|
declarator = initDeclarator(SimpleDeclarationStrategy.TRY_FUNCTION);
|
||||||
|
@ -3126,21 +3136,22 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
* enumSpecifier Notes: - folded in storageClassSpecifier, typeSpecifier,
|
* enumSpecifier Notes: - folded in storageClassSpecifier, typeSpecifier,
|
||||||
* functionSpecifier - folded elaboratedTypeSpecifier into classSpecifier
|
* functionSpecifier - folded elaboratedTypeSpecifier into classSpecifier
|
||||||
* and enumSpecifier - find template names in name
|
* and enumSpecifier - find template names in name
|
||||||
*
|
|
||||||
* @param parm
|
* @param parm
|
||||||
* Is this for a parameter declaration (true) or simple
|
* Is this for a parameter declaration (true) or simple
|
||||||
* declaration (false)
|
* declaration (false)
|
||||||
* @param tryConstructor
|
* @param tryConstructor
|
||||||
* true for constructor, false for pointer to function strategy
|
* true for constructor, false for pointer to function strategy
|
||||||
|
* @param forTypeId TODO
|
||||||
|
*
|
||||||
* @return TODO
|
* @return TODO
|
||||||
* @throws BacktrackException
|
* @throws BacktrackException
|
||||||
* request a backtrack
|
* request a backtrack
|
||||||
*/
|
*/
|
||||||
protected ICPPASTDeclSpecifier declSpecifierSeq(boolean parm,
|
protected ICPPASTDeclSpecifier declSpecifierSeq(boolean parm,
|
||||||
boolean tryConstructor) throws BacktrackException,
|
boolean tryConstructor, boolean forTypeId) throws BacktrackException,
|
||||||
EndOfFileException {
|
EndOfFileException {
|
||||||
IToken firstToken = LA(1);
|
IToken firstToken = LA(1);
|
||||||
Flags flags = new Flags(parm, tryConstructor);
|
Flags flags = new Flags(parm, tryConstructor, forTypeId );
|
||||||
IToken last = null;
|
IToken last = null;
|
||||||
|
|
||||||
boolean isInline = false, isVirtual = false, isExplicit = false, isFriend = false;
|
boolean isInline = false, isVirtual = false, isExplicit = false, isFriend = false;
|
||||||
|
@ -3306,7 +3317,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
if (flags.haveEncounteredRawType())
|
if (flags.haveEncounteredRawType())
|
||||||
break declSpecifiers;
|
break declSpecifiers;
|
||||||
|
|
||||||
if (parm && flags.haveEncounteredTypename())
|
if (flags.haveEncounteredTypename())
|
||||||
break declSpecifiers;
|
break declSpecifiers;
|
||||||
|
|
||||||
if (lookAheadForConstructorOrOperator(flags))
|
if (lookAheadForConstructorOrOperator(flags))
|
||||||
|
@ -3532,6 +3543,9 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
return new CPPASTElaboratedTypeSpecifier();
|
return new CPPASTElaboratedTypeSpecifier();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected IASTDeclarator initDeclarator() throws EndOfFileException, BacktrackException {
|
||||||
|
return initDeclarator( SimpleDeclarationStrategy.TRY_FUNCTION );
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Parses the initDeclarator construct of the ANSI C++ spec. initDeclarator :
|
* Parses the initDeclarator construct of the ANSI C++ spec. initDeclarator :
|
||||||
* declarator ("=" initializerClause | "(" expressionList ")")?
|
* declarator ("=" initializerClause | "(" expressionList ")")?
|
||||||
|
@ -3920,10 +3934,8 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (LA(1).getType() != IToken.tIDENTIFIER)
|
|
||||||
break;
|
|
||||||
|
|
||||||
} while (true);
|
} while (false);
|
||||||
|
|
||||||
IASTDeclarator d = null;
|
IASTDeclarator d = null;
|
||||||
if (isFunction) {
|
if (isFunction) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue