diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTFunctionStyleMacroDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTFunctionStyleMacroDefinition.java new file mode 100644 index 00000000000..5863c8d69d3 --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTFunctionStyleMacroDefinition.java @@ -0,0 +1,20 @@ +/********************************************************************** + * Copyright (c) 2004 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * IBM - Initial API and implementation + **********************************************************************/ +package org.eclipse.cdt.core.dom.ast; + +/** + * @author jcamelon + */ +public interface IASTFunctionStyleMacroDefinition extends IASTMacroDefinition { + + public String [] getParameters(); + public void addParameter( String parm ); +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTMacroDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTMacroDefinition.java index b93b465b6df..7c33895fe22 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTMacroDefinition.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTMacroDefinition.java @@ -15,6 +15,12 @@ package org.eclipse.cdt.core.dom.ast; * * @author Doug Schaefer */ -public interface IASTMacroDefinition { +public interface IASTMacroDefinition extends IASTNode { + public static final ASTNodeProperty MACRO_NAME = new ASTNodeProperty( "Macro Name"); //$NON-NLS-1$ + public IASTName getName(); + public void setName( IASTName name ); + + public String getExpansion(); + public void setExpansion( String exp ); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTMacroExpansion.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTMacroExpansion.java index bab822bd09f..9e105d8583f 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTMacroExpansion.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTMacroExpansion.java @@ -13,7 +13,7 @@ package org.eclipse.cdt.core.dom.ast; /** * @author Doug Schaefer */ -public interface IASTMacroExpansion { +public interface IASTMacroExpansion extends IASTNodeLocation { /** * The macro definition used for the expansion @@ -23,11 +23,11 @@ public interface IASTMacroExpansion { public IASTMacroDefinition getMacroDefinition(); /** - * The source location for for the macro expansion. This is the location - * in the original source that expansion occured and was replaced. + * The source locations for for the macro expansion. These are the locations + * where the expansion in question occured and was replaced. * * @return */ - public IASTNodeLocation getExpansionLocation(); + public IASTNodeLocation[] getExpansionLocations(); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTNode.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTNode.java index d4c83b84c46..bc3e68d66db 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTNode.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTNode.java @@ -19,6 +19,7 @@ package org.eclipse.cdt.core.dom.ast; public interface IASTNode { public IASTTranslationUnit getTranslationUnit(); + public IASTNodeLocation[] getNodeLocations(); /** * Get the parent node of this node in the tree. diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTObjectStyleMacroDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTObjectStyleMacroDefinition.java new file mode 100644 index 00000000000..71270b4755e --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTObjectStyleMacroDefinition.java @@ -0,0 +1,18 @@ +/********************************************************************** + * 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; + +/** + * @author jcamelon + */ +public interface IASTObjectStyleMacroDefinition extends IASTMacroDefinition { + +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTranslationUnit.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTranslationUnit.java index aacd72b0111..c7399ec9a0c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTranslationUnit.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/IASTTranslationUnit.java @@ -56,4 +56,9 @@ public interface IASTTranslationUnit extends IASTNode { */ public List getReferences(IBinding binding); + public IASTNodeLocation getLocationInfo( int offset ); + public IASTNodeLocation [] getLocationInfo( int offset, int length ); + + public IASTNode getNodeForLocation( IASTNodeLocation location ); + } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/ASTNode.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/ASTNode.java index 57e901b587a..580a92046fd 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/ASTNode.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/ASTNode.java @@ -9,10 +9,13 @@ * IBM Rational Software - Initial API and implementation */ package org.eclipse.cdt.internal.core.parser2; +import org.eclipse.cdt.core.dom.ast.IASTNode; +import org.eclipse.cdt.core.dom.ast.IASTNodeLocation; + /** * @author jcamelon */ -public class ASTNode { +public abstract class ASTNode implements IASTNode { private int length; private int offset; @@ -33,4 +36,10 @@ public class ASTNode { this.length = length; } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTNode#getNodeLocations() + */ + public IASTNodeLocation[] getNodeLocations() { + return getTranslationUnit().getLocationInfo( offset, length ); + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/c/CASTTranslationUnit.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/c/CASTTranslationUnit.java index cb36faca91d..57a0b357224 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/c/CASTTranslationUnit.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/c/CASTTranslationUnit.java @@ -12,6 +12,8 @@ package org.eclipse.cdt.internal.core.parser2.c; import java.util.List; import org.eclipse.cdt.core.dom.ast.IASTDeclaration; +import org.eclipse.cdt.core.dom.ast.IASTNode; +import org.eclipse.cdt.core.dom.ast.IASTNodeLocation; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IScope; @@ -97,4 +99,31 @@ public class CASTTranslationUnit extends CASTNode implements IASTTranslationUnit // TODO Auto-generated method stub return null; } + + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getLocationInfo(int) + */ + public IASTNodeLocation getLocationInfo(int offset) { + // TODO Auto-generated method stub + return null; + } + + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getLocationInfo(int, int) + */ + public IASTNodeLocation[] getLocationInfo(int offset, int length) { + // TODO Auto-generated method stub + return null; + } + + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getNodeForLocation(org.eclipse.cdt.core.dom.ast.IASTNodeLocation) + */ + public IASTNode getNodeForLocation(IASTNodeLocation location) { + // TODO Auto-generated method stub + return null; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTTranslationUnit.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTTranslationUnit.java index a03cba4e8d3..c9e6501d9d1 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTTranslationUnit.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser2/cpp/CPPASTTranslationUnit.java @@ -13,6 +13,8 @@ package org.eclipse.cdt.internal.core.parser2.cpp; import java.util.List; import org.eclipse.cdt.core.dom.ast.IASTDeclaration; +import org.eclipse.cdt.core.dom.ast.IASTNode; +import org.eclipse.cdt.core.dom.ast.IASTNodeLocation; import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; import org.eclipse.cdt.core.dom.ast.IBinding; import org.eclipse.cdt.core.dom.ast.IScope; @@ -98,4 +100,29 @@ public class CPPASTTranslationUnit extends CPPASTNode implements } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getLocationInfo(int) + */ + public IASTNodeLocation getLocationInfo(int offset) { + // TODO Auto-generated method stub + return null; + } + + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getLocationInfo(int, int) + */ + public IASTNodeLocation[] getLocationInfo(int offset, int length) { + // TODO Auto-generated method stub + return null; + } + + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getNodeForLocation(org.eclipse.cdt.core.dom.ast.IASTNodeLocation) + */ + public IASTNode getNodeForLocation(IASTNodeLocation location) { + // TODO Auto-generated method stub + return null; + } }