mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 16:56:04 +02:00
Most of C++ Expressions & Declarations.
80% of QuickParseTest2 passing.
This commit is contained in:
parent
778d51ed87
commit
edd4a3ebf0
48 changed files with 3054 additions and 1425 deletions
|
@ -31,7 +31,7 @@ import org.eclipse.cdt.core.dom.ast.IASTName;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryTypeIdExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTTypeIdInitializerExpression;
|
||||
import org.eclipse.cdt.core.parser.CodeReader;
|
||||
|
@ -116,7 +116,7 @@ public class AST2BaseTest extends TestCase {
|
|||
* @throws ParserException
|
||||
*/
|
||||
protected void validateSimpleUnaryTypeIdExpression( String code, int op ) throws ParserException {
|
||||
IASTUnaryTypeIdExpression e = (IASTUnaryTypeIdExpression) getExpressionFromStatementInCode( code, ParserLanguage.C );
|
||||
IASTCastExpression e = (IASTCastExpression) getExpressionFromStatementInCode( code, ParserLanguage.C );
|
||||
assertNotNull( e );
|
||||
assertEquals( e.getOperator(), op );
|
||||
assertNotNull( e.getTypeId() );
|
||||
|
|
|
@ -36,7 +36,7 @@ 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.IASTUnaryExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryTypeIdExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||
import org.eclipse.cdt.core.dom.ast.IField;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||
|
@ -243,7 +243,7 @@ public class AST2Tests extends AST2BaseTest {
|
|||
validateSimpleUnaryExpressionC( "&x", IASTUnaryExpression.op_amper ); //$NON-NLS-1$
|
||||
validateSimpleUnaryExpressionC( "sizeof x", IASTUnaryExpression.op_sizeof ); //$NON-NLS-1$
|
||||
validateSimpleTypeIdExpressionC( "sizeof( int )", IASTTypeIdExpression.op_sizeof ); //$NON-NLS-1$
|
||||
validateSimpleUnaryTypeIdExpression( "(int)x", IASTUnaryTypeIdExpression.op_cast ); //$NON-NLS-1$
|
||||
validateSimpleUnaryTypeIdExpression( "(int)x", IASTCastExpression.op_cast ); //$NON-NLS-1$
|
||||
validateSimplePostfixInitializerExpressionC( "(int) { 5 }"); //$NON-NLS-1$
|
||||
validateSimplePostfixInitializerExpressionC( "(int) { 5, }"); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x=y", IASTBinaryExpression.op_assign ); //$NON-NLS-1$
|
||||
|
|
|
@ -845,7 +845,6 @@ public class QuickParser2Tests extends TestCase {
|
|||
code.write("__a = __b;\n"); //$NON-NLS-1$
|
||||
code.write("__b = __tmp;\n"); //$NON-NLS-1$
|
||||
code.write("}\n"); //$NON-NLS-1$
|
||||
|
||||
parse(code.toString());
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ package org.eclipse.cdt.core.dom.ast;
|
|||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface IASTUnaryTypeIdExpression extends IASTExpression {
|
||||
public interface IASTCastExpression extends IASTExpression {
|
||||
|
||||
public static final int op_cast = 0;
|
||||
public static final int op_last = op_cast;
|
|
@ -21,6 +21,7 @@ public interface IASTLiteralExpression extends IASTExpression {
|
|||
public static final int lk_float_constant = 1;
|
||||
public static final int lk_char_constant = 2;
|
||||
public static final int lk_string_literal = 3;
|
||||
public static final int lk_last = lk_string_literal;
|
||||
|
||||
public int getKind();
|
||||
public void setKind( int value );
|
||||
|
|
|
@ -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.IASTBinaryExpression;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICPPASTBinaryExpression extends IASTBinaryExpression {
|
||||
|
||||
public static final int op_pmdot = IASTBinaryExpression.op_last + 1;
|
||||
public static final int op_pmarrow = IASTBinaryExpression.op_last + 2;
|
||||
public static final int op_last = op_pmarrow;
|
||||
}
|
|
@ -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.IASTCastExpression;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICPPASTCastExpression extends IASTCastExpression {
|
||||
|
||||
public static final int op_dynamic_cast = IASTCastExpression.op_last + 1;
|
||||
public static final int op_static_cast = IASTCastExpression.op_last + 2;
|
||||
public static final int op_reinterpret_cast = IASTCastExpression.op_last + 3;
|
||||
public static final int op_const_cast = IASTCastExpression.op_last + 4;
|
||||
public static final int op_last = op_const_cast;
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/**********************************************************************
|
||||
* 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;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICPPASTCatchHandler extends IASTStatement {
|
||||
|
||||
public static final ASTNodeProperty DECLARATION = new ASTNodeProperty( "Declaration"); //$NON-NLS-1$
|
||||
public static final ASTNodeProperty CATCH_BODY = new ASTNodeProperty( "Catch Body"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* @param isEllipsis
|
||||
*/
|
||||
public void setIsCatchAll(boolean isEllipsis);
|
||||
public boolean isCatchAll();
|
||||
|
||||
/**
|
||||
* @param compoundStatement
|
||||
*/
|
||||
public void setCatchBody(IASTStatement compoundStatement);
|
||||
public IASTStatement getCatchBody();
|
||||
|
||||
/**
|
||||
* @param decl
|
||||
*/
|
||||
public void setDeclaration(IASTDeclaration decl);
|
||||
public IASTDeclaration getDeclaration();
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/**********************************************************************
|
||||
* 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.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICPPASTConstructorChainInitializer extends IASTNode {
|
||||
|
||||
public static final ASTNodeProperty MEMBER_ID = new ASTNodeProperty( "Member Initializer Id"); //$NON-NLS-1$
|
||||
public IASTName getMemberInitializerId();
|
||||
public void setMemberInitializerId( IASTName name );
|
||||
|
||||
public static final ASTNodeProperty INITIALIZER = new ASTNodeProperty( "Expression Initializer"); //$NON-NLS-1$
|
||||
public IASTExpression getInitializerValue();
|
||||
public void setInitializerValue( IASTExpression expression );
|
||||
|
||||
}
|
|
@ -10,8 +10,8 @@
|
|||
**********************************************************************/
|
||||
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.IASTInitializer;
|
||||
|
||||
/**
|
||||
|
@ -25,8 +25,10 @@ public interface ICPPASTConstructorInitializer extends IASTInitializer {
|
|||
/**
|
||||
* Get the arguments to the constructor.
|
||||
*
|
||||
* @return List of IASTExpression
|
||||
* @return IASTExpression
|
||||
*/
|
||||
public List getExpressions();
|
||||
public static final ASTNodeProperty EXPRESSION = new ASTNodeProperty( "Expression"); //$NON-NLS-1$
|
||||
public IASTExpression getExpression();
|
||||
public void setExpression( IASTExpression expression );
|
||||
|
||||
}
|
||||
|
|
|
@ -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 org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICPPASTDeleteExpression extends IASTExpression {
|
||||
|
||||
public static final ASTNodeProperty OPERAND = new ASTNodeProperty( "Operand"); //$NON-NLS-1$
|
||||
public IASTExpression getOperand();
|
||||
public void setOperand( IASTExpression expression );
|
||||
/**
|
||||
* @param global
|
||||
*/
|
||||
public void setIsGlobal(boolean global);
|
||||
public boolean isGlobal();
|
||||
|
||||
/**
|
||||
* @param vectored
|
||||
*/
|
||||
public void setIsVectored(boolean vectored);
|
||||
public boolean isVectored();
|
||||
|
||||
}
|
|
@ -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.IASTFieldReference;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICPPASTFieldReference extends IASTFieldReference {
|
||||
|
||||
public boolean isTemplate();
|
||||
public void setIsTemplate( boolean value );
|
||||
|
||||
|
||||
}
|
|
@ -10,7 +10,11 @@
|
|||
**********************************************************************/
|
||||
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.IASTFunctionDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||
|
||||
/**
|
||||
* C++ adds a few things to function declarators.
|
||||
|
@ -19,9 +23,24 @@ import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
|||
*/
|
||||
public interface ICPPASTFunctionDeclarator extends IASTFunctionDeclarator {
|
||||
|
||||
public boolean isConst();
|
||||
public boolean isVolatile();
|
||||
|
||||
// TODO add in exception specification
|
||||
public boolean isConst();
|
||||
public void setConst( boolean value );
|
||||
|
||||
public boolean isVolatile();
|
||||
public void setVolatile( boolean value );
|
||||
|
||||
public static final ASTNodeProperty EXCEPTION_TYPEID = new ASTNodeProperty( "Exception TypeId"); //$NON-NLS-1$
|
||||
public List getExceptionSpecification();
|
||||
public void addExceptionSpecificationTypeId( IASTTypeId typeId );
|
||||
/**
|
||||
* @param isPureVirtual
|
||||
*/
|
||||
public boolean isPureVirtual();
|
||||
public void setPureVirtual(boolean isPureVirtual);
|
||||
|
||||
public static final ASTNodeProperty CONSTRUCTOR_CHAIN_MEMBER = new ASTNodeProperty( "Constructor Chain Member"); //$NON-NLS-1$
|
||||
public List getConstructorChain();
|
||||
public void addConstructorToChain( ICPPASTConstructorChainInitializer initializer );
|
||||
|
||||
}
|
||||
|
|
|
@ -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 java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICPPASTFunctionTryBlockDeclarator extends
|
||||
ICPPASTFunctionDeclarator {
|
||||
|
||||
public static final ASTNodeProperty CATCH_HANDLER = new ASTNodeProperty( "Catch Handler"); //$NON-NLS-1$
|
||||
public void addCatchHandler( IASTStatement statement );
|
||||
public List getCatchHandlers();
|
||||
}
|
|
@ -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.IASTLiteralExpression;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICPPASTLiteralExpression extends IASTLiteralExpression {
|
||||
|
||||
public static final int lk_this = IASTLiteralExpression.lk_last + 1;
|
||||
public static final int lk_true = IASTLiteralExpression.lk_last + 2;
|
||||
public static final int lk_false = IASTLiteralExpression.lk_last + 3;
|
||||
public static final int lk_last = lk_false;
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/**********************************************************************
|
||||
* 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.IASTTypeId;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICPPASTNewExpression extends IASTExpression {
|
||||
|
||||
public boolean isGlobal();
|
||||
public void setIsGlobal( boolean value );
|
||||
|
||||
public static final ASTNodeProperty NEW_PLACEMENT = new ASTNodeProperty( "New Placement"); //$NON-NLS-1$
|
||||
public IASTExpression getNewPlacement();
|
||||
public void setNewPlacement( IASTExpression expression );
|
||||
|
||||
public static final ASTNodeProperty NEW_INITIALIZER = new ASTNodeProperty( "New Initializer"); //$NON-NLS-1$
|
||||
public IASTExpression getNewInitializer();
|
||||
public void setNewInitializer( IASTExpression expression );
|
||||
|
||||
public static final ASTNodeProperty TYPE_ID = new ASTNodeProperty( "Type Id"); //$NON-NLS-1$
|
||||
public IASTTypeId getTypeId();
|
||||
public void setTypeId( IASTTypeId typeId );
|
||||
|
||||
public boolean isNewTypeId();
|
||||
public void setIsNewTypeId( boolean value );
|
||||
|
||||
public static final ASTNodeProperty NEW_TYPEID_ARRAY_EXPRESSION = new ASTNodeProperty( "Array Size Expression"); //$NON-NLS-1$
|
||||
public List getNewTypeIdArrayExpressions();
|
||||
public void addNewTypeIdArrayExpression( IASTExpression expression );
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/**********************************************************************
|
||||
* 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.IASTExpression;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICPPASTSimpleTypeConstructorExpression extends IASTExpression {
|
||||
|
||||
public static final int t_unspecified = 0;
|
||||
public static final int t_void = 1;
|
||||
public static final int t_char = 2;
|
||||
public static final int t_int = 3;
|
||||
public static final int t_float = 4;
|
||||
public static final int t_double = 5;
|
||||
public static final int t_bool = 6;
|
||||
public static final int t_wchar_t = 7;
|
||||
public static final int t_short = 8;
|
||||
public static final int t_long = 9;
|
||||
public static final int t_signed = 10;
|
||||
public static final int t_unsigned = 11;
|
||||
public static final int t_last = t_unsigned;
|
||||
|
||||
public int getSimpleType();
|
||||
public void setSimpleType( int value );
|
||||
|
||||
public static final ASTNodeProperty INITIALIZER_VALUE = new ASTNodeProperty( "Initializer Value"); //$NON-NLS-1$
|
||||
|
||||
public IASTExpression getInitialValue();
|
||||
public void setInitialValue( IASTExpression expression );
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
/**********************************************************************
|
||||
* 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.IASTTypeIdExpression;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICPPASTTypeIdExpression extends IASTTypeIdExpression {
|
||||
|
||||
public static final int op_typeid = IASTTypeIdExpression.op_last + 1;
|
||||
public static final int op_last = op_typeid;
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/**********************************************************************
|
||||
* 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.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICPPASTTypenameExpression extends IASTExpression {
|
||||
|
||||
/**
|
||||
* @param templateTokenConsumed
|
||||
*/
|
||||
public void setIsTemplate(boolean templateTokenConsumed);
|
||||
public boolean isTemplate();
|
||||
|
||||
public static final ASTNodeProperty TYPENAME = new ASTNodeProperty( "Typename" ); //$NON-NLS-1$
|
||||
/**
|
||||
* @param name
|
||||
*/
|
||||
public void setName(IASTName name);
|
||||
public IASTName getName();
|
||||
|
||||
public static final ASTNodeProperty INITIAL_VALUE = new ASTNodeProperty( "Initial Value"); //$NON-NLS-1$
|
||||
/**
|
||||
* @param expressionList
|
||||
*/
|
||||
public void setInitialValue(IASTExpression expressionList);
|
||||
public IASTExpression getInitialValue();
|
||||
|
||||
}
|
|
@ -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.IASTUnaryExpression;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICPPASTUnaryExpression extends IASTUnaryExpression {
|
||||
|
||||
public static final int op_throw = IASTUnaryExpression.op_last + 1;
|
||||
public static final int op_typeid = IASTUnaryExpression.op_last + 2;
|
||||
public static final int op_last = op_typeid;
|
||||
|
||||
}
|
|
@ -9,14 +9,15 @@
|
|||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast.gnu.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTBinaryExpression;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface IGPPASTBinaryExpression extends IASTBinaryExpression {
|
||||
public interface IGPPASTBinaryExpression extends ICPPASTBinaryExpression {
|
||||
|
||||
public static final int op_max = IASTBinaryExpression.op_last + 1;
|
||||
public static final int op_min = IASTBinaryExpression.op_last + 2;
|
||||
public static final int op_max = ICPPASTBinaryExpression.op_last + 1;
|
||||
public static final int op_min = ICPPASTBinaryExpression.op_last + 2;
|
||||
public static final int op_last = op_min;
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/**********************************************************************
|
||||
* 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.IASTPointer;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface IGPPASTPointer extends IASTPointer {
|
||||
|
||||
public boolean isRestrict();
|
||||
public void setRestrict( boolean value );
|
||||
}
|
|
@ -17,6 +17,7 @@ import org.eclipse.cdt.core.dom.ast.IASTASMDeclaration;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTBreakStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCaseStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTContinueStatement;
|
||||
|
@ -43,7 +44,6 @@ 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;
|
||||
|
@ -62,6 +62,7 @@ import org.eclipse.cdt.internal.core.parser.problem.IProblemFactory;
|
|||
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.CASTCaseStatement;
|
||||
import org.eclipse.cdt.internal.core.parser2.c.CASTCastExpression;
|
||||
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;
|
||||
|
@ -468,14 +469,9 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param d
|
||||
*/
|
||||
protected void throwAwayMarksForInitializerClause(Declarator d) {
|
||||
protected void throwAwayMarksForInitializerClause() {
|
||||
simpleDeclarationMark = null;
|
||||
if (d.getNameDuple() != null)
|
||||
d.getNameDuple().getLastToken().setNext(null);
|
||||
if (d.getPointerOperatorNameDuple() != null)
|
||||
d.getPointerOperatorNameDuple().getLastToken().setNext(null);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -545,10 +541,13 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
consume(IToken.tRPAREN);
|
||||
IGNUASTCompoundStatementExpression resultExpression = createCompoundStatementExpression();
|
||||
((ASTNode)resultExpression).setOffset( startingOffset );
|
||||
resultExpression.setCompoundStatement(compoundStatement);
|
||||
compoundStatement.setParent(resultExpression);
|
||||
compoundStatement
|
||||
.setPropertyInParent(IGNUASTCompoundStatementExpression.STATEMENT);
|
||||
if( compoundStatement != null )
|
||||
{
|
||||
resultExpression.setCompoundStatement(compoundStatement);
|
||||
compoundStatement.setParent(resultExpression);
|
||||
compoundStatement
|
||||
.setPropertyInParent(IGNUASTCompoundStatementExpression.STATEMENT);
|
||||
}
|
||||
|
||||
return resultExpression;
|
||||
}
|
||||
|
@ -1067,7 +1066,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
* @throws BacktrackException
|
||||
* request a backtrack
|
||||
*/
|
||||
protected ICASTEnumerationSpecifier enumSpecifier()
|
||||
protected IASTEnumerationSpecifier enumSpecifier()
|
||||
throws BacktrackException, EndOfFileException {
|
||||
IToken mark = mark();
|
||||
IASTName name = null;
|
||||
|
@ -1079,7 +1078,7 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
name = createName();
|
||||
if (LT(1) == IToken.tLBRACE) {
|
||||
|
||||
ICASTEnumerationSpecifier result = (ICASTEnumerationSpecifier) createEnumerationSpecifier();
|
||||
IASTEnumerationSpecifier result = createEnumerationSpecifier();
|
||||
((ASTNode)result).setOffset( startOffset );
|
||||
result.setName( name );
|
||||
name.setParent( result );
|
||||
|
@ -1593,4 +1592,31 @@ public abstract class AbstractGNUSourceCodeParser implements ISourceCodeParser {
|
|||
return new CASTEnumerationSpecifier();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param op
|
||||
* @param typeId
|
||||
* @param subExpression
|
||||
* @param startingOffset
|
||||
* @return
|
||||
*/
|
||||
protected IASTExpression buildTypeIdUnaryExpression(int op, IASTTypeId typeId, IASTExpression subExpression, int startingOffset) {
|
||||
IASTCastExpression result = createCastExpression();
|
||||
result.setOperator( op );
|
||||
((ASTNode)result).setOffset( startingOffset );
|
||||
result.setTypeId(typeId);
|
||||
typeId.setParent( result );
|
||||
typeId.setPropertyInParent( IASTCastExpression.TYPE_ID );
|
||||
result.setOperand( subExpression );
|
||||
subExpression.setParent( result );
|
||||
subExpression.setPropertyInParent( IASTCastExpression.OPERAND );
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
protected IASTCastExpression createCastExpression() {
|
||||
return new CASTCastExpression();
|
||||
}
|
||||
|
||||
}
|
|
@ -23,9 +23,6 @@ public class CASTArrayDeclarator extends CASTDeclarator implements
|
|||
IASTArrayDeclarator {
|
||||
|
||||
private int currentIndex = 0;
|
||||
/**
|
||||
* @param decls2
|
||||
*/
|
||||
private void removeNullArrayModifiers() {
|
||||
int nullCount = 0;
|
||||
for( int i = 0; i < arrayMods.length; ++i )
|
||||
|
@ -45,9 +42,6 @@ public class CASTArrayDeclarator extends CASTDeclarator implements
|
|||
private static final int DEFAULT_ARRAYMODS_LIST_SIZE = 4;
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator#getArrayModifiers()
|
||||
*/
|
||||
public List getArrayModifiers() {
|
||||
if( arrayMods == null ) return Collections.EMPTY_LIST;
|
||||
removeNullArrayModifiers();
|
||||
|
@ -55,9 +49,6 @@ public class CASTArrayDeclarator extends CASTDeclarator implements
|
|||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator#addArrayModifier(org.eclipse.cdt.core.dom.ast.IASTArrayModifier)
|
||||
*/
|
||||
public void addArrayModifier(IASTArrayModifier arrayModifier) {
|
||||
if( arrayMods == null )
|
||||
{
|
||||
|
|
|
@ -10,13 +10,13 @@
|
|||
package org.eclipse.cdt.internal.core.parser2.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryTypeIdExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class CASTUnaryTypeIdExpression extends CASTUnaryExpression implements
|
||||
IASTUnaryTypeIdExpression {
|
||||
public class CASTCastExpression extends CASTUnaryExpression implements
|
||||
IASTCastExpression {
|
||||
|
||||
private IASTTypeId typeId;
|
||||
|
|
@ -49,7 +49,7 @@ 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.IASTUnaryExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryTypeIdExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTWhileStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||
|
@ -184,8 +184,8 @@ public class CVisitor {
|
|||
}
|
||||
if( binding instanceof ICompositeType )
|
||||
compositeType = (ICompositeType) binding;
|
||||
} else if( fieldOwner instanceof IASTUnaryTypeIdExpression ){
|
||||
IASTTypeId id = ((IASTUnaryTypeIdExpression)fieldOwner).getTypeId();
|
||||
} else if( fieldOwner instanceof IASTCastExpression ){
|
||||
IASTTypeId id = ((IASTCastExpression)fieldOwner).getTypeId();
|
||||
IBinding binding = resolveBinding( id );
|
||||
if( binding != null && binding instanceof ICompositeType ){
|
||||
compositeType = (ICompositeType) binding;
|
||||
|
@ -723,9 +723,9 @@ public class CVisitor {
|
|||
if( !visitTypeId( ((IASTTypeIdExpression)expression).getTypeId(), action ) ) return false;
|
||||
} else if( expression instanceof IASTUnaryExpression ){
|
||||
if( !visitExpression( ((IASTUnaryExpression)expression).getOperand(), action ) ) return false;
|
||||
} else if( expression instanceof IASTUnaryTypeIdExpression ){
|
||||
if( !visitExpression( ((IASTUnaryTypeIdExpression)expression).getOperand(), action ) ) return false;
|
||||
if( !visitTypeId( ((IASTUnaryTypeIdExpression)expression).getTypeId(), action ) ) return false;
|
||||
} else if( expression instanceof IASTCastExpression ){
|
||||
if( !visitExpression( ((IASTCastExpression)expression).getOperand(), action ) ) return false;
|
||||
if( !visitTypeId( ((IASTCastExpression)expression).getTypeId(), action ) ) return false;
|
||||
} else if( expression instanceof ICASTTypeIdInitializerExpression ){
|
||||
if( !visitTypeId( ((ICASTTypeIdInitializerExpression)expression).getTypeId(), action ) ) return false;
|
||||
if( !visitInitializer( ((ICASTTypeIdInitializerExpression)expression).getInitializer(), action ) ) return false;
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArraySubscriptExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCastExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression;
|
||||
|
@ -24,6 +25,7 @@ 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;
|
||||
|
@ -37,6 +39,7 @@ import org.eclipse.cdt.core.dom.ast.IASTInitializerExpression;
|
|||
import org.eclipse.cdt.core.dom.ast.IASTInitializerList;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
|
||||
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.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
|
||||
|
@ -46,15 +49,12 @@ 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.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;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayDesignator;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayModifier;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTEnumerationSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTPointer;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTSimpleDeclSpecifier;
|
||||
|
@ -72,6 +72,7 @@ import org.eclipse.cdt.core.parser.ITokenDuple;
|
|||
import org.eclipse.cdt.core.parser.ParseError;
|
||||
import org.eclipse.cdt.core.parser.ParserMode;
|
||||
import org.eclipse.cdt.internal.core.parser.token.TokenFactory;
|
||||
import org.eclipse.cdt.internal.core.parser2.ASTNode;
|
||||
import org.eclipse.cdt.internal.core.parser2.AbstractGNUSourceCodeParser;
|
||||
import org.eclipse.cdt.internal.core.parser2.cpp.IProblemRequestor;
|
||||
|
||||
|
@ -132,7 +133,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
if (LT(1) == IToken.tLBRACE) {
|
||||
consume(IToken.tLBRACE).getOffset();
|
||||
IASTInitializerList result = createInitializerList();
|
||||
((CASTNode)result).setOffset( startingOffset );
|
||||
((ASTNode)result).setOffset( startingOffset );
|
||||
for (;;) {
|
||||
int checkHashcode = LA(1).hashCode();
|
||||
// required at least one initializer list
|
||||
|
@ -173,7 +174,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
IASTExpression assignmentExpression = assignmentExpression();
|
||||
IASTInitializerExpression result = createInitializerExpression();
|
||||
result.setExpression(assignmentExpression);
|
||||
((CASTNode)result).setOffset(((CASTNode)assignmentExpression).getOffset());
|
||||
((ASTNode)result).setOffset(((ASTNode)assignmentExpression).getOffset());
|
||||
assignmentExpression.setParent(result);
|
||||
assignmentExpression
|
||||
.setPropertyInParent(IASTInitializerExpression.INITIALIZER_EXPRESSION);
|
||||
|
@ -211,7 +212,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
int offset = consume(IToken.tDOT).getOffset();
|
||||
IToken id = identifier();
|
||||
ICASTFieldDesignator designator = createFieldDesignator();
|
||||
((CASTNode)designator).setOffset( offset );
|
||||
((ASTNode)designator).setOffset( offset );
|
||||
IASTName n = createName( id );
|
||||
designator.setName( n );
|
||||
n.setParent( designator );
|
||||
|
@ -226,7 +227,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
if (LT(1) == IToken.tRBRACKET) {
|
||||
consume(IToken.tRBRACKET);
|
||||
ICASTArrayDesignator designator = createArrayDesignator();
|
||||
((CASTNode)designator).setOffset( offset );
|
||||
((ASTNode)designator).setOffset( offset );
|
||||
designator.setSubscriptExpression( constantExpression );
|
||||
constantExpression.setParent( designator );
|
||||
constantExpression.setPropertyInParent( ICASTArrayDesignator.SUBSCRIPT_EXPRESSION );
|
||||
|
@ -243,7 +244,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
IASTExpression constantExpression2 = expression();
|
||||
consume(IToken.tRBRACKET);
|
||||
IGCCASTArrayRangeDesignator designator = createArrayRangeDesignator();
|
||||
((CASTNode)designator).setOffset( startOffset );
|
||||
((ASTNode)designator).setOffset( startOffset );
|
||||
designator.setRangeFloor( constantExpression1 );
|
||||
constantExpression1.setParent( designator );
|
||||
constantExpression1.setPropertyInParent( IGCCASTArrayRangeDesignator.SUBSCRIPT_FLOOR_EXPRESSION );
|
||||
|
@ -259,7 +260,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
IToken identifier = identifier();
|
||||
consume(IToken.tCOLON);
|
||||
ICASTFieldDesignator designator = createFieldDesignator();
|
||||
((CASTNode)designator).setOffset( identifier.getOffset() );
|
||||
((ASTNode)designator).setOffset( identifier.getOffset() );
|
||||
IASTName n = createName( identifier );
|
||||
designator.setName( n );
|
||||
n.setParent( designator );
|
||||
|
@ -277,7 +278,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
IToken identifier = identifier();
|
||||
consume(IToken.tCOLON);
|
||||
ICASTFieldDesignator designator = createFieldDesignator();
|
||||
((CASTNode)designator).setOffset( identifier.getOffset() );
|
||||
((ASTNode)designator).setOffset( identifier.getOffset() );
|
||||
IASTName n = createName( identifier );
|
||||
designator.setName( n );
|
||||
n.setParent( designator );
|
||||
|
@ -292,7 +293,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
IASTExpression constantExpression2 = expression();
|
||||
consume(IToken.tRBRACKET);
|
||||
IGCCASTArrayRangeDesignator designator = createArrayRangeDesignator();
|
||||
((CASTNode)designator).setOffset( startOffset );
|
||||
((ASTNode)designator).setOffset( startOffset );
|
||||
designator.setRangeFloor( constantExpression1 );
|
||||
constantExpression1.setParent( designator );
|
||||
constantExpression1.setPropertyInParent( IGCCASTArrayRangeDesignator.SUBSCRIPT_FLOOR_EXPRESSION );
|
||||
|
@ -409,7 +410,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
.getLineNumber(), fn);
|
||||
|
||||
IASTFunctionDefinition funcDefinition = createFunctionDefinition();
|
||||
((CASTNode)funcDefinition).setOffset(firstOffset);
|
||||
((ASTNode)funcDefinition).setOffset(firstOffset);
|
||||
funcDefinition.setDeclSpecifier(declSpec);
|
||||
declSpec.setParent(funcDefinition);
|
||||
declSpec.setPropertyInParent(IASTFunctionDefinition.DECL_SPECIFIER);
|
||||
|
@ -428,7 +429,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
}
|
||||
|
||||
IASTSimpleDeclaration simpleDeclaration = createSimpleDeclaration();
|
||||
((CASTNode)simpleDeclaration).setOffset(firstOffset);
|
||||
((ASTNode)simpleDeclaration).setOffset(firstOffset);
|
||||
simpleDeclaration.setDeclSpecifier(declSpec);
|
||||
declSpec.setParent(simpleDeclaration);
|
||||
declSpec.setPropertyInParent(IASTSimpleDeclaration.DECL_SPECIFIER);
|
||||
|
@ -670,42 +671,14 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
backup(mark);
|
||||
throwBacktrack(bte);
|
||||
}
|
||||
|
||||
|
||||
return buildTypeIdUnaryExpression( IASTUnaryTypeIdExpression.op_cast, typeId, castExpression, startingOffset );
|
||||
return buildTypeIdUnaryExpression( IASTCastExpression.op_cast, typeId, castExpression, startingOffset );
|
||||
} catch (BacktrackException b) {
|
||||
}
|
||||
}
|
||||
return unaryExpression();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param op
|
||||
* @param typeId
|
||||
* @param subExpression
|
||||
* @param startingOffset
|
||||
* @return
|
||||
*/
|
||||
protected IASTExpression buildTypeIdUnaryExpression(int op, IASTTypeId typeId, IASTExpression subExpression, int startingOffset) {
|
||||
IASTUnaryTypeIdExpression result = createUnaryTypeIdExpression();
|
||||
result.setOperator( op );
|
||||
((CASTNode)result).setOffset( startingOffset );
|
||||
result.setTypeId(typeId);
|
||||
typeId.setParent( result );
|
||||
typeId.setPropertyInParent( IASTUnaryTypeIdExpression.TYPE_ID );
|
||||
result.setOperand( subExpression );
|
||||
subExpression.setParent( result );
|
||||
subExpression.setPropertyInParent( IASTUnaryTypeIdExpression.OPERAND );
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
protected IASTUnaryTypeIdExpression createUnaryTypeIdExpression() {
|
||||
return new CASTUnaryTypeIdExpression();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param expression
|
||||
* @throws BacktrackException
|
||||
|
@ -777,7 +750,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
protected IASTExpression buildTypeIdExpression(int op_sizeof, IASTTypeId typeId, int startingOffset) {
|
||||
IASTTypeIdExpression result = createTypeIdExpression();
|
||||
result.setOperator( op_sizeof );
|
||||
((CASTNode)result).setOffset( startingOffset );
|
||||
((ASTNode)result).setOffset( startingOffset );
|
||||
result.setTypeId( typeId );
|
||||
typeId.setParent( result );
|
||||
typeId.setPropertyInParent( IASTTypeIdExpression.TYPE_ID );
|
||||
|
@ -831,7 +804,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
secondExpression = expression();
|
||||
consume(IToken.tRBRACKET);
|
||||
IASTArraySubscriptExpression s = createArraySubscriptExpression();
|
||||
((CASTNode)s).setOffset( ((CASTNode)firstExpression).getOffset() );
|
||||
((ASTNode)s).setOffset( ((ASTNode)firstExpression).getOffset() );
|
||||
s.setArrayExpression( firstExpression );
|
||||
firstExpression.setParent( s );
|
||||
firstExpression.setPropertyInParent( IASTArraySubscriptExpression.ARRAY );
|
||||
|
@ -847,7 +820,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
secondExpression = expression();
|
||||
consume(IToken.tRPAREN);
|
||||
IASTFunctionCallExpression f = createFunctionCallExpression();
|
||||
((CASTNode)f).setOffset( ((CASTNode)firstExpression).getOffset() );
|
||||
((ASTNode)f).setOffset( ((ASTNode)firstExpression).getOffset() );
|
||||
f.setFunctionNameExpression( firstExpression );
|
||||
firstExpression.setParent( f );
|
||||
firstExpression.setPropertyInParent( IASTFunctionCallExpression.FUNCTION_NAME );
|
||||
|
@ -873,7 +846,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
consume(IToken.tDOT);
|
||||
IASTName name = createName( identifier() );
|
||||
IASTFieldReference result = createFieldReference();
|
||||
((CASTNode)result).setOffset( ((CASTNode)firstExpression).getOffset() );
|
||||
((ASTNode)result).setOffset( ((ASTNode)firstExpression).getOffset() );
|
||||
result.setFieldOwner( firstExpression );
|
||||
result.setIsPointerDereference(false);
|
||||
firstExpression.setParent( result );
|
||||
|
@ -888,7 +861,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
consume(IToken.tARROW);
|
||||
name = createName( identifier() );
|
||||
result = createFieldReference();
|
||||
((CASTNode)result).setOffset( ((CASTNode)firstExpression).getOffset() );
|
||||
((ASTNode)result).setOffset( ((ASTNode)firstExpression).getOffset() );
|
||||
result.setFieldOwner( firstExpression );
|
||||
result.setIsPointerDereference(true);
|
||||
firstExpression.setParent( result );
|
||||
|
@ -926,7 +899,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
*/
|
||||
protected ICASTTypeIdInitializerExpression buildTypeIdInitializerExpression(IASTTypeId t, IASTInitializer i, int offset) {
|
||||
ICASTTypeIdInitializerExpression result = createTypeIdInitializerExpression();
|
||||
((CASTNode)result).setOffset( offset );
|
||||
((ASTNode)result).setOffset( offset );
|
||||
result.setTypeId( t );
|
||||
t.setParent( result );
|
||||
t.setPropertyInParent( ICASTTypeIdInitializerExpression.TYPE_ID );
|
||||
|
@ -965,14 +938,14 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
literalExpression = createLiteralExpression();
|
||||
literalExpression.setKind( IASTLiteralExpression.lk_integer_constant);
|
||||
literalExpression.setValue( t.getImage() );
|
||||
((CASTNode)literalExpression).setOffset( t.getOffset() );
|
||||
((ASTNode)literalExpression).setOffset( t.getOffset() );
|
||||
return literalExpression;
|
||||
case IToken.tFLOATINGPT:
|
||||
t = consume();
|
||||
literalExpression = createLiteralExpression();
|
||||
literalExpression.setKind( IASTLiteralExpression.lk_float_constant );
|
||||
literalExpression.setValue( t.getImage() );
|
||||
((CASTNode)literalExpression).setOffset( t.getOffset() );
|
||||
((ASTNode)literalExpression).setOffset( t.getOffset() );
|
||||
return literalExpression;
|
||||
case IToken.tSTRING:
|
||||
case IToken.tLSTRING:
|
||||
|
@ -980,7 +953,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
literalExpression = createLiteralExpression();
|
||||
literalExpression.setKind( IASTLiteralExpression.lk_string_literal );
|
||||
literalExpression.setValue( t.getImage() );
|
||||
((CASTNode)literalExpression).setOffset( t.getOffset() );
|
||||
((ASTNode)literalExpression).setOffset( t.getOffset() );
|
||||
return literalExpression;
|
||||
case IToken.tCHAR:
|
||||
case IToken.tLCHAR:
|
||||
|
@ -988,7 +961,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
literalExpression = createLiteralExpression();
|
||||
literalExpression.setKind( IASTLiteralExpression.lk_char_constant );
|
||||
literalExpression.setValue( t.getImage() );
|
||||
((CASTNode)literalExpression).setOffset( t.getOffset() );
|
||||
((ASTNode)literalExpression).setOffset( t.getOffset() );
|
||||
return literalExpression;
|
||||
case IToken.tLPAREN:
|
||||
t = consume();
|
||||
|
@ -1059,7 +1032,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
}
|
||||
|
||||
IASTTypeId result = createTypeId();
|
||||
((CASTNode)result).setOffset( startingOffset );
|
||||
((ASTNode)result).setOffset( startingOffset );
|
||||
|
||||
result.setDeclSpecifier( declSpecifier );
|
||||
declSpecifier.setParent( result );
|
||||
|
@ -1136,7 +1109,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
nameDuple.freeReferences();
|
||||
} else {
|
||||
po = createPointer();
|
||||
((CASTNode)po).setOffset( startOffset );
|
||||
((ASTNode)po).setOffset( startOffset );
|
||||
((ICASTPointer) po).setConst(isConst);
|
||||
((ICASTPointer) po).setVolatile(isVolatile);
|
||||
((ICASTPointer) po).setRestrict(isRestrict);
|
||||
|
@ -1164,9 +1137,9 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
boolean isShort = false, isLong = false, isUnsigned = false, isIdentifier = false, isSigned = false;
|
||||
int simpleType = IASTSimpleDeclSpecifier.t_unspecified;
|
||||
IToken identifier = null;
|
||||
ICASTCompositeTypeSpecifier structSpec = null;
|
||||
ICASTElaboratedTypeSpecifier elabSpec = null;
|
||||
ICASTEnumerationSpecifier enumSpec = null;
|
||||
IASTCompositeTypeSpecifier structSpec = null;
|
||||
IASTElaboratedTypeSpecifier elabSpec = null;
|
||||
IASTEnumerationSpecifier enumSpec = null;
|
||||
|
||||
declSpecifiers: for (;;) {
|
||||
switch (LT(1)) {
|
||||
|
@ -1331,9 +1304,9 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
|
||||
if( structSpec != null )
|
||||
{
|
||||
((CASTNode)structSpec).setOffset( startingOffset );
|
||||
((ASTNode)structSpec).setOffset( startingOffset );
|
||||
structSpec.setConst(isConst);
|
||||
structSpec.setRestrict(isRestrict);
|
||||
((ICASTCompositeTypeSpecifier)structSpec).setRestrict(isRestrict);
|
||||
structSpec.setVolatile(isVolatile);
|
||||
structSpec.setInline(isInline);
|
||||
structSpec.setStorageClass(storageClass);
|
||||
|
@ -1343,9 +1316,9 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
|
||||
if( enumSpec != null )
|
||||
{
|
||||
((CASTNode)enumSpec).setOffset( startingOffset );
|
||||
((ASTNode)enumSpec).setOffset( startingOffset );
|
||||
enumSpec.setConst(isConst);
|
||||
enumSpec.setRestrict(isRestrict);
|
||||
((CASTEnumerationSpecifier)enumSpec).setRestrict(isRestrict);
|
||||
enumSpec.setVolatile(isVolatile);
|
||||
enumSpec.setInline(isInline);
|
||||
enumSpec.setStorageClass(storageClass);
|
||||
|
@ -1354,9 +1327,9 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
}
|
||||
if( elabSpec != null )
|
||||
{
|
||||
((CASTNode)elabSpec).setOffset( startingOffset );
|
||||
((ASTNode)elabSpec).setOffset( startingOffset );
|
||||
elabSpec.setConst(isConst);
|
||||
elabSpec.setRestrict(isRestrict);
|
||||
((CASTElaboratedTypeSpecifier)elabSpec).setRestrict(isRestrict);
|
||||
elabSpec.setVolatile(isVolatile);
|
||||
elabSpec.setInline(isInline);
|
||||
elabSpec.setStorageClass(storageClass);
|
||||
|
@ -1371,7 +1344,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
declSpec.setInline(isInline);
|
||||
declSpec.setStorageClass(storageClass);
|
||||
|
||||
((CASTNode)declSpec).setOffset(startingOffset);
|
||||
((ASTNode)declSpec).setOffset(startingOffset);
|
||||
IASTName name = createName( identifier );
|
||||
declSpec.setName( name );
|
||||
name.setParent( declSpec );
|
||||
|
@ -1391,7 +1364,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
declSpec.setSigned(isSigned);
|
||||
declSpec.setShort(isShort);
|
||||
|
||||
((CASTNode)declSpec).setOffset(startingOffset);
|
||||
((ASTNode)declSpec).setOffset(startingOffset);
|
||||
return declSpec;
|
||||
}
|
||||
|
||||
|
@ -1469,7 +1442,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
ICASTCompositeTypeSpecifier result = createCompositeTypeSpecifier();
|
||||
|
||||
result.setKey( classKind );
|
||||
((CASTNode)result).setOffset( classKey.getOffset() );
|
||||
((ASTNode)result).setOffset( classKey.getOffset() );
|
||||
|
||||
result.setName( name );
|
||||
if( name != null )
|
||||
|
@ -1774,7 +1747,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
*/
|
||||
protected IASTName createName(IToken t) {
|
||||
IASTName n = new CASTName(t.getCharImage());
|
||||
((CASTNode)n).setOffset(t.getOffset());
|
||||
((ASTNode)n).setOffset(t.getOffset());
|
||||
return n;
|
||||
}
|
||||
|
||||
|
@ -1840,7 +1813,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
}
|
||||
arrayMod = temp;
|
||||
}
|
||||
((CASTNode)arrayMod).setOffset( startOffset );
|
||||
((ASTNode)arrayMod).setOffset( startOffset );
|
||||
if( exp != null )
|
||||
{
|
||||
arrayMod.setConstantExpression( exp );
|
||||
|
@ -1882,7 +1855,7 @@ public class GNUCSourceParser extends AbstractGNUSourceCodeParser {
|
|||
}
|
||||
|
||||
IASTParameterDeclaration result = createParameterDeclaration();
|
||||
((CASTNode)result).setOffset(startingOffset);
|
||||
((ASTNode)result).setOffset(startingOffset);
|
||||
result.setDeclSpecifier(declSpec);
|
||||
declSpec.setParent(result);
|
||||
declSpec.setPropertyInParent(IASTParameterDeclaration.DECL_SPECIFIER);
|
||||
|
|
|
@ -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 java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class CPPASTArrayDeclarator extends CPPASTDeclarator implements
|
||||
IASTArrayDeclarator {
|
||||
|
||||
private int currentIndex = 0;
|
||||
private void removeNullArrayModifiers() {
|
||||
int nullCount = 0;
|
||||
for( int i = 0; i < arrayMods.length; ++i )
|
||||
if( arrayMods[i] == null )
|
||||
++nullCount;
|
||||
if( nullCount == 0 ) return;
|
||||
IASTArrayModifier [] old = arrayMods;
|
||||
int newSize = old.length - nullCount;
|
||||
arrayMods = new IASTArrayModifier[ newSize ];
|
||||
for( int i = 0; i < newSize; ++i )
|
||||
arrayMods[i] = old[i];
|
||||
currentIndex = newSize;
|
||||
}
|
||||
|
||||
|
||||
private IASTArrayModifier [] arrayMods = null;
|
||||
private static final int DEFAULT_ARRAYMODS_LIST_SIZE = 4;
|
||||
|
||||
|
||||
public List getArrayModifiers() {
|
||||
if( arrayMods == null ) return Collections.EMPTY_LIST;
|
||||
removeNullArrayModifiers();
|
||||
return Arrays.asList( arrayMods );
|
||||
|
||||
}
|
||||
|
||||
public void addArrayModifier(IASTArrayModifier arrayModifier) {
|
||||
if( arrayMods == null )
|
||||
{
|
||||
arrayMods = new IASTArrayModifier[ DEFAULT_ARRAYMODS_LIST_SIZE ];
|
||||
currentIndex = 0;
|
||||
}
|
||||
if( arrayMods.length == currentIndex )
|
||||
{
|
||||
IASTArrayModifier [] old = arrayMods;
|
||||
arrayMods = new IASTArrayModifier[ old.length * 2 ];
|
||||
for( int i = 0; i < old.length; ++i )
|
||||
arrayMods[i] = old[i];
|
||||
}
|
||||
arrayMods[ currentIndex++ ] = arrayModifier;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/**********************************************************************
|
||||
* 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.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class CPPASTArrayModifier extends CPPASTNode implements
|
||||
IASTArrayModifier {
|
||||
|
||||
private IASTExpression exp;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTArrayModifier#getConstantExpression()
|
||||
*/
|
||||
public IASTExpression getConstantExpression() {
|
||||
return exp;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTArrayModifier#setConstantExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
||||
*/
|
||||
public void setConstantExpression(IASTExpression expression) {
|
||||
exp = expression;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTNode#getTranslationUnit()
|
||||
*/
|
||||
public IASTTranslationUnit getTranslationUnit() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTNode#getParent()
|
||||
*/
|
||||
public IASTNode getParent() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTNode#setParent(org.eclipse.cdt.core.dom.ast.IASTNode)
|
||||
*/
|
||||
public void setParent(IASTNode node) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTNode#getPropertyInParent()
|
||||
*/
|
||||
public ASTNodeProperty getPropertyInParent() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTNode#setPropertyInParent(org.eclipse.cdt.core.dom.ast.ASTNodeProperty)
|
||||
*/
|
||||
public void setPropertyInParent(ASTNodeProperty property) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
/**********************************************************************
|
||||
* 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.IASTStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class CPPASTCatchHandler extends CPPASTNode implements
|
||||
ICPPASTCatchHandler {
|
||||
|
||||
private boolean isCatchAll;
|
||||
private IASTStatement body;
|
||||
private IASTDeclaration declaration;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler#setIsCatchAll(boolean)
|
||||
*/
|
||||
public void setIsCatchAll(boolean isEllipsis) {
|
||||
isCatchAll = isEllipsis;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler#isCatchAll()
|
||||
*/
|
||||
public boolean isCatchAll() {
|
||||
return isCatchAll;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler#setCatchBody(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
||||
*/
|
||||
public void setCatchBody(IASTStatement compoundStatement) {
|
||||
body = compoundStatement;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler#getCatchBody()
|
||||
*/
|
||||
public IASTStatement getCatchBody() {
|
||||
return body;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler#setDeclaration(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
|
||||
*/
|
||||
public void setDeclaration(IASTDeclaration decl) {
|
||||
declaration = decl;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCatchHandler#getDeclaration()
|
||||
*/
|
||||
public IASTDeclaration getDeclaration() {
|
||||
return declaration;
|
||||
}
|
||||
|
||||
}
|
|
@ -45,7 +45,7 @@ public class CPPASTCompositeTypeSpecifier extends CPPASTBaseDeclSpecifier
|
|||
baseSpecs = new ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier[ DEFAULT_DECLARATIONS_LIST_SIZE ];
|
||||
currentIndex2 = 0;
|
||||
}
|
||||
if( declarations.length == currentIndex )
|
||||
if( baseSpecs.length == currentIndex )
|
||||
{
|
||||
ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier [] old = baseSpecs;
|
||||
baseSpecs = new ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier[ old.length * 2 ];
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/**********************************************************************
|
||||
* 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.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class CPPASTConstructorChainInitializer extends CPPASTNode implements
|
||||
ICPPASTConstructorChainInitializer {
|
||||
|
||||
private IASTName name;
|
||||
private IASTExpression value;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer#getMemberInitializerId()
|
||||
*/
|
||||
public IASTName getMemberInitializerId() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer#setMemberInitializerId(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||
*/
|
||||
public void setMemberInitializerId(IASTName name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer#getInitializerValue()
|
||||
*/
|
||||
public IASTExpression getInitializerValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer#setInitializerValue(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
||||
*/
|
||||
public void setInitializerValue(IASTExpression expression) {
|
||||
value = expression;
|
||||
}
|
||||
|
||||
}
|
|
@ -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.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorInitializer;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class CPPASTConstructorInitializer extends CPPASTNode implements
|
||||
ICPPASTConstructorInitializer {
|
||||
|
||||
private IASTExpression exp;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorInitializer#getExpression()
|
||||
*/
|
||||
public IASTExpression getExpression() {
|
||||
return exp;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorInitializer#setExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
||||
*/
|
||||
public void setExpression(IASTExpression expression) {
|
||||
this.exp = expression;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
/**********************************************************************
|
||||
* 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.IASTInitializer;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class CPPASTDeclarator extends CPPASTNode implements IASTDeclarator {
|
||||
private IASTInitializer initializer;
|
||||
private IASTName name;
|
||||
private IASTDeclarator nestedDeclarator;
|
||||
private IASTPointerOperator [] pointerOps = null;
|
||||
private static final int DEFAULT_PTROPS_LIST_SIZE = 4;
|
||||
private int currentIndex;
|
||||
|
||||
private void removeNullPointers() {
|
||||
int nullCount = 0;
|
||||
for( int i = 0; i < pointerOps.length; ++i )
|
||||
if( pointerOps[i] == null )
|
||||
++nullCount;
|
||||
if( nullCount == 0 ) return;
|
||||
IASTPointerOperator [] old = pointerOps;
|
||||
int newSize = old.length - nullCount;
|
||||
pointerOps = new IASTPointerOperator[ newSize ];
|
||||
for( int i = 0; i < newSize; ++i )
|
||||
pointerOps[i] = old[i];
|
||||
currentIndex = newSize;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#getPointerOperators()
|
||||
*/
|
||||
public List getPointerOperators() {
|
||||
if( pointerOps == null ) return Collections.EMPTY_LIST;
|
||||
removeNullPointers();
|
||||
return Arrays.asList( pointerOps );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#getNestedDeclarator()
|
||||
*/
|
||||
public IASTDeclarator getNestedDeclarator() {
|
||||
return nestedDeclarator;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#getName()
|
||||
*/
|
||||
public IASTName getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#getInitializer()
|
||||
*/
|
||||
public IASTInitializer getInitializer() {
|
||||
return initializer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param initializer
|
||||
*/
|
||||
public void setInitializer(IASTInitializer initializer) {
|
||||
this.initializer = initializer;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#addPointerOperator(org.eclipse.cdt.core.dom.ast.IASTPointerOperator)
|
||||
*/
|
||||
public void addPointerOperator(IASTPointerOperator operator) {
|
||||
if( pointerOps == null )
|
||||
{
|
||||
pointerOps = new IASTPointerOperator[ DEFAULT_PTROPS_LIST_SIZE ];
|
||||
currentIndex = 0;
|
||||
}
|
||||
if( pointerOps.length == currentIndex )
|
||||
{
|
||||
IASTPointerOperator [] old = pointerOps;
|
||||
pointerOps = new IASTPointerOperator[ old.length * 2 ];
|
||||
for( int i = 0; i < old.length; ++i )
|
||||
pointerOps[i] = old[i];
|
||||
}
|
||||
pointerOps[ currentIndex++ ] = operator; }
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#setNestedDeclarator(org.eclipse.cdt.core.dom.ast.IASTDeclarator)
|
||||
*/
|
||||
public void setNestedDeclarator(IASTDeclarator nested) {
|
||||
this.nestedDeclarator = nested;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTDeclarator#setName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||
*/
|
||||
public void setName(IASTName name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
|
@ -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.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeleteExpression;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class CPPASTDeleteExpression extends CPPASTNode implements
|
||||
ICPPASTDeleteExpression {
|
||||
|
||||
private IASTExpression operand;
|
||||
private boolean isGlobal;
|
||||
private boolean isVectored;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeleteExpression#getOperand()
|
||||
*/
|
||||
public IASTExpression getOperand() {
|
||||
return operand;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeleteExpression#setOperand(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
||||
*/
|
||||
public void setOperand(IASTExpression expression) {
|
||||
operand = expression;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeleteExpression#setIsGlobal(boolean)
|
||||
*/
|
||||
public void setIsGlobal(boolean global) {
|
||||
isGlobal = global;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeleteExpression#isGlobal()
|
||||
*/
|
||||
public boolean isGlobal() {
|
||||
return isGlobal;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeleteExpression#setIsVectored(boolean)
|
||||
*/
|
||||
public void setIsVectored(boolean vectored) {
|
||||
isVectored = vectored;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTDeleteExpression#isVectored()
|
||||
*/
|
||||
public boolean isVectored() {
|
||||
return isVectored;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,84 @@
|
|||
/**********************************************************************
|
||||
* 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.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFieldReference;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class CPPASTFieldReference extends CPPASTNode implements
|
||||
ICPPASTFieldReference {
|
||||
|
||||
private boolean isTemplate;
|
||||
private IASTExpression owner;
|
||||
private IASTName name;
|
||||
private boolean isDeref;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFieldReference#isTemplate()
|
||||
*/
|
||||
public boolean isTemplate() {
|
||||
return isTemplate;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFieldReference#setIsTemplate(boolean)
|
||||
*/
|
||||
public void setIsTemplate(boolean value) {
|
||||
isTemplate = value;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTFieldReference#getFieldOwner()
|
||||
*/
|
||||
public IASTExpression getFieldOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTFieldReference#setFieldOwner(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
||||
*/
|
||||
public void setFieldOwner(IASTExpression expression) {
|
||||
owner = expression;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTFieldReference#getFieldName()
|
||||
*/
|
||||
public IASTName getFieldName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTFieldReference#setFieldName(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||
*/
|
||||
public void setFieldName(IASTName name) {
|
||||
this.name =name;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTFieldReference#isPointerDereference()
|
||||
*/
|
||||
public boolean isPointerDereference() {
|
||||
return isDeref;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTFieldReference#setIsPointerDereference(boolean)
|
||||
*/
|
||||
public void setIsPointerDereference(boolean value) {
|
||||
isDeref = value;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,241 @@
|
|||
/**********************************************************************
|
||||
* 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.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class CPPASTFunctionDeclarator extends CPPASTDeclarator implements
|
||||
ICPPASTFunctionDeclarator {
|
||||
|
||||
private IASTParameterDeclaration [] parameters = null;
|
||||
private static final int DEFAULT_PARAMETERS_LIST_SIZE = 4;
|
||||
|
||||
private int currentIndex = 0;
|
||||
private boolean varArgs;
|
||||
private boolean pureVirtual;
|
||||
private boolean isVolatile;
|
||||
private boolean isConst;
|
||||
|
||||
/**
|
||||
* @param decls2
|
||||
*/
|
||||
private void removeNullParameters() {
|
||||
int nullCount = 0;
|
||||
for( int i = 0; i < parameters.length; ++i )
|
||||
if( parameters[i] == null )
|
||||
++nullCount;
|
||||
if( nullCount == 0 ) return;
|
||||
IASTParameterDeclaration [] old = parameters;
|
||||
int newSize = old.length - nullCount;
|
||||
parameters = new IASTParameterDeclaration[ newSize ];
|
||||
for( int i = 0; i < newSize; ++i )
|
||||
parameters[i] = old[i];
|
||||
currentIndex = newSize;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#getParameters()
|
||||
*/
|
||||
public List getParameters() {
|
||||
if( parameters == null ) return Collections.EMPTY_LIST;
|
||||
removeNullParameters();
|
||||
return Arrays.asList( parameters );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#addParameterDeclaration(org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration)
|
||||
*/
|
||||
public void addParameterDeclaration(IASTParameterDeclaration parameter) {
|
||||
if( parameters == null )
|
||||
{
|
||||
parameters = new IASTParameterDeclaration[ DEFAULT_PARAMETERS_LIST_SIZE ];
|
||||
currentIndex = 0;
|
||||
}
|
||||
if( parameters.length == currentIndex )
|
||||
{
|
||||
IASTParameterDeclaration [] old = parameters;
|
||||
parameters = new IASTParameterDeclaration[ old.length * 2 ];
|
||||
for( int i = 0; i < old.length; ++i )
|
||||
parameters[i] = old[i];
|
||||
}
|
||||
parameters[ currentIndex++ ] = parameter;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#takesVarArgs()
|
||||
*/
|
||||
public boolean takesVarArgs() {
|
||||
return varArgs;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator#setVarArgs(boolean)
|
||||
*/
|
||||
public void setVarArgs(boolean value) {
|
||||
varArgs = value;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#isConst()
|
||||
*/
|
||||
public boolean isConst() {
|
||||
return isConst;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#setConst(boolean)
|
||||
*/
|
||||
public void setConst(boolean value) {
|
||||
this.isConst = value;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#isVolatile()
|
||||
*/
|
||||
public boolean isVolatile() {
|
||||
return isVolatile;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#setVolatile(boolean)
|
||||
*/
|
||||
public void setVolatile(boolean value) {
|
||||
this.isVolatile = value;
|
||||
}
|
||||
|
||||
private int currentTypeIdIndex = 0;
|
||||
private IASTTypeId [] typeIds = null;
|
||||
private static final int DEFAULT_TYPEID_LIST_SIZE = 4;
|
||||
private void removeNullTypeIds() {
|
||||
int nullCount = 0;
|
||||
for( int i = 0; i < typeIds.length; ++i )
|
||||
if( typeIds[i] == null )
|
||||
++nullCount;
|
||||
if( nullCount == 0 ) return;
|
||||
IASTTypeId [] old = typeIds;
|
||||
int newSize = old.length - nullCount;
|
||||
typeIds = new IASTTypeId[ newSize ];
|
||||
for( int i = 0; i < newSize; ++i )
|
||||
typeIds[i] = old[i];
|
||||
currentTypeIdIndex = newSize;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#getExceptionSpecification()
|
||||
*/
|
||||
public List getExceptionSpecification() {
|
||||
if( typeIds == null ) return Collections.EMPTY_LIST;
|
||||
removeNullTypeIds();
|
||||
return Arrays.asList( typeIds );
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#addExceptionSpecificationTypeId(org.eclipse.cdt.core.dom.ast.IASTTypeId)
|
||||
*/
|
||||
public void addExceptionSpecificationTypeId(IASTTypeId typeId) {
|
||||
if( typeIds == null )
|
||||
{
|
||||
typeIds = new IASTTypeId[ DEFAULT_TYPEID_LIST_SIZE ];
|
||||
currentTypeIdIndex = 0;
|
||||
}
|
||||
if( typeIds.length == currentTypeIdIndex )
|
||||
{
|
||||
IASTTypeId [] old = typeIds;
|
||||
typeIds = new IASTTypeId[ old.length * 2 ];
|
||||
for( int i = 0; i < old.length; ++i )
|
||||
typeIds[i] = old[i];
|
||||
}
|
||||
typeIds[ currentTypeIdIndex++ ] = typeId;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#isPureVirtual()
|
||||
*/
|
||||
public boolean isPureVirtual() {
|
||||
return pureVirtual;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#setPureVirtual(boolean)
|
||||
*/
|
||||
public void setPureVirtual(boolean isPureVirtual) {
|
||||
this.pureVirtual = isPureVirtual;
|
||||
}
|
||||
|
||||
|
||||
private int currentConstructorChainIndex = 0;
|
||||
private ICPPASTConstructorChainInitializer [] constructorChain = null;
|
||||
private static final int DEFAULT_CONS_LIST_SIZE = 4;
|
||||
|
||||
private void removeNullConstructors() {
|
||||
int nullCount = 0;
|
||||
for( int i = 0; i < constructorChain.length; ++i )
|
||||
if( constructorChain[i] == null )
|
||||
++nullCount;
|
||||
if( nullCount == 0 ) return;
|
||||
ICPPASTConstructorChainInitializer [] old = constructorChain;
|
||||
int newSize = old.length - nullCount;
|
||||
constructorChain = new ICPPASTConstructorChainInitializer[ newSize ];
|
||||
for( int i = 0; i < newSize; ++i )
|
||||
constructorChain[i] = old[i];
|
||||
currentConstructorChainIndex = newSize;
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#getConstructorChain()
|
||||
*/
|
||||
public List getConstructorChain() {
|
||||
if( constructorChain == null ) return Collections.EMPTY_LIST;
|
||||
removeNullConstructors();
|
||||
return Arrays.asList( constructorChain );
|
||||
}
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator#addConstructorToChain(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer)
|
||||
*/
|
||||
public void addConstructorToChain(ICPPASTConstructorChainInitializer initializer) {
|
||||
if( constructorChain == null )
|
||||
{
|
||||
constructorChain = new ICPPASTConstructorChainInitializer[ DEFAULT_CONS_LIST_SIZE ];
|
||||
currentConstructorChainIndex = 0;
|
||||
}
|
||||
if( constructorChain.length == currentConstructorChainIndex )
|
||||
{
|
||||
ICPPASTConstructorChainInitializer [] old = constructorChain;
|
||||
constructorChain = new ICPPASTConstructorChainInitializer[ old.length * 2 ];
|
||||
for( int i = 0; i < old.length; ++i )
|
||||
constructorChain[i] = old[i];
|
||||
}
|
||||
constructorChain[ currentConstructorChainIndex++ ] = initializer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
/**********************************************************************
|
||||
* 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.IASTStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionTryBlockDeclarator;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class CPPASTFunctionTryBlockDeclarator extends CPPASTFunctionDeclarator
|
||||
implements ICPPASTFunctionTryBlockDeclarator {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionTryBlockDeclarator#addCatchHandler(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
||||
*/
|
||||
public void addCatchHandler(IASTStatement statement) {
|
||||
if( catchHandlers == null )
|
||||
{
|
||||
catchHandlers = new IASTStatement[ DEFAULT_CATCH_HANDLER_LIST_SIZE ];
|
||||
currentIndex = 0;
|
||||
}
|
||||
if( catchHandlers.length == currentIndex )
|
||||
{
|
||||
IASTStatement [] old = catchHandlers;
|
||||
catchHandlers = new IASTStatement[ old.length * 2 ];
|
||||
for( int i = 0; i < old.length; ++i )
|
||||
catchHandlers[i] = old[i];
|
||||
}
|
||||
catchHandlers[ currentIndex++ ] = statement; }
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionTryBlockDeclarator#getCatchHandlers()
|
||||
*/
|
||||
public List getCatchHandlers() {
|
||||
if( catchHandlers == null ) return Collections.EMPTY_LIST;
|
||||
removeNullCatchHandlers();
|
||||
return Arrays.asList( catchHandlers );
|
||||
}
|
||||
|
||||
private void removeNullCatchHandlers() {
|
||||
int nullCount = 0;
|
||||
for( int i = 0; i < catchHandlers.length; ++i )
|
||||
if( catchHandlers[i] == null )
|
||||
++nullCount;
|
||||
if( nullCount == 0 ) return;
|
||||
IASTStatement [] old = catchHandlers;
|
||||
int newSize = old.length - nullCount;
|
||||
catchHandlers = new IASTStatement[ newSize ];
|
||||
for( int i = 0; i < newSize; ++i )
|
||||
catchHandlers[i] = old[i];
|
||||
currentIndex = newSize;
|
||||
}
|
||||
|
||||
private int currentIndex = 0;
|
||||
private IASTStatement [] catchHandlers = null;
|
||||
private static final int DEFAULT_CATCH_HANDLER_LIST_SIZE = 4;
|
||||
|
||||
}
|
|
@ -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.internal.core.parser2.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTLiteralExpression;
|
||||
import org.eclipse.cdt.internal.core.parser2.c.CASTLiteralExpression;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class CPPASTLiteralExpression extends CASTLiteralExpression implements
|
||||
ICPPASTLiteralExpression {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,149 @@
|
|||
/**********************************************************************
|
||||
* 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.IASTTypeId;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class CPPASTNewExpression extends CPPASTNode implements
|
||||
ICPPASTNewExpression {
|
||||
|
||||
private boolean global;
|
||||
private IASTExpression placement;
|
||||
private IASTExpression initializer;
|
||||
private IASTTypeId typeId;
|
||||
private boolean isNewTypeId;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression#isGlobal()
|
||||
*/
|
||||
public boolean isGlobal() {
|
||||
return global;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression#setIsGlobal(boolean)
|
||||
*/
|
||||
public void setIsGlobal(boolean value) {
|
||||
global = value;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression#getNewPlacement()
|
||||
*/
|
||||
public IASTExpression getNewPlacement() {
|
||||
return placement;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression#setNewPlacement(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
||||
*/
|
||||
public void setNewPlacement(IASTExpression expression) {
|
||||
placement = expression;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression#getNewInitializer()
|
||||
*/
|
||||
public IASTExpression getNewInitializer() {
|
||||
return initializer;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression#setNewInitializer(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
||||
*/
|
||||
public void setNewInitializer(IASTExpression expression) {
|
||||
initializer = expression;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression#getTypeId()
|
||||
*/
|
||||
public IASTTypeId getTypeId() {
|
||||
return typeId;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression#setTypeId(org.eclipse.cdt.core.dom.ast.IASTTypeId)
|
||||
*/
|
||||
public void setTypeId(IASTTypeId typeId) {
|
||||
this.typeId = typeId;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression#isNewTypeId()
|
||||
*/
|
||||
public boolean isNewTypeId() {
|
||||
return isNewTypeId;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression#setIsNewTypeId(boolean)
|
||||
*/
|
||||
public void setIsNewTypeId(boolean value) {
|
||||
isNewTypeId = value;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression#getNewTypeIdArrayExpressions()
|
||||
*/
|
||||
public List getNewTypeIdArrayExpressions() {
|
||||
if( arrayExpressions == null ) return Collections.EMPTY_LIST;
|
||||
removeNullExpressions();
|
||||
return Arrays.asList( arrayExpressions );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNewExpression#addNewTypeIdArrayExpression(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
||||
*/
|
||||
public void addNewTypeIdArrayExpression(IASTExpression expression) {
|
||||
if( arrayExpressions == null )
|
||||
{
|
||||
arrayExpressions = new IASTExpression[ DEFAULT_ARRAY_EXPRESSIONS_LIST_SIZE ];
|
||||
currentIndex = 0;
|
||||
}
|
||||
if( arrayExpressions.length == currentIndex )
|
||||
{
|
||||
IASTExpression [] old = arrayExpressions;
|
||||
arrayExpressions = new IASTExpression[ old.length * 2 ];
|
||||
for( int i = 0; i < old.length; ++i )
|
||||
arrayExpressions[i] = old[i];
|
||||
}
|
||||
arrayExpressions[ currentIndex++ ] = expression;
|
||||
}
|
||||
|
||||
private void removeNullExpressions() {
|
||||
int nullCount = 0;
|
||||
for( int i = 0; i < arrayExpressions.length; ++i )
|
||||
if( arrayExpressions[i] == null )
|
||||
++nullCount;
|
||||
if( nullCount == 0 ) return;
|
||||
IASTExpression [] old = arrayExpressions;
|
||||
int newSize = old.length - nullCount;
|
||||
arrayExpressions = new IASTExpression[ newSize ];
|
||||
for( int i = 0; i < newSize; ++i )
|
||||
arrayExpressions[i] = old[i];
|
||||
currentIndex = newSize;
|
||||
}
|
||||
|
||||
private int currentIndex = 0;
|
||||
private IASTExpression [] arrayExpressions = null;
|
||||
private static final int DEFAULT_ARRAY_EXPRESSIONS_LIST_SIZE = 4;
|
||||
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/**********************************************************************
|
||||
* 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.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTParameterDeclaration;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class CPPASTParameterDeclaration extends CPPASTNode implements
|
||||
ICPPASTParameterDeclaration {
|
||||
|
||||
private IASTDeclSpecifier declSpec;
|
||||
private IASTDeclarator declarator;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration#getDeclSpecifier()
|
||||
*/
|
||||
public IASTDeclSpecifier getDeclSpecifier() {
|
||||
return declSpec;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration#getDeclarator()
|
||||
*/
|
||||
public IASTDeclarator getDeclarator() {
|
||||
return declarator;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration#setDeclSpecifier(org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier)
|
||||
*/
|
||||
public void setDeclSpecifier(IASTDeclSpecifier declSpec) {
|
||||
this.declSpec = declSpec;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration#setDeclarator(org.eclipse.cdt.core.dom.ast.IASTDeclarator)
|
||||
*/
|
||||
public void setDeclarator(IASTDeclarator declarator) {
|
||||
this.declarator = declarator;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/**********************************************************************
|
||||
* 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.IASTPointer;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class CPPASTPointer extends CPPASTNode implements IASTPointer {
|
||||
|
||||
private boolean isConst;
|
||||
private boolean isVolatile;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTPointer#isConst()
|
||||
*/
|
||||
public boolean isConst() {
|
||||
return isConst;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTPointer#isVolatile()
|
||||
*/
|
||||
public boolean isVolatile() {
|
||||
return isVolatile;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTPointer#setConst(boolean)
|
||||
*/
|
||||
public void setConst(boolean value) {
|
||||
isConst = value;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTPointer#setVolatile(boolean)
|
||||
*/
|
||||
public void setVolatile(boolean value) {
|
||||
isVolatile = value;
|
||||
}
|
||||
|
||||
}
|
|
@ -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.internal.core.parser2.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTReferenceOperator;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class CPPASTReferenceOperator extends CPPASTNode implements
|
||||
ICPPASTReferenceOperator {
|
||||
|
||||
}
|
|
@ -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.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeConstructorExpression;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class CPPASTSimpleTypeConstructorExpression extends CPPASTNode implements
|
||||
ICPPASTSimpleTypeConstructorExpression {
|
||||
|
||||
private int st;
|
||||
private IASTExpression init;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeConstructorExpression#getSimpleType()
|
||||
*/
|
||||
public int getSimpleType() {
|
||||
return st;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeConstructorExpression#setSimpleType(int)
|
||||
*/
|
||||
public void setSimpleType(int value) {
|
||||
st = value;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeConstructorExpression#getInitialValue()
|
||||
*/
|
||||
public IASTExpression getInitialValue() {
|
||||
return init;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeConstructorExpression#setInitialValue(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
||||
*/
|
||||
public void setInitialValue(IASTExpression expression) {
|
||||
init = expression;
|
||||
}
|
||||
|
||||
}
|
|
@ -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.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class CPPASTTypeId extends CPPASTNode implements IASTTypeId {
|
||||
|
||||
private IASTDeclSpecifier declSpec;
|
||||
private IASTDeclarator absDecl;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTTypeId#getDeclSpecifier()
|
||||
*/
|
||||
public IASTDeclSpecifier getDeclSpecifier() {
|
||||
return declSpec;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTTypeId#setDeclSpecifier(org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier)
|
||||
*/
|
||||
public void setDeclSpecifier(IASTDeclSpecifier declSpec) {
|
||||
this.declSpec = declSpec;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTTypeId#getAbstractDeclarator()
|
||||
*/
|
||||
public IASTDeclarator getAbstractDeclarator() {
|
||||
return absDecl;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.IASTTypeId#setAbstractDeclarator(org.eclipse.cdt.core.dom.ast.IASTDeclarator)
|
||||
*/
|
||||
public void setAbstractDeclarator(IASTDeclarator abstractDeclarator) {
|
||||
this.absDecl = abstractDeclarator;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
/**********************************************************************
|
||||
* 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.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypenameExpression;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class CPPASTTypenameExpression extends CPPASTNode implements
|
||||
ICPPASTTypenameExpression {
|
||||
|
||||
private boolean isTemplate;
|
||||
private IASTName name;
|
||||
private IASTExpression init;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypenameExpression#setIsTemplate(boolean)
|
||||
*/
|
||||
public void setIsTemplate(boolean templateTokenConsumed) {
|
||||
isTemplate = templateTokenConsumed;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypenameExpression#isTemplate()
|
||||
*/
|
||||
public boolean isTemplate() {
|
||||
return isTemplate;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypenameExpression#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.ICPPASTTypenameExpression#getName()
|
||||
*/
|
||||
public IASTName getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypenameExpression#setInitialValue(org.eclipse.cdt.core.dom.ast.IASTExpression)
|
||||
*/
|
||||
public void setInitialValue(IASTExpression expressionList) {
|
||||
init = expressionList;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTypenameExpression#getInitialValue()
|
||||
*/
|
||||
public IASTExpression getInitialValue() {
|
||||
return init;
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -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.internal.core.parser2.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTPointer;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public class GPPASTPointer extends CPPASTPointer implements IGPPASTPointer {
|
||||
|
||||
private boolean isRestrict;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTPointer#isRestrict()
|
||||
*/
|
||||
public boolean isRestrict() {
|
||||
return isRestrict;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.dom.ast.gnu.cpp.IGPPASTPointer#setRestrict(boolean)
|
||||
*/
|
||||
public void setRestrict(boolean value) {
|
||||
isRestrict = value;
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Reference in a new issue