mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-29 03:45:35 +02:00
Templates, Linkage Specs & the start of DeclSpecifierSeq.
This commit is contained in:
parent
b34fcf2fc9
commit
ece695b022
25 changed files with 1098 additions and 498 deletions
|
@ -19,6 +19,7 @@ public interface ICPPASTDeclSpecifier extends IASTDeclSpecifier {
|
||||||
|
|
||||||
// Extra storage class in C++
|
// Extra storage class in C++
|
||||||
public static final int sc_mutable = IASTDeclSpecifier.sc_last + 1;
|
public static final int sc_mutable = IASTDeclSpecifier.sc_last + 1;
|
||||||
|
public static final int sc_last = sc_mutable;
|
||||||
|
|
||||||
// A declaration in C++ can be a friend declaration
|
// A declaration in C++ can be a friend declaration
|
||||||
public boolean isFriend();
|
public boolean isFriend();
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.ASTNodeProperty;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*/
|
||||||
|
public interface ICPPASTExplicitTemplateInstantiation extends IASTDeclaration {
|
||||||
|
|
||||||
|
public static final ASTNodeProperty OWNED_DECLARATION = new ASTNodeProperty( "Owned Declaration"); //$NON-NLS-1$
|
||||||
|
public IASTDeclaration getDeclaration();
|
||||||
|
public void setDeclaration( IASTDeclaration declaration );
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.IASTDeclaration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*/
|
||||||
|
public interface ICPPASTLinkageSpecification extends IASTDeclaration {
|
||||||
|
|
||||||
|
public String getLiteral();
|
||||||
|
public void setLiteral( String value );
|
||||||
|
|
||||||
|
public static final ASTNodeProperty OWNED_DECLARATION = new ASTNodeProperty( "Owned Declaration"); //$NON-NLS-1$
|
||||||
|
public List getDeclarations();
|
||||||
|
public void addDeclaration( IASTDeclaration declaration );
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.IASTParameterDeclaration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*/
|
||||||
|
public interface ICPPASTParameterDeclaration extends ICPPASTTemplateParameter,
|
||||||
|
IASTParameterDeclaration {
|
||||||
|
|
||||||
|
}
|
|
@ -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.core.dom.ast.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*/
|
||||||
|
public interface ICPPASTSimpleTypeTemplateParameter extends
|
||||||
|
ICPPASTTemplateParameter {
|
||||||
|
|
||||||
|
public static final int st_class = 1;
|
||||||
|
public static final int st_typename = 2;
|
||||||
|
|
||||||
|
public int getParameterType();
|
||||||
|
public void setParameterType( int value );
|
||||||
|
|
||||||
|
public static final ASTNodeProperty PARAMETER_NAME = new ASTNodeProperty( "Name" ); //$NON-NLS-1$
|
||||||
|
public IASTName getName();
|
||||||
|
public void setName( IASTName name );
|
||||||
|
|
||||||
|
public static final ASTNodeProperty DEFAULT_TYPE = new ASTNodeProperty( "Default Type"); //$NON-NLS-1$
|
||||||
|
public IASTTypeId getDefaultType();
|
||||||
|
public void setDefaultType( IASTTypeId typeId );
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.IASTDeclaration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*/
|
||||||
|
public interface ICPPASTTemplateDeclaration extends IASTDeclaration {
|
||||||
|
|
||||||
|
public boolean isExported();
|
||||||
|
public void setExported( boolean value );
|
||||||
|
|
||||||
|
public static final ASTNodeProperty OWNED_DECLARATION = new ASTNodeProperty( "Owned Declaration"); //$NON-NLS-1$
|
||||||
|
public IASTDeclaration getDeclaration();
|
||||||
|
public void setDeclaration( IASTDeclaration declaration );
|
||||||
|
|
||||||
|
public static final ASTNodeProperty PARAMETER = new ASTNodeProperty( "Template Parameter"); //$NON-NLS-1$
|
||||||
|
public List getTemplateParameters();
|
||||||
|
public void addTemplateParamter( ICPPASTTemplateParameter parm );
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.IASTNode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*/
|
||||||
|
public interface ICPPASTTemplateParameter extends IASTNode {
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.ASTNodeProperty;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*/
|
||||||
|
public interface ICPPASTTemplateSpecialization extends IASTDeclaration {
|
||||||
|
|
||||||
|
public static final ASTNodeProperty OWNED_DECLARATION = new ASTNodeProperty( "Owned Declaration"); //$NON-NLS-1$
|
||||||
|
public IASTDeclaration getDeclaration();
|
||||||
|
public void setDeclaration( IASTDeclaration declaration );
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.IASTExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*/
|
||||||
|
public interface ICPPASTTemplatedTypeTemplateParameter extends
|
||||||
|
ICPPASTTemplateParameter {
|
||||||
|
|
||||||
|
public static final ASTNodeProperty PARAMETER = new ASTNodeProperty( "Template Parameter"); //$NON-NLS-1$
|
||||||
|
public List getTemplateParameters();
|
||||||
|
public void addTemplateParamter( ICPPASTTemplateParameter parm );
|
||||||
|
|
||||||
|
public static final ASTNodeProperty PARAMETER_NAME = new ASTNodeProperty( "Name" ); //$NON-NLS-1$
|
||||||
|
public IASTName getName();
|
||||||
|
public void setName( IASTName name );
|
||||||
|
|
||||||
|
public static final ASTNodeProperty DEFAULT_VALUE = new ASTNodeProperty( "Default Value"); //$NON-NLS-1$
|
||||||
|
public IASTExpression getDefaultValue();
|
||||||
|
public void setDefaultValue( IASTExpression expression );
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.gnu.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*/
|
||||||
|
public interface IGPPASTDeclSpecifier extends IASTDeclSpecifier {
|
||||||
|
|
||||||
|
// Extra type qualifier in C
|
||||||
|
public boolean isRestrict();
|
||||||
|
|
||||||
|
public void setRestrict( boolean value );
|
||||||
|
|
||||||
|
}
|
|
@ -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.gnu.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExplicitTemplateInstantiation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*/
|
||||||
|
public interface IGPPASTExplicitTemplateInstantiation extends
|
||||||
|
ICPPASTExplicitTemplateInstantiation {
|
||||||
|
|
||||||
|
public static final int ti_static = 1;
|
||||||
|
public static final int ti_inline = 2;
|
||||||
|
public static final int ti_extern = 3;
|
||||||
|
|
||||||
|
public int getModifier();
|
||||||
|
public void setModifier( int value );
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.gnu.cpp;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleDeclSpecifier;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*/
|
||||||
|
public interface IGPPASTSimpleDeclSpecifier extends IGPPASTDeclSpecifier,
|
||||||
|
ICPPASTSimpleDeclSpecifier {
|
||||||
|
|
||||||
|
public static final int t_Complex = ICPPASTSimpleDeclSpecifier.t_last + 1;
|
||||||
|
public static final int t_Imaginary = ICPPASTSimpleDeclSpecifier.t_last + 2;
|
||||||
|
public static final int t_last = t_Imaginary;
|
||||||
|
|
||||||
|
}
|
|
@ -58,7 +58,6 @@ import org.eclipse.cdt.core.parser.ParseError;
|
||||||
import org.eclipse.cdt.core.parser.ParserMode;
|
import org.eclipse.cdt.core.parser.ParserMode;
|
||||||
import org.eclipse.cdt.internal.core.parser.ParserProblemFactory;
|
import org.eclipse.cdt.internal.core.parser.ParserProblemFactory;
|
||||||
import org.eclipse.cdt.internal.core.parser.problem.IProblemFactory;
|
import org.eclipse.cdt.internal.core.parser.problem.IProblemFactory;
|
||||||
import org.eclipse.cdt.internal.core.parser.token.TokenFactory;
|
|
||||||
import org.eclipse.cdt.internal.core.parser2.c.CASTASMDeclaration;
|
import org.eclipse.cdt.internal.core.parser2.c.CASTASMDeclaration;
|
||||||
import org.eclipse.cdt.internal.core.parser2.c.CASTBreakStatement;
|
import org.eclipse.cdt.internal.core.parser2.c.CASTBreakStatement;
|
||||||
import org.eclipse.cdt.internal.core.parser2.c.CASTCaseStatement;
|
import org.eclipse.cdt.internal.core.parser2.c.CASTCaseStatement;
|
||||||
|
@ -967,18 +966,6 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
||||||
return compoundStatement();
|
return compoundStatement();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param sdw
|
|
||||||
* @param typeNameBegin
|
|
||||||
* @param typeNameEnd
|
|
||||||
*/
|
|
||||||
protected void setTypeName(DeclarationWrapper sdw, IToken typeNameBegin,
|
|
||||||
IToken typeNameEnd) {
|
|
||||||
if (typeNameBegin != null)
|
|
||||||
sdw.setTypeName(TokenFactory.createTokenDuple(typeNameBegin,
|
|
||||||
typeNameEnd));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param flags
|
* @param flags
|
||||||
* input flags that are used to make our decision
|
* input flags that are used to make our decision
|
||||||
|
|
|
@ -56,12 +56,8 @@ public class CASTSimpleDeclaration extends CASTNode implements
|
||||||
declarators[i] = old[i];
|
declarators[i] = old[i];
|
||||||
}
|
}
|
||||||
declarators[ currentIndex++ ] = d;
|
declarators[ currentIndex++ ] = d;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param decls2
|
|
||||||
*/
|
|
||||||
private void removeNullDeclarators() {
|
private void removeNullDeclarators() {
|
||||||
int nullCount = 0;
|
int nullCount = 0;
|
||||||
for( int i = 0; i < declarators.length; ++i )
|
for( int i = 0; i < declarators.length; ++i )
|
||||||
|
|
|
@ -57,5 +57,19 @@ public class ANSICPPParserExtensionConfiguration implements
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser2.cpp.ICPPParserExtensionConfiguration#supportComplexNumbers()
|
||||||
|
*/
|
||||||
|
public boolean supportComplexNumbers() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser2.cpp.ICPPParserExtensionConfiguration#supportRestrictKeyword()
|
||||||
|
*/
|
||||||
|
public boolean supportRestrictKeyword() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.IASTDeclaration;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExplicitTemplateInstantiation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*/
|
||||||
|
public class CPPASTExplicitTemplateInstantiation extends CPPASTNode implements
|
||||||
|
ICPPASTExplicitTemplateInstantiation {
|
||||||
|
|
||||||
|
private IASTDeclaration declaration;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExplicitTemplateInstantiation#getDeclaration()
|
||||||
|
*/
|
||||||
|
public IASTDeclaration getDeclaration() {
|
||||||
|
return declaration;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTExplicitTemplateInstantiation#setDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
|
||||||
|
*/
|
||||||
|
public void setDeclaration(IASTDeclaration declaration) {
|
||||||
|
this.declaration = declaration;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,87 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.cpp.ICPPASTLinkageSpecification;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*/
|
||||||
|
public class CPPASTLinkageSpecification extends CPPASTNode implements
|
||||||
|
ICPPASTLinkageSpecification {
|
||||||
|
|
||||||
|
private String literal;
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification#getLiteral()
|
||||||
|
*/
|
||||||
|
public String getLiteral() {
|
||||||
|
return literal;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification#setLiteral(java.lang.String)
|
||||||
|
*/
|
||||||
|
public void setLiteral(String value) {
|
||||||
|
this.literal = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification#getDeclarations()
|
||||||
|
*/
|
||||||
|
public List getDeclarations() {
|
||||||
|
if( declarations == null ) return Collections.EMPTY_LIST;
|
||||||
|
removeNullDeclarations();
|
||||||
|
return Arrays.asList( declarations );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLinkageSpecification#addDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
|
||||||
|
*/
|
||||||
|
public void addDeclaration(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;
|
||||||
|
|
||||||
|
}
|
|
@ -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.IASTTypeId;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeTemplateParameter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*/
|
||||||
|
public class CPPASTSimpleTypeTemplateParameter extends CPPASTNode implements
|
||||||
|
ICPPASTSimpleTypeTemplateParameter {
|
||||||
|
|
||||||
|
private int type;
|
||||||
|
private IASTName name;
|
||||||
|
private IASTTypeId typeId;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeTemplateParameter#getParameterType()
|
||||||
|
*/
|
||||||
|
public int getParameterType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeTemplateParameter#setParameterType(int)
|
||||||
|
*/
|
||||||
|
public void setParameterType(int value) {
|
||||||
|
this.type = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeTemplateParameter#getName()
|
||||||
|
*/
|
||||||
|
public IASTName getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeTemplateParameter#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.cpp.ICPPASTSimpleTypeTemplateParameter#getDefaultType()
|
||||||
|
*/
|
||||||
|
public IASTTypeId getDefaultType() {
|
||||||
|
return typeId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeTemplateParameter#setDefaultType(org.eclipse.cdt.core.dom.ast.IASTTypeId)
|
||||||
|
*/
|
||||||
|
public void setDefaultType(IASTTypeId typeId) {
|
||||||
|
this.typeId = typeId;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,103 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.cpp.ICPPASTTemplateDeclaration;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*/
|
||||||
|
public class CPPASTTemplateDeclaration extends CPPASTNode implements
|
||||||
|
ICPPASTTemplateDeclaration {
|
||||||
|
|
||||||
|
private boolean exported;
|
||||||
|
private IASTDeclaration declaration;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration#isExported()
|
||||||
|
*/
|
||||||
|
public boolean isExported() {
|
||||||
|
return exported;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration#setExported(boolean)
|
||||||
|
*/
|
||||||
|
public void setExported(boolean value) {
|
||||||
|
exported = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration#getDeclaration()
|
||||||
|
*/
|
||||||
|
public IASTDeclaration getDeclaration() {
|
||||||
|
return declaration;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration#setDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
|
||||||
|
*/
|
||||||
|
public void setDeclaration(IASTDeclaration declaration) {
|
||||||
|
this.declaration = declaration;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration#getTemplateParameters()
|
||||||
|
*/
|
||||||
|
public List getTemplateParameters() {
|
||||||
|
if( parameters == null ) return Collections.EMPTY_LIST;
|
||||||
|
removeNullParameters();
|
||||||
|
return Arrays.asList( parameters );
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration#addTemplateParamter(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter)
|
||||||
|
*/
|
||||||
|
public void addTemplateParamter(ICPPASTTemplateParameter parm) {
|
||||||
|
if( parameters == null )
|
||||||
|
{
|
||||||
|
parameters = new ICPPASTTemplateParameter[ DEFAULT_PARMS_LIST_SIZE ];
|
||||||
|
currentIndex = 0;
|
||||||
|
}
|
||||||
|
if( parameters.length == currentIndex )
|
||||||
|
{
|
||||||
|
ICPPASTTemplateParameter [] old = parameters;
|
||||||
|
parameters = new ICPPASTTemplateParameter[ old.length * 2 ];
|
||||||
|
for( int i = 0; i < old.length; ++i )
|
||||||
|
parameters[i] = old[i];
|
||||||
|
}
|
||||||
|
parameters[ currentIndex++ ] = parm;
|
||||||
|
}
|
||||||
|
private void removeNullParameters() {
|
||||||
|
int nullCount = 0;
|
||||||
|
for( int i = 0; i < parameters.length; ++i )
|
||||||
|
if( parameters[i] == null )
|
||||||
|
++nullCount;
|
||||||
|
if( nullCount == 0 ) return;
|
||||||
|
ICPPASTTemplateParameter[] old = parameters;
|
||||||
|
int newSize = old.length - nullCount;
|
||||||
|
parameters = new ICPPASTTemplateParameter[ newSize ];
|
||||||
|
for( int i = 0; i < newSize; ++i )
|
||||||
|
parameters[i] = old[i];
|
||||||
|
currentIndex = newSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int currentIndex = 0;
|
||||||
|
private ICPPASTTemplateParameter [] parameters = null;
|
||||||
|
private static final int DEFAULT_PARMS_LIST_SIZE = 4;
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,38 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.IASTDeclaration;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateSpecialization;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*/
|
||||||
|
public class CPPASTTemplateSpecialization extends CPPASTNode implements
|
||||||
|
ICPPASTTemplateSpecialization {
|
||||||
|
|
||||||
|
private IASTDeclaration declaration;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateSpecialization#getDeclaration()
|
||||||
|
*/
|
||||||
|
public IASTDeclaration getDeclaration() {
|
||||||
|
return declaration;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateSpecialization#setDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
|
||||||
|
*/
|
||||||
|
public void setDeclaration(IASTDeclaration declaration) {
|
||||||
|
this.declaration = declaration;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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 java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplatedTypeTemplateParameter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*/
|
||||||
|
public class CPPASTTemplatedTypeTemplateParameter extends CPPASTNode implements
|
||||||
|
ICPPASTTemplatedTypeTemplateParameter {
|
||||||
|
|
||||||
|
public List getTemplateParameters() {
|
||||||
|
if( parameters == null ) return Collections.EMPTY_LIST;
|
||||||
|
removeNullParameters();
|
||||||
|
return Arrays.asList( parameters );
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addTemplateParamter(ICPPASTTemplateParameter parm) {
|
||||||
|
if( parameters == null )
|
||||||
|
{
|
||||||
|
parameters = new ICPPASTTemplateParameter[ DEFAULT_PARMS_LIST_SIZE ];
|
||||||
|
currentIndex = 0;
|
||||||
|
}
|
||||||
|
if( parameters.length == currentIndex )
|
||||||
|
{
|
||||||
|
ICPPASTTemplateParameter [] old = parameters;
|
||||||
|
parameters = new ICPPASTTemplateParameter[ old.length * 2 ];
|
||||||
|
for( int i = 0; i < old.length; ++i )
|
||||||
|
parameters[i] = old[i];
|
||||||
|
}
|
||||||
|
parameters[ currentIndex++ ] = parm;
|
||||||
|
}
|
||||||
|
private void removeNullParameters() {
|
||||||
|
int nullCount = 0;
|
||||||
|
for( int i = 0; i < parameters.length; ++i )
|
||||||
|
if( parameters[i] == null )
|
||||||
|
++nullCount;
|
||||||
|
if( nullCount == 0 ) return;
|
||||||
|
ICPPASTTemplateParameter[] old = parameters;
|
||||||
|
int newSize = old.length - nullCount;
|
||||||
|
parameters = new ICPPASTTemplateParameter[ newSize ];
|
||||||
|
for( int i = 0; i < newSize; ++i )
|
||||||
|
parameters[i] = old[i];
|
||||||
|
currentIndex = newSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int currentIndex = 0;
|
||||||
|
private ICPPASTTemplateParameter [] parameters = null;
|
||||||
|
private static final int DEFAULT_PARMS_LIST_SIZE = 4;
|
||||||
|
private IASTName name;
|
||||||
|
private IASTExpression defaultValue;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplatedTypeTemplateParameter#getName()
|
||||||
|
*/
|
||||||
|
public IASTName getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplatedTypeTemplateParameter#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.cpp.ICPPASTTemplatedTypeTemplateParameter#getDefaultValue()
|
||||||
|
*/
|
||||||
|
public IASTExpression getDefaultValue() {
|
||||||
|
return defaultValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplatedTypeTemplateParameter#setDefaultValue(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
||||||
|
*/
|
||||||
|
public void setDefaultValue(IASTExpression expression) {
|
||||||
|
this.defaultValue = expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -57,4 +57,18 @@ public class GNUCPPParserExtensionConfiguration implements
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser2.cpp.ICPPParserExtensionConfiguration#supportComplexNumbers()
|
||||||
|
*/
|
||||||
|
public boolean supportComplexNumbers() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.internal.core.parser2.cpp.ICPPParserExtensionConfiguration#supportRestrictKeyword()
|
||||||
|
*/
|
||||||
|
public boolean supportRestrictKeyword() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,38 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* 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.gnu.cpp.IGPPASTExplicitTemplateInstantiation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jcamelon
|
||||||
|
*/
|
||||||
|
public class GPPASTExplicitTemplateInstantiation extends
|
||||||
|
CPPASTExplicitTemplateInstantiation implements
|
||||||
|
IGPPASTExplicitTemplateInstantiation {
|
||||||
|
|
||||||
|
private int mod;
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTExplicitTemplateInstantiation#getModifier()
|
||||||
|
*/
|
||||||
|
public int getModifier() {
|
||||||
|
return mod;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTExplicitTemplateInstantiation#setModifier(int)
|
||||||
|
*/
|
||||||
|
public void setModifier(int value) {
|
||||||
|
this.mod = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -25,6 +25,7 @@ public interface ICPPParserExtensionConfiguration {
|
||||||
public boolean supportExtendedTemplateSyntax();
|
public boolean supportExtendedTemplateSyntax();
|
||||||
public boolean supportMinAndMaxOperators();
|
public boolean supportMinAndMaxOperators();
|
||||||
public boolean supportStatementsInExpressions();
|
public boolean supportStatementsInExpressions();
|
||||||
|
public boolean supportComplexNumbers();
|
||||||
|
public boolean supportRestrictKeyword();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue