diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java index e05e837c4bd..df0dff0406c 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java @@ -40,7 +40,7 @@ import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier; import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression; -import org.eclipse.cdt.core.dom.ast.IASTTypedefNameSpecifier; +import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier; import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression; import org.eclipse.cdt.core.dom.ast.IASTUnaryTypeIdExpression; import org.eclipse.cdt.core.dom.ast.IBinding; @@ -261,7 +261,7 @@ public class AST2Tests extends TestCase { // the declaration for myS IASTSimpleDeclaration decl_myS = (IASTSimpleDeclaration)declstmt_myS.getDeclaration(); // the type specifier for myS - IASTTypedefNameSpecifier type_spec_myS = (IASTTypedefNameSpecifier)decl_myS.getDeclSpecifier(); + IASTNamedTypeSpecifier type_spec_myS = (IASTNamedTypeSpecifier)decl_myS.getDeclSpecifier(); // the type name for myS IASTName name_type_myS = type_spec_myS.getName(); // the declarator for myS diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCompositeTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCompositeTypeSpecifier.java index 8895e6b0faa..4ace555c12a 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCompositeTypeSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTCompositeTypeSpecifier.java @@ -27,6 +27,7 @@ public interface IASTCompositeTypeSpecifier extends IASTDeclSpecifier { public int getKey(); public static final int k_struct = 1; public static final int k_union = 2; + public static final int k_last = k_union; public void setKey( int key ); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTElaboratedTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTElaboratedTypeSpecifier.java index 983e9830694..9854d4b1be9 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTElaboratedTypeSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTElaboratedTypeSpecifier.java @@ -17,6 +17,7 @@ public interface IASTElaboratedTypeSpecifier extends IASTDeclSpecifier { public static final int k_struct = 0; public static final int k_union = 1; public static final int k_enum = 2; + public static final int k_last = k_enum; public int getKind(); public void setKind( int value ); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTypedefNameSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTNamedTypeSpecifier.java similarity index 92% rename from core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTypedefNameSpecifier.java rename to core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTNamedTypeSpecifier.java index 8209c98e6fd..39ff8f2b7ef 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTypedefNameSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTNamedTypeSpecifier.java @@ -15,7 +15,7 @@ package org.eclipse.cdt.core.dom.ast; * * @author Doug Schaefer */ -public interface IASTTypedefNameSpecifier extends IASTDeclSpecifier { +public interface IASTNamedTypeSpecifier extends IASTDeclSpecifier { public static final ASTNodeProperty NAME = new ASTNodeProperty( "Name"); //$NON-NLS-1$ diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/ICASTTypedefNameSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/ICASTTypedefNameSpecifier.java index b2944a0b54a..cf85c6d4f30 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/ICASTTypedefNameSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/ICASTTypedefNameSpecifier.java @@ -9,12 +9,12 @@ * IBM Rational Software - Initial API and implementation */ package org.eclipse.cdt.core.dom.ast.c; -import org.eclipse.cdt.core.dom.ast.IASTTypedefNameSpecifier; +import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier; /** * @author jcamelon */ -public interface ICASTTypedefNameSpecifier extends IASTTypedefNameSpecifier, +public interface ICASTTypedefNameSpecifier extends IASTNamedTypeSpecifier, ICASTDeclSpecifier { } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTCompositeTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTCompositeTypeSpecifier.java new file mode 100644 index 00000000000..af42c30870e --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTCompositeTypeSpecifier.java @@ -0,0 +1,52 @@ +/********************************************************************** + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + **********************************************************************/ +package org.eclipse.cdt.core.dom.ast.cpp; + +import java.util.List; + +import org.eclipse.cdt.core.dom.ast.ASTNodeProperty; +import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier; +import org.eclipse.cdt.core.dom.ast.IASTName; +import org.eclipse.cdt.core.dom.ast.IASTNode; + +/** + * @author jcamelon + */ +public interface ICPPASTCompositeTypeSpecifier extends IASTCompositeTypeSpecifier, + ICPPASTDeclSpecifier { + + public static final int k_class = IASTCompositeTypeSpecifier.k_last + 1; + public static final int k_last = k_class; + + public static final ASTNodeProperty VISIBILITY_LABEL = new ASTNodeProperty( "Visibility Label"); //$NON-NLS-1$ + public static final ASTNodeProperty BASE_SPECIFIER = new ASTNodeProperty( "Base Specifier"); //$NON-NLS-1$ + + public static interface ICPPASTBaseSpecifier extends IASTNode + { + public boolean isVirtual(); + public void setVirtual( boolean value ); + + public static final int v_public = 1; + public static final int v_protected = 2; + public static final int v_private = 3; + + public int getVisibility(); + public void setVisibility( int visibility ); + + public static final ASTNodeProperty NAME = new ASTNodeProperty( "BaseSpec Name"); //$NON-NLS-1$ + public IASTName getName(); + public void setName( IASTName name ); + } + + public List getBaseSpecifiers(); + public void addBaseSpecifier( ICPPASTBaseSpecifier baseSpec ); + +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTDeclSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTDeclSpecifier.java index 0f2d7d5aa33..8d0025a5d9d 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTDeclSpecifier.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTDeclSpecifier.java @@ -23,5 +23,12 @@ public interface ICPPASTDeclSpecifier extends IASTDeclSpecifier { // A declaration in C++ can be a friend declaration public boolean isFriend(); + public void setFriend( boolean value ); + + public boolean isVirtual(); + public void setVirtual( boolean value ); + + public boolean isExplicit(); + public void setExplicit( boolean value ); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTElaboratedTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTElaboratedTypeSpecifier.java new file mode 100644 index 00000000000..fff89663504 --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTElaboratedTypeSpecifier.java @@ -0,0 +1,24 @@ +/********************************************************************** + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + **********************************************************************/ +package org.eclipse.cdt.core.dom.ast.cpp; + +import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier; + +/** + * @author jcamelon + */ +public interface ICPPASTElaboratedTypeSpecifier extends + IASTElaboratedTypeSpecifier, ICPPASTDeclSpecifier { + + public static final int k_class = IASTElaboratedTypeSpecifier.k_last + 1; + public static final int k_last = k_class; + +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTNamedTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTNamedTypeSpecifier.java new file mode 100644 index 00000000000..32a21f48004 --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTNamedTypeSpecifier.java @@ -0,0 +1,23 @@ +/********************************************************************** + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + **********************************************************************/ +package org.eclipse.cdt.core.dom.ast.cpp; + +import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier; + +/** + * @author jcamelon + */ +public interface ICPPASTNamedTypeSpecifier extends IASTNamedTypeSpecifier, ICPPASTDeclSpecifier { + + public boolean isTypename(); + public void setIsTypename( boolean value ); + +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTVisiblityLabel.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTVisiblityLabel.java new file mode 100644 index 00000000000..bcd105936cf --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTVisiblityLabel.java @@ -0,0 +1,27 @@ +/********************************************************************** + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + **********************************************************************/ +package org.eclipse.cdt.core.dom.ast.cpp; + +import org.eclipse.cdt.core.dom.ast.IASTDeclaration; + +/** + * @author jcamelon + */ +public interface ICPPASTVisiblityLabel extends IASTDeclaration { + + public static final int v_public = 1; + public static final int v_protected = 2; + public static final int v_private = 3; + + public int getVisibility(); + public void setVisibility( int visibility ); + +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/AbstractGNUSourceCodeParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/AbstractGNUSourceCodeParser.java index f5332452218..faffdd308f3 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/AbstractGNUSourceCodeParser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/AbstractGNUSourceCodeParser.java @@ -43,6 +43,7 @@ import org.eclipse.cdt.core.dom.ast.IASTTypeId; import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression; import org.eclipse.cdt.core.dom.ast.IASTWhileStatement; import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator; +import org.eclipse.cdt.core.dom.ast.c.ICASTEnumerationSpecifier; import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression; import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTTypeIdExpression; import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTUnaryExpression; @@ -65,6 +66,7 @@ import org.eclipse.cdt.internal.core.parser2.c.CASTContinueStatement; import org.eclipse.cdt.internal.core.parser2.c.CASTDeclarationStatement; import org.eclipse.cdt.internal.core.parser2.c.CASTDefaultStatement; import org.eclipse.cdt.internal.core.parser2.c.CASTDoStatement; +import org.eclipse.cdt.internal.core.parser2.c.CASTEnumerationSpecifier; import org.eclipse.cdt.internal.core.parser2.c.CASTExpressionStatement; import org.eclipse.cdt.internal.core.parser2.c.CASTForStatement; import org.eclipse.cdt.internal.core.parser2.c.CASTGotoStatement; @@ -1058,14 +1060,14 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser { * enumerator-definition enumerator-list , enumerator-definition * enumerator-definition: enumerator enumerator = constant-expression * enumerator: identifier - * * @param owner * IParserCallback object that represents the declaration that * owns this type specifier. + * * @throws BacktrackException * request a backtrack */ - protected IASTEnumerationSpecifier enumSpecifier(DeclarationWrapper sdw) + protected ICASTEnumerationSpecifier enumSpecifier() throws BacktrackException, EndOfFileException { IToken mark = mark(); IASTName name = null; @@ -1077,7 +1079,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser { name = createName(); if (LT(1) == IToken.tLBRACE) { - IASTEnumerationSpecifier result = createEnumerationSpecifier(); + ICASTEnumerationSpecifier result = (ICASTEnumerationSpecifier) createEnumerationSpecifier(); ((ASTNode)result).setOffset( startOffset ); result.setName( name ); name.setParent( result ); @@ -1158,11 +1160,6 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser { */ protected abstract IASTEnumerator createEnumerator(); - /** - * @return - */ - protected abstract IASTEnumerationSpecifier createEnumerationSpecifier(); - /** * @param token * @return @@ -1592,4 +1589,8 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser { return new CASTASMDeclaration(); } + protected IASTEnumerationSpecifier createEnumerationSpecifier() { + return new CASTEnumerationSpecifier(); + } + } \ No newline at end of file diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/c/GNUCSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/c/GNUCSourceParser.java index 6dfef814833..1db4e6ee1e7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/c/GNUCSourceParser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/c/GNUCSourceParser.java @@ -24,7 +24,6 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.IASTDeclaration; import org.eclipse.cdt.core.dom.ast.IASTDeclarator; import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier; -import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier; import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTExpressionList; import org.eclipse.cdt.core.dom.ast.IASTFieldDeclarator; @@ -47,7 +46,7 @@ import org.eclipse.cdt.core.dom.ast.IASTStatement; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IASTTypeId; import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression; -import org.eclipse.cdt.core.dom.ast.IASTTypedefNameSpecifier; +import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier; import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression; import org.eclipse.cdt.core.dom.ast.IASTUnaryTypeIdExpression; import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator; @@ -1310,7 +1309,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { } case IToken.t_enum: try { - enumSpec = (ICASTEnumerationSpecifier) enumSpecifier(null); + enumSpec = enumSpecifier(); flags.setEncounteredTypename(true); break; } catch (BacktrackException bt) { @@ -1376,7 +1375,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { IASTName name = createName( identifier ); declSpec.setName( name ); name.setParent( declSpec ); - name.setPropertyInParent( IASTTypedefNameSpecifier.NAME ); + name.setPropertyInParent( IASTNamedTypeSpecifier.NAME ); return declSpec; } ICASTSimpleDeclSpecifier declSpec = createSimpleTypeSpecifier(); @@ -1982,11 +1981,4 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser { return new CASTEnumerator(); } - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.parser2.AbstractGNUSourceCodeParser#createEnumerationSpecifier() - */ - protected IASTEnumerationSpecifier createEnumerationSpecifier() { - return new CASTEnumerationSpecifier(); - } - } \ No newline at end of file diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTBaseDeclSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTBaseDeclSpecifier.java new file mode 100644 index 00000000000..89725be01cb --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTBaseDeclSpecifier.java @@ -0,0 +1,127 @@ +/********************************************************************** + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + **********************************************************************/ +package org.eclipse.cdt.internal.core.parser2.cpp; + +import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier; + +/** + * @author jcamelon + */ +public class CPPASTBaseDeclSpecifier extends CPPASTNode implements + ICPPASTDeclSpecifier { + + private boolean friend; + private boolean inline; + private boolean volatil; + private boolean isConst; + private int sc; + private boolean virtual; + private boolean explicit; + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier#isFriend() + */ + public boolean isFriend() { + return friend; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#getStorageClass() + */ + public int getStorageClass() { + return sc; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#setStorageClass(int) + */ + public void setStorageClass(int storageClass) { + sc = storageClass; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#isConst() + */ + public boolean isConst() { + return isConst; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#setConst(boolean) + */ + public void setConst(boolean value) { + isConst = value; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#isVolatile() + */ + public boolean isVolatile() { + return volatil; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#setVolatile(boolean) + */ + public void setVolatile(boolean value) { + volatil = value; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#isInline() + */ + public boolean isInline() { + return inline; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier#setInline(boolean) + */ + public void setInline(boolean value) { + this.inline = value; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier#setIsFriend(boolean) + */ + public void setFriend(boolean value) { + friend = value; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier#isVirtual() + */ + public boolean isVirtual() { + return virtual; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier#setVirtual(boolean) + */ + public void setVirtual(boolean value) { + virtual = value; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier#isExplicit() + */ + public boolean isExplicit() { + return explicit; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier#setExplicit(boolean) + */ + public void setExplicit(boolean value) { + this.explicit = value; + } + +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTBaseSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTBaseSpecifier.java new file mode 100644 index 00000000000..63b6c9b4603 --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTBaseSpecifier.java @@ -0,0 +1,68 @@ +/********************************************************************** + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + **********************************************************************/ +package org.eclipse.cdt.internal.core.parser2.cpp; + +import org.eclipse.cdt.core.dom.ast.IASTName; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier; + +/** + * @author jcamelon + */ +public class CPPASTBaseSpecifier extends CPPASTNode implements + ICPPASTBaseSpecifier { + + private boolean isVirtual; + private int visibility; + private IASTName name; + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier#isVirtual() + */ + public boolean isVirtual() { + return isVirtual; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier#setVirtual(boolean) + */ + public void setVirtual(boolean value) { + isVirtual = value; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier#getVisibility() + */ + public int getVisibility() { + return visibility; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier#setVisibility(int) + */ + public void setVisibility(int visibility) { + this.visibility = visibility; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier#getName() + */ + public IASTName getName() { + return name; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName) + */ + public void setName(IASTName name) { + this.name = name; + } + +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTCompositeTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTCompositeTypeSpecifier.java new file mode 100644 index 00000000000..527ec0b28bf --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTCompositeTypeSpecifier.java @@ -0,0 +1,150 @@ +/********************************************************************** + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + **********************************************************************/ +package org.eclipse.cdt.internal.core.parser2.cpp; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.cdt.core.dom.ast.IASTDeclaration; +import org.eclipse.cdt.core.dom.ast.IASTName; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier; + +/** + * @author jcamelon + */ +public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier + implements ICPPASTCompositeTypeSpecifier { + + private int k; + private IASTName n; + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier#getBaseSpecifiers() + */ + public List getBaseSpecifiers() { + if( baseSpecs == null ) return Collections.EMPTY_LIST; + removeNullBaseSpecs(); + return Arrays.asList( baseSpecs ); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier#addBaseSpecifier(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier) + */ + public void addBaseSpecifier(ICPPASTBaseSpecifier baseSpec) { + if( baseSpecs == null ) + { + baseSpecs = new ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier[ DEFAULT_DECLARATIONS_LIST_SIZE ]; + currentIndex2 = 0; + } + if( declarations.length == currentIndex ) + { + ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier [] old = baseSpecs; + baseSpecs = new ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier[ old.length * 2 ]; + for( int i = 0; i < old.length; ++i ) + baseSpecs[i] = old[i]; + } + baseSpecs[ currentIndex2++ ] = baseSpec; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getKey() + */ + public int getKey() { + return k; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#setKey(int) + */ + public void setKey(int key) { + k = key; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getName() + */ + public IASTName getName() { + return n; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName) + */ + public void setName(IASTName name) { + this.n = name; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#getMembers() + */ + public List getMembers() { + if( declarations == null ) return Collections.EMPTY_LIST; + removeNullDeclarations(); + return Arrays.asList( declarations ); + + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier#addMemberDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration) + */ + public void addMemberDeclaration(IASTDeclaration declaration) { + if( declarations == null ) + { + declarations = new IASTDeclaration[ DEFAULT_DECLARATIONS_LIST_SIZE ]; + currentIndex = 0; + } + if( declarations.length == currentIndex ) + { + IASTDeclaration [] old = declarations; + declarations = new IASTDeclaration[ old.length * 2 ]; + for( int i = 0; i < old.length; ++i ) + declarations[i] = old[i]; + } + declarations[ currentIndex++ ] = declaration; + } + + private void removeNullDeclarations() { + int nullCount = 0; + for( int i = 0; i < declarations.length; ++i ) + if( declarations[i] == null ) + ++nullCount; + if( nullCount == 0 ) return; + IASTDeclaration [] old = declarations; + int newSize = old.length - nullCount; + declarations = new IASTDeclaration[ newSize ]; + for( int i = 0; i < newSize; ++i ) + declarations[i] = old[i]; + currentIndex = newSize; + } + + private int currentIndex = 0; + private IASTDeclaration [] declarations = null; + private static final int DEFAULT_DECLARATIONS_LIST_SIZE = 4; + + private void removeNullBaseSpecs() { + int nullCount = 0; + for( int i = 0; i < baseSpecs.length; ++i ) + if( baseSpecs[i] == null ) + ++nullCount; + if( nullCount == 0 ) return; + ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier [] old = baseSpecs; + int newSize = old.length - nullCount; + baseSpecs = new ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier[ newSize ]; + for( int i = 0; i < newSize; ++i ) + baseSpecs[i] = old[i]; + currentIndex2 = newSize; + } + + private int currentIndex2 = 0; + private ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier [] baseSpecs = null; + +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTElaboratedTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTElaboratedTypeSpecifier.java new file mode 100644 index 00000000000..32741814f52 --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTElaboratedTypeSpecifier.java @@ -0,0 +1,53 @@ +/********************************************************************** + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + **********************************************************************/ +package org.eclipse.cdt.internal.core.parser2.cpp; + +import org.eclipse.cdt.core.dom.ast.IASTName; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier; + +/** + * @author jcamelon + */ +public class CPPASTElaboratedTypeSpecifier extends CPPASTBaseDeclSpecifier + implements ICPPASTElaboratedTypeSpecifier { + + private int kind; + private IASTName name; + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier#getKind() + */ + public int getKind() { + return kind; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier#setKind(int) + */ + public void setKind(int value) { + this.kind = value; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier#getName() + */ + public IASTName getName() { + return name; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName) + */ + public void setName(IASTName name) { + this.name = name; + } + +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTEnumerationSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTEnumerationSpecifier.java new file mode 100644 index 00000000000..e3b7051affb --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTEnumerationSpecifier.java @@ -0,0 +1,90 @@ +/********************************************************************** + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + **********************************************************************/ +package org.eclipse.cdt.internal.core.parser2.cpp; + +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.cdt.core.dom.ast.IASTDeclarator; +import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier; +import org.eclipse.cdt.core.dom.ast.IASTName; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier; + +/** + * @author jcamelon + */ +public class CPPASTEnumerationSpecifier extends CPPASTBaseDeclSpecifier + implements IASTEnumerationSpecifier, ICPPASTDeclSpecifier { + + private IASTName name; + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#addEnumerator(org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator) + */ + public void addEnumerator(IASTEnumerator enumerator) { + if( enumerators == null ) + { + enumerators = new IASTEnumerator[ DEFAULT_ENUMERATORS_LIST_SIZE ]; + currentIndex = 0; + } + if( enumerators.length == currentIndex ) + { + IASTEnumerator [] old = enumerators; + enumerators = new IASTEnumerator[ old.length * 2 ]; + for( int i = 0; i < old.length; ++i ) + enumerators[i] = old[i]; + } + enumerators[ currentIndex++ ] = enumerator; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#getEnumerators() + */ + public List getEnumerators() { + if( enumerators == null ) return Collections.EMPTY_LIST; + removeNullEnumerators(); + return Arrays.asList( enumerators ); + } + + private void removeNullEnumerators() { + int nullCount = 0; + for( int i = 0; i < enumerators.length; ++i ) + if( enumerators[i] == null ) + ++nullCount; + if( nullCount == 0 ) return; + IASTEnumerator [] old = enumerators; + int newSize = old.length - nullCount; + enumerators = new IASTEnumerator[ newSize ]; + for( int i = 0; i < newSize; ++i ) + enumerators[i] = old[i]; + currentIndex = newSize; + } + + private int currentIndex = 0; + private IASTEnumerator [] enumerators = null; + private static final int DEFAULT_ENUMERATORS_LIST_SIZE = 4; + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName) + */ + public void setName(IASTName name) { + this.name = name; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier#getName() + */ + public IASTName getName() { + return name; + } + +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTNamedTypeSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTNamedTypeSpecifier.java new file mode 100644 index 00000000000..4643739a4bd --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTNamedTypeSpecifier.java @@ -0,0 +1,53 @@ +/********************************************************************** + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + **********************************************************************/ +package org.eclipse.cdt.internal.core.parser2.cpp; + +import org.eclipse.cdt.core.dom.ast.IASTName; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamedTypeSpecifier; + +/** + * @author jcamelon + */ +public class CPPASTNamedTypeSpecifier extends CPPASTBaseDeclSpecifier implements + ICPPASTNamedTypeSpecifier { + + private boolean typename; + private IASTName name; + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamedTypeSpecifier#isTypename() + */ + public boolean isTypename() { + return typename; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamedTypeSpecifier#setIsTypename(boolean) + */ + public void setIsTypename(boolean value) { + typename = value; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier#getName() + */ + public IASTName getName() { + return name; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier#setName(org.eclipse.cdt.core.dom.ast.IASTName) + */ + public void setName(IASTName name) { + this.name = name; + } + +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTSimpleDeclSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTSimpleDeclSpecifier.java new file mode 100644 index 00000000000..dc489e624dc --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTSimpleDeclSpecifier.java @@ -0,0 +1,97 @@ +/********************************************************************** + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + **********************************************************************/ +package org.eclipse.cdt.internal.core.parser2.cpp; + +import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleDeclSpecifier; + +/** + * @author jcamelon + */ +public class CPPASTSimpleDeclSpecifier extends CPPASTBaseDeclSpecifier + implements ICPPASTSimpleDeclSpecifier { + + private int type; + private boolean isSigned; + private boolean isUnsigned; + private boolean isShort; + private boolean isLong; + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#getType() + */ + public int getType() { + return type; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#setType(int) + */ + public void setType(int type) { + this.type = type; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#isSigned() + */ + public boolean isSigned() { + return isSigned; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#isUnsigned() + */ + public boolean isUnsigned() { + return isUnsigned; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#isShort() + */ + public boolean isShort() { + return isShort; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#isLong() + */ + public boolean isLong() { + return isLong; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#setSigned(boolean) + */ + public void setSigned(boolean value) { + isSigned = value; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#setUnsigned(boolean) + */ + public void setUnsigned(boolean value) { + isUnsigned = value; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#setLong(boolean) + */ + public void setLong(boolean value) { + isLong = value; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier#setShort(boolean) + */ + public void setShort(boolean value) { + isShort = value; + } + +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTVisibilityLabel.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTVisibilityLabel.java new file mode 100644 index 00000000000..62474447aeb --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTVisibilityLabel.java @@ -0,0 +1,37 @@ +/********************************************************************** + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + **********************************************************************/ +package org.eclipse.cdt.internal.core.parser2.cpp; + +import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisiblityLabel; + +/** + * @author jcamelon + */ +public class CPPASTVisibilityLabel extends CPPASTNode implements + ICPPASTVisiblityLabel { + + private int visibility; + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisiblityLabel#getVisibility() + */ + public int getVisibility() { + return visibility; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisiblityLabel#setVisibility(int) + */ + public void setVisibility(int visibility) { + this.visibility = visibility; + } + +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/GNUCPPSourceParser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/GNUCPPSourceParser.java index 6cdc11d2441..19812090b12 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/GNUCPPSourceParser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/GNUCPPSourceParser.java @@ -14,23 +14,29 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression; +import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier; import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement; import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression; import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.IASTDeclaration; +import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier; import org.eclipse.cdt.core.dom.ast.IASTExpression; import org.eclipse.cdt.core.dom.ast.IASTExpressionList; import org.eclipse.cdt.core.dom.ast.IASTName; +import org.eclipse.cdt.core.dom.ast.IASTNamedTypeSpecifier; import org.eclipse.cdt.core.dom.ast.IASTNode; import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IASTTypeId; import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression; import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeclSpecifier; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExplicitTemplateInstantiation; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamedTypeSpecifier; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceAlias; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTParameterDeclaration; @@ -43,7 +49,10 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateSpecialization; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplatedTypeTemplateParameter; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDeclaration; import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTUsingDirective; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisiblityLabel; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier; import org.eclipse.cdt.core.dom.ast.gnu.IGNUASTCompoundStatementExpression; +import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTDeclSpecifier; import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTExplicitTemplateInstantiation; import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTSimpleDeclSpecifier; import org.eclipse.cdt.core.parser.BacktrackException; @@ -69,7 +78,6 @@ import org.eclipse.cdt.internal.core.parser2.c.CASTBinaryExpression; import org.eclipse.cdt.internal.core.parser2.c.CASTCompoundStatement; import org.eclipse.cdt.internal.core.parser2.c.CASTCompoundStatementExpression; import org.eclipse.cdt.internal.core.parser2.c.CASTConditionalExpression; -import org.eclipse.cdt.internal.core.parser2.c.CASTEnumerationSpecifier; import org.eclipse.cdt.internal.core.parser2.c.CASTEnumerator; import org.eclipse.cdt.internal.core.parser2.c.CASTExpressionList; import org.eclipse.cdt.internal.core.parser2.c.CASTName; @@ -2138,7 +2146,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { /** * @return */ - private ICPPASTUsingDeclaration createUsingDeclaration() { + protected ICPPASTUsingDeclaration createUsingDeclaration() { return new CPPASTUsingDeclaration(); } @@ -2209,7 +2217,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { /** * @return */ - private ICPPASTLinkageSpecification createLinkageSpecification() { + protected ICPPASTLinkageSpecification createLinkageSpecification() { return new CPPASTLinkageSpecification(); } @@ -2723,6 +2731,7 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { * @return */ protected IASTName createName(ITokenDuple duple) { + if( duple == null ) return createName(); if( duple.getSegmentCount() != 1 ) return createQualifiedName( duple ); CASTName name = new CASTName( duple.toCharArray() ); name.setOffset( duple.getStartOffset()); @@ -3097,16 +3106,21 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { */ protected ICPPASTDeclSpecifier declSpecifierSeq(boolean parm, boolean tryConstructor) throws BacktrackException, EndOfFileException { + IToken firstToken = LA(1); Flags flags = new Flags(parm, tryConstructor); - boolean isInline, isVirtual, isExplicit, isFriend; - boolean isConst, isVolatile, isRestrict; - boolean isLong, isShort, isUnsigned, isSigned; - boolean isTypename; + boolean isInline= false, isVirtual= false, isExplicit= false, isFriend= false; + boolean isConst = false, isVolatile= false, isRestrict= false; + boolean isLong= false, isShort= false, isUnsigned= false, isSigned= false; + boolean isTypename= false; int storageClass = IASTDeclSpecifier.sc_unspecified; int simpleType = IASTSimpleDeclSpecifier.t_unspecified; ITokenDuple duple = null; + + ICPPASTCompositeTypeSpecifier classSpec = null; + ICPPASTElaboratedTypeSpecifier elabSpec = null; + IASTEnumerationSpecifier enumSpec = null; declSpecifiers: for (;;) { switch (LT(1)) { case IToken.t_inline: @@ -3262,28 +3276,27 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { case IToken.t_struct: case IToken.t_union: try { - classSpecifier(null); + classSpec = classSpecifier(); flags.setEncounteredTypename(true); break; } catch (BacktrackException bt) { - elaboratedTypeSpecifier(null); + elabSpec = elaboratedTypeSpecifier(); flags.setEncounteredTypename(true); break; } case IToken.t_enum: try { - enumSpecifier(null); + enumSpec = enumSpecifier(); flags.setEncounteredTypename(true); break; } catch (BacktrackException bt) { // this is an elaborated class specifier - elaboratedTypeSpecifier(null); + elabSpec = elaboratedTypeSpecifier(); flags.setEncounteredTypename(true); break; } default: if (supportTypeOfUnaries && LT(1) == IGCCToken.t_typeof) { - IToken start = LA(1); Object expression = unaryTypeofExpression(); if (expression != null) { flags.setEncounteredTypename(true); @@ -3292,35 +3305,129 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { break declSpecifiers; } } - return null; + + if( elabSpec != null ) + { + elabSpec.setConst( isConst ); + elabSpec.setVolatile( isVolatile ); + if( elabSpec instanceof IGPPASTDeclSpecifier ) + ((IGPPASTDeclSpecifier)elabSpec).setRestrict( isRestrict ); + elabSpec.setFriend( isFriend ); + elabSpec.setInline( isInline ); + elabSpec.setStorageClass( storageClass ); + elabSpec.setVirtual( isVirtual ); + elabSpec.setExplicit( isExplicit ); + return elabSpec; + } + if( enumSpec != null ) + { + enumSpec.setConst( isConst ); + enumSpec.setVolatile( isVolatile ); + if( enumSpec instanceof IGPPASTDeclSpecifier ) + ((IGPPASTDeclSpecifier)enumSpec).setRestrict( isRestrict ); + ((ICPPASTDeclSpecifier)enumSpec).setFriend( isFriend ); + ((ICPPASTDeclSpecifier)enumSpec).setVirtual( isVirtual ); + ((ICPPASTDeclSpecifier)enumSpec).setExplicit( isExplicit ); + enumSpec.setInline( isInline ); + enumSpec.setStorageClass( storageClass ); + return elabSpec; + } + if( classSpec != null ) + { + classSpec.setConst( isConst ); + classSpec.setVolatile( isVolatile ); + if( classSpec instanceof IGPPASTDeclSpecifier ) + ((IGPPASTDeclSpecifier)classSpec).setRestrict( isRestrict ); + classSpec.setFriend( isFriend ); + classSpec.setInline( isInline ); + classSpec.setStorageClass( storageClass ); + classSpec.setVirtual( isVirtual ); + classSpec.setExplicit( isExplicit ); + return classSpec; + } + if( duple != null ) + { + ICPPASTNamedTypeSpecifier nameSpec = createNamedTypeSpecifier(); + nameSpec.setIsTypename( isTypename ); + IASTName name = createName( duple ); + nameSpec.setName( name ); + name.setParent( nameSpec ); + name.setPropertyInParent( IASTNamedTypeSpecifier.NAME ); + + nameSpec.setConst( isConst ); + nameSpec.setVolatile( isVolatile ); + if( nameSpec instanceof IGPPASTDeclSpecifier ) + ((IGPPASTDeclSpecifier)nameSpec).setRestrict( isRestrict ); + nameSpec.setFriend( isFriend ); + nameSpec.setInline( isInline ); + nameSpec.setStorageClass( storageClass ); + nameSpec.setVirtual( isVirtual ); + nameSpec.setExplicit( isExplicit ); + return nameSpec; + } + ICPPASTSimpleDeclSpecifier simpleDeclSpec = createSimpleDeclSpecifier(); + ((CPPASTNode)simpleDeclSpec).setOffset( firstToken.getOffset() ); + simpleDeclSpec.setConst( isConst ); + simpleDeclSpec.setVolatile( isVolatile ); + if( simpleDeclSpec instanceof IGPPASTDeclSpecifier ) + ((IGPPASTDeclSpecifier)simpleDeclSpec).setRestrict( isRestrict ); + + simpleDeclSpec.setFriend( isFriend ); + simpleDeclSpec.setInline( isInline ); + simpleDeclSpec.setStorageClass( storageClass ); + simpleDeclSpec.setVirtual( isVirtual ); + simpleDeclSpec.setExplicit( isExplicit ); + + simpleDeclSpec.setType( simpleType ); + simpleDeclSpec.setLong( isLong ); + simpleDeclSpec.setShort( isShort ); + simpleDeclSpec.setUnsigned( isUnsigned ); + simpleDeclSpec.setSigned( isSigned ); + + return simpleDeclSpec; + } + + /** + * @return + */ + protected ICPPASTSimpleDeclSpecifier createSimpleDeclSpecifier() { + return new CPPASTSimpleDeclSpecifier(); + } + + /** + * @return + */ + protected ICPPASTNamedTypeSpecifier createNamedTypeSpecifier() { + return new CPPASTNamedTypeSpecifier(); } /** * Parse an elaborated type specifier. - * * @param decl * Declaration which owns the elaborated type + * @return TODO + * * @throws BacktrackException * request a backtrack */ - protected void elaboratedTypeSpecifier(DeclarationWrapper sdw) + protected ICPPASTElaboratedTypeSpecifier elaboratedTypeSpecifier() throws BacktrackException, EndOfFileException { // this is an elaborated class specifier IToken t = consume(); - Object eck = null; + int eck = 0; switch (t.getType()) { case IToken.t_class: - eck = null; //ASTClassKind.CLASS; + eck = ICPPASTElaboratedTypeSpecifier.k_class; break; case IToken.t_struct: - eck = null; //ASTClassKind.STRUCT; + eck = IASTElaboratedTypeSpecifier.k_struct; break; case IToken.t_union: - eck = null; //ASTClassKind.UNION; + eck = IASTElaboratedTypeSpecifier.k_union; break; case IToken.t_enum: - eck = null; //ASTClassKind.ENUM; + eck = IASTElaboratedTypeSpecifier.k_enum; break; default: backup(t); @@ -3328,34 +3435,20 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { t.getFilename()); } - ITokenDuple d = name(); - Object elaboratedTypeSpec = null; - final boolean isForewardDecl = (LT(1) == IToken.tSEMI); + IASTName name = createName( name() ); + + ICPPASTElaboratedTypeSpecifier elaboratedTypeSpec = createElaboratedTypeSpecifier(); + ((CPPASTNode)elaboratedTypeSpec).setOffset( t.getOffset() ); + elaboratedTypeSpec.setKind( eck ); + elaboratedTypeSpec.setName( name ); + return elaboratedTypeSpec; + } - try { - elaboratedTypeSpec = null; /* - * astFactory.createElaboratedTypeSpecifier(sdw - * .getScope(), eck, d, t.getOffset(), - * t.getLineNumber(), d - * .getLastToken().getEndOffset(), - * d.getLastToken() .getLineNumber(), - * isForewardDecl, sdw.isFriend()); } - * catch (ASTSemanticException e) { - * throwBacktrack(e.getProblem()); - */ - } catch (Exception e) { - int endOffset = (lastToken != null) ? lastToken.getEndOffset() : 0; - logException( - "elaboratedTypeSpecifier:createElaboratedTypeSpecifier", e); //$NON-NLS-1$ - throwBacktrack(t.getOffset(), endOffset, t.getLineNumber(), t - .getFilename()); - } - sdw.setTypeSpecifier(elaboratedTypeSpec); - - if (isForewardDecl) { - // ((IASTElaboratedTypeSpecifier) elaboratedTypeSpec).acceptElement( - // requestor); - } + /** + * @return + */ + protected ICPPASTElaboratedTypeSpecifier createElaboratedTypeSpecifier() { + return new CPPASTElaboratedTypeSpecifier(); } /** @@ -3776,18 +3869,17 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { * * classSpecifier : classKey name (baseClause)? "{" (memberSpecification)* * "}" - * * @param owner * IParserCallback object that represents the declaration that * owns this classSpecifier + * + * @return TODO * @throws BacktrackException * request a backtrack */ - protected void classSpecifier(DeclarationWrapper sdw) + protected ICPPASTCompositeTypeSpecifier classSpecifier() throws BacktrackException, EndOfFileException { - Object nameType = null; //ClassNameType.IDENTIFIER; - Object classKind = null; - Object access = null; //ASTAccessVisibility.PUBLIC; + int classKind = 0; IToken classKey = null; IToken mark = mark(); @@ -3795,55 +3887,41 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { switch (LT(1)) { case IToken.t_class: classKey = consume(); - classKind = null; //ASTClassKind.CLASS; - access = null; //ASTAccessVisibility.PRIVATE; + classKind = ICPPASTCompositeTypeSpecifier.k_class; break; case IToken.t_struct: classKey = consume(); - classKind = null; //ASTClassKind.STRUCT; + classKind = IASTCompositeTypeSpecifier.k_struct; break; case IToken.t_union: classKey = consume(); - classKind = null; //ASTClassKind.UNION; + classKind = IASTCompositeTypeSpecifier.k_union; break; default: throwBacktrack(mark.getOffset(), mark.getEndOffset(), mark .getLineNumber(), mark.getFilename()); } - ITokenDuple duple = null; + IASTName name = null; // class name if (LT(1) == IToken.tIDENTIFIER) - duple = name(); - if (duple != null && !duple.isIdentifier()) - nameType = null; //ClassNameType.TEMPLATE; + name = createName( name() ); + else + name = createName(); + if (LT(1) != IToken.tCOLON && LT(1) != IToken.tLBRACE) { IToken errorPoint = LA(1); backup(mark); throwBacktrack(errorPoint.getOffset(), errorPoint.getEndOffset(), errorPoint.getLineNumber(), errorPoint.getFilename()); } - Object astClassSpecifier = null; - - try { - astClassSpecifier = null; /*astFactory.createClassSpecifier(sdw.getScope(), - duple, classKind, nameType, access, classKey.getOffset(), - classKey.getLineNumber(), duple == null ? classKey - .getOffset() : duple.getFirstToken().getOffset(), - duple == null ? classKey.getEndOffset() : duple - .getFirstToken().getEndOffset(), duple == null - ? classKey.getLineNumber() - : duple.getFirstToken().getLineNumber(), classKey.getFilename()); - } catch (ASTSemanticException e) { - throwBacktrack(e.getProblem()); */ - } catch (Exception e) { - int endOffset = (lastToken != null) ? lastToken.getEndOffset() : 0; - logException("classSpecifier:createClassSpecifier", e); //$NON-NLS-1$ - throwBacktrack(mark.getOffset(), endOffset, mark.getLineNumber(), - mark.getFilename()); - } - sdw.setTypeSpecifier(astClassSpecifier); + + ICPPASTCompositeTypeSpecifier astClassSpecifier = createClassSpecifier(); + ((CPPASTNode)astClassSpecifier).setOffset( classKey.getOffset() ); + astClassSpecifier.setKey( classKind ); + astClassSpecifier.setName( name ); + // base clause if (LT(1) == IToken.tCOLON) { baseSpecifier(astClassSpecifier); @@ -3851,62 +3929,77 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { if (LT(1) == IToken.tLBRACE) { consume(IToken.tLBRACE); - // astClassSpecifier.enterScope(requestor); - try { - cleanupLastToken(); - memberDeclarationLoop: while (LT(1) != IToken.tRBRACE) { - int checkToken = LA(1).hashCode(); - switch (LT(1)) { - case IToken.t_public: - consume(); - consume(IToken.tCOLON); -// astClassSpecifier -// .setCurrentVisibility(ASTAccessVisibility.PUBLIC); - break; - case IToken.t_protected: - consume(); - consume(IToken.tCOLON); -// astClassSpecifier -// .setCurrentVisibility(ASTAccessVisibility.PROTECTED); - break; - - case IToken.t_private: - consume(); - consume(IToken.tCOLON); -// astClassSpecifier -// .setCurrentVisibility(ASTAccessVisibility.PRIVATE); - break; - case IToken.tRBRACE: - consume(IToken.tRBRACE); - break memberDeclarationLoop; - default: - try { - declaration(); - } catch (BacktrackException bt) { - if (checkToken == LA(1).hashCode()) - failParseWithErrorHandling(); - } + cleanupLastToken(); + memberDeclarationLoop: while (LT(1) != IToken.tRBRACE) { + int checkToken = LA(1).hashCode(); + switch (LT(1)) { + case IToken.t_public: + case IToken.t_protected: + case IToken.t_private: + IToken key = consume(); + consume(IToken.tCOLON); + ICPPASTVisiblityLabel label = createVisibilityLabel(); + ((CPPASTNode)label).setOffset( key.getOffset() ); + label.setVisibility( token2Visibility( key.getType() )); + astClassSpecifier.addMemberDeclaration( label ); + label.setParent( astClassSpecifier ); + label.setPropertyInParent( ICPPASTCompositeTypeSpecifier.VISIBILITY_LABEL ); + break; + case IToken.tRBRACE: + consume(IToken.tRBRACE); + break memberDeclarationLoop; + default: + try { + IASTDeclaration d = declaration(); + astClassSpecifier.addMemberDeclaration( d ); + d.setParent( astClassSpecifier ); + d.setPropertyInParent( IASTCompositeTypeSpecifier.MEMBER_DECLARATION ); + } catch (BacktrackException bt) { + if (checkToken == LA(1).hashCode()) + failParseWithErrorHandling(); } - if (checkToken == LA(1).hashCode()) - failParseWithErrorHandling(); } - // consume the } - IToken lt = consume(IToken.tRBRACE); -// astClassSpecifier.setEndingOffsetAndLineNumber(lt -// .getEndOffset(), lt.getLineNumber()); - // try { - // astFactory.signalEndOfClassSpecifier(astClassSpecifier); - // } catch (Exception e1) { - // logException("classSpecifier:signalEndOfClassSpecifier", e1); //$NON-NLS-1$ - // throwBacktrack(lt.getOffset(), lt.getEndOffset(), lt.getLineNumber(), lt.getFilename()); - // } - - } finally { - // astClassSpecifier.exitScope(requestor); + if (checkToken == LA(1).hashCode()) + failParseWithErrorHandling(); } + // consume the } + consume(IToken.tRBRACE); + } + return astClassSpecifier; + } + + /** + * @return + */ + protected ICPPASTCompositeTypeSpecifier createClassSpecifier() { + return new CPPASTCompositeTypeSpecifier(); + } + + /** + * @return + */ + protected ICPPASTVisiblityLabel createVisibilityLabel() { + return new CPPASTVisibilityLabel(); + } + + /** + * @param type + * @return + */ + protected int token2Visibility(int type) { + switch( type ) + { + case IToken.t_public: + return ICPPASTVisiblityLabel.v_public; + case IToken.t_protected: + return ICPPASTVisiblityLabel.v_protected; + case IToken.t_private: + return ICPPASTVisiblityLabel.v_private; + } + return 0; } /** @@ -3922,96 +4015,102 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { * @param classSpecOwner * @throws BacktrackException */ - protected void baseSpecifier(Object astClassSpec) + protected void baseSpecifier(ICPPASTCompositeTypeSpecifier astClassSpec) throws EndOfFileException, BacktrackException { - IToken la = LA(1); - char[] fn = la.getFilename(); - int startingOffset = la.getOffset(); - int line = la.getLineNumber(); - la = null; + consume(IToken.tCOLON); boolean isVirtual = false; - Object visibility = null; //ASTAccessVisibility.PUBLIC; - ITokenDuple nameDuple = null; - - ArrayList bases = null; - + int visibility = 0; //ASTAccessVisibility.PUBLIC; + IASTName name = null; + IToken firstToken = null; baseSpecifierLoop: for (;;) { switch (LT(1)) { case IToken.t_virtual: - consume(IToken.t_virtual); + if( firstToken == null ) + firstToken = consume(IToken.t_virtual); + else + consume(IToken.t_virtual); isVirtual = true; break; case IToken.t_public: - consume(); - break; + visibility = ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier.v_public; + if( firstToken == null ) + firstToken = consume(); + else + consume(); + break; case IToken.t_protected: - consume(); - visibility = null; //ASTAccessVisibility.PROTECTED; - break; + visibility = ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier.v_protected; + if( firstToken == null ) + firstToken = consume(); + else + consume(); + break; case IToken.t_private: - visibility = null; //ASTAccessVisibility.PRIVATE; - consume(); + visibility = ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier.v_private; + if( firstToken == null ) + firstToken = consume(); + else + consume(); break; case IToken.tCOLONCOLON: case IToken.tIDENTIFIER: //to get templates right we need to use the class as the scope - nameDuple = name(); + name = createName( name() ); break; case IToken.tCOMMA: - //because we are using the class as the scope to get the name, we need to postpone adding the base - //specifiers until after we have all the nameDuples - if (bases == null) { - bases = new ArrayList(4); - } - bases.add(new Object[] { - isVirtual ? Boolean.TRUE : Boolean.FALSE, visibility, - nameDuple }); + if( name == null ) + name = createName(); + ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier baseSpec = createBaseSpecifier(); + if( firstToken != null ) + ((CPPASTNode)baseSpec).setOffset( firstToken.getOffset() ); + baseSpec.setVirtual( isVirtual ); + baseSpec.setVisibility( visibility ); + baseSpec.setName( name ); + name.setParent( baseSpec ); + name.setPropertyInParent(ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier.NAME ); + astClassSpec.addBaseSpecifier( baseSpec ); + baseSpec.setParent( astClassSpec ); + baseSpec.setPropertyInParent( ICPPASTCompositeTypeSpecifier.BASE_SPECIFIER ); + isVirtual = false; - visibility = null; //ASTAccessVisibility.PUBLIC; - nameDuple = null; + visibility = 0; + name = null; + firstToken = null; consume(); continue baseSpecifierLoop; + case IToken.tLBRACE: + if( name == null ) + name = createName(); + baseSpec = createBaseSpecifier(); + if( firstToken != null ) + ((CPPASTNode)baseSpec).setOffset( firstToken.getOffset() ); + baseSpec.setVirtual( isVirtual ); + baseSpec.setVisibility( visibility ); + baseSpec.setName( name ); + name.setParent( baseSpec ); + name.setPropertyInParent(ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier.NAME ); + + astClassSpec.addBaseSpecifier( baseSpec ); + baseSpec.setParent( astClassSpec ); + baseSpec.setPropertyInParent( ICPPASTCompositeTypeSpecifier.BASE_SPECIFIER ); + //fall through default: break baseSpecifierLoop; } } - - try { - if (bases != null) { - int size = bases.size(); - for (int i = 0; i < size; i++) { - Object[] data = (Object[]) bases.get(i); - // try { - // astFactory.addBaseSpecifier( astClassSpec, - // ((Boolean)data[0]).booleanValue(), - // (ASTAccessVisibility) data[1], - // (ITokenDuple)data[2] ); - // } catch (ASTSemanticException e1) { - // failParse( e1.getProblem() ); - // } - } - } - - // astFactory.addBaseSpecifier( - // astClassSpec, - // isVirtual, - // visibility, - // nameDuple ); - // } - // catch (ASTSemanticException e) - // { - // failParse( e.getProblem() ); - } catch (Exception e) { - int endOffset = (lastToken != null) ? lastToken.getEndOffset() : 0; - logException("baseSpecifier_2::addBaseSpecifier", e); //$NON-NLS-1$ - throwBacktrack(startingOffset, endOffset, line, fn); - } } + /** + * @return + */ + private ICPPASTBaseSpecifier createBaseSpecifier() { + return new CPPASTBaseSpecifier(); + } + protected void catchHandlerSequence() throws EndOfFileException, BacktrackException { if (LT(1) != IToken.t_catch) { @@ -4251,13 +4350,6 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { return new CASTEnumerator(); } - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.parser2.AbstractGNUSourceCodeParser#createEnumerationSpecifier() - */ - protected IASTEnumerationSpecifier createEnumerationSpecifier() { - return new CASTEnumerationSpecifier(); - } - /* (non-Javadoc) * @see org.eclipse.cdt.internal.core.parser2.AbstractGNUSourceCodeParser#buildTypeIdExpression(int, org.eclipse.cdt.core.dom.ast.IASTTypeId, int) */ @@ -4265,6 +4357,13 @@ public class GNUCPPSourceParser extends AbstractGNUSourceCodeParser { // TODO Auto-generated method stub return null; } + + /* (non-Javadoc) + * @see org.eclipse.cdt.internal.core.parser2.AbstractGNUSourceCodeParser#createEnumerationSpecifier() + */ + protected IASTEnumerationSpecifier createEnumerationSpecifier() { + return new CPPASTEnumerationSpecifier(); + } } \ No newline at end of file