1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Add JavaDoc.

Formatted public interfaces.
Restructured some public interfaces.
This commit is contained in:
John Camelon 2005-03-11 19:51:49 +00:00
parent 39ca877911
commit 834e06e8fc
87 changed files with 2610 additions and 1704 deletions

View file

@ -124,12 +124,12 @@ public class AST2BaseTest extends TestCase {
if( lang == ParserLanguage.C && expectNoProblems ) if( lang == ParserLanguage.C && expectNoProblems )
{ {
assertEquals( CVisitor.getProblems(tu).length, 0 ); assertEquals( CVisitor.getProblems(tu).length, 0 );
assertEquals( tu.getPreprocesorProblems().length, 0 ); assertEquals( tu.getPreprocessorProblems().length, 0 );
} }
else if ( lang == ParserLanguage.CPP && expectNoProblems ) else if ( lang == ParserLanguage.CPP && expectNoProblems )
{ {
assertEquals( CPPVisitor.getProblems(tu).length, 0 ); assertEquals( CPPVisitor.getProblems(tu).length, 0 );
assertEquals( tu.getPreprocesorProblems().length, 0 ); assertEquals( tu.getPreprocessorProblems().length, 0 );
} }
return tu; return tu;

View file

@ -14,33 +14,32 @@ import org.eclipse.cdt.core.parser.CodeReader;
/** /**
* This is the interface that an AST Service uses to delegate the construction * This is the interface that an AST Service uses to delegate the construction
* of a CodeReader. * of a CodeReader.
* *
* @author jcamelon * @author jcamelon
*/ */
public interface ICodeReaderFactory { public interface ICodeReaderFactory {
/** /**
* @return unique identifier as int * @return unique identifier as int
*/ */
public int getUniqueIdentifier(); public int getUniqueIdentifier();
/**
/** * Create CodeReader for translation unit
* Create CodeReader for translation unit *
* * @param path
* @param path Canonical Path representing path location for file to be opened * Canonical Path representing path location for file to be
* @return CodeReader for contents at that path. * opened
*/ * @return CodeReader for contents at that path.
public CodeReader createCodeReaderForTranslationUnit( String path ); */
public CodeReader createCodeReaderForTranslationUnit(String path);
/** /**
* Create CodeReader for inclusion. * Create CodeReader for inclusion.
* *
* @param path * @param path
* @return CodeReader for contents at that path. * @return CodeReader for contents at that path.
*/ */
public CodeReader createCodeReaderForInclusion( String path ); public CodeReader createCodeReaderForInclusion(String path);
} }

View file

@ -13,22 +13,23 @@ package org.eclipse.cdt.core.dom;
import org.eclipse.cdt.core.parser.IScannerInfo; import org.eclipse.cdt.core.parser.IScannerInfo;
/** /**
* This interface represents a parser configuration as specified by the * This interface represents a parser configuration as specified by the client
* client to the parser service. * to the parser service.
* *
* @author jcamelon * @author jcamelon
*/ */
public interface IParserConfiguration { public interface IParserConfiguration {
/** /**
* @return IScannerInfo representing the build information required to parse. * @return IScannerInfo representing the build information required to
*/ * parse.
public IScannerInfo getScannerInfo(); */
public IScannerInfo getScannerInfo();
//TODO this may change
/** // TODO this may change
* @return String representing dialect name for the language /**
*/ * @return String representing dialect name for the language
public String getParserDialect(); */
public String getParserDialect();
} }

View file

@ -13,27 +13,29 @@ import java.util.List;
import org.eclipse.cdt.core.parser.IToken; import org.eclipse.cdt.core.parser.IToken;
/** /**
* This class represents the node that would occur at the point of * This class represents the node that would occur at the point of a context
* a context completion. * completion.
* *
* This node may contain the prefix text of an identifer up to the point. * This node may contain the prefix text of an identifer up to the point. If
* If there is no prefix, the completion occurred at the point where a * there is no prefix, the completion occurred at the point where a new token
* new token would have begun. * would have begun.
* *
* The node points to the parent node where this node, if replaced by * The node points to the parent node where this node, if replaced by a proper
* a proper node, would reside in the tree. * node, would reside in the tree.
* *
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public class ASTCompletionNode { public class ASTCompletionNode {
private IToken completionToken; private IToken completionToken;
private List names = new ArrayList(); private List names = new ArrayList();
/** /**
* Only constructor. * Only constructor.
* *
* @param completionToken - the completion token * @param completionToken -
* the completion token
*/ */
public ASTCompletionNode(IToken completionToken) { public ASTCompletionNode(IToken completionToken) {
this.completionToken = completionToken; this.completionToken = completionToken;
@ -47,10 +49,10 @@ public class ASTCompletionNode {
public void addName(IASTName name) { public void addName(IASTName name) {
names.add(name); names.add(name);
} }
/** /**
* If the point of completion was at the end of a potential * If the point of completion was at the end of a potential identifier, this
* identifier, this string contains the text of that identifier. * string contains the text of that identifier.
* *
* @return the prefix text up to the point of completion * @return the prefix text up to the point of completion
*/ */
@ -66,15 +68,14 @@ public class ASTCompletionNode {
public int getLength() { public int getLength() {
return completionToken.getLength(); return completionToken.getLength();
} }
/** /**
* Get a list of names that fit in this context. * Get a list of names that fit in this context.
* *
* @return array of IASTName's * @return array of IASTName's
*/ */
public IASTName[] getNames() { public IASTName[] getNames() {
return (IASTName[])names.toArray(new IASTName[names.size()]); return (IASTName[]) names.toArray(new IASTName[names.size()]);
} }
} }

View file

@ -11,10 +11,10 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This interface represents a structural property in an IASTNode. * This interface represents a structural property in an IASTNode. This is used
* This is used to determine the relationship between a child node and * to determine the relationship between a child node and it's parent. This is
* it's parent. This is especially important with rewrite since we need * especially important with rewrite since we need to understand how to properly
* to understand how to properly replace the child in the source. * replace the child in the source.
* *
* @author Doug Schaefer * @author Doug Schaefer
*/ */
@ -22,30 +22,29 @@ public class ASTNodeProperty {
private String name; private String name;
/** /**
* @param n name * @param n
*/ * name
public ASTNodeProperty(String n) { */
this.name = n; public ASTNodeProperty(String n) {
} this.name = n;
}
/**
/** * Each property has a name to help distinguish it from other properties of
* Each property has a name to help distinguish it from other * a node.
* properties of a node.
* *
* @return the name of the property * @return the name of the property
*/ */
public String getName() public String getName() {
{ return name;
return name; }
/**
* @param name
* The name to set.
*/
public void setName(String name) {
this.name = name;
} }
/**
* @param name The name to set.
*/
public void setName(String name) {
this.name = name;
}
} }

View file

@ -38,22 +38,27 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVisitor;
*/ */
public class ASTUtil { public class ASTUtil {
private static final String COMMA_SPACE = ", "; //$NON-NLS-1$ private static final String COMMA_SPACE = ", "; //$NON-NLS-1$
private static final String EMPTY_STRING = ""; //$NON-NLS-1$ private static final String EMPTY_STRING = ""; //$NON-NLS-1$
private static final String SPACE = " "; //$NON-NLS-1$ private static final String SPACE = " "; //$NON-NLS-1$
private static final String[] EMPTY_STRING_ARRAY = new String[0]; private static final String[] EMPTY_STRING_ARRAY = new String[0];
private static final int DEAULT_ITYPE_SIZE = 2; private static final int DEAULT_ITYPE_SIZE = 2;
public static String getParameterTypeString(IFunctionType type) { public static String getParameterTypeString(IFunctionType type) {
StringBuffer result = new StringBuffer(); StringBuffer result = new StringBuffer();
String[] parms = getParameterTypeStringArray(type); String[] parms = getParameterTypeStringArray(type);
result.append(Keywords.cpLPAREN); result.append(Keywords.cpLPAREN);
for(int i=0; i<parms.length; i++) { for (int i = 0; i < parms.length; i++) {
if (parms[i] != null) { if (parms[i] != null) {
result.append(parms[i]); result.append(parms[i]);
if (i<parms.length-1) result.append(COMMA_SPACE); if (i < parms.length - 1)
result.append(COMMA_SPACE);
} }
} }
result.append(Keywords.cpRPAREN); result.append(Keywords.cpRPAREN);
@ -64,239 +69,367 @@ public class ASTUtil {
IType[] parms = null; IType[] parms = null;
try { try {
parms = type.getParameterTypes(); parms = type.getParameterTypes();
} catch (DOMException e) { return EMPTY_STRING_ARRAY; } } catch (DOMException e) {
return EMPTY_STRING_ARRAY;
}
String[] result = new String[parms.length]; String[] result = new String[parms.length];
for(int i=0; i<parms.length; i++) { for (int i = 0; i < parms.length; i++) {
if (parms[i] != null) { if (parms[i] != null) {
result[i] = getType(parms[i]); result[i] = getType(parms[i]);
} }
} }
return result; return result;
} }
private static String getTypeString(IType type) { private static String getTypeString(IType type) {
StringBuffer result = new StringBuffer(); StringBuffer result = new StringBuffer();
boolean needSpace = false; boolean needSpace = false;
if (type instanceof IArrayType) { if (type instanceof IArrayType) {
result.append(Keywords.cpLBRACKET); result.append(Keywords.cpLBRACKET);
if (type instanceof ICArrayType) { if (type instanceof ICArrayType) {
try { try {
if (((ICArrayType)type).isConst()) { result.append(Keywords.CONST); needSpace=true; } if (((ICArrayType) type).isConst()) {
if (((ICArrayType)type).isRestrict()) { if (needSpace) { result.append(SPACE); needSpace=false; } result.append(Keywords.RESTRICT); needSpace=true; } result.append(Keywords.CONST);
if (((ICArrayType)type).isStatic()) { if (needSpace) { result.append(SPACE); needSpace=false; } result.append(Keywords.STATIC); needSpace=true; } needSpace = true;
if (((ICArrayType)type).isVolatile()) { if (needSpace) { result.append(SPACE); needSpace=false; } result.append(Keywords.VOLATILE); } }
} catch (DOMException e) {} if (((ICArrayType) type).isRestrict()) {
if (needSpace) {
result.append(SPACE);
needSpace = false;
}
result.append(Keywords.RESTRICT);
needSpace = true;
}
if (((ICArrayType) type).isStatic()) {
if (needSpace) {
result.append(SPACE);
needSpace = false;
}
result.append(Keywords.STATIC);
needSpace = true;
}
if (((ICArrayType) type).isVolatile()) {
if (needSpace) {
result.append(SPACE);
needSpace = false;
}
result.append(Keywords.VOLATILE);
}
} catch (DOMException e) {
}
} }
result.append(Keywords.cpRBRACKET); result.append(Keywords.cpRBRACKET);
} else if (type instanceof IBasicType) { } else if (type instanceof IBasicType) {
try { try {
if (((IBasicType)type).isSigned()) { result.append(Keywords.SIGNED); needSpace = true; } if (((IBasicType) type).isSigned()) {
else if (((IBasicType)type).isUnsigned()) { if (needSpace) { result.append(SPACE); needSpace=false; } result.append(Keywords.UNSIGNED); needSpace=true; } result.append(Keywords.SIGNED);
if (((IBasicType)type).isLong()) { if (needSpace) { result.append(SPACE); needSpace=false; } result.append(Keywords.LONG); needSpace = true; } needSpace = true;
else if (((IBasicType)type).isShort()) { if (needSpace) { result.append(SPACE); needSpace=false; }result.append(Keywords.SHORT); needSpace = true; } } else if (((IBasicType) type).isUnsigned()) {
} catch (DOMException e) {} if (needSpace) {
result.append(SPACE);
needSpace = false;
}
result.append(Keywords.UNSIGNED);
needSpace = true;
}
if (((IBasicType) type).isLong()) {
if (needSpace) {
result.append(SPACE);
needSpace = false;
}
result.append(Keywords.LONG);
needSpace = true;
} else if (((IBasicType) type).isShort()) {
if (needSpace) {
result.append(SPACE);
needSpace = false;
}
result.append(Keywords.SHORT);
needSpace = true;
}
} catch (DOMException e) {
}
if (type instanceof IGPPBasicType) { if (type instanceof IGPPBasicType) {
try { try {
if (((IGPPBasicType)type).isLongLong()) { if (needSpace) { result.append(SPACE); needSpace=false; } result.append(Keywords.LONG_LONG); needSpace=true; } if (((IGPPBasicType) type).isLongLong()) {
if (needSpace) {
switch (((IGPPBasicType)type).getType()) { result.append(SPACE);
case IGPPBasicType.t_Complex: needSpace = false;
result.append(Keywords.c_COMPLEX); }
break; result.append(Keywords.LONG_LONG);
case IGPPBasicType.t_Imaginary: needSpace = true;
result.append(Keywords.c_IMAGINARY);
break;
case IGPPBasicType.t_typeof:
result.append(GCCKeywords.TYPEOF);
break;
} }
} catch (DOMException e) {}
switch (((IGPPBasicType) type).getType()) {
case IGPPBasicType.t_Complex:
result.append(Keywords.c_COMPLEX);
break;
case IGPPBasicType.t_Imaginary:
result.append(Keywords.c_IMAGINARY);
break;
case IGPPBasicType.t_typeof:
result.append(GCCKeywords.TYPEOF);
break;
}
} catch (DOMException e) {
}
} else if (type instanceof ICPPBasicType) { } else if (type instanceof ICPPBasicType) {
try { try {
switch (((ICPPBasicType)type).getType()) { switch (((ICPPBasicType) type).getType()) {
case ICPPBasicType.t_bool: case ICPPBasicType.t_bool:
result.append(Keywords.BOOL); result.append(Keywords.BOOL);
break; break;
case ICPPBasicType.t_wchar_t: case ICPPBasicType.t_wchar_t:
result.append(Keywords.WCHAR_T); result.append(Keywords.WCHAR_T);
break; break;
} }
} catch (DOMException e) {} } catch (DOMException e) {
}
} else if (type instanceof ICBasicType) { } else if (type instanceof ICBasicType) {
try { try {
switch (((ICBasicType)type).getType()) { switch (((ICBasicType) type).getType()) {
case ICBasicType.t_Bool: case ICBasicType.t_Bool:
result.append(Keywords.c_BOOL); result.append(Keywords.c_BOOL);
break; break;
case ICBasicType.t_Complex: case ICBasicType.t_Complex:
result.append(Keywords.c_COMPLEX); result.append(Keywords.c_COMPLEX);
break; break;
case ICBasicType.t_Imaginary: case ICBasicType.t_Imaginary:
result.append(Keywords.c_IMAGINARY); result.append(Keywords.c_IMAGINARY);
break; break;
} }
} catch (DOMException e) {} } catch (DOMException e) {
}
try {
switch (((IBasicType)type).getType()) {
case IBasicType.t_char:
result.append(Keywords.CHAR);
break;
case IBasicType.t_double:
result.append(Keywords.DOUBLE);
break;
case IBasicType.t_float:
result.append(Keywords.FLOAT);
break;
case IBasicType.t_int:
result.append(Keywords.INT);
break;
case IBasicType.t_void:
result.append(Keywords.VOID);
break;
} }
} catch (DOMException e) {} }
try {
switch (((IBasicType) type).getType()) {
case IBasicType.t_char:
result.append(Keywords.CHAR);
break;
case IBasicType.t_double:
result.append(Keywords.DOUBLE);
break;
case IBasicType.t_float:
result.append(Keywords.FLOAT);
break;
case IBasicType.t_int:
result.append(Keywords.INT);
break;
case IBasicType.t_void:
result.append(Keywords.VOID);
break;
}
} catch (DOMException e) {
}
} else if (type instanceof ICompositeType) { } else if (type instanceof ICompositeType) {
if (type instanceof ICPPClassType) { if (type instanceof ICPPClassType) {
try { try {
switch(((ICPPClassType)type).getKey()) { switch (((ICPPClassType) type).getKey()) {
case ICPPClassType.k_class: case ICPPClassType.k_class:
result.append(Keywords.CLASS); result.append(Keywords.CLASS);
break; break;
} }
} catch (DOMException e) {} } catch (DOMException e) {
}
try {
switch(((ICompositeType)type).getKey()) {
case ICompositeType.k_struct:
result.append(Keywords.STRUCT);
break;
case ICompositeType.k_union:
result.append(Keywords.UNION);
break;
} }
} catch (DOMException e) {} }
try {
switch (((ICompositeType) type).getKey()) {
case ICompositeType.k_struct:
result.append(Keywords.STRUCT);
break;
case ICompositeType.k_union:
result.append(Keywords.UNION);
break;
}
} catch (DOMException e) {
}
} else if (type instanceof ICPPReferenceType) { } else if (type instanceof ICPPReferenceType) {
result.append(Keywords.cpAMPER); result.append(Keywords.cpAMPER);
} else if (type instanceof ICPPTemplateTypeParameter) { } else if (type instanceof ICPPTemplateTypeParameter) {
try { try {
result.append(getType(((ICPPTemplateTypeParameter)type).getDefault())); result.append(getType(((ICPPTemplateTypeParameter) type)
} catch (DOMException e) {} .getDefault()));
} catch (DOMException e) {
}
} else if (type instanceof IEnumeration) { } else if (type instanceof IEnumeration) {
result.append(Keywords.ENUM); result.append(Keywords.ENUM);
} else if (type instanceof IFunctionType) { } else if (type instanceof IFunctionType) {
try { try {
String temp = getType(((IFunctionType)type).getReturnType()); String temp = getType(((IFunctionType) type).getReturnType());
if (temp != null && !temp.equals(EMPTY_STRING)) { result.append(temp); needSpace=true; } if (temp != null && !temp.equals(EMPTY_STRING)) {
if (needSpace) { result.append(SPACE); needSpace=false; } result.append(temp);
temp = getParameterTypeString((IFunctionType)type); needSpace = true;
if (temp != null && !temp.equals(EMPTY_STRING)) { result.append(temp); needSpace=false; } }
} catch (DOMException e) {} if (needSpace) {
result.append(SPACE);
needSpace = false;
}
temp = getParameterTypeString((IFunctionType) type);
if (temp != null && !temp.equals(EMPTY_STRING)) {
result.append(temp);
needSpace = false;
}
} catch (DOMException e) {
}
} else if (type instanceof IPointerType) { } else if (type instanceof IPointerType) {
result.append(Keywords.cpSTAR); needSpace=true; result.append(Keywords.cpSTAR);
needSpace = true;
if (type instanceof IGPPPointerType) { if (type instanceof IGPPPointerType) {
if (((IGPPPointerType)type).isRestrict()) { if (needSpace) { result.append(SPACE); needSpace=false; } result.append(Keywords.RESTRICT); needSpace=true; } if (((IGPPPointerType) type).isRestrict()) {
if (needSpace) {
result.append(SPACE);
needSpace = false;
}
result.append(Keywords.RESTRICT);
needSpace = true;
}
} else if (type instanceof ICPointerType) { } else if (type instanceof ICPointerType) {
if (((ICPointerType)type).isRestrict()) { if (needSpace) { result.append(SPACE); needSpace=false; } result.append(Keywords.RESTRICT); needSpace=true; } if (((ICPointerType) type).isRestrict()) {
if (needSpace) {
result.append(SPACE);
needSpace = false;
}
result.append(Keywords.RESTRICT);
needSpace = true;
}
} }
try { try {
if (((IPointerType)type).isConst()) { if (needSpace) { result.append(SPACE); needSpace=false; } result.append(Keywords.CONST); needSpace=true; } if (((IPointerType) type).isConst()) {
if (((IPointerType)type).isVolatile()) { if (needSpace) { result.append(SPACE); needSpace=false; } result.append(Keywords.VOLATILE); needSpace=true; } if (needSpace) {
} catch (DOMException e) {} result.append(SPACE);
needSpace = false;
}
result.append(Keywords.CONST);
needSpace = true;
}
if (((IPointerType) type).isVolatile()) {
if (needSpace) {
result.append(SPACE);
needSpace = false;
}
result.append(Keywords.VOLATILE);
needSpace = true;
}
} catch (DOMException e) {
}
} else if (type instanceof IQualifierType) { } else if (type instanceof IQualifierType) {
if (type instanceof ICQualifierType) { if (type instanceof ICQualifierType) {
if (((ICQualifierType)type).isRestrict()) { result.append(Keywords.RESTRICT); needSpace=true; } if (((ICQualifierType) type).isRestrict()) {
result.append(Keywords.RESTRICT);
needSpace = true;
}
} else if (type instanceof IGPPQualifierType) { } else if (type instanceof IGPPQualifierType) {
if (((IGPPQualifierType)type).isRestrict()) { result.append(Keywords.RESTRICT); needSpace=true; } if (((IGPPQualifierType) type).isRestrict()) {
result.append(Keywords.RESTRICT);
needSpace = true;
}
} }
try { try {
if (((IQualifierType)type).isConst()) { if (needSpace) { result.append(SPACE); needSpace=false; } result.append(Keywords.CONST); needSpace=true; } if (((IQualifierType) type).isConst()) {
if (((IQualifierType)type).isVolatile()) { if (needSpace) { result.append(SPACE); needSpace=false; } result.append(Keywords.VOLATILE); needSpace=true; } if (needSpace) {
} catch (DOMException e) {} result.append(SPACE);
needSpace = false;
}
result.append(Keywords.CONST);
needSpace = true;
}
if (((IQualifierType) type).isVolatile()) {
if (needSpace) {
result.append(SPACE);
needSpace = false;
}
result.append(Keywords.VOLATILE);
needSpace = true;
}
} catch (DOMException e) {
}
} }
return result.toString(); return result.toString();
} }
public static String getType(IType type) { public static String getType(IType type) {
StringBuffer result = new StringBuffer(); StringBuffer result = new StringBuffer();
IType[] types = new IType[DEAULT_ITYPE_SIZE]; IType[] types = new IType[DEAULT_ITYPE_SIZE];
// push all of the types onto the stack // push all of the types onto the stack
while(type != null && type instanceof ITypeContainer) { while (type != null && type instanceof ITypeContainer) {
types = (IType[]) ArrayUtil.append( IType.class, types, type ); types = (IType[]) ArrayUtil.append(IType.class, types, type);
try { try {
type = ((ITypeContainer)type).getType(); type = ((ITypeContainer) type).getType();
} catch (DOMException e) {} } catch (DOMException e) {
}
} }
if (type != null && !(type instanceof ITypeContainer)) { if (type != null && !(type instanceof ITypeContainer)) {
types = (IType[]) ArrayUtil.append( IType.class, types, type ); types = (IType[]) ArrayUtil.append(IType.class, types, type);
} }
// pop all of the types off of the stack, and build the string representation while doing so // pop all of the types off of the stack, and build the string
for(int j=types.length-1; j>=0; j--) { // representation while doing so
for (int j = types.length - 1; j >= 0; j--) {
if (types[j] != null) if (types[j] != null)
result.append(getTypeString(types[j])); result.append(getTypeString(types[j]));
if (types[j] != null && j>0) result.append(SPACE); if (types[j] != null && j > 0)
result.append(SPACE);
} }
return result.toString(); return result.toString();
} }
public static String getDeclaratorType(IASTDeclarator decltor) { public static String getDeclaratorType(IASTDeclarator decltor) {
// get the most nested declarator // get the most nested declarator
while(decltor.getNestedDeclarator() != null) while (decltor.getNestedDeclarator() != null)
decltor = decltor.getNestedDeclarator(); decltor = decltor.getNestedDeclarator();
IBinding binding = decltor.getName().resolveBinding(); IBinding binding = decltor.getName().resolveBinding();
IType type = null; IType type = null;
try { try {
if (binding instanceof CExternalFunction) { if (binding instanceof CExternalFunction) {
type = ((CExternalFunction)binding).getType(); type = ((CExternalFunction) binding).getType();
} else if (binding instanceof CExternalVariable) { } else if (binding instanceof CExternalVariable) {
type = ((CExternalVariable)binding).getType(); type = ((CExternalVariable) binding).getType();
} else if (binding instanceof IEnumerator) { } else if (binding instanceof IEnumerator) {
type = ((IEnumerator)binding).getType(); type = ((IEnumerator) binding).getType();
} else if (binding instanceof IFunction) { } else if (binding instanceof IFunction) {
type = ((IFunction)binding).getType(); type = ((IFunction) binding).getType();
} else if (binding instanceof ITypedef) { } else if (binding instanceof ITypedef) {
type = ((ITypedef)binding).getType(); type = ((ITypedef) binding).getType();
} else if (binding instanceof IVariable) { } else if (binding instanceof IVariable) {
type = ((IVariable)binding).getType(); type = ((IVariable) binding).getType();
} }
} catch (DOMException e) { } catch (DOMException e) {
return EMPTY_STRING; return EMPTY_STRING;
} }
if (type != null) { if (type != null) {
return getType(type); return getType(type);
} }
return EMPTY_STRING; return EMPTY_STRING;
} }
/** /**
* Return's the String representation of a node's type (if available). This is * Return's the String representation of a node's type (if available). This
* currently only being used for testing. * is currently only being used for testing.
* *
* TODO Remove this function when done testing if it is no longer needed * TODO Remove this function when done testing if it is no longer needed
* *
@ -306,37 +439,44 @@ public class ASTUtil {
public static String getNodeType(IASTNode node) { public static String getNodeType(IASTNode node) {
try { try {
if (node instanceof IASTDeclarator) if (node instanceof IASTDeclarator)
return getDeclaratorType((IASTDeclarator)node); return getDeclaratorType((IASTDeclarator) node);
if (node instanceof IASTName && ((IASTName)node).resolveBinding() instanceof IVariable) if (node instanceof IASTName
return getType(((IVariable)((IASTName)node).resolveBinding()).getType()); && ((IASTName) node).resolveBinding() instanceof IVariable)
if (node instanceof IASTName && ((IASTName)node).resolveBinding() instanceof IFunction) return getType(((IVariable) ((IASTName) node).resolveBinding())
return getType(((IFunction)((IASTName)node).resolveBinding()).getType()); .getType());
if (node instanceof IASTName && ((IASTName)node).resolveBinding() instanceof IType) if (node instanceof IASTName
return getType((IType)((IASTName)node).resolveBinding()); && ((IASTName) node).resolveBinding() instanceof IFunction)
return getType(((IFunction) ((IASTName) node).resolveBinding())
.getType());
if (node instanceof IASTName
&& ((IASTName) node).resolveBinding() instanceof IType)
return getType((IType) ((IASTName) node).resolveBinding());
if (node instanceof IASTTypeId) if (node instanceof IASTTypeId)
return getType((IASTTypeId)node); return getType((IASTTypeId) node);
} catch (DOMException e) { return EMPTY_STRING; } } catch (DOMException e) {
return EMPTY_STRING;
}
return EMPTY_STRING; return EMPTY_STRING;
} }
public static String getType(IASTTypeId typeId) { public static String getType(IASTTypeId typeId) {
if (typeId instanceof CASTTypeId) if (typeId instanceof CASTTypeId)
return createCType(typeId.getAbstractDeclarator()); return createCType(typeId.getAbstractDeclarator());
else if (typeId instanceof CPPASTTypeId) else if (typeId instanceof CPPASTTypeId)
return createCPPType(typeId.getAbstractDeclarator()); return createCPPType(typeId.getAbstractDeclarator());
return EMPTY_STRING; return EMPTY_STRING;
} }
private static String createCType(IASTDeclarator declarator) { private static String createCType(IASTDeclarator declarator) {
IType type = CVisitor.createType(declarator); IType type = CVisitor.createType(declarator);
return getType(type); return getType(type);
} }
private static String createCPPType(IASTDeclarator declarator) { private static String createCPPType(IASTDeclarator declarator) {
IType type = CPPVisitor.createType(declarator); IType type = CPPVisitor.createType(declarator);
return getType(type); return getType(type);
} }
} }

View file

@ -16,45 +16,89 @@ package org.eclipse.cdt.core.dom.ast;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator; import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
public abstract class ASTVisitor { public abstract class ASTVisitor {
/** /**
* These values should be overriden in the implementation subclass. * These values should be overriden in the implementation subclass.
*/ */
public boolean shouldVisitNames = false; public boolean shouldVisitNames = false;
public boolean shouldVisitDeclarations = false;
public boolean shouldVisitInitializers = false; public boolean shouldVisitDeclarations = false;
public boolean shouldVisitInitializers = false;
public boolean shouldVisitParameterDeclarations = false; public boolean shouldVisitParameterDeclarations = false;
public boolean shouldVisitDeclarators = false;
public boolean shouldVisitDeclarators = false;
public boolean shouldVisitDeclSpecifiers = false; public boolean shouldVisitDeclSpecifiers = false;
public boolean shouldVisitExpressions = false;
public boolean shouldVisitStatements = false; public boolean shouldVisitExpressions = false;
public boolean shouldVisitTypeIds = false;
public boolean shouldVisitEnumerators = false; public boolean shouldVisitStatements = false;
public boolean shouldVisitTypeIds = false;
public boolean shouldVisitEnumerators = false;
public boolean shouldVisitTranslationUnit = false; public boolean shouldVisitTranslationUnit = false;
/** /**
* @return continue to continue visiting, abort to stop, skip to not descend into this node. * @return continue to continue visiting, abort to stop, skip to not descend
* into this node.
*/ */
public final static int PROCESS_SKIP = 1; public final static int PROCESS_SKIP = 1;
public final static int PROCESS_ABORT = 2;
public final static int PROCESS_ABORT = 2;
public final static int PROCESS_CONTINUE = 3; public final static int PROCESS_CONTINUE = 3;
/** /**
* *
* visit methods * visit methods
* *
*/ */
public int visit( IASTTranslationUnit tu ) { return PROCESS_CONTINUE; } public int visit(IASTTranslationUnit tu) {
public int visit( IASTName name ) { return PROCESS_CONTINUE; } return PROCESS_CONTINUE;
public int visit( IASTDeclaration declaration ) { return PROCESS_CONTINUE; } }
public int visit( IASTInitializer initializer ) { return PROCESS_CONTINUE; }
public int visit( IASTParameterDeclaration parameterDeclaration ) { return PROCESS_CONTINUE; } public int visit(IASTName name) {
public int visit( IASTDeclarator declarator ) { return PROCESS_CONTINUE; } return PROCESS_CONTINUE;
public int visit( IASTDeclSpecifier declSpec ) {return PROCESS_CONTINUE; } }
public int visit( IASTExpression expression ) { return PROCESS_CONTINUE; }
public int visit( IASTStatement statement ) { return PROCESS_CONTINUE; } public int visit(IASTDeclaration declaration) {
public int visit( IASTTypeId typeId ) { return PROCESS_CONTINUE; } return PROCESS_CONTINUE;
public int visit( IASTEnumerator enumerator ) { return PROCESS_CONTINUE; } }
public int visit(IASTInitializer initializer) {
return PROCESS_CONTINUE;
}
public int visit(IASTParameterDeclaration parameterDeclaration) {
return PROCESS_CONTINUE;
}
public int visit(IASTDeclarator declarator) {
return PROCESS_CONTINUE;
}
public int visit(IASTDeclSpecifier declSpec) {
return PROCESS_CONTINUE;
}
public int visit(IASTExpression expression) {
return PROCESS_CONTINUE;
}
public int visit(IASTStatement statement) {
return PROCESS_CONTINUE;
}
public int visit(IASTTypeId typeId) {
return PROCESS_CONTINUE;
}
public int visit(IASTEnumerator enumerator) {
return PROCESS_CONTINUE;
}
} }

View file

@ -17,34 +17,30 @@ package org.eclipse.cdt.core.dom.ast;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPSemantics; import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPSemantics;
/** /**
* This is the general purpose exception that is thrown for resolving semantic * This is the general purpose exception that is thrown for resolving semantic
* aspects of an illegal binding. * aspects of an illegal binding.
* *
* @author aniefer * @author aniefer
*/ */
public class DOMException extends Exception { public class DOMException extends Exception {
IProblemBinding problemBinding; IProblemBinding problemBinding;
/**
/** * @param problem
* @param problem binding for throwing * binding for throwing
* *
*/ */
public DOMException( IProblemBinding problem ) { public DOMException(IProblemBinding problem) {
super( CPPSemantics.EMPTY_NAME ); super(CPPSemantics.EMPTY_NAME);
problemBinding = problem; problemBinding = problem;
} }
/** /**
* Get the problem associated w/this exception. * Get the problem associated w/this exception.
* *
* @return problem * @return problem
*/ */
public IProblemBinding getProblem(){ public IProblemBinding getProblem() {
return problemBinding; return problemBinding;
} }
public String getMessage() {
return problemBinding.getMessage();
}
} }

View file

@ -9,7 +9,6 @@
* IBM Rational Software - Initial API and implementation */ * IBM Rational Software - Initial API and implementation */
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* ASM Statement as a Declaration. * ASM Statement as a Declaration.
* *
@ -17,14 +16,17 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTASMDeclaration extends IASTDeclaration { public interface IASTASMDeclaration extends IASTDeclaration {
/** /**
* Get the assembly value. * Get the assembly value.
* @return *
*/ * @return
public String getAssembly(); */
/** public String getAssembly();
* Set the assembly value.
* @param assembly /**
*/ * Set the assembly value.
public void setAssembly( String assembly ); *
* @param assembly
*/
public void setAssembly(String assembly);
} }

View file

@ -17,22 +17,26 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTArrayDeclarator extends IASTDeclarator { public interface IASTArrayDeclarator extends IASTDeclarator {
/** /**
* Node property that describes the relationship between an <code>IASTArrayDeclarator</code> and an <code>IASTArrayModifier</code>. * Node property that describes the relationship between an
*/ * <code>IASTArrayDeclarator</code> and an <code>IASTArrayModifier</code>.
public static final ASTNodeProperty ARRAY_MODIFIER = new ASTNodeProperty( "Array Modifier"); //$NON-NLS-1$ */
public static final ASTNodeProperty ARRAY_MODIFIER = new ASTNodeProperty(
"Array Modifier"); //$NON-NLS-1$
/** /**
* Get all <code>IASTArrayModifier</code>'s for this declarator. * Get all <code>IASTArrayModifier</code>'s for this declarator.
* *
* @return array of <code>IASTArrayModifier</code> * @return array of <code>IASTArrayModifier</code>
*/ */
public IASTArrayModifier[] getArrayModifiers(); public IASTArrayModifier[] getArrayModifiers();
/** /**
* Add an <code>IASTArrayModifier</code> to this declarator * Add an <code>IASTArrayModifier</code> to this declarator
* @param arrayModifier <code>IASTArrayModifier</code> to be added *
* @param arrayModifier
* <code>IASTArrayModifier</code> to be added
*/ */
public void addArrayModifier( IASTArrayModifier arrayModifier ); public void addArrayModifier(IASTArrayModifier arrayModifier);
} }

View file

@ -10,32 +10,38 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This is the portion of the node that represents the portions when someone declares a * This is the portion of the node that represents the portions when someone
* variable/type which is an array. * declares a variable/type which is an array.
* *
* @author jcamelon * @author jcamelon
*/ */
public interface IASTArrayModifier extends IASTNode { public interface IASTArrayModifier extends IASTNode {
/** /**
* Node property that describes the relationship between an <code>IASTArrayModifier</code> and an <code>IASTExpression</code>. * Node property that describes the relationship between an
*/ * <code>IASTArrayModifier</code> and an <code>IASTExpression</code>.
public static final ASTNodeProperty CONSTANT_EXPRESSION = new ASTNodeProperty( "Constant Expression"); //$NON-NLS-1$ */
/** public static final ASTNodeProperty CONSTANT_EXPRESSION = new ASTNodeProperty(
* <code>EMPTY_ARRAY</code> is referred to in implementations "Constant Expression"); //$NON-NLS-1$
*/
public static final IASTArrayModifier[] EMPTY_ARRAY = new IASTArrayModifier[0]; /**
/** * <code>EMPTY_ARRAY</code> is referred to in implementations
* Get the constant expression that represents the size of the array. */
* public static final IASTArrayModifier[] EMPTY_ARRAY = new IASTArrayModifier[0];
* @return <code>IASTExpression</code>
*/ /**
public IASTExpression getConstantExpression(); * Get the constant expression that represents the size of the array.
/** *
* Set the constant expression that represents the size of the array. * @return <code>IASTExpression</code>
* */
* @param expression <code>IASTExpression</code> public IASTExpression getConstantExpression();
*/
public void setConstantExpression( IASTExpression expression ); /**
* Set the constant expression that represents the size of the array.
*
* @param expression
* <code>IASTExpression</code>
*/
public void setConstantExpression(IASTExpression expression);
} }

View file

@ -10,41 +10,56 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This interface represents a postfix array subscript expression. * This interface represents a postfix array subscript expression. x[ 10 ]
* x[ 10 ]
* y.z()[ t * t ] * y.z()[ t * t ]
* *
* @author jcamelon * @author jcamelon
*/ */
public interface IASTArraySubscriptExpression extends IASTExpression { public interface IASTArraySubscriptExpression extends IASTExpression {
/** /**
* Node property that describes the relationship between an <code>IASTArraySubscriptExpression</code> and an <code>IASTExpression</code> representing the subscript. * Node property that describes the relationship between an
*/ * <code>IASTArraySubscriptExpression</code> and an
public static final ASTNodeProperty ARRAY = new ASTNodeProperty( "Array"); //$NON-NLS-1$ * <code>IASTExpression</code> representing the subscript.
/** */
* Get the expression that represents the array. public static final ASTNodeProperty ARRAY = new ASTNodeProperty("Array"); //$NON-NLS-1$
* @return <code>IASTExpression</code> that represents the array.
*/ /**
public IASTExpression getArrayExpression(); * Get the expression that represents the array.
/** *
* Set the expression that represents the array. * @return <code>IASTExpression</code> that represents the array.
* @param expression <code>IASTExpression</code> to be set. */
*/ public IASTExpression getArrayExpression();
public void setArrayExpression( IASTExpression expression );
/** /**
* Node property that describes the relationship between an <code>IASTArraySubscriptExpression</code> and an <code>IASTExpression</code> representing the array. * Set the expression that represents the array.
*/ *
public static final ASTNodeProperty SUBSCRIPT = new ASTNodeProperty( "Subscript"); //$NON-NLS-1$ * @param expression
/** * <code>IASTExpression</code> to be set.
* Get the subscript expression. */
* @return <code>IASTExpression</code> that represents the subscript. public void setArrayExpression(IASTExpression expression);
*/
public IASTExpression getSubscriptExpression(); /**
/** * Node property that describes the relationship between an
* Set the subscript expression. * <code>IASTArraySubscriptExpression</code> and an
* @param expression <code>IASTExpression</code> to be set. * <code>IASTExpression</code> representing the array.
*/ */
public void setSubscriptExpression( IASTExpression expression ); public static final ASTNodeProperty SUBSCRIPT = new ASTNodeProperty(
"Subscript"); //$NON-NLS-1$
/**
* Get the subscript expression.
*
* @return <code>IASTExpression</code> that represents the subscript.
*/
public IASTExpression getSubscriptExpression();
/**
* Set the subscript expression.
*
* @param expression
* <code>IASTExpression</code> to be set.
*/
public void setSubscriptExpression(IASTExpression expression);
} }

View file

@ -11,203 +11,219 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This interface represents a binary expression. * This interface represents a binary expression.
* *
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public interface IASTBinaryExpression extends IASTExpression { public interface IASTBinaryExpression extends IASTExpression {
/**
* Node property that describes the relationship between an <code>IASTBinaryExpression</code> and an <code>IASTExpression</code> representing the lhs.
*/
public static final ASTNodeProperty OPERAND_ONE = new ASTNodeProperty( "Operand 1"); //$NON-NLS-1$
/**
* Node property that describes the relationship between an <code>IASTBinaryExpression</code> and an <code>IASTExpression</code> representing the rhs.
*/
public static final ASTNodeProperty OPERAND_TWO = new ASTNodeProperty( "Operand 2"); //$NON-NLS-1$
/**
* Set the operator.
* @param op Value to set.
*/
public void setOperator( int op );
/** /**
* Get the operator. * Node property that describes the relationship between an
* <code>IASTBinaryExpression</code> and an <code>IASTExpression</code>
* representing the lhs.
*/
public static final ASTNodeProperty OPERAND_ONE = new ASTNodeProperty(
"Operand 1"); //$NON-NLS-1$
/**
* Node property that describes the relationship between an
* <code>IASTBinaryExpression</code> and an <code>IASTExpression</code>
* representing the rhs.
*/
public static final ASTNodeProperty OPERAND_TWO = new ASTNodeProperty(
"Operand 2"); //$NON-NLS-1$
/**
* Set the operator.
*
* @param op
* Value to set.
*/
public void setOperator(int op);
/**
* Get the operator.
*
* @return int value as operator * @return int value as operator
*/ */
public int getOperator(); public int getOperator();
/** /**
* multiply * * multiply *
*/ */
public static final int op_multiply = 1; public static final int op_multiply = 1;
/** /**
* divide / * divide /
*/ */
public static final int op_divide = 2; public static final int op_divide = 2;
/** /**
* modulo % * modulo %
*/ */
public static final int op_modulo = 3; public static final int op_modulo = 3;
/** /**
* plus + * plus +
*/ */
public static final int op_plus = 4; public static final int op_plus = 4;
/** /**
* minus - * minus -
*/ */
public static final int op_minus = 5; public static final int op_minus = 5;
/** /**
* shift left << * shift left <<
*/ */
public static final int op_shiftLeft = 6; public static final int op_shiftLeft = 6;
/** /**
* shift right >> * shift right >>
*/ */
public static final int op_shiftRight = 7; public static final int op_shiftRight = 7;
/** /**
* less than < * less than <
*/ */
public static final int op_lessThan = 8; public static final int op_lessThan = 8;
/** /**
* greater than > * greater than >
*/ */
public static final int op_greaterThan = 9; public static final int op_greaterThan = 9;
/** /**
* less than or equals <= * less than or equals <=
*/ */
public static final int op_lessEqual = 10; public static final int op_lessEqual = 10;
/** /**
* greater than or equals >= * greater than or equals >=
*/ */
public static final int op_greaterEqual = 11; public static final int op_greaterEqual = 11;
/** /**
* binary and & * binary and &
*/ */
public static final int op_binaryAnd = 12; public static final int op_binaryAnd = 12;
/** /**
* binary Xor ^ * binary Xor ^
*/ */
public static final int op_binaryXor = 13; public static final int op_binaryXor = 13;
/** /**
* binary Or | * binary Or |
*/ */
public static final int op_binaryOr = 14; public static final int op_binaryOr = 14;
/** /**
* logical and && * logical and &&
*/ */
public static final int op_logicalAnd = 15; public static final int op_logicalAnd = 15;
/** /**
* logical or || * logical or ||
*/ */
public static final int op_logicalOr = 16; public static final int op_logicalOr = 16;
/** /**
* assignment = * assignment =
*/ */
public static final int op_assign = 17; public static final int op_assign = 17;
/** /**
* multiply assignment *= * multiply assignment *=
*/ */
public static final int op_multiplyAssign = 18; public static final int op_multiplyAssign = 18;
/** /**
* divide assignemnt /= * divide assignemnt /=
*/ */
public static final int op_divideAssign = 19; public static final int op_divideAssign = 19;
/** /**
* modulo assignment %= * modulo assignment %=
*/ */
public static final int op_moduloAssign = 20; public static final int op_moduloAssign = 20;
/** /**
* plus assignment += * plus assignment +=
*/ */
public static final int op_plusAssign = 21; public static final int op_plusAssign = 21;
/** /**
* minus assignment -= * minus assignment -=
*/ */
public static final int op_minusAssign = 22; public static final int op_minusAssign = 22;
/** /**
* shift left assignment <<= * shift left assignment <<=
*/ */
public static final int op_shiftLeftAssign = 23; public static final int op_shiftLeftAssign = 23;
/** /**
* shift right assign >>= * shift right assign >>=
*/ */
public static final int op_shiftRightAssign = 24; public static final int op_shiftRightAssign = 24;
/** /**
* binary and assign &= * binary and assign &=
*/ */
public static final int op_binaryAndAssign = 25; public static final int op_binaryAndAssign = 25;
/** /**
* binary Xor assign ^= * binary Xor assign ^=
*/ */
public static final int op_binaryXorAssign = 26; public static final int op_binaryXorAssign = 26;
/** /**
* binary Or assign |= * binary Or assign |=
*/ */
public static final int op_binaryOrAssign = 27; public static final int op_binaryOrAssign = 27;
/** /**
* equals == * equals ==
*/ */
public static final int op_equals = 28; public static final int op_equals = 28;
/** /**
* not equals != * not equals !=
*/ */
public static final int op_notequals = 29; public static final int op_notequals = 29;
/** /**
* op_last is the field used in subinterfaces to start their operators at * op_last is the field used in subinterfaces to start their operators at
*/ */
public static final int op_last = op_notequals; public static final int op_last = op_notequals;
/** /**
* Get the first operand. * Get the first operand.
* *
* @return <code>IASTExpression</code> representing operand 1. * @return <code>IASTExpression</code> representing operand 1.
*/ */
public IASTExpression getOperand1(); public IASTExpression getOperand1();
/** /**
* Set the first operand. * Set the first operand.
* *
* @param expression <code>IASTExpression</code> value. * @param expression
* <code>IASTExpression</code> value.
*/ */
public void setOperand1( IASTExpression expression ); public void setOperand1(IASTExpression expression);
/** /**
* Get the second operand. * Get the second operand.
* *
* @return <code>IASTExpression</code> representing operand 2. * @return <code>IASTExpression</code> representing operand 2.
*/ */
public IASTExpression getOperand2(); public IASTExpression getOperand2();
/** /**
* @param expression <code>IASTExpression</code> value * @param expression
* <code>IASTExpression</code> value
*/ */
public void setOperand2( IASTExpression expression ); public void setOperand2(IASTExpression expression);
} }

View file

@ -11,31 +11,34 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This is a case in a switch statement. Note that in the grammar, * This is a case in a switch statement. Note that in the grammar, a statement
* a statement is part of the clause. For the AST, just go on to the * is part of the clause. For the AST, just go on to the next statement to find
* next statement to find it. It's really only there to ensure that there * it. It's really only there to ensure that there is at least one statement
* is at least one statement following this clause. * following this clause.
* *
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public interface IASTCaseStatement extends IASTStatement { public interface IASTCaseStatement extends IASTStatement {
/**
* <code>ASTNodeProperty</code> that represents the relationship between a case statement and the expression it contains.
*/
public static final ASTNodeProperty EXPRESSION = new ASTNodeProperty("expression"); //$NON-NLS-1$
/** /**
* The expression that determines whether this case should be * <code>ASTNodeProperty</code> that represents the relationship between a
* taken. * case statement and the expression it contains.
*/
public static final ASTNodeProperty EXPRESSION = new ASTNodeProperty(
"expression"); //$NON-NLS-1$
/**
* The expression that determines whether this case should be taken.
*
* @return * @return
*/ */
public IASTExpression getExpression(); public IASTExpression getExpression();
/** /**
* Set the expression. * Set the expression.
*
* @param expression * @param expression
*/ */
public void setExpression(IASTExpression expression); public void setExpression(IASTExpression expression);
} }

View file

@ -19,56 +19,67 @@ public interface IASTCastExpression extends IASTExpression {
/** /**
* <code>op_cast</code> represents a traditional cast. * <code>op_cast</code> represents a traditional cast.
*/ */
public static final int op_cast = 0; public static final int op_cast = 0;
/** /**
* <code>op_last</code> for subinterfaces * <code>op_last</code> for subinterfaces
*/ */
public static final int op_last = op_cast; public static final int op_last = op_cast;
/** /**
* Get the type of cast (as an operator). * Get the type of cast (as an operator).
* *
* @return operator * @return operator
*/ */
public int getOperator(); public int getOperator();
/** /**
* Set the operator (type of cast). * Set the operator (type of cast).
* *
* @param value * @param value
*/ */
public void setOperator( int value ); public void setOperator(int value);
/** /**
* <code>OPERAND</code> represents the relationship between a cast expression and the expression it is casting (operand). * <code>OPERAND</code> represents the relationship between a cast
* expression and the expression it is casting (operand).
*/ */
public static final ASTNodeProperty OPERAND = new ASTNodeProperty( "Operand" ); //$NON-NLS-1$ public static final ASTNodeProperty OPERAND = new ASTNodeProperty("Operand"); //$NON-NLS-1$
/** /**
* Get expression being cast. * Get expression being cast.
*
* @return <code>IASTExpression</code> the expression being cast * @return <code>IASTExpression</code> the expression being cast
*/ */
public IASTExpression getOperand(); public IASTExpression getOperand();
/** /**
* Set the expression being cast. * Set the expression being cast.
* @param expression <code>IASTExpression</code> the expression to be cast *
* @param expression
* <code>IASTExpression</code> the expression to be cast
*/ */
public void setOperand( IASTExpression expression ); public void setOperand(IASTExpression expression);
/** /**
* <code>TYPE_ID</code> represents the relationship between a cast expression and the type cast to. * <code>TYPE_ID</code> represents the relationship between a cast
*/ * expression and the type cast to.
public static final ASTNodeProperty TYPE_ID = new ASTNodeProperty( "Type Id"); //$NON-NLS-1$ */
public static final ASTNodeProperty TYPE_ID = new ASTNodeProperty("Type Id"); //$NON-NLS-1$
/**
* Set the typeId. /**
* @param typeId <code>IASTTypeId</code> to be set. * Set the typeId.
*/ *
public void setTypeId( IASTTypeId typeId ); * @param typeId
/** * <code>IASTTypeId</code> to be set.
* Get the typeId. */
* @return <code>IASTTypeId</code> representing type being casted to. public void setTypeId(IASTTypeId typeId);
*/
public IASTTypeId getTypeId(); /**
* Get the typeId.
*
* @return <code>IASTTypeId</code> representing type being casted to.
*/
public IASTTypeId getTypeId();
} }

View file

@ -10,82 +10,87 @@
**********************************************************************/ **********************************************************************/
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* A composite type specifier represents a ocmposite structure (contains declarations). * A composite type specifier represents a ocmposite structure (contains
* declarations).
* *
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public interface IASTCompositeTypeSpecifier extends IASTDeclSpecifier { public interface IASTCompositeTypeSpecifier extends IASTDeclSpecifier {
/** /**
* <code>TYPE_NAME</code> represents the relationship between an <code>IASTCompositeTypeSpecifier</code> and its <code>IASTName</code>. * <code>TYPE_NAME</code> represents the relationship between an
*/ * <code>IASTCompositeTypeSpecifier</code> and its <code>IASTName</code>.
public static final ASTNodeProperty TYPE_NAME = new ASTNodeProperty( "Type Name"); //$NON-NLS-1$ */
public static final ASTNodeProperty TYPE_NAME = new ASTNodeProperty(
"Type Name"); //$NON-NLS-1$
/** /**
* <code>MEMBER_DECLARATION</code> represents the relationship between an <code>IASTCompositeTypeSpecifier</code> and its nested<code>IASTDeclaration</code>s. * <code>MEMBER_DECLARATION</code> represents the relationship between an
*/ * <code>IASTCompositeTypeSpecifier</code> and its nested<code>IASTDeclaration</code>s.
public static final ASTNodeProperty MEMBER_DECLARATION = new ASTNodeProperty( "Member Declaration"); //$NON-NLS-1$ */
public static final ASTNodeProperty MEMBER_DECLARATION = new ASTNodeProperty(
"Member Declaration"); //$NON-NLS-1$
/** /**
* Get the type (key) of this composite specifier. * Get the type (key) of this composite specifier.
* *
* @return key for this type * @return key for this type
*/ */
public int getKey(); public int getKey();
/** /**
* <code>k_struct</code> represents 'struct' in C & C++ * <code>k_struct</code> represents 'struct' in C & C++
*/ */
public static final int k_struct = 1; public static final int k_struct = 1;
/** /**
* <code>k_union</code> represents 'union' in C & C++ * <code>k_union</code> represents 'union' in C & C++
*/ */
public static final int k_union = 2; public static final int k_union = 2;
/** /**
* <code>k_last</code> allows for subinterfaces to continue enumerating keys * <code>k_last</code> allows for subinterfaces to continue enumerating
* keys
*/ */
public static final int k_last = k_union; public static final int k_last = k_union;
/** /**
* Set the type (key) of this composite specifier. * Set the type (key) of this composite specifier.
* *
* @param key * @param key
*/ */
public void setKey( int key ); public void setKey(int key);
/** /**
* Return the name for this composite type. If this is an anonymous * Return the name for this composite type. If this is an anonymous type,
* type, this will return an empty name. * this will return an empty name.
* *
* @return the name of the type * @return the name of the type
*/ */
public IASTName getName(); public IASTName getName();
/** /**
* Set the name for this composite type. * Set the name for this composite type.
* *
* @param name * @param name
*/ */
public void setName( IASTName name ); public void setName(IASTName name);
/** /**
* Returns a list of member declarations. * Returns a list of member declarations.
* *
* @return List of IASTDeclaration * @return List of IASTDeclaration
*/ */
public IASTDeclaration[] getMembers(); public IASTDeclaration[] getMembers();
/** /**
* Add a member declaration. * Add a member declaration.
* *
* @param declaration * @param declaration
*/ */
public void addMemberDeclaration( IASTDeclaration declaration ); public void addMemberDeclaration(IASTDeclaration declaration);
/** /**
* Get the scope that this interface eludes to in the logical tree. * Get the scope that this interface eludes to in the logical tree.
* *

View file

@ -10,7 +10,6 @@
**********************************************************************/ **********************************************************************/
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This represents a block of statements. * This represents a block of statements.
* *
@ -19,28 +18,33 @@ package org.eclipse.cdt.core.dom.ast;
public interface IASTCompoundStatement extends IASTStatement { public interface IASTCompoundStatement extends IASTStatement {
/** /**
* <code>NESTED_STATEMENT</code> represents the relationship between an <code>IASTCompoundStatement</code> and its nested <code>IASTStatement</code> * <code>NESTED_STATEMENT</code> represents the relationship between an
* <code>IASTCompoundStatement</code> and its nested
* <code>IASTStatement</code>
*/ */
public static final ASTNodeProperty NESTED_STATEMENT = new ASTNodeProperty( "Nested Statement" ); //$NON-NLS-1$ public static final ASTNodeProperty NESTED_STATEMENT = new ASTNodeProperty(
"Nested Statement"); //$NON-NLS-1$
/** /**
* Gets the statements in this block. * Gets the statements in this block.
* *
* @return Array of IASTStatement * @return Array of IASTStatement
*/ */
public IASTStatement[] getStatements(); public IASTStatement[] getStatements();
/** /**
* Add a statement to the compound block. * Add a statement to the compound block.
* *
* @param statement statement to be added * @param statement
* statement to be added
*/ */
public void addStatement( IASTStatement statement ); public void addStatement(IASTStatement statement);
/** /**
* Get <code>IScope</code> node that this node eludes to in the logical tree. * Get <code>IScope</code> node that this node eludes to in the logical
* tree.
* *
* @return the <code>IScope</code> * @return the <code>IScope</code>
*/ */
public IScope getScope(); public IScope getScope();
} }

View file

@ -16,57 +16,73 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTConditionalExpression extends IASTExpression { public interface IASTConditionalExpression extends IASTExpression {
/**
* <code>LOGICAL_CONDITION</code> represents the relationship between an <code>IASTConditionalExpression</code> and its condition <code>IASTExpression</code>.
*/
public static final ASTNodeProperty LOGICAL_CONDITION = new ASTNodeProperty( "Logical Condition"); //$NON-NLS-1$
/**
* <code>POSITIVE_RESULT</code> represents the relationship between an <code>IASTConditionalExpression</code> and its positive result <code>IASTExpression</code>.
*/
public static final ASTNodeProperty POSITIVE_RESULT = new ASTNodeProperty( "Positive Result" ); //$NON-NLS-1$
/**
* <code>NEGATIVE_RESULT</code> represents the relationship between an <code>IASTConditionalExpression</code> and its positive result <code>IASTExpression</code>.
*/
public static final ASTNodeProperty NEGATIVE_RESULT = new ASTNodeProperty( "Negative Result" ); //$NON-NLS-1$
/**
* Get the logical condition expression.
*
* @return <code>IASTExpression</code> representing the logical condition.
*/
public IASTExpression getLogicalConditionExpression();
/**
* Set the logical condition expression.
*
* @param expression condition to be set
*/
public void setLogicalConditionExpression( IASTExpression expression );
/**
* Get the positive result expression.
*
* @return <code>IASTExpression</code>
*/
public IASTExpression getPositiveResultExpression();
/**
* Set positive result expression.
*
* @param expression
*/
public void setPositiveResultExpression(IASTExpression expression);
/**
* Get the negative result expression.
* @return <code>IASTExpression</code>
*/
public IASTExpression getNegativeResultExpression();
/** /**
* Set negative result expression. * <code>LOGICAL_CONDITION</code> represents the relationship between an
* * <code>IASTConditionalExpression</code> and its condition
* @param expression <code>IASTExpression</code> * <code>IASTExpression</code>.
*/ */
public void setNegativeResultExpression(IASTExpression expression); public static final ASTNodeProperty LOGICAL_CONDITION = new ASTNodeProperty(
"Logical Condition"); //$NON-NLS-1$
/**
* <code>POSITIVE_RESULT</code> represents the relationship between an
* <code>IASTConditionalExpression</code> and its positive result
* <code>IASTExpression</code>.
*/
public static final ASTNodeProperty POSITIVE_RESULT = new ASTNodeProperty(
"Positive Result"); //$NON-NLS-1$
/**
* <code>NEGATIVE_RESULT</code> represents the relationship between an
* <code>IASTConditionalExpression</code> and its positive result
* <code>IASTExpression</code>.
*/
public static final ASTNodeProperty NEGATIVE_RESULT = new ASTNodeProperty(
"Negative Result"); //$NON-NLS-1$
/**
* Get the logical condition expression.
*
* @return <code>IASTExpression</code> representing the logical condition.
*/
public IASTExpression getLogicalConditionExpression();
/**
* Set the logical condition expression.
*
* @param expression
* condition to be set
*/
public void setLogicalConditionExpression(IASTExpression expression);
/**
* Get the positive result expression.
*
* @return <code>IASTExpression</code>
*/
public IASTExpression getPositiveResultExpression();
/**
* Set positive result expression.
*
* @param expression
*/
public void setPositiveResultExpression(IASTExpression expression);
/**
* Get the negative result expression.
*
* @return <code>IASTExpression</code>
*/
public IASTExpression getNegativeResultExpression();
/**
* Set negative result expression.
*
* @param expression
* <code>IASTExpression</code>
*/
public void setNegativeResultExpression(IASTExpression expression);
} }

View file

@ -15,6 +15,6 @@ package org.eclipse.cdt.core.dom.ast;
* *
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public interface IASTContinueStatement extends IASTStatement { public interface IASTContinueStatement extends IASTStatement {
} }

View file

@ -16,25 +16,29 @@ package org.eclipse.cdt.core.dom.ast;
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public interface IASTDeclSpecifier extends IASTNode { public interface IASTDeclSpecifier extends IASTNode {
/** /**
* <code>sc_unspecified</code> undefined storage class * <code>sc_unspecified</code> undefined storage class
*/ */
public static final int sc_unspecified = 0; public static final int sc_unspecified = 0;
/** /**
* <code>sc_typedef</code> typedef * <code>sc_typedef</code> typedef
*/ */
public static final int sc_typedef = 1; public static final int sc_typedef = 1;
/** /**
* <code>sc_extern</code>extern * <code>sc_extern</code>extern
*/ */
public static final int sc_extern = 2; public static final int sc_extern = 2;
/** /**
* <code>sc_static</code>static * <code>sc_static</code>static
*/ */
public static final int sc_static = 3; public static final int sc_static = 3;
/** /**
* <code>sc_auto</code>auto * <code>sc_auto</code>auto
*/ */
@ -52,55 +56,73 @@ public interface IASTDeclSpecifier extends IASTNode {
public static final int sc_last = sc_register; public static final int sc_last = sc_register;
/** /**
* Set the storage class. * Set the storage class.
* @param storageClass int *
* @param storageClass
* int
*/ */
public void setStorageClass( int storageClass ); public void setStorageClass(int storageClass);
/** /**
* Get the storage class. * Get the storage class.
*
* @return int * @return int
*/ */
public int getStorageClass(); public int getStorageClass();
// Type qualifier // Type qualifier
/** /**
* Is const modifier used? * Is const modifier used?
*
* @return boolean * @return boolean
*/ */
public boolean isConst(); public boolean isConst();
/** /**
* Set const modifier used. * Set const modifier used.
* @param value boolean *
* @param value
* boolean
*/ */
public void setConst( boolean value ); public void setConst(boolean value);
/** /**
* Is volatile modifier used? * Is volatile modifier used?
*
* @return boolean * @return boolean
*/ */
public boolean isVolatile(); public boolean isVolatile();
/** /**
* Set volatile modifier used. * Set volatile modifier used.
* @param value boolean *
* @param value
* boolean
*/ */
public void setVolatile( boolean value ); public void setVolatile(boolean value);
// Function specifier // Function specifier
/** /**
* Is inline modifier used? * Is inline modifier used?
*
* @return boolean * @return boolean
*/ */
public boolean isInline(); public boolean isInline();
/** /**
* Set inline modifier used. * Set inline modifier used.
* @param value boolean *
* @param value
* boolean
*/ */
public void setInline( boolean value ); public void setInline(boolean value);
/** /**
* Get the string that represents the decl specifier seq. as represented in the file pre-processing. * Get the string that represents the decl specifier seq. as represented in
* the file pre-processing.
*
* @return String * @return String
*/ */
public String getUnpreprocessedSignature(); public String getUnpreprocessedSignature();
} }

View file

@ -16,6 +16,6 @@ package org.eclipse.cdt.core.dom.ast;
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public interface IASTDeclaration extends IASTNode { public interface IASTDeclaration extends IASTNode {
public static final IASTDeclaration [] EMPTY_DECLARATION_ARRAY = new IASTDeclaration[0]; public static final IASTDeclaration[] EMPTY_DECLARATION_ARRAY = new IASTDeclaration[0];
} }

View file

@ -18,22 +18,24 @@ package org.eclipse.cdt.core.dom.ast;
public interface IASTDeclarationStatement extends IASTStatement { public interface IASTDeclarationStatement extends IASTStatement {
/** /**
* <code>DECLARATION</code> represents the relationship between a declaration statement and the declaration it wraps. * <code>DECLARATION</code> represents the relationship between a
* declaration statement and the declaration it wraps.
*/ */
public static final ASTNodeProperty DECLARATION = new ASTNodeProperty( "Declaration"); //$NON-NLS-1$ public static final ASTNodeProperty DECLARATION = new ASTNodeProperty(
"Declaration"); //$NON-NLS-1$
/** /**
* Gets the declaration introduced by this statement. * Gets the declaration introduced by this statement.
* *
* @return the declaration * @return the declaration
*/ */
public IASTDeclaration getDeclaration(); public IASTDeclaration getDeclaration();
/** /**
* Set the declaration for this statement. * Set the declaration for this statement.
* *
* @param declaration * @param declaration
*/ */
public void setDeclaration( IASTDeclaration declaration ); public void setDeclaration(IASTDeclaration declaration);
} }

View file

@ -10,61 +10,72 @@
**********************************************************************/ **********************************************************************/
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* Base interface for a declarator. * Base interface for a declarator.
* *
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public interface IASTDeclarator extends IASTNode { public interface IASTDeclarator extends IASTNode {
/**
* Constant - empty declarator array
*/
public static final IASTDeclarator[] EMPTY_DECLARATOR_ARRAY = new IASTDeclarator[0];
/** /**
* <code>POINTER_OPERATOR</code> represents the relationship between an <code>IASTDeclarator</code> and an <code>IASTPointerOperator</code>. * Constant - empty declarator array
*/ */
public static final ASTNodeProperty POINTER_OPERATOR = new ASTNodeProperty( "Pointer Operator"); //$NON-NLS-1$ public static final IASTDeclarator[] EMPTY_DECLARATOR_ARRAY = new IASTDeclarator[0];
/**
* <code>INITIALIZER</code> represents the relationship between an <code>IASTDeclarator</code> and an <code>IASTInitializer</code>.
*/
public static final ASTNodeProperty INITIALIZER = new ASTNodeProperty( "Initializer"); //$NON-NLS-1$
/**
* <code>NESTED_DECLARATOR</code> represents the relationship between an <code>IASTDeclarator</code> and a nested <code>IASTDeclarator</code>.
*/
public static final ASTNodeProperty NESTED_DECLARATOR = new ASTNodeProperty( "Nested Declarator"); //$NON-NLS-1$
/**
* <code>DECLARATOR_NAME</code> represents the relationship between an <code>IASTDeclarator</code> and an <code>IASTName</code>.
*/
public static final ASTNodeProperty DECLARATOR_NAME = new ASTNodeProperty( "Declarator Name"); //$NON-NLS-1$
/** /**
* This is the list of pointer operators applied to the type for * <code>POINTER_OPERATOR</code> represents the relationship between an
* the declarator. * <code>IASTDeclarator</code> and an <code>IASTPointerOperator</code>.
*/
public static final ASTNodeProperty POINTER_OPERATOR = new ASTNodeProperty(
"Pointer Operator"); //$NON-NLS-1$
/**
* <code>INITIALIZER</code> represents the relationship between an
* <code>IASTDeclarator</code> and an <code>IASTInitializer</code>.
*/
public static final ASTNodeProperty INITIALIZER = new ASTNodeProperty(
"Initializer"); //$NON-NLS-1$
/**
* <code>NESTED_DECLARATOR</code> represents the relationship between an
* <code>IASTDeclarator</code> and a nested <code>IASTDeclarator</code>.
*/
public static final ASTNodeProperty NESTED_DECLARATOR = new ASTNodeProperty(
"Nested Declarator"); //$NON-NLS-1$
/**
* <code>DECLARATOR_NAME</code> represents the relationship between an
* <code>IASTDeclarator</code> and an <code>IASTName</code>.
*/
public static final ASTNodeProperty DECLARATOR_NAME = new ASTNodeProperty(
"Declarator Name"); //$NON-NLS-1$
/**
* This is the list of pointer operators applied to the type for the
* declarator.
* *
* @return array of IASTPointerOperator * @return array of IASTPointerOperator
*/ */
public IASTPointerOperator[] getPointerOperators(); public IASTPointerOperator[] getPointerOperators();
/**
* Adds a pointer operator to the declarator.
*
* @param operator <code>IASTPointerOperator</code> to be added.
*/
public void addPointerOperator( IASTPointerOperator operator );
/** /**
* If the declarator is nested in parenthesis, this returns the * Adds a pointer operator to the declarator.
* declarator as found in those parenethesis. *
* @param operator
* <code>IASTPointerOperator</code> to be added.
*/
public void addPointerOperator(IASTPointerOperator operator);
/**
* If the declarator is nested in parenthesis, this returns the declarator
* as found in those parenethesis.
* *
* @return the nested declarator or null * @return the nested declarator or null
*/ */
public IASTDeclarator getNestedDeclarator(); public IASTDeclarator getNestedDeclarator();
public void setNestedDeclarator( IASTDeclarator nested ); public void setNestedDeclarator(IASTDeclarator nested);
/** /**
* This returns the name of the declarator. If this is an abstract * This returns the name of the declarator. If this is an abstract
* declarator, this will return an empty name. * declarator, this will return an empty name.
@ -72,26 +83,28 @@ public interface IASTDeclarator extends IASTNode {
* @return the name of the declarator * @return the name of the declarator
*/ */
public IASTName getName(); public IASTName getName();
/** /**
* Set the name of he declarator. * Set the name of he declarator.
* *
* @param name <code>IASTName</code> * @param name
* <code>IASTName</code>
*/ */
public void setName( IASTName name ); public void setName(IASTName name);
/** /**
* This is the optional initializer for this declarator. * This is the optional initializer for this declarator.
* *
* @return the initializer expression or null * @return the initializer expression or null
*/ */
public IASTInitializer getInitializer(); public IASTInitializer getInitializer();
/** /**
* Set the optional initializer. * Set the optional initializer.
* *
* @param initializer <code>IASTInitializer</code> * @param initializer
* <code>IASTInitializer</code>
*/ */
public void setInitializer( IASTInitializer initializer ); public void setInitializer(IASTInitializer initializer);
} }

View file

@ -12,9 +12,9 @@ package org.eclipse.cdt.core.dom.ast;
/** /**
* This is the default clause in the switch statement. Note that in the grammar, * This is the default clause in the switch statement. Note that in the grammar,
* a statement is part of the clause. For the AST, just go on to the * a statement is part of the clause. For the AST, just go on to the next
* next statement to find it. It's really only there to ensure that there * statement to find it. It's really only there to ensure that there is at least
* is at least one statement following this clause. * one statement following this clause.
* *
* @author Doug Schaefer * @author Doug Schaefer
*/ */

View file

@ -17,14 +17,20 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTDoStatement extends IASTStatement { public interface IASTDoStatement extends IASTStatement {
/** /**
* <code>BODY</code> represents the relationship between a <code>IASTDoStatement</code> and its nested body <code>IASTStatement</code>. * <code>BODY</code> represents the relationship between a
*/ * <code>IASTDoStatement</code> and its nested body
public static final ASTNodeProperty BODY = new ASTNodeProperty("body"); //$NON-NLS-1$ * <code>IASTStatement</code>.
/** */
* <code>CONDITION</code> represents the relationship between a <code>IASTDoStatement</code> and its condition <code>IASTExpression</code>. public static final ASTNodeProperty BODY = new ASTNodeProperty("body"); //$NON-NLS-1$
*/
public static final ASTNodeProperty CONDITION = new ASTNodeProperty("condition"); //$NON-NLS-1$ /**
* <code>CONDITION</code> represents the relationship between a
* <code>IASTDoStatement</code> and its condition
* <code>IASTExpression</code>.
*/
public static final ASTNodeProperty CONDITION = new ASTNodeProperty(
"condition"); //$NON-NLS-1$
/** /**
* Get the body of the loop. * Get the body of the loop.
@ -32,24 +38,28 @@ public interface IASTDoStatement extends IASTStatement {
* @return <code>IASTStatement</code> loop code body * @return <code>IASTStatement</code> loop code body
*/ */
public IASTStatement getBody(); public IASTStatement getBody();
/** /**
* Set the body of the loop. * Set the body of the loop.
* @param body an <code>IASTStatement</code> *
* @param body
* an <code>IASTStatement</code>
*/ */
public void setBody(IASTStatement body); public void setBody(IASTStatement body);
/** /**
* The condition on the loop. * The condition on the loop.
* *
* @return the expression for the condition * @return the expression for the condition
*/ */
public IASTExpression getCondition(); public IASTExpression getCondition();
/** /**
* Set the condition for the loop. * Set the condition for the loop.
* @param condition an IASTExpression *
* @param condition
* an IASTExpression
*/ */
public void setCondition(IASTExpression condition); public void setCondition(IASTExpression condition);
} }

View file

@ -16,51 +16,61 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTElaboratedTypeSpecifier extends IASTDeclSpecifier { public interface IASTElaboratedTypeSpecifier extends IASTDeclSpecifier {
/** /**
* Enumeration. * Enumeration.
*/ */
public static final int k_enum = 0; public static final int k_enum = 0;
/**
* Structure. /**
*/ * Structure.
public static final int k_struct = 1; */
/** public static final int k_struct = 1;
* Union.
*/ /**
public static final int k_union = 2; * Union.
/** */
* Constant for extensibility in sub-interfaces. public static final int k_union = 2;
*/
public static final int k_last = k_union; /**
* Constant for extensibility in sub-interfaces.
/** */
* Get the kind. public static final int k_last = k_union;
*
* @return int (kind). /**
*/ * Get the kind.
public int getKind(); *
/** * @return int (kind).
* Set the kind. */
* @param value int (kind) public int getKind();
*/
public void setKind( int value ); /**
* Set the kind.
/** *
* <code>TYPE_NAME</code> describes the relationship between <code>IASTElaboratedTypeSpecifier</code> and <code>IASTName</code>. * @param value
*/ * int (kind)
public static final ASTNodeProperty TYPE_NAME = new ASTNodeProperty( "Type Name"); //$NON-NLS-1$ */
/** public void setKind(int value);
* Get the name.
* /**
* @return <code>IASTName</code> * <code>TYPE_NAME</code> describes the relationship between
*/ * <code>IASTElaboratedTypeSpecifier</code> and <code>IASTName</code>.
public IASTName getName(); */
/** public static final ASTNodeProperty TYPE_NAME = new ASTNodeProperty(
* Set the name. "Type Name"); //$NON-NLS-1$
*
* @param name <code>IASTName</code> /**
*/ * Get the name.
public void setName( IASTName name ); *
* @return <code>IASTName</code>
*/
public IASTName getName();
/**
* Set the name.
*
* @param name
* <code>IASTName</code>
*/
public void setName(IASTName name);
} }

View file

@ -9,92 +9,110 @@
* IBM Rational Software - Initial API and implementation */ * IBM Rational Software - Initial API and implementation */
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This interface represents enumerations in C and C++. * This interface represents enumerations in C and C++.
* *
* @author jcamelon * @author jcamelon
*/ */
public interface IASTEnumerationSpecifier extends IASTDeclSpecifier { public interface IASTEnumerationSpecifier extends IASTDeclSpecifier {
/** /**
* This interface represents an enumerator member of an enum specifier. * This interface represents an enumerator member of an enum specifier.
* @author jcamelon *
*/ * @author jcamelon
public interface IASTEnumerator extends IASTNode { */
/** public interface IASTEnumerator extends IASTNode {
* Empty array (constant). /**
*/ * Empty array (constant).
public static final IASTEnumerator[] EMPTY_ENUMERATOR_ARRAY = new IASTEnumerator[0]; */
public static final IASTEnumerator[] EMPTY_ENUMERATOR_ARRAY = new IASTEnumerator[0];
/** /**
* <code>ENUMERATOR_NAME</code> describes the relationship between <code>IASTEnumerator</code> and <code>IASTName</code>. * <code>ENUMERATOR_NAME</code> describes the relationship between
*/ * <code>IASTEnumerator</code> and <code>IASTName</code>.
public static final ASTNodeProperty ENUMERATOR_NAME = new ASTNodeProperty( "Enumerator Name"); //$NON-NLS-1$ */
/** public static final ASTNodeProperty ENUMERATOR_NAME = new ASTNodeProperty(
* Set the enumerator's name. "Enumerator Name"); //$NON-NLS-1$
*
* @param name /**
*/ * Set the enumerator's name.
public void setName( IASTName name ); *
/** * @param name
* Get the enumerator's name. */
* public void setName(IASTName name);
* @return <code>IASTName</code>
*/ /**
public IASTName getName(); * Get the enumerator's name.
*
/** * @return <code>IASTName</code>
* <code>ENUMERATOR_VALUE</code> describes the relationship between <code>IASTEnumerator</code> and <code>IASTExpression</code>. */
*/ public IASTName getName();
public static final ASTNodeProperty ENUMERATOR_VALUE = new ASTNodeProperty( "Enumerator Value"); //$NON-NLS-1$
/** /**
* Set enumerator value. * <code>ENUMERATOR_VALUE</code> describes the relationship between
* * <code>IASTEnumerator</code> and <code>IASTExpression</code>.
* @param expression */
*/ public static final ASTNodeProperty ENUMERATOR_VALUE = new ASTNodeProperty(
public void setValue( IASTExpression expression ); "Enumerator Value"); //$NON-NLS-1$
/**
* Get enumerator value. /**
* * Set enumerator value.
* @return <code>IASTExpression</code> value *
*/ * @param expression
public IASTExpression getValue(); */
public void setValue(IASTExpression expression);
/**
* Get enumerator value.
*
* @return <code>IASTExpression</code> value
*/
public IASTExpression getValue();
}
/**
* <code>ENUMERATOR</code> describes the relationship between
* <code>IASTEnumerationSpecifier</code> and the nested
* <code>IASTEnumerator</code>s.
*/
public static final ASTNodeProperty ENUMERATOR = new ASTNodeProperty(
"Enumerator"); //$NON-NLS-1$
/**
* Add an enumerator.
*
* @param enumerator
* <code>IASTEnumerator</code>
*/
public void addEnumerator(IASTEnumerator enumerator);
/**
* Get enumerators.
*
* @return <code>IASTEnumerator []</code> array
*/
public IASTEnumerator[] getEnumerators();
/**
* <code>ENUMERATION_NAME</code> describes the relationship between
* <code>IASTEnumerationSpecifier</code> and its <code>IASTName</code>.
*/
public static final ASTNodeProperty ENUMERATION_NAME = new ASTNodeProperty(
"Enum Name"); //$NON-NLS-1$
/**
* Set the enum's name.
*
* @param name
*/
public void setName(IASTName name);
/**
* Get the enum's name.
*
* @return
*/
public IASTName getName();
}
/**
* <code>ENUMERATOR</code> describes the relationship between <code>IASTEnumerationSpecifier</code> and the nested <code>IASTEnumerator</code>s.
*/
public static final ASTNodeProperty ENUMERATOR = new ASTNodeProperty( "Enumerator" ); //$NON-NLS-1$
/**
* Add an enumerator.
*
* @param enumerator <code>IASTEnumerator</code>
*/
public void addEnumerator( IASTEnumerator enumerator );
/**
* Get enumerators.
* @return <code>IASTEnumerator []</code> array
*/
public IASTEnumerator[] getEnumerators();
/**
* <code>ENUMERATION_NAME</code> describes the relationship between <code>IASTEnumerationSpecifier</code> and its <code>IASTName</code>.
*/
public static final ASTNodeProperty ENUMERATION_NAME = new ASTNodeProperty( "Enum Name"); //$NON-NLS-1$
/**
* Set the enum's name.
*
* @param name
*/
public void setName( IASTName name );
/**
* Get the enum's name.
*
* @return
*/
public IASTName getName();
} }

View file

@ -16,8 +16,8 @@ package org.eclipse.cdt.core.dom.ast;
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public interface IASTExpression extends IASTNode { public interface IASTExpression extends IASTNode {
/** /**
* Empty expression array. * Empty expression array.
*/ */
public static final IASTExpression [] EMPTY_EXPRESSION_ARRAY = new IASTExpression[0]; public static final IASTExpression[] EMPTY_EXPRESSION_ARRAY = new IASTExpression[0];
} }

View file

@ -9,7 +9,6 @@
* IBM Rational Software - Initial API and implementation */ * IBM Rational Software - Initial API and implementation */
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* Expression List (Comma separated list of expressions). * Expression List (Comma separated list of expressions).
* *
@ -17,22 +16,26 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTExpressionList extends IASTExpression { public interface IASTExpressionList extends IASTExpression {
/** /**
* <code>NESTED_EXPRESSION</code> describes the relationship between <code>IASTExpressionList</code> and the nested <code>IASTExpression</code>s. * <code>NESTED_EXPRESSION</code> describes the relationship between
*/ * <code>IASTExpressionList</code> and the nested
public static final ASTNodeProperty NESTED_EXPRESSION = new ASTNodeProperty( "Nested Expression"); //$NON-NLS-1$ * <code>IASTExpression</code>s.
*/
public static final ASTNodeProperty NESTED_EXPRESSION = new ASTNodeProperty(
"Nested Expression"); //$NON-NLS-1$
/** /**
* Get nested expressions. * Get nested expressions.
* *
* @return <code>IASTExpression [] </code> nested expressions * @return <code>IASTExpression [] </code> nested expressions
*/ */
public IASTExpression [] getExpressions(); public IASTExpression[] getExpressions();
/** /**
* Add nested expression. * Add nested expression.
* *
* @param expression <code>IASTExpression</code> value to be added. * @param expression
*/ * <code>IASTExpression</code> value to be added.
public void addExpression( IASTExpression expression ); */
public void addExpression(IASTExpression expression);
} }

View file

@ -10,7 +10,6 @@
**********************************************************************/ **********************************************************************/
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* Expression statement. * Expression statement.
* *
@ -18,21 +17,24 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTExpressionStatement extends IASTStatement { public interface IASTExpressionStatement extends IASTStatement {
/** /**
* <code>EXPRESSION</code> is the relationship between an <code>IASTExpressionStatement</code> and an <code>IASTExpression</code>. * <code>EXPRESSION</code> is the relationship between an
*/ * <code>IASTExpressionStatement</code> and an <code>IASTExpression</code>.
public static final ASTNodeProperty EXPFRESSION = new ASTNodeProperty( "Expression"); //$NON-NLS-1$ */
public static final ASTNodeProperty EXPFRESSION = new ASTNodeProperty(
"Expression"); //$NON-NLS-1$
/** /**
* Get the expression in this statement. * Get the expression in this statement.
* *
* @return the expression * @return the expression
*/ */
public IASTExpression getExpression(); public IASTExpression getExpression();
/** /**
* Set the expression statement. * Set the expression statement.
* *
* @param expression * @param expression
*/ */
public void setExpression( IASTExpression expression ); public void setExpression(IASTExpression expression);
} }

View file

@ -18,23 +18,27 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTFieldDeclarator extends IASTDeclarator { public interface IASTFieldDeclarator extends IASTDeclarator {
/**
* <code>FIELD_SIZE</code> represents the relationship between a <code>IASTFieldDeclarator</code> and its <code>IASTExpression</code>.
*/
public static final ASTNodeProperty FIELD_SIZE = new ASTNodeProperty( "BitField Size"); //$NON-NLS-1$
/** /**
* This returns the number of bits if this is a bit field. * <code>FIELD_SIZE</code> represents the relationship between a
* If it is not a bit field, it returns null. * <code>IASTFieldDeclarator</code> and its <code>IASTExpression</code>.
*/
public static final ASTNodeProperty FIELD_SIZE = new ASTNodeProperty(
"BitField Size"); //$NON-NLS-1$
/**
* This returns the number of bits if this is a bit field. If it is not a
* bit field, it returns null.
* *
* @return size of bit field or null. * @return size of bit field or null.
*/ */
public IASTExpression getBitFieldSize(); public IASTExpression getBitFieldSize();
/** /**
* Set the bitfield size. * Set the bitfield size.
* @param size <code>IASTExpression</code> *
* @param size
* <code>IASTExpression</code>
*/ */
public void setBitFieldSize( IASTExpression size ); public void setBitFieldSize(IASTExpression size);
} }

View file

@ -11,63 +11,72 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This interface represents expressions that access a field reference. * This interface represents expressions that access a field reference. e.g. a.b =>
* e.g. a.b => a is the expression, b is the field name. * a is the expression, b is the field name. e.g. a()->def => a() is the
* e.g. a()->def => a() is the expression, def is the field name. * expression, def is the field name.
* *
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public interface IASTFieldReference extends IASTExpression { public interface IASTFieldReference extends IASTExpression {
/** /**
* <code>FIELD_OWNER</code> represents the relationship between a <code>IASTFieldReference</code> and its <code>IASTExpression</code> field owner. * <code>FIELD_OWNER</code> represents the relationship between a
*/ * <code>IASTFieldReference</code> and its <code>IASTExpression</code>
public static final ASTNodeProperty FIELD_OWNER = new ASTNodeProperty( "Field Owner"); //$NON-NLS-1$ * field owner.
/** */
* <code>FIELD_NAME</code> represents the relationship between a <code>IASTFieldReference</code> and its <code>IASTName</code> field name. public static final ASTNodeProperty FIELD_OWNER = new ASTNodeProperty(
*/ "Field Owner"); //$NON-NLS-1$
public static final ASTNodeProperty FIELD_NAME = new ASTNodeProperty( "Field Name"); //$NON-NLS-1$
/**
* <code>FIELD_NAME</code> represents the relationship between a
* <code>IASTFieldReference</code> and its <code>IASTName</code> field
* name.
*/
public static final ASTNodeProperty FIELD_NAME = new ASTNodeProperty(
"Field Name"); //$NON-NLS-1$
/** /**
* This returns an expression for the object containing the field. * This returns an expression for the object containing the field.
* *
* @return the field owner * @return the field owner
*/ */
public IASTExpression getFieldOwner(); public IASTExpression getFieldOwner();
/** /**
* Set the expression for the object containing the field. * Set the expression for the object containing the field.
* *
* @param expression * @param expression
*/ */
public void setFieldOwner( IASTExpression expression ); public void setFieldOwner(IASTExpression expression);
/** /**
* This returns the name of the field being dereferenced. * This returns the name of the field being dereferenced.
* *
* @return the name of the field (<code>IASTName</code>) * @return the name of the field (<code>IASTName</code>)
*/ */
public IASTName getFieldName(); public IASTName getFieldName();
/** /**
* Set the name of the field. * Set the name of the field.
* *
* @param name <code>IASTName</code> * @param name
* <code>IASTName</code>
*/ */
public void setFieldName( IASTName name ); public void setFieldName(IASTName name);
/** /**
* This returns true of this is the arrow operator and not the * This returns true of this is the arrow operator and not the dot operator.
* dot operator.
* *
* @return is this a pointer dereference * @return is this a pointer dereference
*/ */
public boolean isPointerDereference(); public boolean isPointerDereference();
/** /**
* Set whether or not this is a pointer dereference (default == no). * Set whether or not this is a pointer dereference (default == no).
* @param value boolean *
* @param value
* boolean
*/ */
public void setIsPointerDereference( boolean value ); public void setIsPointerDereference(boolean value);
} }

View file

@ -11,62 +11,81 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* The for statement. The initialization clause can be an expression or * The for statement. The initialization clause can be an expression or a
* a declaration but not both. * declaration but not both.
* *
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public interface IASTForStatement extends IASTStatement { public interface IASTForStatement extends IASTStatement {
/** /**
* <code>INITEXPRESSION</code> represents the relationship between a <code>IASTForStatement</code> and its <code>IASTExpression</code> initializer. * <code>INITEXPRESSION</code> represents the relationship between a
*/ * <code>IASTForStatement</code> and its <code>IASTExpression</code>
public static final ASTNodeProperty INITEXPRESSION = new ASTNodeProperty("initExpression"); //$NON-NLS-1$ * initializer.
/** */
* <code>INITDECLARATION</code> represents the relationship between a <code>IASTForStatement</code> and its <code>IASTDeclaration</code> initializer. public static final ASTNodeProperty INITEXPRESSION = new ASTNodeProperty(
*/ "initExpression"); //$NON-NLS-1$
public static final ASTNodeProperty INITDECLARATION = new ASTNodeProperty("initDeclaration"); //$NON-NLS-1$
/**
* <code>CONDITION</code> represents the relationship between a <code>IASTForStatement</code> and its <code>IASTExpression</code> condition.
*/
public static final ASTNodeProperty CONDITION = new ASTNodeProperty("condition"); //$NON-NLS-1$
/**
* <code>ITERATION</code> represents the relationship between a <code>IASTForStatement</code> and its <code>IASTExpression</code> iteration expression.
*/
public static final ASTNodeProperty ITERATION = new ASTNodeProperty("iteration"); //$NON-NLS-1$
/**
* <code>BODY</code> represents the relationship between a <code>IASTForStatement</code> and its <code>IASTStatement</code> body.
*/
public static final ASTNodeProperty BODY = new ASTNodeProperty("body"); //$NON-NLS-1$
/** /**
* Get the initial expression for the loop. Returns null if there is * <code>INITDECLARATION</code> represents the relationship between a
* none. You can not have both an initial expression and an initial * <code>IASTForStatement</code> and its <code>IASTDeclaration</code>
* declaration. * initializer.
*/
public static final ASTNodeProperty INITDECLARATION = new ASTNodeProperty(
"initDeclaration"); //$NON-NLS-1$
/**
* <code>CONDITION</code> represents the relationship between a
* <code>IASTForStatement</code> and its <code>IASTExpression</code>
* condition.
*/
public static final ASTNodeProperty CONDITION = new ASTNodeProperty(
"condition"); //$NON-NLS-1$
/**
* <code>ITERATION</code> represents the relationship between a
* <code>IASTForStatement</code> and its <code>IASTExpression</code>
* iteration expression.
*/
public static final ASTNodeProperty ITERATION = new ASTNodeProperty(
"iteration"); //$NON-NLS-1$
/**
* <code>BODY</code> represents the relationship between a
* <code>IASTForStatement</code> and its <code>IASTStatement</code>
* body.
*/
public static final ASTNodeProperty BODY = new ASTNodeProperty("body"); //$NON-NLS-1$
/**
* Get the initial expression for the loop. Returns null if there is none.
* You can not have both an initial expression and an initial declaration.
* *
* @return <code>IASTExpression</code> * @return <code>IASTExpression</code>
*/ */
public IASTExpression getInitExpression(); public IASTExpression getInitExpression();
/** /**
* Set the initial expression for the loop. * Set the initial expression for the loop.
* *
* @param expression <code>IASTExpression</code> * @param expression
* <code>IASTExpression</code>
*/ */
public void setInit(IASTExpression expression); public void setInit(IASTExpression expression);
/** /**
* Get the initial declaration for the loop. Returns null if there is * Get the initial declaration for the loop. Returns null if there is none.
* none. You can not have both an initial declaration and an initial * You can not have both an initial declaration and an initial declaration.
* declaration.
* *
* @return <code>IASTDeclaration</code> * @return <code>IASTDeclaration</code>
*/ */
public IASTDeclaration getInitDeclaration(); public IASTDeclaration getInitDeclaration();
/** /**
* Set the intiial declaration for the loop. * Set the intiial declaration for the loop.
* *
* @param declaration <code>IASTDeclaration</code> * @param declaration
* <code>IASTDeclaration</code>
*/ */
public void setInit(IASTDeclaration declaration); public void setInit(IASTDeclaration declaration);
@ -76,11 +95,12 @@ public interface IASTForStatement extends IASTStatement {
* @return <code>IASTExpression</code> * @return <code>IASTExpression</code>
*/ */
public IASTExpression getCondition(); public IASTExpression getCondition();
/** /**
* Set the condition expression for the loop. * Set the condition expression for the loop.
* *
* @param condition <code>IASTExpression</code> * @param condition
* <code>IASTExpression</code>
*/ */
public void setCondition(IASTExpression condition); public void setCondition(IASTExpression condition);
@ -93,28 +113,33 @@ public interface IASTForStatement extends IASTStatement {
public IASTExpression getIterationExpression(); public IASTExpression getIterationExpression();
/** /**
* Set the expression that is evaluated after the completion of an iteration of the loop. * Set the expression that is evaluated after the completion of an iteration
* of the loop.
* *
* @param iterator <code>IASTExpression</code> * @param iterator
* <code>IASTExpression</code>
*/ */
public void setIterationExpression(IASTExpression iterator); public void setIterationExpression(IASTExpression iterator);
/** /**
* Get the statements that this for loop controls. * Get the statements that this for loop controls.
* *
* @return <code>IASTStatement</code> * @return <code>IASTStatement</code>
*/ */
public IASTStatement getBody(); public IASTStatement getBody();
/** /**
* Set the body of the for loop. * Set the body of the for loop.
* *
* @param statement <code>IASTStatement</code> * @param statement
* <code>IASTStatement</code>
*/ */
public void setBody( IASTStatement statement ); public void setBody(IASTStatement statement);
/** /**
* Get the <code>IScope</code> represented by this for loop. * Get the <code>IScope</code> represented by this for loop.
*
* @return <code>IScope</code> * @return <code>IScope</code>
*/ */
public IScope getScope(); public IScope getScope();
} }

View file

@ -10,42 +10,57 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This interface represents a function call expression. * This interface represents a function call expression. f( x ) : f is the
* f( x ) : f is the function name expression, x is the parameter expression. * function name expression, x is the parameter expression.
* *
* @author jcamelon * @author jcamelon
*/ */
public interface IASTFunctionCallExpression extends IASTExpression { public interface IASTFunctionCallExpression extends IASTExpression {
/**
/** * <code>FUNCTION_NAME</code> represents the relationship between a
* <code>FUNCTION_NAME</code> represents the relationship between a <code>IASTFunctionCallExpression</code> and its <code>IASTExpression</code> (function name). * <code>IASTFunctionCallExpression</code> and its
*/ * <code>IASTExpression</code> (function name).
public static final ASTNodeProperty FUNCTION_NAME = new ASTNodeProperty( "Function Name"); //$NON-NLS-1$ */
/** public static final ASTNodeProperty FUNCTION_NAME = new ASTNodeProperty(
* Set the function name expression. "Function Name"); //$NON-NLS-1$
* @param expression <code>IASTExpression</code> representing the function name
*/ /**
public void setFunctionNameExpression( IASTExpression expression ); * Set the function name expression.
/** *
* Get the function name expression. * @param expression
* @return <code>IASTExpression</code> representing the function name * <code>IASTExpression</code> representing the function name
*/ */
public IASTExpression getFunctionNameExpression(); public void setFunctionNameExpression(IASTExpression expression);
/** /**
* <code>PARAMETERS</code> represents the relationship between a <code>IASTFunctionCallExpression</code> and its <code>IASTExpression</code> (parameters). * Get the function name expression.
*/ *
public static final ASTNodeProperty PARAMETERS = new ASTNodeProperty( "Parameters"); //$NON-NLS-1$ * @return <code>IASTExpression</code> representing the function name
/** */
* Set the parameters expression. public IASTExpression getFunctionNameExpression();
* @param expression <code>IASTExpression</code> representing the parameters
*/ /**
public void setParameterExpression( IASTExpression expression ); * <code>PARAMETERS</code> represents the relationship between a
/** * <code>IASTFunctionCallExpression</code> and its
* Get the parameter expression. * <code>IASTExpression</code> (parameters).
* @return <code>IASTExpression</code> representing the parameters */
*/ public static final ASTNodeProperty PARAMETERS = new ASTNodeProperty(
public IASTExpression getParameterExpression(); "Parameters"); //$NON-NLS-1$
/**
* Set the parameters expression.
*
* @param expression
* <code>IASTExpression</code> representing the parameters
*/
public void setParameterExpression(IASTExpression expression);
/**
* Get the parameter expression.
*
* @return <code>IASTExpression</code> representing the parameters
*/
public IASTExpression getParameterExpression();
} }

View file

@ -10,7 +10,6 @@
**********************************************************************/ **********************************************************************/
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This is a declarator for a function. * This is a declarator for a function.
* *

View file

@ -18,19 +18,29 @@ package org.eclipse.cdt.core.dom.ast;
public interface IASTFunctionDefinition extends IASTDeclaration { public interface IASTFunctionDefinition extends IASTDeclaration {
/** /**
* <code>DECL_SPECIFIER</code> represents the relationship between a <code>IASTFunctionDefinition</code> and its <code>IASTDeclSpecifier</code>. * <code>DECL_SPECIFIER</code> represents the relationship between a
* <code>IASTFunctionDefinition</code> and its
* <code>IASTDeclSpecifier</code>.
*/ */
public static final ASTNodeProperty DECL_SPECIFIER = new ASTNodeProperty( "Decl Specifier"); //$NON-NLS-1$ public static final ASTNodeProperty DECL_SPECIFIER = new ASTNodeProperty(
/** "Decl Specifier"); //$NON-NLS-1$
* <code>DECLARATOR</code> represents the relationship between a <code>IASTFunctionDefinition</code> and its <code>IASTFunctionDeclarator</code>.
*/
public static final ASTNodeProperty DECLARATOR = new ASTNodeProperty( "Declarator"); //$NON-NLS-1$
/**
* <code>FUNCTION_BODY</code> represents the relationship between a <code>IASTFunctionDefinition</code> and its <code>IASTStatement</code>.
*/
public static final ASTNodeProperty FUNCTION_BODY = new ASTNodeProperty( "Function Body"); //$NON-NLS-1$
/** /**
* <code>DECLARATOR</code> represents the relationship between a
* <code>IASTFunctionDefinition</code> and its
* <code>IASTFunctionDeclarator</code>.
*/
public static final ASTNodeProperty DECLARATOR = new ASTNodeProperty(
"Declarator"); //$NON-NLS-1$
/**
* <code>FUNCTION_BODY</code> represents the relationship between a
* <code>IASTFunctionDefinition</code> and its <code>IASTStatement</code>.
*/
public static final ASTNodeProperty FUNCTION_BODY = new ASTNodeProperty(
"Function Body"); //$NON-NLS-1$
/**
* Get the decl specifier for the function. * Get the decl specifier for the function.
* *
* @return * @return
@ -42,40 +52,42 @@ public interface IASTFunctionDefinition extends IASTDeclaration {
* *
* @param declSpec * @param declSpec
*/ */
public void setDeclSpecifier( IASTDeclSpecifier declSpec ); public void setDeclSpecifier(IASTDeclSpecifier declSpec);
/** /**
* Get the declarator for the function. * Get the declarator for the function.
* *
* @return * @return
*/ */
public IASTFunctionDeclarator getDeclarator(); public IASTFunctionDeclarator getDeclarator();
/** /**
* Set the declarator for the function. * Set the declarator for the function.
* *
* @param declarator * @param declarator
*/ */
public void setDeclarator( IASTFunctionDeclarator declarator ); public void setDeclarator(IASTFunctionDeclarator declarator);
/** /**
* Get the body of the function. This is usually a compound statement * Get the body of the function. This is usually a compound statement but
* but C++ also has a function try block. * C++ also has a function try block.
* *
* @return * @return
*/ */
public IASTStatement getBody(); public IASTStatement getBody();
/** /**
* Set the body of the function. * Set the body of the function.
*
* @param statement * @param statement
*/ */
public void setBody( IASTStatement statement ); public void setBody(IASTStatement statement);
/** /**
* Get the logical IScope that the function definition body represents. * Get the logical IScope that the function definition body represents.
*
* @return <code>IScope</code> representing function body. * @return <code>IScope</code> representing function body.
*/ */
public IScope getScope(); public IScope getScope();
} }

View file

@ -11,20 +11,21 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This interface represents the name of a function style macro parameter. * This interface represents the name of a function style macro parameter. This
* This is not an IASTName, as there are not any bindings for * is not an IASTName, as there are not any bindings for
* *
* @author jcamelon * @author jcamelon
*/ */
public interface IASTFunctionStyleMacroParameter extends IASTNode { public interface IASTFunctionStyleMacroParameter extends IASTNode {
/** /**
* Constant <code>EMPTY_PARAMETER_ARRAY</code> is used to return anempty array. * Constant <code>EMPTY_PARAMETER_ARRAY</code> is used to return anempty
* array.
*/ */
public static final IASTFunctionStyleMacroParameter[] EMPTY_PARAMETER_ARRAY = new IASTFunctionStyleMacroParameter[0]; public static final IASTFunctionStyleMacroParameter[] EMPTY_PARAMETER_ARRAY = new IASTFunctionStyleMacroParameter[0];
/** /**
* Get the parameter name. * Get the parameter name.
* *
* @return String name * @return String name
*/ */
@ -33,7 +34,8 @@ public interface IASTFunctionStyleMacroParameter extends IASTNode {
/** /**
* Set the parameter name. * Set the parameter name.
* *
* @param value String * @param value
* String
*/ */
public void setParameter(String value); public void setParameter(String value);

View file

@ -17,7 +17,7 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTGotoStatement extends IASTStatement { public interface IASTGotoStatement extends IASTStatement {
public static final ASTNodeProperty NAME = new ASTNodeProperty("name"); //$NON-NLS-1$ public static final ASTNodeProperty NAME = new ASTNodeProperty("name"); //$NON-NLS-1$
/** /**
* Returns the name of the label. The name resolves to a ILabel binding. * Returns the name of the label. The name resolves to a ILabel binding.
@ -25,12 +25,13 @@ public interface IASTGotoStatement extends IASTStatement {
* @return <code>IASTName</code> * @return <code>IASTName</code>
*/ */
public IASTName getName(); public IASTName getName();
/** /**
* Set the name for a goto statement label. * Set the name for a goto statement label.
* *
* @param name <code>IASTName</code> * @param name
* <code>IASTName</code>
*/ */
public void setName(IASTName name); public void setName(IASTName name);
} }

View file

@ -17,21 +17,24 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTIdExpression extends IASTExpression { public interface IASTIdExpression extends IASTExpression {
/** /**
* <code>ID_NAME</code> represents the relationship between an <code>IASTIdExpression</code> and a <code>IASTName</code>. * <code>ID_NAME</code> represents the relationship between an
*/ * <code>IASTIdExpression</code> and a <code>IASTName</code>.
public static final ASTNodeProperty ID_NAME = new ASTNodeProperty( "IdExpression Name"); //$NON-NLS-1$ */
public static final ASTNodeProperty ID_NAME = new ASTNodeProperty(
"IdExpression Name"); //$NON-NLS-1$
/** /**
* Returns the name used in the expression. * Returns the name used in the expression.
* *
* @return the name * @return the name
*/ */
public IASTName getName(); public IASTName getName();
/** /**
* Set the name to be used inthe expression. * Set the name to be used inthe expression.
* *
* @param name * @param name
*/ */
public void setName( IASTName name ); public void setName(IASTName name);
} }

View file

@ -17,18 +17,26 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTIfStatement extends IASTStatement { public interface IASTIfStatement extends IASTStatement {
/** /**
* <code>CONDITION</code> represents the relationship between an <code>IASTIfStatement</code> and its nested <code>IASTExpression</code>. * <code>CONDITION</code> represents the relationship between an
*/ * <code>IASTIfStatement</code> and its nested <code>IASTExpression</code>.
public static final ASTNodeProperty CONDITION = new ASTNodeProperty("condition"); //$NON-NLS-1$ */
/** public static final ASTNodeProperty CONDITION = new ASTNodeProperty(
* <code>THEN</code> represents the relationship between an <code>IASTIfStatement</code> and its nested <code>IASTStatement</code> (then). "condition"); //$NON-NLS-1$
*/
public static final ASTNodeProperty THEN = new ASTNodeProperty("then"); //$NON-NLS-1$ /**
/** * <code>THEN</code> represents the relationship between an
* <code>ELSE</code> represents the relationship between an <code>IASTIfStatement</code> and its nested <code>IASTStatement</code> (else). * <code>IASTIfStatement</code> and its nested <code>IASTStatement</code>
*/ * (then).
public static final ASTNodeProperty ELSE = new ASTNodeProperty("else"); //$NON-NLS-1$ */
public static final ASTNodeProperty THEN = new ASTNodeProperty("then"); //$NON-NLS-1$
/**
* <code>ELSE</code> represents the relationship between an
* <code>IASTIfStatement</code> and its nested <code>IASTStatement</code>
* (else).
*/
public static final ASTNodeProperty ELSE = new ASTNodeProperty("else"); //$NON-NLS-1$
/** /**
* Get the condition in the if statement. * Get the condition in the if statement.
@ -36,40 +44,44 @@ public interface IASTIfStatement extends IASTStatement {
* @return the condition <code>IASTExpression</code> * @return the condition <code>IASTExpression</code>
*/ */
public IASTExpression getCondition(); public IASTExpression getCondition();
/** /**
* Set the condition in the if statement. * Set the condition in the if statement.
* @param condition <code>IASTExpression</code> *
* @param condition
* <code>IASTExpression</code>
*/ */
public void setCondition(IASTExpression condition); public void setCondition(IASTExpression condition);
/** /**
* Get the statement that is executed if the condition is true. * Get the statement that is executed if the condition is true.
* *
* @return the then clause <code>IASTStatement</code> * @return the then clause <code>IASTStatement</code>
*/ */
public IASTStatement getThenClause(); public IASTStatement getThenClause();
/** /**
* Set the statement that is executed if the condition is true. * Set the statement that is executed if the condition is true.
* *
* @param thenClause <code>IASTStatement</code> * @param thenClause
* <code>IASTStatement</code>
*/ */
public void setThenClause(IASTStatement thenClause); public void setThenClause(IASTStatement thenClause);
/** /**
* Get the statement that is executed if the condition is false. This * Get the statement that is executed if the condition is false. This clause
* clause is optional and returns null if there is none. * is optional and returns null if there is none.
* *
* @return the else clause or null <code>IASTStatement</code> * @return the else clause or null <code>IASTStatement</code>
*/ */
public IASTStatement getElseClause(); public IASTStatement getElseClause();
/** /**
* Set the else clause. * Set the else clause.
* *
* @param elseClause <code>IASTStatement</code> * @param elseClause
* <code>IASTStatement</code>
*/ */
public void setElseClause(IASTStatement elseClause); public void setElseClause(IASTStatement elseClause);
} }

View file

@ -16,10 +16,10 @@ package org.eclipse.cdt.core.dom.ast;
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public interface IASTInitializer extends IASTNode { public interface IASTInitializer extends IASTNode {
/** /**
* Constant. * Constant.
*/ */
public final static IASTInitializer[] EMPTY_INITIALIZER_ARRAY = new IASTInitializer[0]; public final static IASTInitializer[] EMPTY_INITIALIZER_ARRAY = new IASTInitializer[0];
} }

View file

@ -17,21 +17,25 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTInitializerExpression extends IASTInitializer { public interface IASTInitializerExpression extends IASTInitializer {
/** /**
* <code>INITIALIZER_EXPRESSION</code> represents the relationship between an <code>IASTInitializerExpression</code>. and its <code></code>IASTExpression</code>. * <code>INITIALIZER_EXPRESSION</code> represents the relationship between
*/ * an <code>IASTInitializerExpression</code>. and its <code></code>IASTExpression</code>.
public static final ASTNodeProperty INITIALIZER_EXPRESSION = new ASTNodeProperty( "Initializer Expression"); //$NON-NLS-1$ */
public static final ASTNodeProperty INITIALIZER_EXPRESSION = new ASTNodeProperty(
"Initializer Expression"); //$NON-NLS-1$
/** /**
* Get the expression for the initializer. * Get the expression for the initializer.
* *
* @return <code>IASTExpression</code> * @return <code>IASTExpression</code>
*/ */
public IASTExpression getExpression(); public IASTExpression getExpression();
/** /**
* Set the initializer's expression. * Set the initializer's expression.
* *
* @param expression <code>IASTExpression</code> * @param expression
* <code>IASTExpression</code>
*/ */
public void setExpression( IASTExpression expression ); public void setExpression(IASTExpression expression);
} }

View file

@ -10,7 +10,6 @@
**********************************************************************/ **********************************************************************/
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This is an an initializer that is a list of initializers. * This is an an initializer that is a list of initializers.
* *
@ -18,10 +17,12 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTInitializerList extends IASTInitializer { public interface IASTInitializerList extends IASTInitializer {
/** /**
* <code>NESTED_INITIALIZER</code> describes the relationship between an <code>IASTInitializerList</code> and its sub-<code>IASTInitializer</code>s. * <code>NESTED_INITIALIZER</code> describes the relationship between an
*/ * <code>IASTInitializerList</code> and its sub-<code>IASTInitializer</code>s.
public static final ASTNodeProperty NESTED_INITIALIZER = new ASTNodeProperty( "Nested Initializer" ); //$NON-NLS-1$ */
public static final ASTNodeProperty NESTED_INITIALIZER = new ASTNodeProperty(
"Nested Initializer"); //$NON-NLS-1$
/** /**
* Get the list of initializers. * Get the list of initializers.
@ -29,11 +30,12 @@ public interface IASTInitializerList extends IASTInitializer {
* @return <code>IASTInitializer[]</code> array of initializers * @return <code>IASTInitializer[]</code> array of initializers
*/ */
public IASTInitializer[] getInitializers(); public IASTInitializer[] getInitializers();
/** /**
* Add an initializer to the initializer list. * Add an initializer to the initializer list.
* *
* @param initializer <code>IASTInitializer</code> * @param initializer
* <code>IASTInitializer</code>
*/ */
public void addInitializer( IASTInitializer initializer ); public void addInitializer(IASTInitializer initializer);
} }

View file

@ -17,7 +17,7 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTLabelStatement extends IASTStatement { public interface IASTLabelStatement extends IASTStatement {
public static final ASTNodeProperty NAME = new ASTNodeProperty("name"); //$NON-NLS-1$ public static final ASTNodeProperty NAME = new ASTNodeProperty("name"); //$NON-NLS-1$
/** /**
* The name for the label. The name resolves to an ILabel binding. * The name for the label. The name resolves to an ILabel binding.
@ -32,5 +32,5 @@ public interface IASTLabelStatement extends IASTStatement {
* @param name * @param name
*/ */
public void setName(IASTName name); public void setName(IASTName name);
} }

View file

@ -17,45 +17,51 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTLiteralExpression extends IASTExpression { public interface IASTLiteralExpression extends IASTExpression {
/** /**
* An integer literal e.g. 5 * An integer literal e.g. 5
*/ */
public static final int lk_integer_constant = 0; public static final int lk_integer_constant = 0;
/**
* A floating point literal e.g. 6.0 /**
*/ * A floating point literal e.g. 6.0
public static final int lk_float_constant = 1; */
/** public static final int lk_float_constant = 1;
* A char literal e.g. 'abc'
*/ /**
public static final int lk_char_constant = 2; * A char literal e.g. 'abc'
/** */
* A string literal e.g. "abcdefg" public static final int lk_char_constant = 2;
*/
public static final int lk_string_literal = 3; /**
/** * A string literal e.g. "abcdefg"
* A constant defined for subclasses to extend from. */
*/ public static final int lk_string_literal = 3;
public static final int lk_last = lk_string_literal;
/**
/** * A constant defined for subclasses to extend from.
* Get the literal expression kind. */
* public static final int lk_last = lk_string_literal;
* @return int
*/ /**
public int getKind(); * Get the literal expression kind.
/** *
* Set the literal expression kind. * @return int
* */
* @param value int public int getKind();
*/
public void setKind( int value ); /**
* Set the literal expression kind.
/** *
* Set the value of the literal expression. * @param value
* * int
* @param value */
*/ public void setKind(int value);
public void setValue( String value );
/**
* Set the value of the literal expression.
*
* @param value
*/
public void setValue(String value);
} }

View file

@ -11,9 +11,9 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* A Macro expansion is a node location. * A Macro expansion is a node location. Nodes that have locations that arrive
* Nodes that have locations that arrive through the expansion of preprocessor macros * through the expansion of preprocessor macros will refer to these type of
* will refer to these type of objects. * objects.
* *
* @author Doug Schaefer * @author Doug Schaefer
*/ */
@ -33,5 +33,5 @@ public interface IASTMacroExpansion extends IASTNodeLocation {
* @return * @return
*/ */
public IASTNodeLocation[] getExpansionLocations(); public IASTNodeLocation[] getExpansionLocations();
} }

View file

@ -11,8 +11,8 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This class represents a name in the program that represents a semantic * This class represents a name in the program that represents a semantic object
* object in the program. * in the program.
* *
* The toString method produces a string representation of the name as * The toString method produces a string representation of the name as
* appropriate for the language. * appropriate for the language.
@ -20,9 +20,9 @@ package org.eclipse.cdt.core.dom.ast;
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public interface IASTName extends IASTNode { public interface IASTName extends IASTNode {
/** /**
* Constant sentinel. * Constant sentinel.
*/ */
public static final IASTName[] EMPTY_NAME_ARRAY = new IASTName[0]; public static final IASTName[] EMPTY_NAME_ARRAY = new IASTName[0];
@ -32,15 +32,15 @@ public interface IASTName extends IASTNode {
* @return <code>IBinding</code> binding * @return <code>IBinding</code> binding
*/ */
public IBinding resolveBinding(); public IBinding resolveBinding();
/** /**
* Return a list of bindings in the scope of the name that have the * Return a list of bindings in the scope of the name that have the name as
* name as a prefix. * a prefix.
* *
* @return <code>IBinding []</code> bindings that start with this name * @return <code>IBinding []</code> bindings that start with this name
*/ */
public IBinding[] resolvePrefix(); public IBinding[] resolvePrefix();
/** /**
* Return a char array representation of the name. * Return a char array representation of the name.
* *

View file

@ -11,30 +11,32 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* Represents the use of a typedef name in an decl specifier in C. * Represents the use of a typedef name in an decl specifier in C. Also used for
* Also used for class/struct/union names in C. * class/struct/union names in C.
* *
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public interface IASTNamedTypeSpecifier extends IASTDeclSpecifier { public interface IASTNamedTypeSpecifier extends IASTDeclSpecifier {
/** /**
* <code>NAME</code> describes the relationship between an <code>IASTNamedTypeSpecifier</code> and its nested <code>IASTName</code>. * <code>NAME</code> describes the relationship between an
* <code>IASTNamedTypeSpecifier</code> and its nested
* <code>IASTName</code>.
*/ */
public static final ASTNodeProperty NAME = new ASTNodeProperty( "Name"); //$NON-NLS-1$ public static final ASTNodeProperty NAME = new ASTNodeProperty("Name"); //$NON-NLS-1$
/** /**
* Get the name. * Get the name.
* *
* @return the typedef name. * @return the typedef name.
*/ */
public IASTName getName(); public IASTName getName();
/** /**
* Set the name. * Set the name.
* *
* @param name * @param name
*/ */
public void setName( IASTName name ); public void setName(IASTName name);
} }

View file

@ -52,9 +52,10 @@ public interface IASTNode {
public IASTNode getParent(); public IASTNode getParent();
/** /**
* Set the parent node of this node in the tree. * Set the parent node of this node in the tree.
* *
* @param node <code>IASTNode</code> * @param node
* <code>IASTNode</code>
*/ */
public void setParent(IASTNode node); public void setParent(IASTNode node);
@ -67,15 +68,15 @@ public interface IASTNode {
public ASTNodeProperty getPropertyInParent(); public ASTNodeProperty getPropertyInParent();
/** /**
* Set the parent property of the node. * Set the parent property of the node.
* *
* @param property * @param property
*/ */
public void setPropertyInParent(ASTNodeProperty property); public void setPropertyInParent(ASTNodeProperty property);
/** /**
* Abstract method to be overriden by all subclasses. * Abstract method to be overriden by all subclasses. Necessary for
* Necessary for visitation of the tree using an <code>ASTVisitor</code>. * visitation of the tree using an <code>ASTVisitor</code>.
* *
* @param visitor * @param visitor
* @return continue on (true) or quit( false ) * @return continue on (true) or quit( false )

View file

@ -11,22 +11,21 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* A NodeLocation represents the source location of a given node. Most * A NodeLocation represents the source location of a given node. Most often
* often this is a file it may be other fancy things like macro * this is a file it may be other fancy things like macro expansions.
* expansions.
* *
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public interface IASTNodeLocation { public interface IASTNodeLocation {
/** /**
* This is the offset into the actual source location that this node * This is the offset into the actual source location that this node starts
* starts at. * at.
* *
* @return * @return
*/ */
public int getNodeOffset(); public int getNodeOffset();
/** /**
* This is the length of the node contained in this location. * This is the length of the node contained in this location.
* *

View file

@ -9,10 +9,8 @@
* IBM Rational Software - Initial API and implementation */ * IBM Rational Software - Initial API and implementation */
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This node represents a null statement. * This node represents a null statement. ';'
* ';'
* *
* @author jcamelon * @author jcamelon
*/ */

View file

@ -16,46 +16,55 @@ package org.eclipse.cdt.core.dom.ast;
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public interface IASTParameterDeclaration extends IASTNode { public interface IASTParameterDeclaration extends IASTNode {
/**
* Constant/sentinel.
*/
public static final IASTParameterDeclaration [] EMPTY_PARAMETERDECLARATION_ARRAY = new IASTParameterDeclaration[0];
/** /**
* <code>DECL_SPECIFIER</code> represents the relationship between an <code>IASTParameterDeclaration</code> and its nested <code>IASTDeclSpecifier</code>. * Constant/sentinel.
*/ */
public static final ASTNodeProperty DECL_SPECIFIER = new ASTNodeProperty( "Decl Specifier"); //$NON-NLS-1$ public static final IASTParameterDeclaration[] EMPTY_PARAMETERDECLARATION_ARRAY = new IASTParameterDeclaration[0];
/**
* <code>DECLARATOR</code> represents the relationship between an <code>IASTParameterDeclaration</code> and its nested <code>IASTDeclarator</code>.
*/
public static final ASTNodeProperty DECLARATOR = new ASTNodeProperty( "Declarator"); //$NON-NLS-1$
/**
* Get the decl specifier.
*
* @return <code>IASTDeclSpecifier</code>
*/
public IASTDeclSpecifier getDeclSpecifier();
/** /**
* Get the declarator. * <code>DECL_SPECIFIER</code> represents the relationship between an
* <code>IASTParameterDeclaration</code> and its nested
* <code>IASTDeclSpecifier</code>.
*/
public static final ASTNodeProperty DECL_SPECIFIER = new ASTNodeProperty(
"Decl Specifier"); //$NON-NLS-1$
/**
* <code>DECLARATOR</code> represents the relationship between an
* <code>IASTParameterDeclaration</code> and its nested
* <code>IASTDeclarator</code>.
*/
public static final ASTNodeProperty DECLARATOR = new ASTNodeProperty(
"Declarator"); //$NON-NLS-1$
/**
* Get the decl specifier.
*
* @return <code>IASTDeclSpecifier</code>
*/
public IASTDeclSpecifier getDeclSpecifier();
/**
* Get the declarator.
* *
* @return <code>IASTDeclarator</code> * @return <code>IASTDeclarator</code>
*/ */
public IASTDeclarator getDeclarator(); public IASTDeclarator getDeclarator();
/** /**
* Set the decl specifier. * Set the decl specifier.
* *
* @param declSpec <code>IASTDeclSpecifier</code>. * @param declSpec
*/ * <code>IASTDeclSpecifier</code>.
public void setDeclSpecifier(IASTDeclSpecifier declSpec); */
public void setDeclSpecifier(IASTDeclSpecifier declSpec);
/**
* Set the declarator.
*
* @param declarator
* <code>IASTDeclarator</code>
*/
public void setDeclarator(IASTDeclarator declarator);
/**
* Set the declarator.
*
* @param declarator <code>IASTDeclarator</code>
*/
public void setDeclarator(IASTDeclarator declarator);
} }

View file

@ -24,24 +24,28 @@ public interface IASTPointer extends IASTPointerOperator {
* @return boolean * @return boolean
*/ */
public boolean isConst(); public boolean isConst();
/** /**
* Is this a volatile pointer? * Is this a volatile pointer?
* *
* @return boolean * @return boolean
*/ */
public boolean isVolatile(); public boolean isVolatile();
/** /**
* Set this to be a const pointer (true/false). * Set this to be a const pointer (true/false).
* *
* @param value - the value * @param value -
* the value
*/ */
public void setConst( boolean value ); public void setConst(boolean value);
/** /**
* Set this to be a volatile pointer (true/false). * Set this to be a volatile pointer (true/false).
* *
* @param value - the value * @param value -
* the value
*/ */
public void setVolatile( boolean value ); public void setVolatile(boolean value);
} }

View file

@ -15,9 +15,9 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTPointerOperator extends IASTNode { public interface IASTPointerOperator extends IASTNode {
/** /**
* Constant/sentinel. * Constant/sentinel.
*/ */
public static final IASTPointerOperator[] EMPTY_ARRAY = new IASTPointerOperator[0]; public static final IASTPointerOperator[] EMPTY_ARRAY = new IASTPointerOperator[0];
} }

View file

@ -15,13 +15,14 @@ package org.eclipse.cdt.core.dom.ast;
* *
* @author jcamelon * @author jcamelon
*/ */
public interface IASTPreprocessorElifStatement extends IASTPreprocessorStatement { public interface IASTPreprocessorElifStatement extends
IASTPreprocessorStatement {
/**
* Was this #elif branch taken?
*
* @return boolean
*/
public boolean taken();
/**
* Was this #elif branch taken?
*
* @return boolean
*/
public boolean taken();
} }

View file

@ -15,11 +15,13 @@ package org.eclipse.cdt.core.dom.ast;
* *
* @author jcamelon * @author jcamelon
*/ */
public interface IASTPreprocessorElseStatement extends IASTPreprocessorStatement { public interface IASTPreprocessorElseStatement extends
IASTPreprocessorStatement {
/** /**
* Was this #else branch taken? * Was this #else branch taken?
* @return boolean *
*/ * @return boolean
public boolean taken(); */
public boolean taken();
} }

View file

@ -12,8 +12,10 @@ package org.eclipse.cdt.core.dom.ast;
/** /**
* This interface represent a preprocessor #endif statement. * This interface represent a preprocessor #endif statement.
*
* @author jcamelon * @author jcamelon
*/ */
public interface IASTPreprocessorEndifStatement extends IASTPreprocessorStatement{ public interface IASTPreprocessorEndifStatement extends
IASTPreprocessorStatement {
} }

View file

@ -16,6 +16,6 @@ package org.eclipse.cdt.core.dom.ast;
* @author jcamelon * @author jcamelon
*/ */
public interface IASTPreprocessorErrorStatement extends public interface IASTPreprocessorErrorStatement extends
IASTPreprocessorStatement { IASTPreprocessorStatement {
} }

View file

@ -20,22 +20,24 @@ public interface IASTPreprocessorFunctionStyleMacroDefinition extends
IASTPreprocessorMacroDefinition { IASTPreprocessorMacroDefinition {
/** /**
* This property represents the relationship between a function style macro definition and one of its parameters. * This property represents the relationship between a function style macro
* definition and one of its parameters.
*/ */
public static final ASTNodeProperty PARAMETER = new ASTNodeProperty( public static final ASTNodeProperty PARAMETER = new ASTNodeProperty(
"Function Macro Parameter"); //$NON-NLS-1$ "Function Macro Parameter"); //$NON-NLS-1$
/** /**
* Get the macro parameters. * Get the macro parameters.
* *
* @return <code>IASTFunctionStyleMacroParameter[]</code> parameters * @return <code>IASTFunctionStyleMacroParameter[]</code> parameters
*/ */
public IASTFunctionStyleMacroParameter[] getParameters(); public IASTFunctionStyleMacroParameter[] getParameters();
/** /**
* Add a function-style macro parameter. * Add a function-style macro parameter.
* *
* @param parm <code>IASTFunctionStyleMacroParameter</code> * @param parm
* <code>IASTFunctionStyleMacroParameter</code>
*/ */
public void addParameter(IASTFunctionStyleMacroParameter parm); public void addParameter(IASTFunctionStyleMacroParameter parm);

View file

@ -12,14 +12,15 @@ package org.eclipse.cdt.core.dom.ast;
/** /**
* This interface represent a preprocessor #if statement. * This interface represent a preprocessor #if statement.
*
* @author jcamelon * @author jcamelon
*/ */
public interface IASTPreprocessorIfStatement extends IASTPreprocessorStatement { public interface IASTPreprocessorIfStatement extends IASTPreprocessorStatement {
/** /**
* Was this branch taken? * Was this branch taken?
* *
* @return boolean * @return boolean
*/ */
public boolean taken(); public boolean taken();
} }

View file

@ -12,13 +12,16 @@ package org.eclipse.cdt.core.dom.ast;
/** /**
* This interface represent a preprocessor #ifdef statement. * This interface represent a preprocessor #ifdef statement.
*
* @author jcamelon * @author jcamelon
*/ */
public interface IASTPreprocessorIfdefStatement extends IASTPreprocessorStatement { public interface IASTPreprocessorIfdefStatement extends
IASTPreprocessorStatement {
/** /**
* Was this #ifdef branch taken? * Was this #ifdef branch taken?
* @return *
*/ * @return
public boolean taken(); */
public boolean taken();
} }

View file

@ -16,11 +16,12 @@ package org.eclipse.cdt.core.dom.ast;
* @author jcamelon * @author jcamelon
*/ */
public interface IASTPreprocessorIfndefStatement extends public interface IASTPreprocessorIfndefStatement extends
IASTPreprocessorStatement { IASTPreprocessorStatement {
/** /**
* Was this branch taken? * Was this branch taken?
* @return *
*/ * @return
public boolean taken(); */
public boolean taken();
} }

View file

@ -12,6 +12,7 @@ package org.eclipse.cdt.core.dom.ast;
/** /**
* This interface represent a preprocessor #include statement. * This interface represent a preprocessor #include statement.
*
* @author jcamelon * @author jcamelon
*/ */
public interface IASTPreprocessorIncludeStatement extends public interface IASTPreprocessorIncludeStatement extends
@ -19,6 +20,7 @@ public interface IASTPreprocessorIncludeStatement extends
/** /**
* Get the full path filename of the file found through #include. * Get the full path filename of the file found through #include.
*
* @return * @return
*/ */
public String getPath(); public String getPath();

View file

@ -15,35 +15,42 @@ package org.eclipse.cdt.core.dom.ast;
* *
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public interface IASTPreprocessorMacroDefinition extends IASTPreprocessorStatement { public interface IASTPreprocessorMacroDefinition extends
IASTPreprocessorStatement {
/** /**
* <code>MACRO_NAME</code> describes the relationship between a macro definition and it's name. * <code>MACRO_NAME</code> describes the relationship between a macro
*/ * definition and it's name.
public static final ASTNodeProperty MACRO_NAME = new ASTNodeProperty( "Macro Name"); //$NON-NLS-1$ */
/** public static final ASTNodeProperty MACRO_NAME = new ASTNodeProperty(
* Get the macro name. "Macro Name"); //$NON-NLS-1$
*
* @return <code>IASTName</code> /**
*/ * Get the macro name.
public IASTName getName(); *
/** * @return <code>IASTName</code>
* Set the macro name. */
* public IASTName getName();
* @param name
*/ /**
public void setName( IASTName name ); * Set the macro name.
*
/** * @param name
* Get the macro expansion. */
* public void setName(IASTName name);
* @return String
*/ /**
public String getExpansion(); * Get the macro expansion.
/** *
* Set the macro expansion. * @return String
* */
* @param exp String public String getExpansion();
*/
public void setExpansion( String exp ); /**
* Set the macro expansion.
*
* @param exp
* String
*/
public void setExpansion(String exp);
} }

View file

@ -11,11 +11,12 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This interface represents an object-style macro definition. * This interface represents an object-style macro definition. e.g. #define
* e.g. #define ONE_TWO_THREE 123 * ONE_TWO_THREE 123
* *
* @author jcamelon * @author jcamelon
*/ */
public interface IASTPreprocessorObjectStyleMacroDefinition extends IASTPreprocessorMacroDefinition { public interface IASTPreprocessorObjectStyleMacroDefinition extends
IASTPreprocessorMacroDefinition {
} }

View file

@ -16,6 +16,6 @@ package org.eclipse.cdt.core.dom.ast;
* @author jcamelon * @author jcamelon
*/ */
public interface IASTPreprocessorPragmaStatement extends public interface IASTPreprocessorPragmaStatement extends
IASTPreprocessorStatement { IASTPreprocessorStatement {
} }

View file

@ -11,10 +11,11 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This interface represents a preprocessor #undef statement. * This interface represents a preprocessor #undef statement.
* *
* @author jcamelon * @author jcamelon
*/ */
public interface IASTPreprocessorUndefStatement extends IASTPreprocessorStatement { public interface IASTPreprocessorUndefStatement extends
IASTPreprocessorStatement {
} }

View file

@ -15,377 +15,394 @@ import org.eclipse.cdt.internal.core.parser.ParserMessages;
/** /**
* @author jcamelon * @author jcamelon
* *
* Description of a C/C++ parse/compilation problem, as detected by the parser or some of the underlying * Description of a C/C++ parse/compilation problem, as detected by the parser
* clients of the parser. * or some of the underlying clients of the parser.
* *
* A problem provides access to: * A problem provides access to:
* <ul> * <ul>
* <li> its location (originating source file name, source position, line number), </li> * <li> its location (originating source file name, source position, line
* <li> its message description and a predicate to check its severity (warning or error). </li> * number), </li>
* <li> its ID : an number identifying the very nature of this problem. All possible IDs are listed * <li> its message description and a predicate to check its severity (warning
* as constants on this interface. </li> * or error). </li>
* <li> its ID : an number identifying the very nature of this problem. All
* possible IDs are listed as constants on this interface. </li>
* </ul> * </ul>
*/ */
public interface IASTProblem extends IASTNode { public interface IASTProblem extends IASTNode {
/** /**
* Returns the problem id * Returns the problem id
* *
* @return the problem id * @return the problem id
*/ */
int getID(); int getID();
/** /**
* Answer a localized, human-readable message string which describes the problem. * Answer a localized, human-readable message string which describes the
* * problem.
* @return a localized, human-readable message string which describes the problem *
*/ * @return a localized, human-readable message string which describes the
String getMessage(); * problem
*/
String getMessage();
/** /**
* Return to the client a map between parameter names and values. * Return to the client a map between parameter names and values.
* *
* The keys and values are all Strings. * The keys and values are all Strings.
* *
* *
* @return a map between parameter names and values. * @return a map between parameter names and values.
*/ */
String getArguments(); String getArguments();
/** /**
* Checks the severity to see if the Error bit is set. * Checks the severity to see if the Error bit is set.
* *
* @return true if the Error bit is set for the severity, false otherwise * @return true if the Error bit is set for the severity, false otherwise
*/ */
boolean isError(); boolean isError();
/** /**
* Checks the severity to see if the Warning bit is not set. * Checks the severity to see if the Warning bit is not set.
* *
* @return true if the Warning bit is not set for the severity, false otherwise * @return true if the Warning bit is not set for the severity, false
*/ * otherwise
boolean isWarning(); */
boolean isWarning();
/** /**
* Unknown Numeric Value for line numbers and offsets; use this constant * Unknown Numeric Value for line numbers and offsets; use this constant
*/ */
public final static int INT_VALUE_NOT_PROVIDED = -1; public final static int INT_VALUE_NOT_PROVIDED = -1;
/**
* Unknown filename sentinel value
*/
public final static String FILENAME_NOT_PROVIDED = ParserMessages.getString("IProblem.unknownFileName"); //$NON-NLS-1$
/** /**
* Problem Categories * Unknown filename sentinel value
* The high bits of a problem ID contains information about the category of a problem. */
* For example, (problemID & TypeRelated) != 0, indicates that this problem is type related. public final static String FILENAME_NOT_PROVIDED = ParserMessages
* .getString("IProblem.unknownFileName"); //$NON-NLS-1$
* A problem category can help to implement custom problem filters. Indeed, when numerous problems
* are listed, focusing on import related problems first might be relevant.
*
* When a problem is tagged as Internal, it means that no change other than a local source code change
* can fix the corresponding problem.
*/
/**
* IProblem relates to a valid error on the Scanner
*/
public final static int SCANNER_RELATED = 0x01000000;
/**
* IProblem relates to a valid error on the preprocessor
*/
public final static int PREPROCESSOR_RELATED = 0x02000000;
/**
* IProblem relates to a valid syntax error in the parser
*/
public final static int SYNTAX_RELATED = 0x04000000;
/**
* IProblem relates to a valid semantical error in the parser
*/
public final static int SEMANTICS_RELATED = 0x08000000;
/**
* IProblem relates to an implementation of design limitation
*/
public final static int INTERNAL_RELATED = 0x10000000;
/**
* Problem Categories The high bits of a problem ID contains information
* about the category of a problem. For example, (problemID & TypeRelated) !=
* 0, indicates that this problem is type related.
*
* A problem category can help to implement custom problem filters. Indeed,
* when numerous problems are listed, focusing on import related problems
* first might be relevant.
*
* When a problem is tagged as Internal, it means that no change other than
* a local source code change can fix the corresponding problem.
*/
/** /**
* Check the parameter bitmask against an IProblem's ID to broadly segregate the * IProblem relates to a valid error on the Scanner
* types of problems. */
* public final static int SCANNER_RELATED = 0x01000000;
* @param bitmask
* @return true if ( (id & bitmask ) != 0 )
*/
public boolean checkCategory(int bitmask);
/** /**
* Mask to use in order to filter out the category portion of the problem ID. * IProblem relates to a valid error on the preprocessor
*/ */
public final static int IGNORE_CATEGORIES_MASK = 0xFFFFFF; public final static int PREPROCESSOR_RELATED = 0x02000000;
/** /**
* Below are listed all available problem attributes. The JavaDoc for each problem ID indicates * IProblem relates to a valid syntax error in the parser
* when they should be contributed to creating a problem of that type. */
*/ public final static int SYNTAX_RELATED = 0x04000000;
// Preprocessor IProblem attributes /**
/** * IProblem relates to a valid semantical error in the parser
* The text that follows a #error preprocessor directive */
*/ public final static int SEMANTICS_RELATED = 0x08000000;
public final static String A_PREPROC_POUND_ERROR = ParserMessages.getString("IProblem.preproc.poundError"); //$NON-NLS-1$
/** /**
* The filename that failed somehow in an preprocessor include directive * IProblem relates to an implementation of design limitation
*/ */
public final static String A_PREPROC_INCLUDE_FILENAME = ParserMessages.getString("IProblem.preproc.include"); //$NON-NLS-1$ public final static int INTERNAL_RELATED = 0x10000000;
/** /**
* A preprocessor macro name * Check the parameter bitmask against an IProblem's ID to broadly segregate
*/ * the types of problems.
public final static String A_PREPROC_MACRO_NAME = ParserMessages.getString("IProblem.preproc.macro"); //$NON-NLS-1$ *
* @param bitmask
* @return true if ( (id & bitmask ) != 0 )
*/
public boolean checkCategory(int bitmask);
/** /**
* A preprocessor conditional that could not be evaluated * Mask to use in order to filter out the category portion of the problem
* * ID.
* #if X + Y == Z <== that one, if X, Y or Z are not defined */
* #endif public final static int IGNORE_CATEGORIES_MASK = 0xFFFFFF;
*/
public final static String A_PREPROC_CONDITION = ParserMessages.getString("IProblem.preproc.condition"); //$NON-NLS-1$
/** /**
* A preprocessor directive that could not be interpretted * Below are listed all available problem attributes. The JavaDoc for each
* * problem ID indicates when they should be contributed to creating a
* e.g. #blah * problem of that type.
*/ */
public final static String A_PREPROC_UNKNOWN_DIRECTIVE = ParserMessages.getString("IProblem.preproc.unknownDirective"); //$NON-NLS-1$
/** // Preprocessor IProblem attributes
* The preprocessor conditional statement that caused an unbalanced mismatch. /**
* * The text that follows a #error preprocessor directive
* #if X */
* #else public final static String A_PREPROC_POUND_ERROR = ParserMessages
* #else <=== that one .getString("IProblem.preproc.poundError"); //$NON-NLS-1$
* #endif
*/
public final static String A_PREPROC_CONDITIONAL_MISMATCH = ParserMessages.getString("IProblem.preproc.conditionalMismatch"); //$NON-NLS-1$
/** /**
* The Bad character encountered in scanner * The filename that failed somehow in an preprocessor include directive
*/ */
public static final String A_SCANNER_BADCHAR = null; public final static String A_PREPROC_INCLUDE_FILENAME = ParserMessages
.getString("IProblem.preproc.include"); //$NON-NLS-1$
/** /**
* A_SYMBOL_NAME - symbol name * A preprocessor macro name
*/ */
public static final String A_SYMBOL_NAME = ParserMessages.getString("IProblem.symbolName"); //$NON-NLS-1$ public final static String A_PREPROC_MACRO_NAME = ParserMessages
.getString("IProblem.preproc.macro"); //$NON-NLS-1$
/**
* A_NAMESPACE_NAME = namespace name
*/
public static final String A_NAMESPACE_NAME = ParserMessages.getString("IProblem.namespaceName"); //$NON-NLS-1$
/**
* A_TYPE_NAME - type name
*/
public static final String A_TYPE_NAME = ParserMessages.getString("IProblem.typeName"); //$NON-NLS-1$
/**
* Below are listed all available problem IDs. Note that this list could be augmented in the future,
* as new features are added to the C/C++ core implementation.
*/
/* /**
* Scanner Problems * A preprocessor conditional that could not be evaluated
*/ *
* #if X + Y == Z <== that one, if X, Y or Z are not defined #endif
/** */
* Bad character encountered by Scanner. public final static String A_PREPROC_CONDITION = ParserMessages
* Required attributes: A_SCANNER_BADCHAR .getString("IProblem.preproc.condition"); //$NON-NLS-1$
* @see #A_SCANNER_BADCHAR
*/
public final static int SCANNER_BAD_CHARACTER = SCANNER_RELATED | 0x001;
/**
* Unbounded literal string encountered by Scanner.
* Required attributes: none.
*/
public final static int SCANNER_UNBOUNDED_STRING = SCANNER_RELATED | 0x002;
/**
* Invalid escape sequence encountered by Scanner.
* Required attributes: none.
*/
public final static int SCANNER_INVALID_ESCAPECHAR = SCANNER_RELATED | 0x003;
/**
* Bad floating point encountered by Scanner.
* Required attributes: none.
*/
public final static int SCANNER_BAD_FLOATING_POINT = SCANNER_RELATED | 0x004;
/**
* Bad hexidecimal encountered by Scanner.
* Required attributes: none.
*/
public final static int SCANNER_BAD_HEX_FORMAT = SCANNER_RELATED | 0x005;
/**
* Unexpected EOF encountered by Scanner.
* Required attributes: none.
*/
public final static int SCANNER_UNEXPECTED_EOF = SCANNER_RELATED | 0x006;
/**
* Bad octal encountered by Scanner.
* Required attributes: none.
*/
public final static int SCANNER_BAD_OCTAL_FORMAT = SCANNER_RELATED | 0x007;
/** /**
* Bad decimal encountered by Scanner. * A preprocessor directive that could not be interpretted
* Required attributes: none. *
*/ * e.g. #blah
public final static int SCANNER_BAD_DECIMAL_FORMAT = SCANNER_RELATED | 0x008; */
public final static String A_PREPROC_UNKNOWN_DIRECTIVE = ParserMessages
.getString("IProblem.preproc.unknownDirective"); //$NON-NLS-1$
/** /**
* Assignment '=' encountered in macro by Scanner. * The preprocessor conditional statement that caused an unbalanced
* Required attributes: none. * mismatch.
*/ *
public final static int SCANNER_ASSIGNMENT_NOT_ALLOWED = SCANNER_RELATED | 0x009; * #if X #else #else <=== that one #endif
*/
public final static String A_PREPROC_CONDITIONAL_MISMATCH = ParserMessages
.getString("IProblem.preproc.conditionalMismatch"); //$NON-NLS-1$
/** /**
* Division by 0 encountered in macro by Scanner. * The Bad character encountered in scanner
* Required attributes: none. */
*/ public static final String A_SCANNER_BADCHAR = null;
public final static int SCANNER_DIVIDE_BY_ZERO = SCANNER_RELATED | 0x00A;
/**
* Missing ')' encountered in macro by Scanner.
* Required attributes: none.
*/
public final static int SCANNER_MISSING_R_PAREN = SCANNER_RELATED | 0x00B;
/** /**
* Expression syntax error encountered in macro by Scanner. * A_SYMBOL_NAME - symbol name
* Required attributes: none. */
*/ public static final String A_SYMBOL_NAME = ParserMessages
public final static int SCANNER_EXPRESSION_SYNTAX_ERROR = SCANNER_RELATED | 0x00C; .getString("IProblem.symbolName"); //$NON-NLS-1$
/**
* Expression syntax error encountered in macro by Scanner.
* Required attributes: none.
*/
public final static int SCANNER_ILLEGAL_IDENTIFIER = SCANNER_RELATED | 0x00D;
/** /**
* Division by 0 encountered in macro by Scanner. * A_NAMESPACE_NAME = namespace name
* Required attributes: none. */
*/ public static final String A_NAMESPACE_NAME = ParserMessages
public final static int SCANNER_BAD_CONDITIONAL_EXPRESSION = SCANNER_RELATED | 0x00E; .getString("IProblem.namespaceName"); //$NON-NLS-1$
/* /**
* Preprocessor Problems * A_TYPE_NAME - type name
*/ */
public static final String A_TYPE_NAME = ParserMessages
/** .getString("IProblem.typeName"); //$NON-NLS-1$
* #error encountered by Preprocessor.
* Required attributes: A_PREPROC_POUND_ERROR
* @see #A_PREPROC_POUND_ERROR
*/
public final static int PREPROCESSOR_POUND_ERROR = PREPROCESSOR_RELATED | 0x001;
/**
* Inclusion not found by Preprocessor.
* Required attributes: A_PREPROC_INCLUDE_FILENAME
* @see #A_PREPROC_INCLUDE_FILENAME
*/
public final static int PREPROCESSOR_INCLUSION_NOT_FOUND = PREPROCESSOR_RELATED | 0x002;
/**
* Macro definition not found by Preprocessor.
* Required attributes: A_PREPROC_MACRO_NAME
* @see #A_PREPROC_MACRO_NAME
*/
public final static int PREPROCESSOR_DEFINITION_NOT_FOUND = PREPROCESSOR_RELATED | 0x003;
/**
* Preprocessor conditionals seem unbalanced.
* Required attributes: A_PREPROC_CONDITIONAL_MISMATCH
* @see #A_PREPROC_CONDITIONAL_MISMATCH
*/
public final static int PREPROCESSOR_UNBALANCE_CONDITION = PREPROCESSOR_RELATED | 0x004;
/**
* Invalid format to Macro definition.
* Required attributes: A_PREPROC_MACRO_NAME
* @see #A_PREPROC_MACRO_NAME
*/
public final static int PREPROCESSOR_INVALID_MACRO_DEFN = PREPROCESSOR_RELATED | 0x005;
/**
* Invalid or unknown preprocessor directive encountered by Preprocessor.
* Required attributes: A_PREPROC_UNKNOWN_DIRECTIVE
* @see #A_PREPROC_UNKNOWN_DIRECTIVE
*/
public final static int PREPROCESSOR_INVALID_DIRECTIVE = PREPROCESSOR_RELATED | 0x006;
/**
* Invalid macro redefinition encountered by Preprocessor.
* Required attributes: A_PREPROC_MACRO_NAME
* @see #A_PREPROC_MACRO_NAME
*/
public final static int PREPROCESSOR_INVALID_MACRO_REDEFN = PREPROCESSOR_RELATED | 0x007;
/**
* Preprocessor Conditional cannot not be evaluated due.
* Required attributes: A_PREPROC_CONDITION
* @see #A_PREPROC_CONDITION
*/
public final static int PREPROCESSOR_CONDITIONAL_EVAL_ERROR = PREPROCESSOR_RELATED | 0x008;
/**
* Invalid macro usage encountered by Preprocessor.
* Required attributes: A_PREPROC_MACRO_NAME
* @see #A_PREPROC_MACRO_NAME
*/
public final static int PREPROCESSOR_MACRO_USAGE_ERROR = PREPROCESSOR_RELATED | 0x009;
/**
* Invalid Macro Pasting encountered by Preprocessor.
* Required attributes: A_PREPROC_MACRO_NAME
* @see #A_PREPROC_MACRO_NAME
*/
public final static int PREPROCESSOR_MACRO_PASTING_ERROR = PREPROCESSOR_RELATED | 0x00A;
/**
* Circular inclusion encountered by Preprocessor.
* Required attributes: A_PREPROC_INCLUDE_FILENAME
* @see #A_PREPROC_INCLUDE_FILENAME
*/
public final static int PREPROCESSOR_CIRCULAR_INCLUSION = PREPROCESSOR_RELATED | 0x00B;
/**
* macro argument "..." encountered without the required ')' i.e. must be last argument if used
* Required attributes: none
*/
public final static int PREPROCESSOR_MISSING_RPAREN_PARMLIST = PREPROCESSOR_RELATED | 0x00C;
/** /**
* __VA_ARGS__ encountered in macro definition without the required '...' parameter * Below are listed all available problem IDs. Note that this list could be
* Required attributes: none * augmented in the future, as new features are added to the C/C++ core
*/ * implementation.
public final static int PREPROCESSOR_INVALID_VA_ARGS = PREPROCESSOR_RELATED | 0x00D; */
/*
* Parser Syntactic Problems
*/
public final static int SYNTAX_ERROR = SYNTAX_RELATED | 0x001;
/*
* Scanner Problems
*/
/**
* Bad character encountered by Scanner. Required attributes:
* A_SCANNER_BADCHAR
*
* @see #A_SCANNER_BADCHAR
*/
public final static int SCANNER_BAD_CHARACTER = SCANNER_RELATED | 0x001;
/**
* Unbounded literal string encountered by Scanner. Required attributes:
* none.
*/
public final static int SCANNER_UNBOUNDED_STRING = SCANNER_RELATED | 0x002;
/**
* Invalid escape sequence encountered by Scanner. Required attributes:
* none.
*/
public final static int SCANNER_INVALID_ESCAPECHAR = SCANNER_RELATED | 0x003;
/**
* Bad floating point encountered by Scanner. Required attributes: none.
*/
public final static int SCANNER_BAD_FLOATING_POINT = SCANNER_RELATED | 0x004;
/**
* Bad hexidecimal encountered by Scanner. Required attributes: none.
*/
public final static int SCANNER_BAD_HEX_FORMAT = SCANNER_RELATED | 0x005;
/**
* Unexpected EOF encountered by Scanner. Required attributes: none.
*/
public final static int SCANNER_UNEXPECTED_EOF = SCANNER_RELATED | 0x006;
/**
* Bad octal encountered by Scanner. Required attributes: none.
*/
public final static int SCANNER_BAD_OCTAL_FORMAT = SCANNER_RELATED | 0x007;
/**
* Bad decimal encountered by Scanner. Required attributes: none.
*/
public final static int SCANNER_BAD_DECIMAL_FORMAT = SCANNER_RELATED | 0x008;
/**
* Assignment '=' encountered in macro by Scanner. Required attributes:
* none.
*/
public final static int SCANNER_ASSIGNMENT_NOT_ALLOWED = SCANNER_RELATED | 0x009;
/**
* Division by 0 encountered in macro by Scanner. Required attributes: none.
*/
public final static int SCANNER_DIVIDE_BY_ZERO = SCANNER_RELATED | 0x00A;
/**
* Missing ')' encountered in macro by Scanner. Required attributes: none.
*/
public final static int SCANNER_MISSING_R_PAREN = SCANNER_RELATED | 0x00B;
/**
* Expression syntax error encountered in macro by Scanner. Required
* attributes: none.
*/
public final static int SCANNER_EXPRESSION_SYNTAX_ERROR = SCANNER_RELATED | 0x00C;
/**
* Expression syntax error encountered in macro by Scanner. Required
* attributes: none.
*/
public final static int SCANNER_ILLEGAL_IDENTIFIER = SCANNER_RELATED | 0x00D;
/**
* Division by 0 encountered in macro by Scanner. Required attributes: none.
*/
public final static int SCANNER_BAD_CONDITIONAL_EXPRESSION = SCANNER_RELATED | 0x00E;
/*
* Preprocessor Problems
*/
/**
* #error encountered by Preprocessor. Required attributes:
* A_PREPROC_POUND_ERROR
*
* @see #A_PREPROC_POUND_ERROR
*/
public final static int PREPROCESSOR_POUND_ERROR = PREPROCESSOR_RELATED | 0x001;
/**
* Inclusion not found by Preprocessor. Required attributes:
* A_PREPROC_INCLUDE_FILENAME
*
* @see #A_PREPROC_INCLUDE_FILENAME
*/
public final static int PREPROCESSOR_INCLUSION_NOT_FOUND = PREPROCESSOR_RELATED | 0x002;
/**
* Macro definition not found by Preprocessor. Required attributes:
* A_PREPROC_MACRO_NAME
*
* @see #A_PREPROC_MACRO_NAME
*/
public final static int PREPROCESSOR_DEFINITION_NOT_FOUND = PREPROCESSOR_RELATED | 0x003;
/**
* Preprocessor conditionals seem unbalanced. Required attributes:
* A_PREPROC_CONDITIONAL_MISMATCH
*
* @see #A_PREPROC_CONDITIONAL_MISMATCH
*/
public final static int PREPROCESSOR_UNBALANCE_CONDITION = PREPROCESSOR_RELATED | 0x004;
/**
* Invalid format to Macro definition. Required attributes:
* A_PREPROC_MACRO_NAME
*
* @see #A_PREPROC_MACRO_NAME
*/
public final static int PREPROCESSOR_INVALID_MACRO_DEFN = PREPROCESSOR_RELATED | 0x005;
/**
* Invalid or unknown preprocessor directive encountered by Preprocessor.
* Required attributes: A_PREPROC_UNKNOWN_DIRECTIVE
*
* @see #A_PREPROC_UNKNOWN_DIRECTIVE
*/
public final static int PREPROCESSOR_INVALID_DIRECTIVE = PREPROCESSOR_RELATED | 0x006;
/**
* Invalid macro redefinition encountered by Preprocessor. Required
* attributes: A_PREPROC_MACRO_NAME
*
* @see #A_PREPROC_MACRO_NAME
*/
public final static int PREPROCESSOR_INVALID_MACRO_REDEFN = PREPROCESSOR_RELATED | 0x007;
/**
* Preprocessor Conditional cannot not be evaluated due. Required
* attributes: A_PREPROC_CONDITION
*
* @see #A_PREPROC_CONDITION
*/
public final static int PREPROCESSOR_CONDITIONAL_EVAL_ERROR = PREPROCESSOR_RELATED | 0x008;
/**
* Invalid macro usage encountered by Preprocessor. Required attributes:
* A_PREPROC_MACRO_NAME
*
* @see #A_PREPROC_MACRO_NAME
*/
public final static int PREPROCESSOR_MACRO_USAGE_ERROR = PREPROCESSOR_RELATED | 0x009;
/**
* Invalid Macro Pasting encountered by Preprocessor. Required attributes:
* A_PREPROC_MACRO_NAME
*
* @see #A_PREPROC_MACRO_NAME
*/
public final static int PREPROCESSOR_MACRO_PASTING_ERROR = PREPROCESSOR_RELATED | 0x00A;
/**
* Circular inclusion encountered by Preprocessor. Required attributes:
* A_PREPROC_INCLUDE_FILENAME
*
* @see #A_PREPROC_INCLUDE_FILENAME
*/
public final static int PREPROCESSOR_CIRCULAR_INCLUSION = PREPROCESSOR_RELATED | 0x00B;
/**
* macro argument "..." encountered without the required ')' i.e. must be
* last argument if used Required attributes: none
*/
public final static int PREPROCESSOR_MISSING_RPAREN_PARMLIST = PREPROCESSOR_RELATED | 0x00C;
/**
* __VA_ARGS__ encountered in macro definition without the required '...'
* parameter Required attributes: none
*/
public final static int PREPROCESSOR_INVALID_VA_ARGS = PREPROCESSOR_RELATED | 0x00D;
/*
* Parser Syntactic Problems
*/
public final static int SYNTAX_ERROR = SYNTAX_RELATED | 0x001;
} }

View file

@ -11,11 +11,12 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This interface represents a parse problem where we tried to match against a declaration. * This interface represents a parse problem where we tried to match against a
* declaration.
* *
* @author jcamelon * @author jcamelon
*/ */
public interface IASTProblemDeclaration extends IASTDeclaration, IASTProblemHolder { public interface IASTProblemDeclaration extends IASTDeclaration,
IASTProblemHolder {
} }

View file

@ -10,12 +10,13 @@
**********************************************************************/ **********************************************************************/
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This interface represents a parse problem where we tried to match against a expression. * This interface represents a parse problem where we tried to match against a
* expression.
* *
* @author jcamelon * @author jcamelon
*/ */
public interface IASTProblemExpression extends IASTExpression, IASTProblemHolder { public interface IASTProblemExpression extends IASTExpression,
IASTProblemHolder {
} }

View file

@ -11,25 +11,30 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This interface represents a base interface to represent a problem owner or holder. * This interface represents a base interface to represent a problem owner or
* holder.
* *
* @author jcamelon * @author jcamelon
*/ */
public interface IASTProblemHolder { public interface IASTProblemHolder {
/** /**
* <code>PROBLEM</code> represents the relationship between a <code>IASTProblemHolder</code> and its <code>IASTProblem</code>. * <code>PROBLEM</code> represents the relationship between a
*/ * <code>IASTProblemHolder</code> and its <code>IASTProblem</code>.
public static final ASTNodeProperty PROBLEM = new ASTNodeProperty( "Problem"); //$NON-NLS-1$ */
/** public static final ASTNodeProperty PROBLEM = new ASTNodeProperty("Problem"); //$NON-NLS-1$
* Get the problem.
* /**
* @return <code>IASTProblem</code> * Get the problem.
*/ *
public IASTProblem getProblem(); * @return <code>IASTProblem</code>
/** */
* Set the problem. public IASTProblem getProblem();
*
* @param p <code>IASTProblem</code> /**
*/ * Set the problem.
public void setProblem(IASTProblem p); *
* @param p
* <code>IASTProblem</code>
*/
public void setProblem(IASTProblem p);
} }

View file

@ -11,10 +11,11 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This interface represents a parse problem where we tried to match against a statement. * This interface represents a parse problem where we tried to match against a
* statement.
*
* @author jcamelon * @author jcamelon
*/ */
public interface IASTProblemStatement extends IASTStatement, IASTProblemHolder { public interface IASTProblemStatement extends IASTStatement, IASTProblemHolder {
} }

View file

@ -11,7 +11,8 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This interface represents a parse problem where we tried to match against a type-id. * This interface represents a parse problem where we tried to match against a
* type-id.
* *
* @author jcamelon * @author jcamelon
*/ */

View file

@ -15,7 +15,13 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTReturnStatement extends IASTStatement { public interface IASTReturnStatement extends IASTStatement {
public static final ASTNodeProperty RETURNVALUE = new ASTNodeProperty("returnValue"); //$NON-NLS-1$ /**
* <code>RETURNVALUE</code> represents the relationship between an
* <code>IASTReturnStatement</code> and it's nested
* <code>IASTExpression</code>.
*/
public static final ASTNodeProperty RETURNVALUE = new ASTNodeProperty(
"returnValue"); //$NON-NLS-1$
/** /**
* This is the optional return value for this function. * This is the optional return value for this function.
@ -23,7 +29,13 @@ public interface IASTReturnStatement extends IASTStatement {
* @return the return expression or null. * @return the return expression or null.
*/ */
public IASTExpression getReturnValue(); public IASTExpression getReturnValue();
/**
* Set the return value.
*
* @param returnValue
* <code>IASTExpression</code>
*/
public void setReturnValue(IASTExpression returnValue); public void setReturnValue(IASTExpression returnValue);
} }

View file

@ -18,32 +18,117 @@ package org.eclipse.cdt.core.dom.ast;
public interface IASTSimpleDeclSpecifier extends IASTDeclSpecifier { public interface IASTSimpleDeclSpecifier extends IASTDeclSpecifier {
/** /**
* This returns the built-in type for the declaration. The type is * This returns the built-in type for the declaration. The type is then
* then refined by qualifiers for signed/unsigned and short/long. * refined by qualifiers for signed/unsigned and short/long. The type could
* The type could also be unspecified which usually means int. * also be unspecified which usually means int.
* *
* @return * @return
*/ */
public int getType(); public int getType();
/**
* <code>t_unspecified</code> implies an unspecified type. .e.g x = 5; //
* declaration w/t_unspecified type logically defaults to integer.
*/
public static final int t_unspecified = 0; public static final int t_unspecified = 0;
/**
* <code>t_void</code> implies void type e.g. void x();
*/
public static final int t_void = 1; public static final int t_void = 1;
/**
* <code>t_char</code> implies char type e.g. char y;
*/
public static final int t_char = 2; public static final int t_char = 2;
/**
* <code>t_int</code> implies int type e.g. int x;
*/
public static final int t_int = 3; public static final int t_int = 3;
/**
* <code>t_float</code> implies floating point type. e.g. float yy;
*/
public static final int t_float = 4; public static final int t_float = 4;
/**
* <code>t_double</code> implies double floating point type. e.g. double
* d;
*/
public static final int t_double = 5; public static final int t_double = 5;
/**
* <code>t_last</code> specified for subinterface definition.
*/
public static final int t_last = t_double; // used only in subclasses public static final int t_last = t_double; // used only in subclasses
public void setType( int type ); /**
* Set this decl specifier type to <code>type</code>.
*
* @param type
* (int)
*/
public void setType(int type);
/**
* Is the type modified by the signed keyword?
*
* @return boolean
*/
public boolean isSigned(); public boolean isSigned();
/**
* Is the type modified by the unsigned keyword?
*
* @return boolean
*/
public boolean isUnsigned(); public boolean isUnsigned();
/**
* Is the type modified by the short keyword?
*
* @return boolean
*/
public boolean isShort(); public boolean isShort();
/**
* Is the type modified by the long keyword?
*
* @return boolean
*/
public boolean isLong(); public boolean isLong();
public void setSigned( boolean value ); /**
public void setUnsigned( boolean value ); * Change as to if the type is modified by the keyword signed.
public void setLong( boolean value ); *
public void setShort( boolean value ); * @param value
* boolean
*/
public void setSigned(boolean value);
/**
* Change as to if the type is modified by the keyword unsigned.
*
* @param value
* boolean
*/
public void setUnsigned(boolean value);
/**
* Change as to if the type is modified by the keyword long.
*
* @param value
* boolean
*/
public void setLong(boolean value);
/**
* Change as to if the type is modified by the keyword short.
*
* @param value
* boolean
*/
public void setShort(boolean value);
} }

View file

@ -10,7 +10,6 @@
**********************************************************************/ **********************************************************************/
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This is a simple declaration which contains a sequence of declSpecifiers * This is a simple declaration which contains a sequence of declSpecifiers
* followed by a list of declarators. * followed by a list of declarators.
@ -19,26 +18,51 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTSimpleDeclaration extends IASTDeclaration, IASTNode { public interface IASTSimpleDeclaration extends IASTDeclaration, IASTNode {
ASTNodeProperty DECL_SPECIFIER = new ASTNodeProperty( "Decl Specifier"); //$NON-NLS-1$ /**
ASTNodeProperty DECLARATOR = new ASTNodeProperty( "Declarator"); //$NON-NLS-1$ * <code>DECL_SPECIFIER</code> represents the relationship between an
* <code>IASTSimpleDeclaration</code> and it's nested
* <code>IASTDeclSpecifier</code>.
*/
public static final ASTNodeProperty DECL_SPECIFIER = new ASTNodeProperty(
"Decl Specifier"); //$NON-NLS-1$
/** /**
* <code>DECLARATOR</code> represents the relationship between an
* <code>IASTSimpleDeclaration</code> and it's nested
* <code>IASTDeclarator</code>s.
*/
public static final ASTNodeProperty DECLARATOR = new ASTNodeProperty(
"Declarator"); //$NON-NLS-1$
/**
* This returns the object representing the declSpecifiers for this * This returns the object representing the declSpecifiers for this
* declaration. * declaration.
* *
* @return the declSpecifier object * @return the declSpecifier object
*/ */
public IASTDeclSpecifier getDeclSpecifier(); public IASTDeclSpecifier getDeclSpecifier();
public void setDeclSpecifier( IASTDeclSpecifier declSpec ); /**
* Set the decl specifier.
*
* @param declSpec
* <code>IASTDeclSpecifier</code>
*/
public void setDeclSpecifier(IASTDeclSpecifier declSpec);
/** /**
* This returns the list of declarators in this declaration. * This returns the list of declarators in this declaration.
* *
* @return list of IASTDeclarator * @return <code>IASTDeclarator []</code>
*/ */
public IASTDeclarator[] getDeclarators(); public IASTDeclarator[] getDeclarators();
public void addDeclarator( IASTDeclarator declarator ); /**
* Add a declarator.
*
* @param declarator
* <code>IASTDeclarator</code>
*/
public void addDeclarator(IASTDeclarator declarator);
} }

View file

@ -10,7 +10,6 @@
**********************************************************************/ **********************************************************************/
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This is a declarator for a non K&R C function. * This is a declarator for a non K&R C function.
* *
@ -18,17 +17,41 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTStandardFunctionDeclarator extends IASTFunctionDeclarator { public interface IASTStandardFunctionDeclarator extends IASTFunctionDeclarator {
public final static ASTNodeProperty FUNCTION_PARAMETER = new ASTNodeProperty( "Parameter"); //$NON-NLS-1$ /**
* <code>FUNCTION_PARAMETER</code> represents the relationship between an
* <code>IASTStandardFunctionDeclarator</code> and it's nested
* <code>IASTParameterDeclaration</code>.
*/
public final static ASTNodeProperty FUNCTION_PARAMETER = new ASTNodeProperty(
"Parameter"); //$NON-NLS-1$
/** /**
* Gets the parameter declarations for the function * Gets the parameter declarations for the function
* *
* @return List of IASTParameterDeclaration * @return array of IASTParameterDeclaration
*/ */
public IASTParameterDeclaration[] getParameters(); public IASTParameterDeclaration[] getParameters();
public void addParameterDeclaration( IASTParameterDeclaration parameter ); /**
* Add a parameter.
*
* @param parameter
* <code>IASTParameterDeclaration</code>
*/
public void addParameterDeclaration(IASTParameterDeclaration parameter);
/**
* Does this function take a variable number of arguments?
*
* @return boolean
*/
public boolean takesVarArgs(); public boolean takesVarArgs();
public void setVarArgs( boolean value ); /**
* Set whether or not this function takes a variable number or arguments.
*
* @param value
* boolean
*/
public void setVarArgs(boolean value);
} }

View file

@ -1,5 +1,5 @@
/********************************************************************** /**********************************************************************
* Copyright (c) 2004 IBM Corporation and others. Z * Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0 * are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -16,6 +16,9 @@ package org.eclipse.cdt.core.dom.ast;
* @author Doug Schaefer * @author Doug Schaefer
*/ */
public interface IASTStatement extends IASTNode { public interface IASTStatement extends IASTNode {
public static final IASTStatement[] EMPTY_STATEMENT_ARRAY = new IASTStatement[0]; /**
* Constant.
*/
public static final IASTStatement[] EMPTY_STATEMENT_ARRAY = new IASTStatement[0];
} }

View file

@ -17,8 +17,20 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTSwitchStatement extends IASTStatement { public interface IASTSwitchStatement extends IASTStatement {
public static final ASTNodeProperty CONTROLLER = new ASTNodeProperty("controller"); //$NON-NLS-1$ /**
public static final ASTNodeProperty BODY = new ASTNodeProperty("body"); //$NON-NLS-1$ * <code>CONTROLLER</code> represents the relationship between an
* <code>IASTSwitchStatement</code> and it's nested
* <code>IASTExpression</code>.
*/
public static final ASTNodeProperty CONTROLLER = new ASTNodeProperty(
"controller"); //$NON-NLS-1$
/**
* <code>BODY</code> represents the relationship between an
* <code>IASTSwitchStatement</code> and it's nested
* <code>IASTStatement</code>.
*/
public static final ASTNodeProperty BODY = new ASTNodeProperty("body"); //$NON-NLS-1$
/** /**
* This returns the expression which determines which case to take. * This returns the expression which determines which case to take.
@ -26,18 +38,30 @@ public interface IASTSwitchStatement extends IASTStatement {
* @return the controller expression * @return the controller expression
*/ */
public IASTExpression getController(); public IASTExpression getController();
public void setController(IASTExpression controller);
/** /**
* The body of the switch statement. * Set the controlling expression for the switch.
*
* @param controller
* <code>IASTExpression</code>
*/
public void setController(IASTExpression controller);
/**
* Returns the body of the switch statement.
* *
* TODO - finding the cases could be a logical thing * TODO - finding the cases could be a logical thing
* *
* @return * @return <code>IASTStatement</code>
*/ */
public IASTStatement getBody(); public IASTStatement getBody();
/**
* Set the body for the switch statement.
*
* @param body
* <code>IASTStatement</code>
*/
public void setBody(IASTStatement body); public void setBody(IASTStatement body);
} }

View file

@ -17,61 +17,121 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTTranslationUnit extends IASTNode { public interface IASTTranslationUnit extends IASTNode {
public static final ASTNodeProperty OWNED_DECLARATION = new ASTNodeProperty( /**
"Owned"); //$NON-NLS-1$ * <code>OWNED_DECLARATION</code> represents the relationship between an <code>IASTTranslationUnit</code> and
public static final ASTNodeProperty SCANNER_PROBLEM = new ASTNodeProperty( * it's nested <code>IASTDeclaration</code>'s.
"Scanner Problem"); //$NON-NLS-1$ */
public static final ASTNodeProperty PREPROCESSOR_STATEMENT = new ASTNodeProperty( public static final ASTNodeProperty OWNED_DECLARATION = new ASTNodeProperty(
"Inclusion"); //$NON-NLS-1$ "Owned"); //$NON-NLS-1$
/** /**
* A translation unit contains an ordered sequence of declarations. * <code>SCANNER_PROBLEM</code> represents the relationship between an <code>IASTTranslationUnit</code> and
* * it's nested <code>IASTProblem</code>.
* @return List of IASTDeclaration */
*/ public static final ASTNodeProperty SCANNER_PROBLEM = new ASTNodeProperty(
public IASTDeclaration[] getDeclarations(); "Scanner Problem"); //$NON-NLS-1$
public void addDeclaration(IASTDeclaration declaration); /**
* <code>PREPROCESSOR_STATEMENT</code> represents the relationship between an <code>IASTTranslationUnit</code> and
* it's nested <code>IASTPreprocessorStatement</code>.
*/
public static final ASTNodeProperty PREPROCESSOR_STATEMENT = new ASTNodeProperty(
"PP Statement"); //$NON-NLS-1$
/** /**
* This returns the global scope for the translation unit. * A translation unit contains an ordered sequence of declarations.
* *
* @return the global scope * @return List of IASTDeclaration
*/ */
public IScope getScope(); public IASTDeclaration[] getDeclarations();
/** /**
* Returns the list of declarations in this translation unit for the given * Add declaration to translation unit.
* binding. The list contains the IASTName nodes that declare the binding. *
* * @param declaration <code>IASTDeclaration</code>
* @param binding */
* @return List of IASTName nodes for the binding's declaration public void addDeclaration(IASTDeclaration declaration);
*/
public IASTName[] getDeclarations(IBinding binding);
/** /**
* Returns the list of references in this translation unit to the given * This returns the global scope for the translation unit.
* binding. This list contains the IASTName nodes that represent a use of the *
* binding. * @return the global scope
* */
* @param binding public IScope getScope();
* @return List of IASTName nodes representing uses of the binding
*/
public IASTName[] getReferences(IBinding binding);
public IASTNodeLocation[] getLocationInfo(int offset, int length); /**
* Returns the list of declarations in this translation unit for the given
* binding. The list contains the IASTName nodes that declare the binding.
*
* @param binding
* @return List of IASTName nodes for the binding's declaration
*/
public IASTName[] getDeclarations(IBinding binding);
public IASTNode selectNodeForLocation(String path, int offset, int length); /**
* Returns the list of references in this translation unit to the given
* binding. This list contains the IASTName nodes that represent a use of
* the binding.
*
* @param binding
* @return List of IASTName nodes representing uses of the binding
*/
public IASTName[] getReferences(IBinding binding);
public IASTPreprocessorMacroDefinition[] getMacroDefinitions(); /**
* @param offset
* @param length
* @return
*/
public IASTNodeLocation[] getLocationInfo(int offset, int length);
public IASTPreprocessorIncludeStatement[] getIncludeDirectives(); /**
* Select the node in the treet that best fits the offset/length/file path.
*
* @param path - file name specified through path
* @param offset - location in the file as an offset
* @param length - length of selection
* @return <code>IASTNode</code> that best fits
*/
public IASTNode selectNodeForLocation(String path, int offset, int length);
public IASTPreprocessorStatement[] getAllPreprocessorStatements(); /**
* Get the macro definitions encountered in parsing this translation unit.
*
* @return <code>IASTPreprocessorMacroDefinition[]</code>
*/
public IASTPreprocessorMacroDefinition[] getMacroDefinitions();
public IASTProblem[] getPreprocesorProblems(); /**
* Get the #include directives encountered in parsing this translation unit.
public String getUnpreprocessedSignature( IASTNodeLocation [] locations ); * @return <code>IASTPreprocessorIncludeStatement[]</code>
*/
public String getFilePath(); public IASTPreprocessorIncludeStatement[] getIncludeDirectives();
/**
* Get all preprocessor statements.
*
* @return <code>IASTPreprocessorStatement[]</code>
*/
public IASTPreprocessorStatement[] getAllPreprocessorStatements();
/**
* Get all preprocessor and scanner problems.
* @return <code>IASTProblem[]</code>
*/
public IASTProblem[] getPreprocessorProblems();
/**
* For a given range of locations, return a String that represents what is there underneath the range.
*
* @param locations A range of node locations
* @return A String signature.
*/
public String getUnpreprocessedSignature(IASTNodeLocation[] locations);
/**
* Get the translation unit's full path.
* @return String representation of path.
*/
public String getFilePath();
} }

View file

@ -13,14 +13,48 @@ package org.eclipse.cdt.core.dom.ast;
* @author jcamelon * @author jcamelon
*/ */
public interface IASTTypeId extends IASTNode { public interface IASTTypeId extends IASTNode {
public static final IASTTypeId [] EMPTY_TYPEID_ARRAY = new IASTTypeId[0]; /**
* Constant.
public static final ASTNodeProperty DECL_SPECIFIER = new ASTNodeProperty( "Decl Specifier"); //$NON-NLS-1$ */
public static final ASTNodeProperty ABSTRACT_DECLARATOR = new ASTNodeProperty( "Abstract Declarator"); //$NON-NLS-1$ public static final IASTTypeId[] EMPTY_TYPEID_ARRAY = new IASTTypeId[0];
public IASTDeclSpecifier getDeclSpecifier(); /**
public void setDeclSpecifier( IASTDeclSpecifier declSpec ); * <code>DECL_SPECIFIER</code> represents the relationship between an <code>IASTTypeId</code> and
public IASTDeclarator getAbstractDeclarator(); * it's nested <code>IASTDeclSpecifier</code>.
public void setAbstractDeclarator( IASTDeclarator abstractDeclarator ); */
public static final ASTNodeProperty DECL_SPECIFIER = new ASTNodeProperty(
"Decl Specifier"); //$NON-NLS-1$
/**
* <code>ABSTRACT_DECLARATOR</code> represents the relationship between an <code>IASTTypeId</code> and
* it's nested <code>IASTDeclarator</code>.
*/
public static final ASTNodeProperty ABSTRACT_DECLARATOR = new ASTNodeProperty(
"Abstract Declarator"); //$NON-NLS-1$
/**
* Get the decl specifier.
* @return <code>IASTDeclSpecifier</code>
*/
public IASTDeclSpecifier getDeclSpecifier();
/**
* Set the decl specifier.
* @param declSpec <code>IASTDeclSpecifier</code>
*/
public void setDeclSpecifier(IASTDeclSpecifier declSpec);
/**
* Get the abstract declarator.
*
* @return <code>IASTDeclarator</code>
*/
public IASTDeclarator getAbstractDeclarator();
/**
* Set the abstract declarator.
* @param abstractDeclarator <code>IASTDeclarator</code>
*/
public void setAbstractDeclarator(IASTDeclarator abstractDeclarator);
} }

View file

@ -14,14 +14,46 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTTypeIdExpression extends IASTExpression { public interface IASTTypeIdExpression extends IASTExpression {
public static final int op_sizeof = 0; /**
public static final int op_last = op_sizeof; * <code>op_sizeof</code> sizeof( typeId ) expression
*/
public int getOperator(); public static final int op_sizeof = 0;
public void setOperator( int value );
/**
public static final ASTNodeProperty TYPE_ID = new ASTNodeProperty( "Type Id"); //$NON-NLS-1$ * <code>op_last</code> defined for sub-interfaces to extend.
public void setTypeId( IASTTypeId typeId ); */
public IASTTypeId getTypeId(); public static final int op_last = op_sizeof;
/**
* Get the operator for the expression.
*
* @return int
*/
public int getOperator();
/**
* Set the operator for the expression.
* @param value int
*/
public void setOperator(int value);
/**
* <code>TYPEID</code> represents the relationship between an <code>IASTTypeIdExpression</code> and
* it's nested <code>IASTTypeId</code>.
*/
public static final ASTNodeProperty TYPE_ID = new ASTNodeProperty("Type Id"); //$NON-NLS-1$
/**
* Set the type Id.
* @param typeId
*/
public void setTypeId(IASTTypeId typeId);
/**
* Get the type Id.
*
* @return
*/
public IASTTypeId getTypeId();
} }

View file

@ -10,31 +10,121 @@
package org.eclipse.cdt.core.dom.ast; package org.eclipse.cdt.core.dom.ast;
/** /**
* This interface is used to represent a unary expression in the AST.
*
* @author jcamelon * @author jcamelon
*/ */
public interface IASTUnaryExpression extends IASTExpression { public interface IASTUnaryExpression extends IASTExpression {
public static final int op_prefixIncr = 0; /**
public static final int op_prefixDecr = 1; * Prefix increment.
public static final int op_plus = 2; * <code>op_prefixIncr</code> ++exp
public static final int op_minus = 3; */
public static final int op_star = 4; public static final int op_prefixIncr = 0;
public static final int op_amper = 5;
public static final int op_tilde = 6; /**
public static final int op_not = 7; * Prefix decrement.
public static final int op_sizeof = 8; * <code>op_prefixDecr</code> --exp
public static final int op_postFixIncr = 9; */
public static final int op_postFixDecr = 10; public static final int op_prefixDecr = 1;
public static final int op_bracketedPrimary = 11;
public static final int op_last = op_bracketedPrimary; /**
* Operator plus.
public int getOperator(); * <code>op_plus</code> ==> + exp
public void setOperator( int value ); */
public static final int op_plus = 2;
public static final ASTNodeProperty OPERAND = new ASTNodeProperty( "Operand" ); //$NON-NLS-1$
/**
* Operator minus.
public IASTExpression getOperand(); * <code>op_minux</code> ==> -exp
public void setOperand( IASTExpression expression ); */
public static final int op_minus = 3;
/**
* Operator star.
* <code>op_star</code> ==> *exp
*/
public static final int op_star = 4;
/**
* Operator ampersand.
* <code>op_amper</code> ==> &exp
*/
public static final int op_amper = 5;
/**
* Operator tilde.
* <code>op_tilde</code> ==> ~exp
*/
public static final int op_tilde = 6;
/**
* not.
* <code>op_not</code> ==> ! exp
*/
public static final int op_not = 7;
/**
* sizeof.
* <code>op_sizeof</code> ==> sizeof exp
*/
public static final int op_sizeof = 8;
/**
* Postfix increment.
* <code>op_postFixIncr</code> ==> exp++
*/
public static final int op_postFixIncr = 9;
/**
* Postfix decrement.
* <code>op_bracketedPrimary</code> ==> exp--
*/
public static final int op_postFixDecr = 10;
/**
* A bracketed expression.
* <code>op_bracketedPrimary</code> ==> ( exp )
*/
public static final int op_bracketedPrimary = 11;
/**
* <code>op_last</code> is made available for subclasses.
*/
public static final int op_last = op_bracketedPrimary;
/**
* Get the operator/kind.
*
* @return (int)
*/
public int getOperator();
/**
* Set the operator/kind.
*
* @param value (int) value
*/
public void setOperator(int value);
/**
* <code>OPERAND</code> represents the relationship between an <code>IASTUnaryExpression</code> and
* it's nested <code>IASTExpression</code>.
*/
public static final ASTNodeProperty OPERAND = new ASTNodeProperty("Operand"); //$NON-NLS-1$
/**
* Get the operand.
*
* @return <code>IASTExpression</code>
*/
public IASTExpression getOperand();
/**
* Set the operand.
*
* @param expression <code>IASTExpression</code>
*/
public void setOperand(IASTExpression expression);
} }

View file

@ -17,17 +17,33 @@ package org.eclipse.cdt.core.dom.ast;
*/ */
public interface IASTWhileStatement extends IASTStatement { public interface IASTWhileStatement extends IASTStatement {
public static final ASTNodeProperty CONDITIONEXPRESSION = new ASTNodeProperty("condition"); //$NON-NLS-1$ /**
public static final ASTNodeProperty BODY = new ASTNodeProperty("body"); //$NON-NLS-1$ * <code>CONDITIONEXPRESSION</code> represents the relationship between an <code>IASTWhileStatement</code> and
* it's nested <code>IASTExpression</code>.
*/
public static final ASTNodeProperty CONDITIONEXPRESSION = new ASTNodeProperty(
"condition"); //$NON-NLS-1$
/** /**
* The condition on the while loop * <code>BODY</code> represents the relationship between an <code>IASTWhileStatement</code> and
* it's nested <code>IASTStatement</code>.
*/
public static final ASTNodeProperty BODY = new ASTNodeProperty("body"); //$NON-NLS-1$
/**
* Get the condition on the while loop
* *
* @return expression for the condition * @return expression for the condition
*/ */
public IASTExpression getCondition(); public IASTExpression getCondition();
/**
* Set the condition of the while loop.
*
* @param condition
*/
public void setCondition(IASTExpression condition); public void setCondition(IASTExpression condition);
/** /**
* The body of the loop. * The body of the loop.
* *
@ -35,6 +51,11 @@ public interface IASTWhileStatement extends IASTStatement {
*/ */
public IASTStatement getBody(); public IASTStatement getBody();
/**
* Set the body of the while loop.
*
* @param body
*/
public void setBody(IASTStatement body); public void setBody(IASTStatement body);
} }

View file

@ -447,7 +447,7 @@ public class CASTTranslationUnit extends CASTNode implements
* *
* @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getPreprocesorProblems() * @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getPreprocesorProblems()
*/ */
public IASTProblem[] getPreprocesorProblems() { public IASTProblem[] getPreprocessorProblems() {
if (resolver == null) if (resolver == null)
return EMPTY_PROBLEM_ARRAY; return EMPTY_PROBLEM_ARRAY;
IASTProblem[] result = resolver.getScannerProblems(); IASTProblem[] result = resolver.getScannerProblems();

View file

@ -432,7 +432,7 @@ public class CPPASTTranslationUnit extends CPPASTNode implements
* *
* @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getPreprocesorProblems() * @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getPreprocesorProblems()
*/ */
public IASTProblem[] getPreprocesorProblems() { public IASTProblem[] getPreprocessorProblems() {
if (resolver == null) if (resolver == null)
return EMPTY_PROBLEM_ARRAY; return EMPTY_PROBLEM_ARRAY;
IASTProblem[] result = resolver.getScannerProblems(); IASTProblem[] result = resolver.getScannerProblems();

View file

@ -384,7 +384,7 @@ public class DOMAST extends ViewPart {
if (monitor.isCanceled()) return Status.CANCEL_STATUS; if (monitor.isCanceled()) return Status.CANCEL_STATUS;
monitor.subTask(RETRIEVING_PREPROCESSOR_PROBLEMS); monitor.subTask(RETRIEVING_PREPROCESSOR_PROBLEMS);
start=System.currentTimeMillis(); start=System.currentTimeMillis();
IASTProblem[] problems = tu.getPreprocesorProblems(); IASTProblem[] problems = tu.getPreprocessorProblems();
monitor.worked(5); monitor.worked(5);
System.out.println("[DOM AST View] done " + RETRIEVING_PREPROCESSOR_PROBLEMS + ": " + (System.currentTimeMillis()- start) ); System.out.println("[DOM AST View] done " + RETRIEVING_PREPROCESSOR_PROBLEMS + ": " + (System.currentTimeMillis()- start) );