1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

fixed constructor ambiguity bug

This commit is contained in:
Mike Kucera 2008-03-13 21:06:04 +00:00
parent b90fa70285
commit 7e112a866e
16 changed files with 10612 additions and 10938 deletions

View file

@ -106,7 +106,6 @@ import org.eclipse.cdt.internal.core.parser.ParserException;
* @author Doug Schaefer
*/
public class AST2Tests extends AST2BaseTest {
private static ParserLanguage[] LANGUAGES= {ParserLanguage.C, ParserLanguage.CPP};
public static TestSuite suite() {
return suite(AST2Tests.class);
@ -3604,8 +3603,7 @@ public class AST2Tests extends AST2BaseTest {
// }
public void testBug181305_1() throws Exception {
StringBuffer buffer = getContents(1)[0];
for (int i = 0; i < LANGUAGES.length; i++) {
final ParserLanguage lang= LANGUAGES[i];
for(ParserLanguage lang : ParserLanguage.values()) {
IASTTranslationUnit tu = parse( buffer.toString(), lang, true, true );
// check class
@ -3627,8 +3625,7 @@ public class AST2Tests extends AST2BaseTest {
// }
public void testBug181305_2() throws Exception {
StringBuffer buffer = getContents(1)[0];
for (int i = 0; i < LANGUAGES.length; i++) {
final ParserLanguage lang= LANGUAGES[i];
for(ParserLanguage lang : ParserLanguage.values()) {
IASTTranslationUnit tu = parse( buffer.toString(), lang, true, true );
// check class
@ -3650,8 +3647,8 @@ public class AST2Tests extends AST2BaseTest {
+ "int g(int n, int m) {return n;}\n"
+ "void foo() { f=g; }";
for (int i = 0; i < LANGUAGES.length; i++)
parseAndCheckBindings(code, LANGUAGES[i]);
for(ParserLanguage lang : ParserLanguage.values())
parseAndCheckBindings(code, lang);
}
// void test() {
@ -3659,8 +3656,8 @@ public class AST2Tests extends AST2BaseTest {
// }
public void testBug181942() throws Exception {
StringBuffer buffer = getContents(1)[0];
for (int i = 0; i < LANGUAGES.length; i++)
parse( buffer.toString(), LANGUAGES[i], true, true );
for(ParserLanguage lang : ParserLanguage.values())
parse( buffer.toString(), lang, true, true );
}
public void testMacroCommentsBug_177154_2() throws Exception {
@ -3696,8 +3693,8 @@ public class AST2Tests extends AST2BaseTest {
// int __builtin_sin;
public void testBug182464() throws Exception {
StringBuffer buffer = getContents(1)[0];
for (int i = 0; i < LANGUAGES.length; i++)
parseAndCheckBindings( buffer.toString(), LANGUAGES[i], true);
for(ParserLanguage lang : ParserLanguage.values())
parseAndCheckBindings( buffer.toString(), lang, true);
}
public void testBug186018() throws Exception {
@ -3854,8 +3851,8 @@ public class AST2Tests extends AST2BaseTest {
// typedef int (*J)(J);
public void testBug192165() throws Exception {
String content= getContents(1)[0].toString();
for (int i = 0; i < LANGUAGES.length; i++) {
IASTTranslationUnit tu = parse( content, LANGUAGES[i], true, false );
for(ParserLanguage lang : ParserLanguage.values()) {
IASTTranslationUnit tu = parse( content, lang, true, false );
CNameCollector col = new CNameCollector();
tu.accept(col);
assertInstance(col.getName(0).resolveBinding(), IProblemBinding.class);

View file

@ -87,8 +87,7 @@ public class DOMLocationTests extends AST2BaseTest {
}
public void testBaseCase() throws ParserException {
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
: null) {
for (ParserLanguage p : ParserLanguage.values()) {
IASTTranslationUnit tu = parse("int x;", p); //$NON-NLS-1$
IASTDeclaration declaration = tu.getDeclarations()[0];
IASTNodeLocation[] nodeLocations = declaration.getNodeLocations();
@ -101,19 +100,15 @@ public class DOMLocationTests extends AST2BaseTest {
assertEquals(fileLocation.getNodeLength(), 6);
IASTNodeLocation[] tuLocations = tu.getNodeLocations();
assertEquals(tuLocations.length, nodeLocations.length);
assertEquals(fileLocation.getFileName(),
((IASTFileLocation) tuLocations[0]).getFileName());
assertEquals(fileLocation.getNodeOffset(), tuLocations[0]
.getNodeOffset());
assertEquals(fileLocation.getNodeLength(), tuLocations[0]
.getNodeLength());
assertEquals(fileLocation.getFileName(), ((IASTFileLocation) tuLocations[0]).getFileName());
assertEquals(fileLocation.getNodeOffset(), tuLocations[0].getNodeOffset());
assertEquals(fileLocation.getNodeLength(), tuLocations[0].getNodeLength());
}
}
public void testSimpleDeclaration() throws ParserException {
String code = "int xLen5, * yLength8, zLength16( int );"; //$NON-NLS-1$
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
: null) {
for (ParserLanguage p : ParserLanguage.values()) {
IASTTranslationUnit tu = parse(code, p);
IASTDeclaration[] declarations = tu.getDeclarations();
assertEquals(declarations.length, 1);
@ -132,17 +127,13 @@ public class DOMLocationTests extends AST2BaseTest {
IASTDeclarator declarator = declarators[i];
switch (i) {
case 0:
assertSoleLocation(declarator,
code.indexOf("xLen5"), "xLen5".length()); //$NON-NLS-1$ //$NON-NLS-2$
assertSoleLocation(declarator, code.indexOf("xLen5"), "xLen5".length()); //$NON-NLS-1$ //$NON-NLS-2$
break;
case 1:
assertSoleLocation(declarator,
code.indexOf("* yLength8"), "* yLength8".length()); //$NON-NLS-1$ //$NON-NLS-2$
assertSoleLocation(declarator, code.indexOf("* yLength8"), "* yLength8".length()); //$NON-NLS-1$ //$NON-NLS-2$
break;
case 2:
assertSoleLocation(
declarator,
code.indexOf("zLength16( int )"), "zLength16( int )".length()); //$NON-NLS-1$ //$NON-NLS-2$
assertSoleLocation(declarator, code.indexOf("zLength16( int )"), "zLength16( int )".length()); //$NON-NLS-1$ //$NON-NLS-2$
break;
}
}
@ -152,17 +143,14 @@ public class DOMLocationTests extends AST2BaseTest {
public void testSimpleObjectStyleMacroDefinition() throws Exception {
String code = "/* hi */\n#define FOOT 0x01\n\n"; //$NON-NLS-1$
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
: null) {
for (ParserLanguage p : ParserLanguage.values()) {
IASTTranslationUnit tu = parse(code, p);
IASTDeclaration[] declarations = tu.getDeclarations();
assertEquals(declarations.length, 0);
IASTPreprocessorMacroDefinition[] macros = tu.getMacroDefinitions();
assertNotNull(macros);
assertEquals(macros.length, 1);
assertSoleLocation(
macros[0],
code.indexOf("#"), code.indexOf("0x01") + 4 - code.indexOf("#")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
assertSoleLocation(macros[0], code.indexOf("#"), code.indexOf("0x01") + 4 - code.indexOf("#")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
assertTrue(macros[0] instanceof IASTPreprocessorObjectStyleMacroDefinition);
assertEquals(macros[0].getName().toString(), "FOOT"); //$NON-NLS-1$
assertEquals(macros[0].getExpansion(), "0x01"); //$NON-NLS-1$
@ -171,8 +159,7 @@ public class DOMLocationTests extends AST2BaseTest {
public void testSimpleFunctionStyleMacroDefinition() throws Exception {
String code = "#define FOOBAH( WOOBAH ) JOHN##WOOBAH\n\n"; //$NON-NLS-1$
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
: null) {
for (ParserLanguage p : ParserLanguage.values()) {
IASTTranslationUnit tu = parse(code, p);
IASTDeclaration[] declarations = tu.getDeclarations();
assertEquals(declarations.length, 0);
@ -180,13 +167,10 @@ public class DOMLocationTests extends AST2BaseTest {
assertNotNull(macros);
assertEquals(macros.length, 1);
assertTrue(macros[0] instanceof IASTPreprocessorFunctionStyleMacroDefinition);
assertSoleLocation(
macros[0],
code.indexOf("#define"), code.indexOf("##WOOBAH") + 8 - code.indexOf("#define")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$s
assertSoleLocation(macros[0], code.indexOf("#define"), code.indexOf("##WOOBAH") + 8 - code.indexOf("#define")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$s
assertEquals(macros[0].getName().toString(), "FOOBAH"); //$NON-NLS-1$
assertEquals(macros[0].getExpansion(), "JOHN##WOOBAH"); //$NON-NLS-1$
IASTFunctionStyleMacroParameter[] parms = ((IASTPreprocessorFunctionStyleMacroDefinition) macros[0])
.getParameters();
IASTFunctionStyleMacroParameter[] parms = ((IASTPreprocessorFunctionStyleMacroDefinition) macros[0]).getParameters();
assertNotNull(parms);
assertEquals(parms.length, 1);
assertEquals(parms[0].getParameter(), "WOOBAH"); //$NON-NLS-1$
@ -221,30 +205,21 @@ public class DOMLocationTests extends AST2BaseTest {
assertEquals(declarations.length, 1);
IASTFunctionDefinition definition = (IASTFunctionDefinition) declarations[0];
IASTFunctionDeclarator declarator = definition.getDeclarator();
assertSoleLocation(
declarator,
code.indexOf("foo"), code.indexOf("int x;") + 6 - code.indexOf("foo")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IASTCompoundStatement body = (IASTCompoundStatement) definition
.getBody();
assertSoleLocation(declarator, code.indexOf("foo"), code.indexOf("int x;") + 6 - code.indexOf("foo")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IASTCompoundStatement body = (IASTCompoundStatement) definition.getBody();
assertEquals(body.getStatements().length, 1);
IASTReturnStatement returnStatement = (IASTReturnStatement) body
.getStatements()[0];
IASTIdExpression expression = (IASTIdExpression) returnStatement
.getReturnValue();
assertSoleLocation(expression,
code.indexOf("return ") + "return ".length(), 1); //$NON-NLS-1$ //$NON-NLS-2$
IASTReturnStatement returnStatement = (IASTReturnStatement) body.getStatements()[0];
IASTIdExpression expression = (IASTIdExpression) returnStatement.getReturnValue();
assertSoleLocation(expression, code.indexOf("return ") + "return ".length(), 1); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testBug84343() throws Exception {
String code = "class A {}; int f() {\nA * b = 0;\nreturn b;}"; //$NON-NLS-1$
IASTTranslationUnit tu = parse(code, ParserLanguage.CPP);
IASTFunctionDefinition f = (IASTFunctionDefinition) tu
.getDeclarations()[1];
IASTDeclarationStatement ds = (IASTDeclarationStatement) ((IASTCompoundStatement) f
.getBody()).getStatements()[0];
IASTFunctionDefinition f = (IASTFunctionDefinition) tu.getDeclarations()[1];
IASTDeclarationStatement ds = (IASTDeclarationStatement) ((IASTCompoundStatement) f.getBody()).getStatements()[0];
IASTSimpleDeclaration b = (IASTSimpleDeclaration) ds.getDeclaration();
ICPPASTNamedTypeSpecifier namedTypeSpec = (ICPPASTNamedTypeSpecifier) b
.getDeclSpecifier();
ICPPASTNamedTypeSpecifier namedTypeSpec = (ICPPASTNamedTypeSpecifier) b.getDeclSpecifier();
assertSoleLocation(namedTypeSpec, code.indexOf("\nA") + 1, 1); //$NON-NLS-1$
}
@ -252,10 +227,8 @@ public class DOMLocationTests extends AST2BaseTest {
String code = "enum hue { red, blue, green };"; //$NON-NLS-1$
IASTTranslationUnit tu = parse(code, ParserLanguage.CPP);
IASTSimpleDeclaration d = (IASTSimpleDeclaration) tu.getDeclarations()[0];
IASTEnumerationSpecifier enumeration = (IASTEnumerationSpecifier) d
.getDeclSpecifier();
IASTEnumerationSpecifier.IASTEnumerator enumerator = enumeration
.getEnumerators()[0];
IASTEnumerationSpecifier enumeration = (IASTEnumerationSpecifier) d.getDeclSpecifier();
IASTEnumerationSpecifier.IASTEnumerator enumerator = enumeration.getEnumerators()[0];
assertSoleLocation(enumerator, code.indexOf("red"), "red".length()); //$NON-NLS-1$ //$NON-NLS-2$
}
@ -263,20 +236,16 @@ public class DOMLocationTests extends AST2BaseTest {
String code = "class D { public: int x; };\nclass C : public virtual D {};"; //$NON-NLS-1$
IASTTranslationUnit tu = parse(code, ParserLanguage.CPP);
IASTSimpleDeclaration d2 = (IASTSimpleDeclaration) tu.getDeclarations()[1];
ICPPASTCompositeTypeSpecifier classSpec = (ICPPASTCompositeTypeSpecifier) d2
.getDeclSpecifier();
ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier [] bases = classSpec
.getBaseSpecifiers();
assertSoleLocation(bases[0],
code.indexOf("public virtual D"), "public virtual D".length()); //$NON-NLS-1$ //$NON-NLS-2$
ICPPASTCompositeTypeSpecifier classSpec = (ICPPASTCompositeTypeSpecifier) d2.getDeclSpecifier();
ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier [] bases = classSpec.getBaseSpecifiers();
assertSoleLocation(bases[0], code.indexOf("public virtual D"), "public virtual D".length()); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testBug84357() throws Exception {
String code = "class X { int a;\n};\nint X:: * pmi = &X::a;"; //$NON-NLS-1$
IASTTranslationUnit tu = parse(code, ParserLanguage.CPP);
IASTSimpleDeclaration pmi = (IASTSimpleDeclaration) tu
.getDeclarations()[1];
IASTSimpleDeclaration pmi = (IASTSimpleDeclaration) tu.getDeclarations()[1];
IASTDeclarator d = pmi.getDeclarators()[0];
IASTPointerOperator p = d.getPointerOperators()[0];
assertSoleLocation(p, code.indexOf("X:: *"), "X:: *".length()); //$NON-NLS-1$ //$NON-NLS-2$
@ -284,37 +253,28 @@ public class DOMLocationTests extends AST2BaseTest {
public void testBug84367() throws Exception {
String code = "void foo( int );"; //$NON-NLS-1$
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
: null) {
for (ParserLanguage p : ParserLanguage.values()) {
IASTTranslationUnit tu = parse(code, p);
IASTSimpleDeclaration definition = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
IASTStandardFunctionDeclarator declarator = (IASTStandardFunctionDeclarator) definition
.getDeclarators()[0];
IASTSimpleDeclaration definition = (IASTSimpleDeclaration) tu.getDeclarations()[0];
IASTStandardFunctionDeclarator declarator = (IASTStandardFunctionDeclarator) definition.getDeclarators()[0];
IASTParameterDeclaration parameter = declarator.getParameters()[0];
assertSoleLocation(parameter, code.indexOf("int"), 3); //$NON-NLS-1$
}
}
public void testElaboratedTypeSpecifier() throws ParserException {
String code = "/* blah */ struct A anA; /* blah */"; //$NON-NLS-1$
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
: null) {
for (ParserLanguage p : ParserLanguage.values()) {
IASTTranslationUnit tu = parse(code, p);
IASTSimpleDeclaration declaration = (IASTSimpleDeclaration) tu
.getDeclarations()[0];
IASTElaboratedTypeSpecifier elabType = (IASTElaboratedTypeSpecifier) declaration
.getDeclSpecifier();
assertSoleLocation(elabType,
code.indexOf("struct"), "struct A".length()); //$NON-NLS-1$ //$NON-NLS-2$
IASTSimpleDeclaration declaration = (IASTSimpleDeclaration) tu.getDeclarations()[0];
IASTElaboratedTypeSpecifier elabType = (IASTElaboratedTypeSpecifier) declaration.getDeclSpecifier();
assertSoleLocation(elabType, code.indexOf("struct"), "struct A".length()); //$NON-NLS-1$ //$NON-NLS-2$
}
}
public void testBug83852() throws Exception {
String code = "/* blah */ typedef short jc; int x = 4; jc myJc = (jc)x; "; //$NON-NLS-1$
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
: null) {
for (ParserLanguage p : ParserLanguage.values()) {
IASTTranslationUnit tu = parse(code, p);
IASTDeclaration[] declarations = tu.getDeclarations();
assertEquals(3, declarations.length);
@ -339,8 +299,7 @@ public class DOMLocationTests extends AST2BaseTest {
}
IASTInitializerExpression initializer = (IASTInitializerExpression) ((IASTSimpleDeclaration) declarations[2])
.getDeclarators()[0].getInitializer();
IASTCastExpression castExpression = (IASTCastExpression) initializer
.getExpression();
IASTCastExpression castExpression = (IASTCastExpression) initializer.getExpression();
IASTTypeId typeId = castExpression.getTypeId();
assertSoleLocation(typeId, code.indexOf("(jc)") + 1, "jc".length()); //$NON-NLS-1$ //$NON-NLS-2$
}
@ -348,61 +307,40 @@ public class DOMLocationTests extends AST2BaseTest {
public void testBug83853() throws ParserException {
String code = "int f() {return (1?0:1); }"; //$NON-NLS-1$
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
: null) {
for (ParserLanguage p : ParserLanguage.values()) {
IASTTranslationUnit tu = parse(code, p);
IASTFunctionDefinition definition = (IASTFunctionDefinition) tu
.getDeclarations()[0];
IASTCompoundStatement statement = (IASTCompoundStatement) definition
.getBody();
IASTReturnStatement returnStatement = (IASTReturnStatement) statement
.getStatements()[0];
IASTUnaryExpression unaryExpression = (IASTUnaryExpression) returnStatement
.getReturnValue();
assertEquals(unaryExpression.getOperator(),
IASTUnaryExpression.op_bracketedPrimary);
IASTConditionalExpression conditional = (IASTConditionalExpression) unaryExpression
.getOperand();
assertSoleLocation(conditional,
code.indexOf("1?0:1"), "1?0:1".length()); //$NON-NLS-1$ //$NON-NLS-2$
IASTFunctionDefinition definition = (IASTFunctionDefinition) tu.getDeclarations()[0];
IASTCompoundStatement statement = (IASTCompoundStatement) definition.getBody();
IASTReturnStatement returnStatement = (IASTReturnStatement) statement.getStatements()[0];
IASTUnaryExpression unaryExpression = (IASTUnaryExpression) returnStatement.getReturnValue();
assertEquals(unaryExpression.getOperator(), IASTUnaryExpression.op_bracketedPrimary);
IASTConditionalExpression conditional = (IASTConditionalExpression) unaryExpression.getOperand();
assertSoleLocation(conditional, code.indexOf("1?0:1"), "1?0:1".length()); //$NON-NLS-1$ //$NON-NLS-2$
}
}
public void testBug84374() throws Exception {
String code = "class P1 { public: int x; };\nclass P2 { public: int x; };\nclass B : public P1, public P2 {};\nvoid main() {\nB * b = new B();\n}"; //$NON-NLS-1$
IASTTranslationUnit tu = parse(code, ParserLanguage.CPP);
IASTFunctionDefinition main = (IASTFunctionDefinition) tu
.getDeclarations()[3];
IASTCompoundStatement statement = (IASTCompoundStatement) main
.getBody();
IASTDeclarationStatement decl = (IASTDeclarationStatement) statement
.getStatements()[0];
IASTFunctionDefinition main = (IASTFunctionDefinition) tu.getDeclarations()[3];
IASTCompoundStatement statement = (IASTCompoundStatement) main.getBody();
IASTDeclarationStatement decl = (IASTDeclarationStatement) statement.getStatements()[0];
IASTSimpleDeclaration b = (IASTSimpleDeclaration) decl.getDeclaration();
IASTInitializerExpression initializerExpression = (IASTInitializerExpression) b
.getDeclarators()[0].getInitializer();
assertSoleLocation(initializerExpression,
code.indexOf("new B()"), "new B()".length()); //$NON-NLS-1$ //$NON-NLS-2$
ICPPASTNewExpression newExpression = (ICPPASTNewExpression) initializerExpression
.getExpression();
assertSoleLocation(newExpression,
code.indexOf("new B()"), "new B()".length()); //$NON-NLS-1$ //$NON-NLS-2$
IASTInitializerExpression initializerExpression = (IASTInitializerExpression) b.getDeclarators()[0].getInitializer();
assertSoleLocation(initializerExpression,code.indexOf("new B()"), "new B()".length()); //$NON-NLS-1$ //$NON-NLS-2$
ICPPASTNewExpression newExpression = (ICPPASTNewExpression) initializerExpression.getExpression();
assertSoleLocation(newExpression, code.indexOf("new B()"), "new B()".length()); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testBug83737() throws Exception {
String code = "void f() { if( a == 0 ) g( a ); else if( a < 0 ) g( a >> 1 ); else if( a > 0 ) g( *(&a + 2) ); }"; //$NON-NLS-1$
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
: null) {
for (ParserLanguage p : ParserLanguage.values()) {
IASTTranslationUnit tu = parse(code, p);
IASTFunctionDefinition definition = (IASTFunctionDefinition) tu
.getDeclarations()[0];
IASTCompoundStatement statement = (IASTCompoundStatement) definition
.getBody();
IASTIfStatement first_if = (IASTIfStatement) statement
.getStatements()[0];
IASTIfStatement second_if = (IASTIfStatement) first_if
.getElseClause();
IASTIfStatement third_if = (IASTIfStatement) second_if
.getElseClause();
IASTFunctionDefinition definition = (IASTFunctionDefinition) tu.getDeclarations()[0];
IASTCompoundStatement statement = (IASTCompoundStatement) definition.getBody();
IASTIfStatement first_if = (IASTIfStatement) statement.getStatements()[0];
IASTIfStatement second_if = (IASTIfStatement) first_if.getElseClause();
IASTIfStatement third_if = (IASTIfStatement) second_if.getElseClause();
assertNull(third_if.getElseClause());
int first_if_start = code.indexOf("if( a == 0 )"); //$NON-NLS-1$
int total_if_length = "if( a == 0 ) g( a ); else if( a < 0 ) g( a >> 1 ); else if( a > 0 ) g( *(&a + 2) );".length(); //$NON-NLS-1$
@ -410,10 +348,8 @@ public class DOMLocationTests extends AST2BaseTest {
int second_if_start = code.indexOf("if( a < 0 )"); //$NON-NLS-1$
int third_if_start = code.indexOf("if( a > 0 )"); //$NON-NLS-1$
assertSoleLocation(first_if, first_if_start, total_if_length);
assertSoleLocation(second_if, second_if_start, total_if_end
- second_if_start);
assertSoleLocation(third_if, third_if_start, total_if_end
- third_if_start);
assertSoleLocation(second_if, second_if_start, total_if_end - second_if_start);
assertSoleLocation(third_if, third_if_start, total_if_end - third_if_start);
}
}
@ -421,31 +357,23 @@ public class DOMLocationTests extends AST2BaseTest {
String code = "class D { };\n D d1;\n const D d2;\n void foo() {\n typeid(d1) == typeid(d2);\n }"; //$NON-NLS-1$
IASTTranslationUnit tu = parse(code, ParserLanguage.CPP);
IASTBinaryExpression bexp = (IASTBinaryExpression) ((IASTExpressionStatement) ((IASTCompoundStatement) ((IASTFunctionDefinition) tu
.getDeclarations()[3]).getBody()).getStatements()[0])
.getExpression();
.getDeclarations()[3]).getBody()).getStatements()[0]).getExpression();
IASTUnaryExpression exp = (IASTUnaryExpression) ((IASTBinaryExpression) ((IASTExpressionStatement) ((IASTCompoundStatement) ((IASTFunctionDefinition) tu
.getDeclarations()[3]).getBody()).getStatements()[0])
.getExpression()).getOperand1();
assertSoleLocation(
bexp,
code.indexOf("typeid(d1) == typeid(d2)"), "typeid(d1) == typeid(d2)".length()); //$NON-NLS-1$ //$NON-NLS-2$
assertSoleLocation(exp,
code.indexOf("typeid(d1)"), "typeid(d1)".length()); //$NON-NLS-1$ //$NON-NLS-2$
assertSoleLocation(bexp, code.indexOf("typeid(d1) == typeid(d2)"), "typeid(d1) == typeid(d2)".length()); //$NON-NLS-1$ //$NON-NLS-2$
assertSoleLocation(exp, code.indexOf("typeid(d1)"), "typeid(d1)".length()); //$NON-NLS-1$ //$NON-NLS-2$
exp = (IASTUnaryExpression) ((IASTBinaryExpression) ((IASTExpressionStatement) ((IASTCompoundStatement) ((IASTFunctionDefinition) tu
.getDeclarations()[3]).getBody()).getStatements()[0])
.getExpression()).getOperand2();
assertSoleLocation(exp,
code.indexOf("typeid(d2)"), "typeid(d2)".length()); //$NON-NLS-1$ //$NON-NLS-2$
.getDeclarations()[3]).getBody()).getStatements()[0]).getExpression()).getOperand2();
assertSoleLocation(exp, code.indexOf("typeid(d2)"), "typeid(d2)".length()); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testBug84576() throws Exception {
String code = "namespace A {\n extern \"C\" int g();\n }"; //$NON-NLS-1$
IASTTranslationUnit tu = parse(code, ParserLanguage.CPP);
ICPPASTLinkageSpecification spec = (ICPPASTLinkageSpecification) ((ICPPASTNamespaceDefinition) tu
.getDeclarations()[0]).getDeclarations()[0];
assertSoleLocation(spec,
code.indexOf("extern \"C\""), "extern \"C\" int g();".length()); //$NON-NLS-1$ //$NON-NLS-2$
ICPPASTLinkageSpecification spec = (ICPPASTLinkageSpecification) ((ICPPASTNamespaceDefinition) tu.getDeclarations()[0]).getDeclarations()[0];
assertSoleLocation(spec, code.indexOf("extern \"C\""), "extern \"C\" int g();".length()); //$NON-NLS-1$ //$NON-NLS-2$
}
public void testSimplePreprocessorStatements() throws Exception
@ -456,8 +384,7 @@ public class DOMLocationTests extends AST2BaseTest {
buffer.append( "#undef _APPLE_H_\n"); //$NON-NLS-1$
buffer.append( "#endif\n"); //$NON-NLS-1$
String code = buffer.toString();
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
: null) {
for (ParserLanguage p : ParserLanguage.values()) {
IASTTranslationUnit tu = parse(code, p);
assertEquals( tu.getDeclarations().length, 0 );
IASTPreprocessorStatement [] statements = tu.getAllPreprocessorStatements();
@ -479,8 +406,7 @@ public class DOMLocationTests extends AST2BaseTest {
buffer.append( "#include <notfound.h>\n"); //$NON-NLS-1$
buffer.append( "int x;\n"); //$NON-NLS-1$
String code = buffer.toString();
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
: null) {
for (ParserLanguage p : ParserLanguage.values()) {
IASTTranslationUnit tu = parse(code, p, false, false);
IASTDeclaration[] decls= tu.getDeclarations();
assertEquals( decls.length, 1 );
@ -507,8 +433,7 @@ public class DOMLocationTests extends AST2BaseTest {
buffer.append( "#include <notfound2.h> // more stuff \n"); //$NON-NLS-1$
buffer.append( "int x;\n"); //$NON-NLS-1$
String code = buffer.toString();
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
: null) {
for (ParserLanguage p : ParserLanguage.values()) {
IASTTranslationUnit tu = parse(code, p, false, false);
IASTDeclaration[] decls= tu.getDeclarations();
IASTPreprocessorStatement [] statements = tu.getAllPreprocessorStatements();
@ -531,8 +456,7 @@ public class DOMLocationTests extends AST2BaseTest {
buffer.append( "int x\\i;\n"); // [28-36]
buffer.append( "int x2;\n"); // [37-44]
String code = buffer.toString();
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
: null) {
for (ParserLanguage p : ParserLanguage.values()) {
IASTTranslationUnit tu = parse(code, p, false, false);
IASTDeclaration[] decls= tu.getDeclarations();
IASTPreprocessorStatement [] statements = tu.getAllPreprocessorStatements();
@ -553,8 +477,7 @@ public class DOMLocationTests extends AST2BaseTest {
buffer.append( "#define ! x\n");
buffer.append( "int x;\n");
String code = buffer.toString();
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
: null) {
for (ParserLanguage p : ParserLanguage.values()) {
IASTTranslationUnit tu = parse(code, p, false, false);
IASTDeclaration[] decls= tu.getDeclarations();
IASTPreprocessorStatement [] statements = tu.getAllPreprocessorStatements();
@ -573,8 +496,7 @@ public class DOMLocationTests extends AST2BaseTest {
buffer.append( "nix(y,z);");
buffer.append( "int x;\n");
String code = buffer.toString();
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
: null) {
for (ParserLanguage p : ParserLanguage.values()) {
IASTTranslationUnit tu = parse(code, p, false, false);
IASTDeclaration[] decls= tu.getDeclarations();
IASTPreprocessorStatement [] statements = tu.getAllPreprocessorStatements();
@ -593,8 +515,7 @@ public class DOMLocationTests extends AST2BaseTest {
buffer.append( "#else\n");
buffer.append( "int x;\n");
String code = buffer.toString();
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
: null) {
for (ParserLanguage p : ParserLanguage.values()) {
IASTTranslationUnit tu = parse(code, p, false, false);
IASTDeclaration[] decls= tu.getDeclarations();
IASTProblem[] problems = tu.getPreprocessorProblems();
@ -616,8 +537,7 @@ public class DOMLocationTests extends AST2BaseTest {
public void testBug86323() throws Exception {
String code = "void f() { int i=0; for (; i<10; i++) { } }"; //$NON-NLS-1$
for (ParserLanguage p = ParserLanguage.C; p != null; p = (p == ParserLanguage.C) ? ParserLanguage.CPP
: null) {
for (ParserLanguage p : ParserLanguage.values()) {
IASTTranslationUnit tu = parse(code, p);
IASTForStatement for_stmt = (IASTForStatement) ((IASTCompoundStatement)((IASTFunctionDefinition)tu.getDeclarations()[0]).getBody()).getStatements()[1];
assertTrue( for_stmt.getInitializerStatement() instanceof IASTNullStatement );
@ -740,7 +660,7 @@ public class DOMLocationTests extends AST2BaseTest {
}
public void testTemplateIdNameLocation_Bug211444() throws Exception {
IASTTranslationUnit tu = parse( "Foo::template test<T> bar;", ParserLanguage.CPP ); //$NON-NLS-1$
IASTTranslationUnit tu = parse( "Foo::template test<T> bar;", ParserLanguage.CPP );
CPPNameCollector col = new CPPNameCollector();
tu.accept( col );

View file

@ -483,7 +483,7 @@ nested_name_specifier_opt
class_or_namespace_name -- just identifiers
::= class_name
| namespace_name
--| namespace_name -- namespace_name name can only be an identifier token, which is already accepted by class_name
postfix_expression
@ -958,9 +958,10 @@ declaration_specifiers
declaration_specifiers_opt
::= declaration_specifiers
| $empty
::=? $empty -- this option must come first for constructors to parse correctly
/. $Build consumeEmpty(); $EndBuild ./
| declaration_specifiers
-- what about type qualifiers... cv_qualifier
@ -1040,8 +1041,9 @@ function_specifier
| 'explicit'
typedef_name
::= identifier_token
-- We have no way to disambiguate token types
--typedef_name
-- ::= identifier_token
--type_specifier
@ -1082,8 +1084,8 @@ simple_type_specifier_token
-- last two rules moved here from simple_type_specifier
type_name -- all identifiers of some kind
::= class_name
| enum_name
| typedef_name
-- | enum_name
-- | typedef_name
-- last two rules moved here from simple_type_specifier
@ -1109,8 +1111,9 @@ elaborated_type_specifier
/. $Build consumeTypeSpecifierElaborated(false); $EndBuild ./
enum_name
::= identifier_token
-- there is currently no way to disambiguate identifier tokens
--enum_name
-- ::= identifier_token
enum_specifier
@ -1131,25 +1134,29 @@ enumerator_list_opt
enumerator_definition
::= enumerator
::= identifier_token
/. $Build consumeEnumerator(false); $EndBuild ./
| enumerator '=' constant_expression
| identifier_token '=' constant_expression
/. $Build consumeEnumerator(true); $EndBuild ./
enumerator
::= identifier_token
namespace_name
::= original_namespace_name
| namespace_alias
original_namespace_name
::= identifier_name
--namespace_name
-- ::= original_namespace_name
-- | namespace_alias
--original_namespace_name
-- ::= identifier_name
--namespace_alias
-- ::= identifier_token
namespace_definition
::= named_namespace_definition
| unnamed_namespace_definition
@ -1175,8 +1182,7 @@ unnamed_namespace_definition
/. $Build consumeNamespaceDefinition(false); $EndBuild ./
namespace_alias
::= identifier_token
namespace_alias_definition
@ -1343,7 +1349,7 @@ type_specifier_seq
abstract_declarator
::=? direct_abstract_declarator
::= direct_abstract_declarator
| <openscope-ast> ptr_operator_seq
/. $Build consumeDeclaratorWithPointer(false); $EndBuild ./
| <openscope-ast> ptr_operator_seq direct_abstract_declarator
@ -1351,10 +1357,8 @@ abstract_declarator
direct_abstract_declarator
::=? basic_direct_abstract_declarator
direct_abstract_declarator
::= array_direct_abstract_declarator
::= basic_direct_abstract_declarator
| array_direct_abstract_declarator
| function_direct_abstract_declarator

View file

@ -57,6 +57,7 @@ import org.eclipse.cdt.core.dom.ast.IASTProblem;
import org.eclipse.cdt.core.dom.ast.IASTProblemExpression;
import org.eclipse.cdt.core.dom.ast.IASTProblemHolder;
import org.eclipse.cdt.core.dom.ast.IASTReturnStatement;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTStatement;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
@ -433,8 +434,8 @@ public abstract class BuildASTParserAction {
IASTNode result;
if(expressionStatement == null)
result = declarationStatement;
//else if(isImplicitInt(decl))
// result = expressionStatement;
else if(isImplicitInt(decl))
result = expressionStatement;
else
result = nodeFactory.newAmbiguousStatement(declarationStatement, expressionStatement);
@ -445,22 +446,30 @@ public abstract class BuildASTParserAction {
/**
* TODO : don't think this is correct.
*
* Returns true if the given declaration has unspecified type,
* Returns true if the given declaration has unspecified type,
* in this case the type defaults to int and is know as "implicit int".
*
* With implicit int a lot of language constructs can be accidentally parsed
* as declarations:
*
* eg) x = 1;
* Should be an assignment statement but can also be parsed as a declaration
* of a variable x, of unspecified type, initialized to 1.
*
* These cases are easy to detect (using this method) and the wrong interpretation
* as a declaration is discarded.
*/
// protected static boolean isImplicitInt(IASTDeclaration declaration) {
// if(declaration instanceof IASTSimpleDeclaration) {
// IASTDeclSpecifier declSpec = ((IASTSimpleDeclaration)declaration).getDeclSpecifier();
// if(declSpec instanceof IASTSimpleDeclSpecifier &&
// ((IASTSimpleDeclSpecifier)declSpec).getType() == IASTSimpleDeclSpecifier.t_unspecified) {
//
// return true;
// }
// }
// return false;
// }
protected static boolean isImplicitInt(IASTDeclaration declaration) {
if(declaration instanceof IASTSimpleDeclaration) {
IASTDeclSpecifier declSpec = ((IASTSimpleDeclaration)declaration).getDeclSpecifier();
if(declSpec instanceof IASTSimpleDeclSpecifier &&
((IASTSimpleDeclSpecifier)declSpec).getType() == IASTSimpleDeclSpecifier.t_unspecified) {
return true;
}
}
return false;
}
/**

View file

@ -17,11 +17,11 @@ public interface CPPExpressionStatementParsersym {
public final static int
TK_asm = 68,
TK_auto = 50,
TK_bool = 15,
TK_bool = 12,
TK_break = 77,
TK_case = 78,
TK_catch = 120,
TK_char = 16,
TK_catch = 119,
TK_char = 13,
TK_class = 59,
TK_const = 48,
TK_const_cast = 28,
@ -29,7 +29,7 @@ public interface CPPExpressionStatementParsersym {
TK_default = 80,
TK_delete = 42,
TK_do = 81,
TK_double = 17,
TK_double = 14,
TK_dynamic_cast = 29,
TK_else = 122,
TK_enum = 61,
@ -37,64 +37,64 @@ public interface CPPExpressionStatementParsersym {
TK_export = 82,
TK_extern = 44,
TK_false = 30,
TK_float = 18,
TK_float = 15,
TK_for = 83,
TK_friend = 52,
TK_goto = 84,
TK_if = 85,
TK_inline = 53,
TK_int = 19,
TK_long = 20,
TK_int = 16,
TK_long = 17,
TK_mutable = 54,
TK_namespace = 67,
TK_namespace = 66,
TK_new = 43,
TK_operator = 7,
TK_private = 116,
TK_protected = 117,
TK_public = 118,
TK_private = 114,
TK_protected = 115,
TK_public = 116,
TK_register = 55,
TK_reinterpret_cast = 31,
TK_return = 86,
TK_short = 21,
TK_signed = 22,
TK_short = 18,
TK_signed = 19,
TK_sizeof = 32,
TK_static = 56,
TK_static_cast = 33,
TK_struct = 62,
TK_switch = 87,
TK_template = 58,
TK_template = 57,
TK_this = 34,
TK_throw = 41,
TK_try = 74,
TK_true = 35,
TK_typedef = 57,
TK_typedef = 58,
TK_typeid = 36,
TK_typename = 9,
TK_union = 63,
TK_unsigned = 23,
TK_using = 65,
TK_unsigned = 20,
TK_using = 64,
TK_virtual = 47,
TK_void = 24,
TK_void = 21,
TK_volatile = 49,
TK_wchar_t = 25,
TK_while = 76,
TK_wchar_t = 22,
TK_while = 75,
TK_integer = 37,
TK_floating = 38,
TK_charconst = 39,
TK_stringlit = 26,
TK_identifier = 1,
TK_Completion = 2,
TK_EndOfCompletion = 12,
TK_Invalid = 123,
TK_LeftBracket = 66,
TK_EndOfCompletion = 23,
TK_Invalid = 124,
TK_LeftBracket = 67,
TK_LeftParen = 3,
TK_LeftBrace = 64,
TK_Dot = 119,
TK_LeftBrace = 65,
TK_Dot = 120,
TK_DotStar = 96,
TK_Arrow = 103,
TK_ArrowStar = 90,
TK_PlusPlus = 13,
TK_MinusMinus = 14,
TK_PlusPlus = 24,
TK_MinusMinus = 25,
TK_And = 8,
TK_Star = 6,
TK_Plus = 10,
@ -115,7 +115,7 @@ public interface CPPExpressionStatementParsersym {
TK_Or = 100,
TK_AndAnd = 101,
TK_OrOr = 102,
TK_Question = 114,
TK_Question = 117,
TK_Colon = 73,
TK_ColonColon = 4,
TK_DotDotDot = 95,
@ -132,11 +132,12 @@ public interface CPPExpressionStatementParsersym {
TK_OrAssign = 113,
TK_Comma = 70,
TK_zero = 40,
TK_RightBracket = 115,
TK_RightParen = 75,
TK_RightBracket = 118,
TK_RightParen = 76,
TK_RightBrace = 72,
TK_SemiColon = 45,
TK_ERROR_TOKEN = 46,
TK_original_namespace_name = 123,
TK_EOF_TOKEN = 121;
public final static String orderedTerminalSymbols[] = {
@ -152,9 +153,6 @@ public interface CPPExpressionStatementParsersym {
"typename",
"Plus",
"Minus",
"EndOfCompletion",
"PlusPlus",
"MinusMinus",
"bool",
"char",
"double",
@ -166,6 +164,9 @@ public interface CPPExpressionStatementParsersym {
"unsigned",
"void",
"wchar_t",
"EndOfCompletion",
"PlusPlus",
"MinusMinus",
"stringlit",
"Bang",
"const_cast",
@ -197,17 +198,17 @@ public interface CPPExpressionStatementParsersym {
"mutable",
"register",
"static",
"typedef",
"template",
"typedef",
"class",
"LT",
"enum",
"struct",
"union",
"LeftBrace",
"using",
"LeftBracket",
"LeftBrace",
"namespace",
"LeftBracket",
"asm",
"GT",
"Comma",
@ -215,8 +216,8 @@ public interface CPPExpressionStatementParsersym {
"RightBrace",
"Colon",
"try",
"RightParen",
"while",
"RightParen",
"break",
"case",
"continue",
@ -254,15 +255,16 @@ public interface CPPExpressionStatementParsersym {
"AndAssign",
"CaretAssign",
"OrAssign",
"Question",
"RightBracket",
"private",
"protected",
"public",
"Dot",
"Question",
"RightBracket",
"catch",
"Dot",
"EOF_TOKEN",
"else",
"original_namespace_name",
"Invalid"
};

View file

@ -16,53 +16,53 @@ package org.eclipse.cdt.internal.core.dom.lrparser.cpp;
public interface CPPNoCastExpressionParsersym {
public final static int
TK_asm = 68,
TK_auto = 50,
TK_bool = 15,
TK_auto = 51,
TK_bool = 12,
TK_break = 77,
TK_case = 78,
TK_catch = 121,
TK_char = 16,
TK_class = 60,
TK_catch = 120,
TK_char = 13,
TK_class = 59,
TK_const = 48,
TK_const_cast = 28,
TK_continue = 79,
TK_default = 80,
TK_delete = 42,
TK_do = 81,
TK_double = 17,
TK_double = 14,
TK_dynamic_cast = 29,
TK_else = 122,
TK_enum = 62,
TK_explicit = 51,
TK_enum = 61,
TK_explicit = 52,
TK_export = 82,
TK_extern = 44,
TK_false = 30,
TK_float = 18,
TK_float = 15,
TK_for = 83,
TK_friend = 52,
TK_friend = 53,
TK_goto = 84,
TK_if = 85,
TK_inline = 53,
TK_int = 19,
TK_long = 20,
TK_mutable = 54,
TK_namespace = 67,
TK_inline = 54,
TK_int = 16,
TK_long = 17,
TK_mutable = 55,
TK_namespace = 66,
TK_new = 43,
TK_operator = 7,
TK_private = 117,
TK_protected = 118,
TK_public = 119,
TK_register = 55,
TK_private = 114,
TK_protected = 115,
TK_public = 116,
TK_register = 56,
TK_reinterpret_cast = 31,
TK_return = 86,
TK_short = 21,
TK_signed = 22,
TK_short = 18,
TK_signed = 19,
TK_sizeof = 32,
TK_static = 56,
TK_static = 57,
TK_static_cast = 33,
TK_struct = 63,
TK_struct = 62,
TK_switch = 87,
TK_template = 57,
TK_template = 49,
TK_this = 34,
TK_throw = 41,
TK_try = 74,
@ -70,31 +70,31 @@ public interface CPPNoCastExpressionParsersym {
TK_typedef = 58,
TK_typeid = 36,
TK_typename = 9,
TK_union = 64,
TK_unsigned = 23,
TK_using = 65,
TK_union = 63,
TK_unsigned = 20,
TK_using = 64,
TK_virtual = 47,
TK_void = 24,
TK_volatile = 49,
TK_wchar_t = 25,
TK_while = 76,
TK_void = 21,
TK_volatile = 50,
TK_wchar_t = 22,
TK_while = 75,
TK_integer = 37,
TK_floating = 38,
TK_charconst = 39,
TK_stringlit = 26,
TK_identifier = 1,
TK_Completion = 2,
TK_EndOfCompletion = 12,
TK_Invalid = 123,
TK_LeftBracket = 66,
TK_EndOfCompletion = 23,
TK_Invalid = 124,
TK_LeftBracket = 67,
TK_LeftParen = 3,
TK_LeftBrace = 61,
TK_Dot = 120,
TK_LeftBrace = 65,
TK_Dot = 121,
TK_DotStar = 96,
TK_Arrow = 103,
TK_ArrowStar = 90,
TK_PlusPlus = 13,
TK_MinusMinus = 14,
TK_PlusPlus = 24,
TK_MinusMinus = 25,
TK_And = 8,
TK_Star = 6,
TK_Plus = 10,
@ -105,7 +105,7 @@ public interface CPPNoCastExpressionParsersym {
TK_Percent = 92,
TK_RightShift = 88,
TK_LeftShift = 89,
TK_LT = 59,
TK_LT = 60,
TK_GT = 69,
TK_LE = 93,
TK_GE = 94,
@ -115,7 +115,7 @@ public interface CPPNoCastExpressionParsersym {
TK_Or = 100,
TK_AndAnd = 101,
TK_OrOr = 102,
TK_Question = 114,
TK_Question = 117,
TK_Colon = 73,
TK_ColonColon = 4,
TK_DotDotDot = 95,
@ -132,12 +132,13 @@ public interface CPPNoCastExpressionParsersym {
TK_OrAssign = 113,
TK_Comma = 70,
TK_zero = 40,
TK_RightBracket = 115,
TK_RightParen = 75,
TK_RightBracket = 118,
TK_RightParen = 76,
TK_RightBrace = 72,
TK_SemiColon = 45,
TK_ERROR_TOKEN = 46,
TK_EOF_TOKEN = 116;
TK_original_namespace_name = 123,
TK_EOF_TOKEN = 119;
public final static String orderedTerminalSymbols[] = {
"",
@ -152,9 +153,6 @@ public interface CPPNoCastExpressionParsersym {
"typename",
"Plus",
"Minus",
"EndOfCompletion",
"PlusPlus",
"MinusMinus",
"bool",
"char",
"double",
@ -166,6 +164,9 @@ public interface CPPNoCastExpressionParsersym {
"unsigned",
"void",
"wchar_t",
"EndOfCompletion",
"PlusPlus",
"MinusMinus",
"stringlit",
"Bang",
"const_cast",
@ -189,6 +190,7 @@ public interface CPPNoCastExpressionParsersym {
"ERROR_TOKEN",
"virtual",
"const",
"template",
"volatile",
"auto",
"explicit",
@ -197,17 +199,16 @@ public interface CPPNoCastExpressionParsersym {
"mutable",
"register",
"static",
"template",
"typedef",
"LT",
"class",
"LeftBrace",
"LT",
"enum",
"struct",
"union",
"using",
"LeftBracket",
"LeftBrace",
"namespace",
"LeftBracket",
"asm",
"GT",
"Comma",
@ -215,8 +216,8 @@ public interface CPPNoCastExpressionParsersym {
"RightBrace",
"Colon",
"try",
"RightParen",
"while",
"RightParen",
"break",
"case",
"continue",
@ -254,15 +255,16 @@ public interface CPPNoCastExpressionParsersym {
"AndAssign",
"CaretAssign",
"OrAssign",
"Question",
"RightBracket",
"EOF_TOKEN",
"private",
"protected",
"public",
"Dot",
"Question",
"RightBracket",
"EOF_TOKEN",
"catch",
"Dot",
"else",
"original_namespace_name",
"Invalid"
};

View file

@ -15,13 +15,13 @@ package org.eclipse.cdt.internal.core.dom.lrparser.cpp;
public interface CPPParsersym {
public final static int
TK_asm = 67,
TK_asm = 66,
TK_auto = 50,
TK_bool = 13,
TK_bool = 11,
TK_break = 78,
TK_case = 79,
TK_catch = 120,
TK_char = 14,
TK_catch = 119,
TK_char = 12,
TK_class = 59,
TK_const = 48,
TK_const_cast = 28,
@ -29,55 +29,55 @@ public interface CPPParsersym {
TK_default = 81,
TK_delete = 43,
TK_do = 82,
TK_double = 15,
TK_double = 13,
TK_dynamic_cast = 29,
TK_else = 122,
TK_enum = 61,
TK_enum = 60,
TK_explicit = 51,
TK_export = 74,
TK_extern = 42,
TK_false = 30,
TK_float = 16,
TK_float = 14,
TK_for = 83,
TK_friend = 52,
TK_goto = 84,
TK_if = 85,
TK_inline = 53,
TK_int = 17,
TK_long = 18,
TK_int = 15,
TK_long = 16,
TK_mutable = 54,
TK_namespace = 65,
TK_new = 44,
TK_operator = 7,
TK_private = 116,
TK_protected = 117,
TK_public = 118,
TK_private = 114,
TK_protected = 115,
TK_public = 116,
TK_register = 55,
TK_reinterpret_cast = 31,
TK_return = 86,
TK_short = 19,
TK_signed = 20,
TK_short = 17,
TK_signed = 18,
TK_sizeof = 32,
TK_static = 56,
TK_static_cast = 33,
TK_struct = 62,
TK_struct = 61,
TK_switch = 87,
TK_template = 58,
TK_template = 57,
TK_this = 34,
TK_throw = 41,
TK_try = 75,
TK_true = 35,
TK_typedef = 57,
TK_typedef = 58,
TK_typeid = 36,
TK_typename = 9,
TK_union = 63,
TK_unsigned = 21,
TK_union = 62,
TK_unsigned = 19,
TK_using = 64,
TK_virtual = 47,
TK_void = 22,
TK_void = 20,
TK_volatile = 49,
TK_wchar_t = 23,
TK_while = 77,
TK_wchar_t = 21,
TK_while = 76,
TK_integer = 37,
TK_floating = 38,
TK_charconst = 39,
@ -85,11 +85,11 @@ public interface CPPParsersym {
TK_identifier = 1,
TK_Completion = 2,
TK_EndOfCompletion = 10,
TK_Invalid = 123,
TK_Invalid = 124,
TK_LeftBracket = 68,
TK_LeftParen = 3,
TK_LeftBrace = 66,
TK_Dot = 119,
TK_LeftBrace = 67,
TK_Dot = 120,
TK_DotStar = 96,
TK_Arrow = 103,
TK_ArrowStar = 90,
@ -97,15 +97,15 @@ public interface CPPParsersym {
TK_MinusMinus = 25,
TK_And = 8,
TK_Star = 6,
TK_Plus = 11,
TK_Minus = 12,
TK_Plus = 22,
TK_Minus = 23,
TK_Tilde = 5,
TK_Bang = 27,
TK_Slash = 91,
TK_Percent = 92,
TK_RightShift = 88,
TK_LeftShift = 89,
TK_LT = 60,
TK_LT = 63,
TK_GT = 69,
TK_LE = 93,
TK_GE = 94,
@ -115,7 +115,7 @@ public interface CPPParsersym {
TK_Or = 100,
TK_AndAnd = 101,
TK_OrOr = 102,
TK_Question = 114,
TK_Question = 117,
TK_Colon = 73,
TK_ColonColon = 4,
TK_DotDotDot = 95,
@ -132,11 +132,12 @@ public interface CPPParsersym {
TK_OrAssign = 113,
TK_Comma = 70,
TK_zero = 40,
TK_RightBracket = 115,
TK_RightParen = 76,
TK_RightBracket = 118,
TK_RightParen = 77,
TK_RightBrace = 72,
TK_SemiColon = 45,
TK_ERROR_TOKEN = 46,
TK_original_namespace_name = 123,
TK_EOF_TOKEN = 121;
public final static String orderedTerminalSymbols[] = {
@ -151,8 +152,6 @@ public interface CPPParsersym {
"And",
"typename",
"EndOfCompletion",
"Plus",
"Minus",
"bool",
"char",
"double",
@ -164,6 +163,8 @@ public interface CPPParsersym {
"unsigned",
"void",
"wchar_t",
"Plus",
"Minus",
"PlusPlus",
"MinusMinus",
"stringlit",
@ -197,17 +198,17 @@ public interface CPPParsersym {
"mutable",
"register",
"static",
"typedef",
"template",
"typedef",
"class",
"LT",
"enum",
"struct",
"union",
"LT",
"using",
"namespace",
"LeftBrace",
"asm",
"LeftBrace",
"LeftBracket",
"GT",
"Comma",
@ -216,8 +217,8 @@ public interface CPPParsersym {
"Colon",
"export",
"try",
"RightParen",
"while",
"RightParen",
"break",
"case",
"continue",
@ -254,15 +255,16 @@ public interface CPPParsersym {
"AndAssign",
"CaretAssign",
"OrAssign",
"Question",
"RightBracket",
"private",
"protected",
"public",
"Dot",
"Question",
"RightBracket",
"catch",
"Dot",
"EOF_TOKEN",
"else",
"original_namespace_name",
"Invalid"
};

View file

@ -17,52 +17,52 @@ public interface CPPSizeofExpressionParsersym {
public final static int
TK_asm = 68,
TK_auto = 51,
TK_bool = 15,
TK_bool = 12,
TK_break = 77,
TK_case = 78,
TK_catch = 121,
TK_char = 16,
TK_catch = 120,
TK_char = 13,
TK_class = 60,
TK_const = 48,
TK_const = 49,
TK_const_cast = 28,
TK_continue = 79,
TK_default = 80,
TK_delete = 42,
TK_do = 81,
TK_double = 17,
TK_double = 14,
TK_dynamic_cast = 29,
TK_else = 122,
TK_enum = 64,
TK_enum = 63,
TK_explicit = 52,
TK_export = 82,
TK_extern = 44,
TK_false = 30,
TK_float = 18,
TK_float = 15,
TK_for = 83,
TK_friend = 53,
TK_goto = 84,
TK_if = 85,
TK_inline = 54,
TK_int = 19,
TK_long = 20,
TK_int = 16,
TK_long = 17,
TK_mutable = 55,
TK_namespace = 65,
TK_namespace = 64,
TK_new = 43,
TK_operator = 7,
TK_private = 117,
TK_protected = 118,
TK_public = 119,
TK_private = 114,
TK_protected = 115,
TK_public = 116,
TK_register = 56,
TK_reinterpret_cast = 31,
TK_return = 86,
TK_short = 21,
TK_signed = 22,
TK_short = 18,
TK_signed = 19,
TK_sizeof = 32,
TK_static = 57,
TK_static_cast = 33,
TK_struct = 66,
TK_struct = 65,
TK_switch = 87,
TK_template = 49,
TK_template = 47,
TK_this = 34,
TK_throw = 41,
TK_try = 74,
@ -70,31 +70,31 @@ public interface CPPSizeofExpressionParsersym {
TK_typedef = 58,
TK_typeid = 36,
TK_typename = 9,
TK_union = 67,
TK_unsigned = 23,
TK_using = 62,
TK_virtual = 47,
TK_void = 24,
TK_union = 66,
TK_unsigned = 20,
TK_using = 61,
TK_virtual = 48,
TK_void = 21,
TK_volatile = 50,
TK_wchar_t = 25,
TK_while = 76,
TK_wchar_t = 22,
TK_while = 75,
TK_integer = 37,
TK_floating = 38,
TK_charconst = 39,
TK_stringlit = 26,
TK_identifier = 1,
TK_Completion = 2,
TK_EndOfCompletion = 12,
TK_Invalid = 123,
TK_LeftBracket = 63,
TK_EndOfCompletion = 23,
TK_Invalid = 124,
TK_LeftBracket = 67,
TK_LeftParen = 3,
TK_LeftBrace = 61,
TK_Dot = 120,
TK_LeftBrace = 62,
TK_Dot = 121,
TK_DotStar = 96,
TK_Arrow = 103,
TK_ArrowStar = 90,
TK_PlusPlus = 13,
TK_MinusMinus = 14,
TK_PlusPlus = 24,
TK_MinusMinus = 25,
TK_And = 8,
TK_Star = 6,
TK_Plus = 10,
@ -115,7 +115,7 @@ public interface CPPSizeofExpressionParsersym {
TK_Or = 100,
TK_AndAnd = 101,
TK_OrOr = 102,
TK_Question = 114,
TK_Question = 117,
TK_Colon = 73,
TK_ColonColon = 4,
TK_DotDotDot = 95,
@ -132,12 +132,13 @@ public interface CPPSizeofExpressionParsersym {
TK_OrAssign = 113,
TK_Comma = 70,
TK_zero = 40,
TK_RightBracket = 115,
TK_RightParen = 75,
TK_RightBracket = 118,
TK_RightParen = 76,
TK_RightBrace = 72,
TK_SemiColon = 45,
TK_ERROR_TOKEN = 46,
TK_EOF_TOKEN = 116;
TK_original_namespace_name = 123,
TK_EOF_TOKEN = 119;
public final static String orderedTerminalSymbols[] = {
"",
@ -152,9 +153,6 @@ public interface CPPSizeofExpressionParsersym {
"typename",
"Plus",
"Minus",
"EndOfCompletion",
"PlusPlus",
"MinusMinus",
"bool",
"char",
"double",
@ -166,6 +164,9 @@ public interface CPPSizeofExpressionParsersym {
"unsigned",
"void",
"wchar_t",
"EndOfCompletion",
"PlusPlus",
"MinusMinus",
"stringlit",
"Bang",
"const_cast",
@ -187,9 +188,9 @@ public interface CPPSizeofExpressionParsersym {
"extern",
"SemiColon",
"ERROR_TOKEN",
"template",
"virtual",
"const",
"template",
"volatile",
"auto",
"explicit",
@ -201,13 +202,13 @@ public interface CPPSizeofExpressionParsersym {
"typedef",
"LT",
"class",
"LeftBrace",
"using",
"LeftBracket",
"LeftBrace",
"enum",
"namespace",
"struct",
"union",
"LeftBracket",
"asm",
"GT",
"Comma",
@ -215,8 +216,8 @@ public interface CPPSizeofExpressionParsersym {
"RightBrace",
"Colon",
"try",
"RightParen",
"while",
"RightParen",
"break",
"case",
"continue",
@ -254,15 +255,16 @@ public interface CPPSizeofExpressionParsersym {
"AndAssign",
"CaretAssign",
"OrAssign",
"Question",
"RightBracket",
"EOF_TOKEN",
"private",
"protected",
"public",
"Dot",
"Question",
"RightBracket",
"EOF_TOKEN",
"catch",
"Dot",
"else",
"original_namespace_name",
"Invalid"
};