mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-01 06:05:24 +02:00
Merging AST2 branch into HEAD.
Definition of new DOM AST interface. Construction of new C Parser. Tests.
This commit is contained in:
parent
cea83a5a77
commit
6a84887550
193 changed files with 19677 additions and 1 deletions
|
@ -0,0 +1,818 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTBinaryExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTConditionalExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarationStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpressionStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFieldReference;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTForStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionCallExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTIdExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTInitializerExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTLiteralExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTParameterDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTypeIdExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTypedefNameSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTUnaryTypeIdExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||
import org.eclipse.cdt.core.dom.ast.IField;
|
||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||
import org.eclipse.cdt.core.dom.ast.ITypedef;
|
||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTCompositeTypeSpecifier;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTPointer;
|
||||
import org.eclipse.cdt.core.dom.ast.c.ICASTTypeIdInitializerExpression;
|
||||
import org.eclipse.cdt.core.parser.CodeReader;
|
||||
import org.eclipse.cdt.core.parser.IParserLogService;
|
||||
import org.eclipse.cdt.core.parser.IScanner;
|
||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.NullLogService;
|
||||
import org.eclipse.cdt.core.parser.NullSourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.ParserFactory;
|
||||
import org.eclipse.cdt.core.parser.ParserLanguage;
|
||||
import org.eclipse.cdt.core.parser.ParserMode;
|
||||
import org.eclipse.cdt.core.parser.ScannerInfo;
|
||||
import org.eclipse.cdt.core.parser.tests.parser2.QuickParser2Tests.ProblemCollector;
|
||||
import org.eclipse.cdt.internal.core.parser.ParserException;
|
||||
import org.eclipse.cdt.internal.core.parser2.ISourceCodeParser;
|
||||
import org.eclipse.cdt.internal.core.parser2.c.ANSICParserExtensionConfiguration;
|
||||
import org.eclipse.cdt.internal.core.parser2.c.CVisitor;
|
||||
import org.eclipse.cdt.internal.core.parser2.c.GNUCSourceParser;
|
||||
import org.eclipse.cdt.internal.core.parser2.c.ICParserExtensionConfiguration;
|
||||
import org.eclipse.cdt.internal.core.parser2.cpp.ANSICPPParserExtensionConfiguration;
|
||||
import org.eclipse.cdt.internal.core.parser2.cpp.GNUCPPSourceParser;
|
||||
import org.eclipse.cdt.internal.core.parser2.cpp.ICPPParserExtensionConfiguration;
|
||||
|
||||
/**
|
||||
* Test the new AST.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public class AST2Tests extends TestCase {
|
||||
|
||||
private static final ISourceElementRequestor NULL_REQUESTOR = new NullSourceElementRequestor();
|
||||
private static final IParserLogService NULL_LOG = new NullLogService();
|
||||
|
||||
/**
|
||||
* @param string
|
||||
* @param c
|
||||
* @return
|
||||
* @throws ParserException
|
||||
*/
|
||||
protected IASTTranslationUnit parse(String code, ParserLanguage lang) throws ParserException {
|
||||
ProblemCollector collector = new ProblemCollector();
|
||||
IScanner scanner = ParserFactory.createScanner(new CodeReader(code
|
||||
.toCharArray()), new ScannerInfo(), ParserMode.COMPLETE_PARSE,
|
||||
lang, NULL_REQUESTOR,
|
||||
NULL_LOG, Collections.EMPTY_LIST);
|
||||
ISourceCodeParser parser2 = null;
|
||||
if( lang == ParserLanguage.CPP )
|
||||
{
|
||||
ICPPParserExtensionConfiguration config = null;
|
||||
config = new ANSICPPParserExtensionConfiguration();
|
||||
parser2 = new GNUCPPSourceParser(scanner, ParserMode.COMPLETE_PARSE, collector,
|
||||
NULL_LOG,
|
||||
config );
|
||||
}
|
||||
else
|
||||
{
|
||||
ICParserExtensionConfiguration config = null;
|
||||
config = new ANSICParserExtensionConfiguration();
|
||||
|
||||
parser2 = new GNUCSourceParser( scanner, ParserMode.COMPLETE_PARSE, collector,
|
||||
NULL_LOG, config );
|
||||
}
|
||||
IASTTranslationUnit tu = parser2.parse();
|
||||
if( parser2.encounteredError() )
|
||||
throw new ParserException( "FAILURE"); //$NON-NLS-1$
|
||||
|
||||
assertTrue( collector.hasNoProblems() );
|
||||
|
||||
return tu;
|
||||
}
|
||||
|
||||
|
||||
public void testBasicFunction() throws ParserException {
|
||||
StringBuffer buff = new StringBuffer();
|
||||
buff.append("int x;\n"); //$NON-NLS-1$
|
||||
buff.append("void f(int y) {\n"); //$NON-NLS-1$
|
||||
buff.append(" int z = x + y;\n"); //$NON-NLS-1$
|
||||
buff.append("}\n"); //$NON-NLS-1$
|
||||
|
||||
IASTTranslationUnit tu = parse(buff.toString(), ParserLanguage.C );
|
||||
IScope globalScope = tu.getScope();
|
||||
|
||||
List declarations = tu.getDeclarations();
|
||||
|
||||
// int x
|
||||
IASTSimpleDeclaration decl_x = (IASTSimpleDeclaration) declarations
|
||||
.get(0);
|
||||
IASTSimpleDeclSpecifier declspec_x = (IASTSimpleDeclSpecifier) decl_x
|
||||
.getDeclSpecifier();
|
||||
assertEquals(IASTSimpleDeclSpecifier.t_int, declspec_x.getType());
|
||||
IASTDeclarator declor_x = (IASTDeclarator) decl_x.getDeclarators().get(
|
||||
0);
|
||||
IASTName name_x = declor_x.getName();
|
||||
assertEquals("x", name_x.toString()); //$NON-NLS-1$
|
||||
|
||||
// function - void f()
|
||||
IASTFunctionDefinition funcdef_f = (IASTFunctionDefinition) declarations
|
||||
.get(1);
|
||||
IASTSimpleDeclSpecifier declspec_f = (IASTSimpleDeclSpecifier) funcdef_f
|
||||
.getDeclSpecifier();
|
||||
assertEquals(IASTSimpleDeclSpecifier.t_void, declspec_f.getType());
|
||||
IASTFunctionDeclarator declor_f = funcdef_f
|
||||
.getDeclarator();
|
||||
IASTName name_f = declor_f.getName();
|
||||
assertEquals("f", name_f.toString()); //$NON-NLS-1$
|
||||
|
||||
// parameter - int y
|
||||
IASTParameterDeclaration decl_y = (IASTParameterDeclaration) declor_f
|
||||
.getParameters().get(0);
|
||||
IASTSimpleDeclSpecifier declspec_y = (IASTSimpleDeclSpecifier) decl_y
|
||||
.getDeclSpecifier();
|
||||
assertEquals(IASTSimpleDeclSpecifier.t_int, declspec_y.getType());
|
||||
IASTDeclarator declor_y = decl_y.getDeclarator();
|
||||
IASTName name_y = declor_y.getName();
|
||||
assertEquals("y", name_y.toString()); //$NON-NLS-1$
|
||||
|
||||
// int z
|
||||
IASTCompoundStatement body_f = (IASTCompoundStatement) funcdef_f
|
||||
.getBody();
|
||||
IASTDeclarationStatement declstmt_z = (IASTDeclarationStatement) body_f
|
||||
.getStatements().get(0);
|
||||
IASTSimpleDeclaration decl_z = (IASTSimpleDeclaration) declstmt_z
|
||||
.getDeclaration();
|
||||
IASTSimpleDeclSpecifier declspec_z = (IASTSimpleDeclSpecifier) decl_z
|
||||
.getDeclSpecifier();
|
||||
assertEquals(IASTSimpleDeclSpecifier.t_int, declspec_z.getType());
|
||||
IASTDeclarator declor_z = (IASTDeclarator) decl_z.getDeclarators().get(
|
||||
0);
|
||||
IASTName name_z = declor_z.getName();
|
||||
assertEquals("z", name_z.toString()); //$NON-NLS-1$
|
||||
|
||||
// = x + y
|
||||
IASTInitializerExpression initializer = (IASTInitializerExpression) declor_z.getInitializer();
|
||||
IASTBinaryExpression init_z = (IASTBinaryExpression) initializer.getExpression();
|
||||
assertEquals(IASTBinaryExpression.op_plus, init_z.getOperator());
|
||||
IASTIdExpression ref_x = (IASTIdExpression) init_z.getOperand1();
|
||||
IASTName name_ref_x = ref_x.getName();
|
||||
assertEquals("x", name_ref_x.toString()); //$NON-NLS-1$
|
||||
|
||||
IASTIdExpression ref_y = (IASTIdExpression) init_z.getOperand2();
|
||||
IASTName name_ref_y = ref_y.getName();
|
||||
assertEquals("y", name_ref_y.toString()); //$NON-NLS-1$
|
||||
|
||||
//BINDINGS
|
||||
// resolve the binding to get the variable object
|
||||
IVariable var_x = (IVariable) name_x.resolveBinding();
|
||||
assertEquals(globalScope, var_x.getScope());
|
||||
IFunction func_f = (IFunction) name_f.resolveBinding();
|
||||
assertEquals(globalScope, func_f.getScope());
|
||||
IParameter var_y = (IParameter) name_y.resolveBinding();
|
||||
assertEquals(func_f.getFunctionScope(), var_y.getScope());
|
||||
|
||||
IVariable var_z = (IVariable) name_z.resolveBinding();
|
||||
assertEquals(func_f.getFunctionScope(), var_z.getScope());
|
||||
|
||||
// make sure the variable referenced is the same one we declared above
|
||||
assertEquals(var_x, name_ref_x.resolveBinding());
|
||||
assertEquals(var_y, name_ref_y.resolveBinding());
|
||||
|
||||
}
|
||||
|
||||
public void testSimpleStruct() throws ParserException {
|
||||
StringBuffer buff = new StringBuffer();
|
||||
buff.append("typedef struct {\n"); //$NON-NLS-1$
|
||||
buff.append(" int x;\n"); //$NON-NLS-1$
|
||||
buff.append("} S;\n"); //$NON-NLS-1$
|
||||
|
||||
buff.append("void f() {\n"); //$NON-NLS-1$
|
||||
buff.append(" S myS;\n"); //$NON-NLS-1$
|
||||
buff.append(" myS.x = 5;"); //$NON-NLS-1$
|
||||
buff.append("}"); //$NON-NLS-1$
|
||||
|
||||
IASTTranslationUnit tu = parse(buff.toString(), ParserLanguage.C );
|
||||
IASTSimpleDeclaration decl = (IASTSimpleDeclaration)tu.getDeclarations().get(0);
|
||||
IASTCompositeTypeSpecifier type = (IASTCompositeTypeSpecifier)decl.getDeclSpecifier();
|
||||
|
||||
// it's a typedef
|
||||
assertEquals(IASTDeclSpecifier.sc_typedef, type.getStorageClass());
|
||||
// this an anonymous struct
|
||||
IASTName name_struct = type.getName();
|
||||
assertNull("", name_struct.toString()); //$NON-NLS-1$
|
||||
// member - x
|
||||
IASTSimpleDeclaration decl_x = (IASTSimpleDeclaration) type
|
||||
.getMembers().get(0);
|
||||
IASTSimpleDeclSpecifier spec_x = (IASTSimpleDeclSpecifier) decl_x
|
||||
.getDeclSpecifier();
|
||||
// it's an int
|
||||
assertEquals(IASTSimpleDeclSpecifier.t_int, spec_x.getType());
|
||||
IASTDeclarator tor_x = (IASTDeclarator) decl_x
|
||||
.getDeclarators().get(0);
|
||||
IASTName name_x = tor_x.getName();
|
||||
assertEquals("x", name_x.toString()); //$NON-NLS-1$
|
||||
|
||||
// declarator S
|
||||
IASTDeclarator tor_S = (IASTDeclarator) decl.getDeclarators().get(0);
|
||||
IASTName name_S = tor_S.getName();
|
||||
assertEquals("S", name_S.toString()); //$NON-NLS-1$
|
||||
|
||||
// function f
|
||||
IASTFunctionDefinition def_f = (IASTFunctionDefinition) tu
|
||||
.getDeclarations().get(1);
|
||||
// f's body
|
||||
IASTCompoundStatement body_f = (IASTCompoundStatement) def_f.getBody();
|
||||
// the declaration statement for myS
|
||||
IASTDeclarationStatement declstmt_myS = (IASTDeclarationStatement)body_f.getStatements().get(0);
|
||||
// the declaration for myS
|
||||
IASTSimpleDeclaration decl_myS = (IASTSimpleDeclaration)declstmt_myS.getDeclaration();
|
||||
// the type specifier for myS
|
||||
IASTTypedefNameSpecifier type_spec_myS = (IASTTypedefNameSpecifier)decl_myS.getDeclSpecifier();
|
||||
// the type name for myS
|
||||
IASTName name_type_myS = type_spec_myS.getName();
|
||||
// the declarator for myS
|
||||
IASTDeclarator tor_myS = (IASTDeclarator)decl_myS.getDeclarators().get(0);
|
||||
// the name for myS
|
||||
IASTName name_myS = tor_myS.getName();
|
||||
// the assignment expression statement
|
||||
IASTExpressionStatement exprstmt = (IASTExpressionStatement)body_f.getStatements().get(1);
|
||||
// the assignment expression
|
||||
IASTBinaryExpression assexpr = (IASTBinaryExpression)exprstmt.getExpression();
|
||||
// the field reference to myS.x
|
||||
IASTFieldReference fieldref = (IASTFieldReference)assexpr.getOperand1();
|
||||
// the reference to myS
|
||||
IASTIdExpression ref_myS = (IASTIdExpression)fieldref.getFieldOwner();
|
||||
IASTLiteralExpression lit_5 = (IASTLiteralExpression)assexpr.getOperand2();
|
||||
assertEquals("5", lit_5.toString()); //$NON-NLS-1$
|
||||
|
||||
//Logical Bindings In Test
|
||||
ICompositeType type_struct = (ICompositeType) name_struct.resolveBinding();
|
||||
ITypedef typedef_S = (ITypedef) name_S.resolveBinding();
|
||||
// make sure the typedef is hooked up correctly
|
||||
assertEquals(type_struct, typedef_S.getType());
|
||||
// the typedef S for myS
|
||||
ITypedef typedef_myS = (ITypedef)name_type_myS.resolveBinding();
|
||||
assertEquals(typedef_S, typedef_myS);
|
||||
// get the real type for S which is our anonymous struct
|
||||
ICompositeType type_myS = (ICompositeType)typedef_myS.getType();
|
||||
assertEquals( type_myS, type_struct );
|
||||
// the variable myS
|
||||
IVariable var_myS = (IVariable)name_myS.resolveBinding();
|
||||
assertEquals(typedef_S, var_myS.getType());
|
||||
assertEquals(var_myS, ref_myS.getName().resolveBinding());
|
||||
IField field_x = (IField)name_x.resolveBinding();
|
||||
assertEquals(field_x, fieldref.getFieldName().resolveBinding());
|
||||
}
|
||||
|
||||
public void testCExpressions() throws ParserException
|
||||
{
|
||||
validateSimpleUnaryExpressionC( "++x", IASTUnaryExpression.op_prefixIncr ); //$NON-NLS-1$
|
||||
validateSimpleUnaryExpressionC( "--x", IASTUnaryExpression.op_prefixDecr ); //$NON-NLS-1$
|
||||
validateSimpleUnaryExpressionC( "+x", IASTUnaryExpression.op_plus ); //$NON-NLS-1$
|
||||
validateSimpleUnaryExpressionC( "-x", IASTUnaryExpression.op_minus ); //$NON-NLS-1$
|
||||
validateSimpleUnaryExpressionC( "!x", IASTUnaryExpression.op_not ); //$NON-NLS-1$
|
||||
validateSimpleUnaryExpressionC( "~x", IASTUnaryExpression.op_tilde ); //$NON-NLS-1$
|
||||
validateSimpleUnaryExpressionC( "*x", IASTUnaryExpression.op_star ); //$NON-NLS-1$
|
||||
validateSimpleUnaryExpressionC( "&x", IASTUnaryExpression.op_amper ); //$NON-NLS-1$
|
||||
validateSimpleUnaryExpressionC( "sizeof x", IASTUnaryExpression.op_sizeof ); //$NON-NLS-1$
|
||||
validateSimpleTypeIdExpressionC( "sizeof( int )", IASTTypeIdExpression.op_sizeof ); //$NON-NLS-1$
|
||||
validateSimpleUnaryTypeIdExpression( "(int)x", IASTUnaryTypeIdExpression.op_cast ); //$NON-NLS-1$
|
||||
validateSimplePostfixInitializerExpressionC( "(int) { 5 }"); //$NON-NLS-1$
|
||||
validateSimplePostfixInitializerExpressionC( "(int) { 5, }"); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x=y", IASTBinaryExpression.op_assign ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x*=y", IASTBinaryExpression.op_multiplyAssign ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x/=y", IASTBinaryExpression.op_divideAssign ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x%=y", IASTBinaryExpression.op_moduloAssign ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x+=y", IASTBinaryExpression.op_plusAssign); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x-=y", IASTBinaryExpression.op_minusAssign ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x<<=y", IASTBinaryExpression.op_shiftLeftAssign); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x>>=y", IASTBinaryExpression.op_shiftRightAssign ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x&=y", IASTBinaryExpression.op_binaryAndAssign ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x^=y", IASTBinaryExpression.op_binaryXorAssign ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x|=y", IASTBinaryExpression.op_binaryOrAssign ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x-y", IASTBinaryExpression.op_minus ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x+y", IASTBinaryExpression.op_plus ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x/y", IASTBinaryExpression.op_divide ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x*y", IASTBinaryExpression.op_multiply); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x%y", IASTBinaryExpression.op_modulo ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x<<y", IASTBinaryExpression.op_shiftLeft ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x>>y", IASTBinaryExpression.op_shiftRight ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x<y", IASTBinaryExpression.op_lessThan ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x>y", IASTBinaryExpression.op_greaterThan); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x<=y", IASTBinaryExpression.op_lessEqual ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x>=y", IASTBinaryExpression.op_greaterEqual ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x==y", IASTBinaryExpression.op_equals ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x!=y", IASTBinaryExpression.op_notequals ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x&y", IASTBinaryExpression.op_binaryAnd ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x^y", IASTBinaryExpression.op_binaryXor ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x|y", IASTBinaryExpression.op_binaryOr ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x&&y", IASTBinaryExpression.op_logicalAnd ); //$NON-NLS-1$
|
||||
validateSimpleBinaryExpressionC("x||y", IASTBinaryExpression.op_logicalOr ); //$NON-NLS-1$
|
||||
validateConditionalExpressionC( "x ? y : x" ); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
*/
|
||||
protected void validateSimplePostfixInitializerExpressionC(String code ) throws ParserException {
|
||||
ICASTTypeIdInitializerExpression e = (ICASTTypeIdInitializerExpression) getExpressionFromStatementInCode(code, ParserLanguage.C );
|
||||
assertNotNull( e );
|
||||
assertNotNull( e.getTypeId() );
|
||||
assertNotNull( e.getInitializer() );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string
|
||||
* @throws ParserException
|
||||
*/
|
||||
protected void validateSimpleUnaryTypeIdExpression(String code, int op ) throws ParserException {
|
||||
IASTUnaryTypeIdExpression e = (IASTUnaryTypeIdExpression) getExpressionFromStatementInCode( code, ParserLanguage.C );
|
||||
assertNotNull( e );
|
||||
assertEquals( e.getOperator(), op );
|
||||
assertNotNull( e.getTypeId() );
|
||||
IASTIdExpression x = (IASTIdExpression) e.getOperand();
|
||||
assertEquals( x.getName().toString(), "x"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param code
|
||||
* @param op
|
||||
* @throws ParserException
|
||||
*/
|
||||
protected void validateSimpleTypeIdExpressionC(String code, int op ) throws ParserException {
|
||||
IASTTypeIdExpression e = (IASTTypeIdExpression) getExpressionFromStatementInCode( code, ParserLanguage.C );
|
||||
assertNotNull( e );
|
||||
assertEquals( e.getOperator(), op );
|
||||
assertNotNull( e.getTypeId() );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string
|
||||
* @param op_prefixIncr
|
||||
* @throws ParserException
|
||||
*/
|
||||
protected void validateSimpleUnaryExpressionC(String code , int operator ) throws ParserException {
|
||||
IASTUnaryExpression e = (IASTUnaryExpression) getExpressionFromStatementInCode( code, ParserLanguage.C );
|
||||
assertNotNull( e );
|
||||
assertEquals( e.getOperator(), operator );
|
||||
IASTIdExpression x = (IASTIdExpression) e.getOperand();
|
||||
assertEquals( x.getName().toString(), "x"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param code
|
||||
* @throws ParserException
|
||||
*/
|
||||
protected void validateConditionalExpressionC(String code ) throws ParserException {
|
||||
IASTConditionalExpression e = (IASTConditionalExpression) getExpressionFromStatementInCode( code , ParserLanguage.C );
|
||||
assertNotNull( e );
|
||||
IASTIdExpression x = (IASTIdExpression) e.getLogicalConditionExpression();
|
||||
assertEquals( x.getName().toString(), "x" ); //$NON-NLS-1$
|
||||
IASTIdExpression y = (IASTIdExpression) e.getPositiveResultExpression();
|
||||
assertEquals( y.getName().toString(), "y"); //$NON-NLS-1$
|
||||
IASTIdExpression x2 = (IASTIdExpression) e.getNegativeResultExpression();
|
||||
assertEquals( x.getName().toString(), x2.getName().toString() );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param operand
|
||||
* @throws ParserException
|
||||
*/
|
||||
protected void validateSimpleBinaryExpressionC( String code, int operand) throws ParserException {
|
||||
IASTBinaryExpression e = (IASTBinaryExpression) getExpressionFromStatementInCode( code, ParserLanguage.C ); //$NON-NLS-1$
|
||||
assertNotNull( e );
|
||||
assertEquals( e.getOperator(), operand );
|
||||
IASTIdExpression x = (IASTIdExpression) e.getOperand1();
|
||||
assertEquals( x.getName().toString(), "x"); //$NON-NLS-1$
|
||||
IASTIdExpression y = (IASTIdExpression) e.getOperand2();
|
||||
assertEquals( y.getName().toString(), "y"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
|
||||
protected IASTExpression getExpressionFromStatementInCode( String code, ParserLanguage language ) throws ParserException
|
||||
{
|
||||
StringBuffer buffer = new StringBuffer( "void f() { "); //$NON-NLS-1$
|
||||
buffer.append( "int x, y;\n"); //$NON-NLS-1$
|
||||
buffer.append( code );
|
||||
buffer.append( ";\n}"); //$NON-NLS-1$
|
||||
IASTTranslationUnit tu = parse( buffer.toString(), language );
|
||||
IASTFunctionDefinition f = (IASTFunctionDefinition) tu.getDeclarations().get(0);
|
||||
IASTCompoundStatement cs = (IASTCompoundStatement) f.getBody();
|
||||
IASTExpressionStatement s = (IASTExpressionStatement) cs.getStatements().get( 1 );
|
||||
return s.getExpression();
|
||||
}
|
||||
|
||||
|
||||
public void testMultipleDeclarators() throws Exception {
|
||||
IASTTranslationUnit tu = parse( "int r, s;" , ParserLanguage.C ); //$NON-NLS-1$
|
||||
IASTSimpleDeclaration decl = (IASTSimpleDeclaration)tu.getDeclarations().get(0);
|
||||
List declarators = decl.getDeclarators();
|
||||
assertEquals( 2, declarators.size() );
|
||||
|
||||
IASTDeclarator dtor1 = (IASTDeclarator) declarators.get(0);
|
||||
IASTDeclarator dtor2 = (IASTDeclarator) declarators.get(1);
|
||||
|
||||
IASTName name1 = dtor1.getName();
|
||||
IASTName name2 = dtor2.getName();
|
||||
|
||||
assertEquals( name1.resolveBinding().getName(), "r" ); //$NON-NLS-1$
|
||||
assertEquals( name2.resolveBinding().getName(), "s" ); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public void testStructureTagScoping_1() throws Exception{
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append( "struct A; \n" ); //$NON-NLS-1$
|
||||
buffer.append( "void f(){ \n" ); //$NON-NLS-1$
|
||||
buffer.append( " struct A; \n" ); //$NON-NLS-1$
|
||||
buffer.append( " struct A * a; \n" ); //$NON-NLS-1$
|
||||
buffer.append( "} \n" ); //$NON-NLS-1$
|
||||
|
||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||
|
||||
//struct A;
|
||||
IASTSimpleDeclaration decl1 = (IASTSimpleDeclaration) tu.getDeclarations().get(0);
|
||||
IASTElaboratedTypeSpecifier compTypeSpec = (IASTElaboratedTypeSpecifier) decl1.getDeclSpecifier();
|
||||
assertEquals( 0, decl1.getDeclarators().size() );
|
||||
IASTName nameA1 = compTypeSpec.getName();
|
||||
|
||||
//void f() {
|
||||
IASTFunctionDefinition fndef = (IASTFunctionDefinition) tu.getDeclarations().get(1);
|
||||
IASTCompoundStatement compoundStatement = (IASTCompoundStatement) fndef.getBody();
|
||||
assertEquals( 2, compoundStatement.getStatements().size() );
|
||||
|
||||
// struct A;
|
||||
IASTDeclarationStatement declStatement = (IASTDeclarationStatement) compoundStatement.getStatements().get( 0 );
|
||||
IASTSimpleDeclaration decl2 = (IASTSimpleDeclaration) declStatement.getDeclaration();
|
||||
compTypeSpec = (IASTElaboratedTypeSpecifier) decl2.getDeclSpecifier();
|
||||
assertEquals( 0, decl2.getDeclarators().size() );
|
||||
IASTName nameA2 = compTypeSpec.getName();
|
||||
|
||||
// struct A * a;
|
||||
declStatement = (IASTDeclarationStatement) compoundStatement.getStatements().get(1);
|
||||
IASTSimpleDeclaration decl3 = (IASTSimpleDeclaration) declStatement.getDeclaration();
|
||||
compTypeSpec = (IASTElaboratedTypeSpecifier) decl3.getDeclSpecifier();
|
||||
IASTName nameA3 = compTypeSpec.getName();
|
||||
IASTDeclarator dtor = (IASTDeclarator) decl3.getDeclarators().get(0);
|
||||
IASTName namea = dtor.getName();
|
||||
assertEquals( 1, dtor.getPointerOperators().size() );
|
||||
assertTrue( dtor.getPointerOperators().get(0) instanceof ICASTPointer );
|
||||
|
||||
//bindings
|
||||
ICompositeType str1 = (ICompositeType) nameA1.resolveBinding();
|
||||
ICompositeType str2 = (ICompositeType) nameA2.resolveBinding();
|
||||
IVariable var = (IVariable) namea.resolveBinding();
|
||||
ICompositeType str3 = (ICompositeType) var.getType();
|
||||
ICompositeType str4 = (ICompositeType) nameA3.resolveBinding();
|
||||
assertNotNull( str1 );
|
||||
assertNotNull( str2 );
|
||||
assertNotSame( str1, str2 );
|
||||
assertSame( str2, str3 );
|
||||
assertSame( str3, str4 );
|
||||
}
|
||||
|
||||
public void testStructureTagScoping_2() throws Exception{
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append( "struct A; \n" ); //$NON-NLS-1$
|
||||
buffer.append( "void f(){ \n" ); //$NON-NLS-1$
|
||||
buffer.append( " struct A * a; \n" ); //$NON-NLS-1$
|
||||
buffer.append( "} \r\n" ); //$NON-NLS-1$
|
||||
|
||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||
|
||||
//struct A;
|
||||
IASTSimpleDeclaration decl1 = (IASTSimpleDeclaration) tu.getDeclarations().get(0);
|
||||
IASTElaboratedTypeSpecifier compTypeSpec = (IASTElaboratedTypeSpecifier) decl1.getDeclSpecifier();
|
||||
assertEquals( 0, decl1.getDeclarators().size() );
|
||||
IASTName nameA1 = compTypeSpec.getName();
|
||||
|
||||
//void f() {
|
||||
IASTFunctionDefinition fndef = (IASTFunctionDefinition) tu.getDeclarations().get(1);
|
||||
IASTCompoundStatement compoundStatement = (IASTCompoundStatement) fndef.getBody();
|
||||
assertEquals( 1, compoundStatement.getStatements().size() );
|
||||
|
||||
// struct A * a;
|
||||
IASTDeclarationStatement declStatement = (IASTDeclarationStatement) compoundStatement.getStatements().get(0);
|
||||
IASTSimpleDeclaration decl2 = (IASTSimpleDeclaration) declStatement.getDeclaration();
|
||||
compTypeSpec = (IASTElaboratedTypeSpecifier) decl2.getDeclSpecifier();
|
||||
IASTName nameA2 = compTypeSpec.getName();
|
||||
IASTDeclarator dtor = (IASTDeclarator) decl2.getDeclarators().get(0);
|
||||
IASTName namea = dtor.getName();
|
||||
assertEquals( 1, dtor.getPointerOperators().size() );
|
||||
assertTrue( dtor.getPointerOperators().get(0) instanceof ICASTPointer );
|
||||
|
||||
//bindings
|
||||
ICompositeType str1 = (ICompositeType) nameA1.resolveBinding();
|
||||
ICompositeType str2 = (ICompositeType) nameA2.resolveBinding();
|
||||
IVariable var = (IVariable) namea.resolveBinding();
|
||||
ICompositeType str3 = (ICompositeType) var.getType();
|
||||
assertNotNull( str1 );
|
||||
assertSame( str1, str2 );
|
||||
assertSame( str2, str3 );
|
||||
}
|
||||
|
||||
public void testStructureDef() throws Exception{
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append( "struct A; \r\n"); //$NON-NLS-1$
|
||||
buffer.append( "struct A * a; \n"); //$NON-NLS-1$
|
||||
buffer.append( "struct A { int i; }; \n"); //$NON-NLS-1$
|
||||
buffer.append( "void f() { \n"); //$NON-NLS-1$
|
||||
buffer.append( " a->i; \n"); //$NON-NLS-1$
|
||||
buffer.append( "} \n"); //$NON-NLS-1$
|
||||
|
||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||
|
||||
//struct A;
|
||||
IASTSimpleDeclaration decl = (IASTSimpleDeclaration) tu.getDeclarations().get(0);
|
||||
IASTElaboratedTypeSpecifier elabTypeSpec = (IASTElaboratedTypeSpecifier) decl.getDeclSpecifier();
|
||||
assertEquals( 0, decl.getDeclarators().size() );
|
||||
IASTName name_A1 = elabTypeSpec.getName();
|
||||
|
||||
//struct A * a;
|
||||
decl = (IASTSimpleDeclaration) tu.getDeclarations().get(1);
|
||||
elabTypeSpec = (IASTElaboratedTypeSpecifier) decl.getDeclSpecifier();
|
||||
IASTName name_A2 = elabTypeSpec.getName();
|
||||
IASTDeclarator dtor = (IASTDeclarator) decl.getDeclarators().get(0);
|
||||
IASTName name_a = dtor.getName();
|
||||
assertEquals( 1, dtor.getPointerOperators().size() );
|
||||
assertTrue( dtor.getPointerOperators().get(0) instanceof ICASTPointer );
|
||||
|
||||
//struct A {
|
||||
decl = (IASTSimpleDeclaration) tu.getDeclarations().get(2);
|
||||
ICASTCompositeTypeSpecifier compTypeSpec = (ICASTCompositeTypeSpecifier) decl.getDeclSpecifier();
|
||||
IASTName name_Adef = compTypeSpec.getName();
|
||||
|
||||
// int i;
|
||||
decl = (IASTSimpleDeclaration) compTypeSpec.getMembers().get(0);
|
||||
dtor = (IASTDeclarator) decl.getDeclarators().get(0);
|
||||
IASTName name_i = dtor.getName();
|
||||
|
||||
//void f() {
|
||||
IASTFunctionDefinition fndef = (IASTFunctionDefinition) tu.getDeclarations().get(3);
|
||||
IASTCompoundStatement compoundStatement = (IASTCompoundStatement) fndef.getBody();
|
||||
assertEquals( 1, compoundStatement.getStatements().size() );
|
||||
|
||||
// a->i;
|
||||
IASTExpressionStatement exprstmt = (IASTExpressionStatement)compoundStatement.getStatements().get(0);
|
||||
IASTFieldReference fieldref = (IASTFieldReference)exprstmt.getExpression();
|
||||
IASTIdExpression id_a = (IASTIdExpression) fieldref.getFieldOwner();
|
||||
IASTName name_aref = id_a.getName();
|
||||
IASTName name_iref = fieldref.getFieldName();
|
||||
|
||||
//bindings
|
||||
IVariable var_a1 = (IVariable) name_aref.resolveBinding();
|
||||
IVariable var_i1 = (IVariable) name_iref.resolveBinding();
|
||||
ICompositeType structA_1 = (ICompositeType) var_a1.getType();
|
||||
ICompositeType structA_2 = (ICompositeType) name_A1.resolveBinding();
|
||||
ICompositeType structA_3 = (ICompositeType) name_A2.resolveBinding();
|
||||
ICompositeType structA_4 = (ICompositeType) name_Adef.resolveBinding();
|
||||
|
||||
IVariable var_a2 = (IVariable) name_a.resolveBinding();
|
||||
IVariable var_i2 = (IVariable) name_i.resolveBinding();
|
||||
|
||||
assertSame( var_a1, var_a2 );
|
||||
assertSame( var_i1, var_i2 );
|
||||
assertSame( structA_1, structA_2 );
|
||||
assertSame( structA_2, structA_3 );
|
||||
assertSame( structA_3, structA_4 );
|
||||
}
|
||||
|
||||
public void testFunctionParameters() throws Exception {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append( "void f( int a ); \n"); //$NON-NLS-1$
|
||||
buffer.append( "void f( int b ){ \n"); //$NON-NLS-1$
|
||||
buffer.append( " b; \n"); //$NON-NLS-1$
|
||||
buffer.append( "} \n"); //$NON-NLS-1$
|
||||
|
||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||
|
||||
//void f(
|
||||
IASTSimpleDeclaration f_decl = (IASTSimpleDeclaration) tu.getDeclarations().get(0);
|
||||
IASTFunctionDeclarator dtor = (IASTFunctionDeclarator) f_decl.getDeclarators().get(0);
|
||||
IASTName f_name1 = dtor.getName();
|
||||
// int a );
|
||||
IASTParameterDeclaration param = (IASTParameterDeclaration) dtor.getParameters().get(0);
|
||||
IASTDeclarator paramDtor = param.getDeclarator();
|
||||
IASTName name_param1 = paramDtor.getName();
|
||||
|
||||
//void f(
|
||||
IASTFunctionDefinition f_defn = (IASTFunctionDefinition) tu.getDeclarations().get(1);
|
||||
dtor = f_defn.getDeclarator();
|
||||
IASTName f_name2 = dtor.getName();
|
||||
// int b );
|
||||
param = (IASTParameterDeclaration) dtor.getParameters().get(0);
|
||||
paramDtor = param.getDeclarator();
|
||||
IASTName name_param2 = paramDtor.getName();
|
||||
|
||||
// b;
|
||||
IASTCompoundStatement compound = (IASTCompoundStatement) f_defn.getBody();
|
||||
IASTExpressionStatement expStatement = (IASTExpressionStatement) compound.getStatements().get(0);
|
||||
IASTIdExpression idexp = (IASTIdExpression) expStatement.getExpression();
|
||||
IASTName name_param3 = idexp.getName();
|
||||
|
||||
//bindings
|
||||
IParameter param_1 = (IParameter) name_param3.resolveBinding();
|
||||
IParameter param_2 = (IParameter) name_param2.resolveBinding();
|
||||
IParameter param_3 = (IParameter) name_param1.resolveBinding();
|
||||
IFunction f_1 = (IFunction) f_name1.resolveBinding();
|
||||
IFunction f_2 = (IFunction) f_name2.resolveBinding();
|
||||
|
||||
assertNotNull( param_1 );
|
||||
assertNotNull( f_1 );
|
||||
assertSame( param_1, param_2 );
|
||||
assertSame( param_2, param_3 );
|
||||
assertSame( f_1, f_2 );
|
||||
|
||||
CVisitor.clearBindings( tu );
|
||||
param_1 = (IParameter) name_param1.resolveBinding();
|
||||
param_2 = (IParameter) name_param3.resolveBinding();
|
||||
param_3 = (IParameter) name_param2.resolveBinding();
|
||||
f_1 = (IFunction) f_name2.resolveBinding();
|
||||
f_2 = (IFunction) f_name1.resolveBinding();
|
||||
assertNotNull( param_1 );
|
||||
assertNotNull( f_1 );
|
||||
assertSame( param_1, param_2 );
|
||||
assertSame( param_2, param_3 );
|
||||
assertSame( f_1, f_2 );
|
||||
}
|
||||
|
||||
public void testSimpleFunction() throws Exception {
|
||||
StringBuffer buffer = new StringBuffer( "void f( int a, int b ) { } \n" ); //$NON-NLS-1$
|
||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||
|
||||
IASTFunctionDefinition fDef = (IASTFunctionDefinition) tu.getDeclarations().get(0);
|
||||
IASTFunctionDeclarator fDtor = fDef.getDeclarator();
|
||||
IASTName fName = fDtor.getName();
|
||||
|
||||
IASTParameterDeclaration a = (IASTParameterDeclaration) fDtor.getParameters().get( 0 );
|
||||
IASTName name_a = a.getDeclarator().getName();
|
||||
|
||||
IASTParameterDeclaration b = (IASTParameterDeclaration) fDtor.getParameters().get( 1 );
|
||||
IASTName name_b = b.getDeclarator().getName();
|
||||
|
||||
IFunction function = (IFunction) fName.resolveBinding();
|
||||
IParameter param_a = (IParameter) name_a.resolveBinding();
|
||||
IParameter param_b = (IParameter) name_b.resolveBinding();
|
||||
|
||||
assertEquals( "f", function.getName() ); //$NON-NLS-1$
|
||||
assertEquals( "a", param_a.getName() ); //$NON-NLS-1$
|
||||
assertEquals( "b", param_b.getName() ); //$NON-NLS-1$
|
||||
|
||||
List params = function.getParameters();
|
||||
assertEquals( 2, params.size() );
|
||||
assertSame( params.get(0), param_a );
|
||||
assertSame( params.get(1), param_b );
|
||||
}
|
||||
|
||||
public void testSimpleFunctionCall() throws Exception {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append( "void f(); \n" ); //$NON-NLS-1$
|
||||
buffer.append( "void g() { \n" ); //$NON-NLS-1$
|
||||
buffer.append( " f(); \n" ); //$NON-NLS-1$
|
||||
buffer.append( "} \n" ); //$NON-NLS-1$
|
||||
buffer.append( "void f(){ } \n" ); //$NON-NLS-1$
|
||||
|
||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||
|
||||
//void f();
|
||||
IASTSimpleDeclaration fdecl = (IASTSimpleDeclaration) tu.getDeclarations().get(0);
|
||||
IASTFunctionDeclarator fdtor = (IASTFunctionDeclarator) fdecl.getDeclarators().get(0);
|
||||
IASTName name_f = fdtor.getName();
|
||||
|
||||
//void g() {
|
||||
IASTFunctionDefinition gdef = (IASTFunctionDefinition) tu.getDeclarations().get(1);
|
||||
|
||||
// f();
|
||||
IASTCompoundStatement compound = (IASTCompoundStatement) gdef.getBody();
|
||||
IASTExpressionStatement expStatement = (IASTExpressionStatement) compound.getStatements().get(0);
|
||||
IASTFunctionCallExpression fcall = (IASTFunctionCallExpression) expStatement.getExpression();
|
||||
IASTIdExpression fcall_id = (IASTIdExpression) fcall.getFunctionNameExpression();
|
||||
IASTName name_fcall = fcall_id.getName();
|
||||
assertNull( fcall.getParameterExpression() );
|
||||
|
||||
//void f() {}
|
||||
IASTFunctionDefinition fdef = (IASTFunctionDefinition) tu.getDeclarations().get(2);
|
||||
fdtor = fdef.getDeclarator();
|
||||
IASTName name_fdef = fdtor.getName();
|
||||
|
||||
//bindings
|
||||
IFunction function_1 = (IFunction) name_fcall.resolveBinding();
|
||||
IFunction function_2 = (IFunction) name_f.resolveBinding();
|
||||
IFunction function_3 = (IFunction) name_fdef.resolveBinding();
|
||||
|
||||
assertNotNull( function_1 );
|
||||
assertSame( function_1, function_2 );
|
||||
assertSame( function_2, function_3 );
|
||||
}
|
||||
|
||||
public void testForLoop() throws Exception {
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append( "void f() { \n"); //$NON-NLS-1$
|
||||
buffer.append( " for( int i = 0; i < 5; i++ ) { \n"); //$NON-NLS-1$
|
||||
buffer.append( " i; \n"); //$NON-NLS-1$
|
||||
buffer.append( " } \n"); //$NON-NLS-1$
|
||||
buffer.append( "} \n"); //$NON-NLS-1$
|
||||
|
||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||
|
||||
//void f() {
|
||||
IASTFunctionDefinition fdef = (IASTFunctionDefinition) tu.getDeclarations().get(0);
|
||||
IASTCompoundStatement compound = (IASTCompoundStatement) fdef.getBody();
|
||||
|
||||
// for(
|
||||
IASTForStatement for_stmt = (IASTForStatement) compound.getStatements().get(0);
|
||||
// int i = 0;
|
||||
assertNull( for_stmt.getInitExpression() );
|
||||
IASTSimpleDeclaration initDecl = (IASTSimpleDeclaration) for_stmt.getInitDeclaration();
|
||||
IASTDeclarator dtor = (IASTDeclarator) initDecl.getDeclarators().get(0);
|
||||
IASTName name_i = dtor.getName();
|
||||
// i < 5;
|
||||
IASTBinaryExpression exp = (IASTBinaryExpression) for_stmt.getCondition();
|
||||
IASTIdExpression id_i = (IASTIdExpression) exp.getOperand1();
|
||||
IASTName name_i2 = id_i.getName();
|
||||
IASTLiteralExpression lit_5 = (IASTLiteralExpression) exp.getOperand2();
|
||||
assertEquals( IASTLiteralExpression.lk_integer_constant, lit_5.getKind() );
|
||||
// i++ ) {
|
||||
IASTUnaryExpression un = (IASTUnaryExpression) for_stmt.getIterationExpression();
|
||||
IASTIdExpression id_i2 = (IASTIdExpression) un.getOperand();
|
||||
IASTName name_i3 = id_i2.getName();
|
||||
assertEquals( IASTUnaryExpression.op_postFixIncr, un.getOperator() );
|
||||
|
||||
// i;
|
||||
compound = (IASTCompoundStatement) for_stmt.getBody();
|
||||
IASTExpressionStatement exprSt = (IASTExpressionStatement) compound.getStatements().get(0);
|
||||
IASTIdExpression id_i3 = (IASTIdExpression) exprSt.getExpression();
|
||||
IASTName name_i4 = id_i3.getName();
|
||||
|
||||
//bindings
|
||||
IVariable var_1 = (IVariable) name_i4.resolveBinding();
|
||||
IVariable var_2 = (IVariable) name_i.resolveBinding();
|
||||
IVariable var_3 = (IVariable) name_i2.resolveBinding();
|
||||
IVariable var_4 = (IVariable) name_i3.resolveBinding();
|
||||
|
||||
assertSame( var_1, var_2 );
|
||||
assertSame( var_2, var_3 );
|
||||
assertSame( var_3, var_4 );
|
||||
}
|
||||
|
||||
public void testExpressionFieldReference() throws Exception{
|
||||
StringBuffer buffer = new StringBuffer();
|
||||
buffer.append( "struct A { int x; }; \n"); //$NON-NLS-1$
|
||||
buffer.append( "void f(){ \n"); //$NON-NLS-1$
|
||||
buffer.append( " ((struct A *) 1)->x; \n"); //$NON-NLS-1$
|
||||
buffer.append( "} \n"); //$NON-NLS-1$
|
||||
|
||||
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.C );
|
||||
|
||||
IASTSimpleDeclaration simpleDecl = (IASTSimpleDeclaration) tu.getDeclarations().get(0);
|
||||
IASTCompositeTypeSpecifier compType = (IASTCompositeTypeSpecifier) simpleDecl.getDeclSpecifier();
|
||||
IASTSimpleDeclaration decl_x = (IASTSimpleDeclaration) compType.getMembers().get(0);
|
||||
IASTName name_x1 = ((IASTDeclarator) decl_x.getDeclarators().get(0)).getName();
|
||||
IASTFunctionDefinition fdef = (IASTFunctionDefinition) tu.getDeclarations().get(1);
|
||||
IASTCompoundStatement body = (IASTCompoundStatement) fdef.getBody();
|
||||
IASTExpressionStatement expStatement = (IASTExpressionStatement) body.getStatements().get(0);
|
||||
IASTFieldReference fieldRef = (IASTFieldReference) expStatement.getExpression();
|
||||
IASTName name_x2 = fieldRef.getFieldName();
|
||||
|
||||
IField x1 = (IField) name_x1.resolveBinding();
|
||||
IField x2 = (IField) name_x2.resolveBinding();
|
||||
|
||||
assertNotNull( x1 );
|
||||
assertSame( x1, x2 );
|
||||
}
|
||||
}
|
|
@ -0,0 +1,121 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.parser.tests.ast2;
|
||||
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.parser.IScannerInfo;
|
||||
import org.eclipse.cdt.core.parser.ScannerInfo;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public class ScannerConfigFactory {
|
||||
|
||||
public static IScannerInfo getScannerInfo() {
|
||||
String config = System.getProperty("speedTest.config");
|
||||
|
||||
if (config == null)
|
||||
return mingwScannerInfo();
|
||||
|
||||
if (config.equals("msvc"))
|
||||
return msvcScannerInfo();
|
||||
else if (config.equals("ydl"))
|
||||
return ydlScannerInfo();
|
||||
else
|
||||
return mingwScannerInfo();
|
||||
}
|
||||
|
||||
private static IScannerInfo msvcScannerInfo() {
|
||||
Map definitions = new Hashtable();
|
||||
//definitions.put( "__GNUC__", "3" ); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
String [] includePaths = new String[] {
|
||||
"C:\\Program Files\\Microsoft SDK\\Include",
|
||||
"C:\\Program Files\\Microsoft Visual C++ Toolkit 2003\\include"
|
||||
};
|
||||
return new ScannerInfo( definitions, includePaths );
|
||||
}
|
||||
|
||||
private static IScannerInfo mingwScannerInfo() {
|
||||
// TODO It would be easier and more flexible if we used discovery for this
|
||||
Map definitions = new Hashtable();
|
||||
definitions.put("__GNUC__", "3");
|
||||
definitions.put("__GNUC_MINOR__", "2");
|
||||
definitions.put("__GNUC_PATCHLEVEL__", "3");
|
||||
definitions.put("__GXX_ABI_VERSION", "102");
|
||||
definitions.put("_WIN32", "");
|
||||
definitions.put("__WIN32", "");
|
||||
definitions.put("__WIN32__", "");
|
||||
definitions.put("WIN32", "");
|
||||
definitions.put("__MINGW32__", "");
|
||||
definitions.put("__MSVCRT__", "");
|
||||
definitions.put("WINNT", "");
|
||||
definitions.put("_X86_", "1");
|
||||
definitions.put("__WINNT", "");
|
||||
definitions.put("_NO_INLINE__", "");
|
||||
definitions.put("__STDC_HOSTED__", "1");
|
||||
definitions.put("i386", "");
|
||||
definitions.put("__i386", "");
|
||||
definitions.put("__i386__", "");
|
||||
definitions.put("__tune_i586__", "");
|
||||
definitions.put("__tune_pentium__", "");
|
||||
definitions.put("__stdcall", "__attribute__((__stdcall__))");
|
||||
definitions.put("__cdecl", "__attribute__((__cdecl__))");
|
||||
definitions.put("__fastcall", "__attribute__((__fastcall__))");
|
||||
definitions.put("_stdcall", "__attribute__((__stdcall__))");
|
||||
definitions.put("_cdecl", "__attribute__((__cdecl__))");
|
||||
definitions.put("_fastcall", "__attribute__((__fastcall__))");
|
||||
definitions.put("__declspec(x)", "__attribute__((x))");
|
||||
definitions.put("__DEPRECATED", "");
|
||||
definitions.put("__EXCEPTIONS", "");
|
||||
|
||||
String [] includePaths = new String[] {
|
||||
"c:/mingw/include/c++/3.2.3",
|
||||
"c:/mingw/include/c++/3.2.3/mingw32",
|
||||
"c:/mingw/include/c++/3.2.3/backward",
|
||||
"c:/mingw/include",
|
||||
"c:/mingw/lib/gcc-lib/mingw32/3.2.3/include"
|
||||
};
|
||||
|
||||
return new ScannerInfo( definitions, includePaths );
|
||||
}
|
||||
|
||||
private static IScannerInfo ydlScannerInfo() {
|
||||
// TODO It would be easier and more flexible if we used discovery for this
|
||||
Map definitions = new Hashtable();
|
||||
definitions.put("__GNUC__", "3");
|
||||
definitions.put("__GNUC_MINOR__", "3");
|
||||
definitions.put("__GNUC_PATCHLEVEL__", "3");
|
||||
definitions.put("_GNU_SOURCE", "");
|
||||
definitions.put("__unix__", "");
|
||||
definitions.put("__gnu_linux__", "");
|
||||
definitions.put("__linux__", "");
|
||||
definitions.put("unix", "");
|
||||
definitions.put("__unix", "");
|
||||
definitions.put("linux", "");
|
||||
definitions.put("__linux", "");
|
||||
definitions.put("__GNUG__", "3");
|
||||
|
||||
String [] includePaths = new String[] {
|
||||
"/usr/include/g++",
|
||||
"/usr/include/g++/powerpc-yellowdog-linux",
|
||||
"/usr/include/g++/backward",
|
||||
"/usr/local/include",
|
||||
"/usr/lib/gcc-lib/powerpc-yellowdog-linux/3.3.3/include",
|
||||
"/usr/include"
|
||||
};
|
||||
|
||||
return new ScannerInfo( definitions, includePaths );
|
||||
}
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,51 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* This interface represents a structural property in an IASTNode.
|
||||
* This is used to determine the relationship between a child node and
|
||||
* it's parent. This is especially important with rewrite since we need
|
||||
* to understand how to properly replace the child in the source.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public class ASTNodeProperty {
|
||||
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* @param n
|
||||
*/
|
||||
public ASTNodeProperty(String n) {
|
||||
this.name = n;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Each property has a name to help distinguish it from other
|
||||
* properties of a node.
|
||||
*
|
||||
* @return the name of the property
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param name The name to set.
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface IASTASMDeclaration extends IASTDeclaration {
|
||||
|
||||
public String getAssembly();
|
||||
public void setAssembly( String assembly );
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* This is the declarator for an array.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTArrayDeclarator extends IASTDeclarator {
|
||||
|
||||
public static final ASTNodeProperty ARRAY_MODIFIER = new ASTNodeProperty( "Array Modifier"); //$NON-NLS-1$
|
||||
|
||||
public List getArrayModifiers();
|
||||
public void addArrayModifier( IASTArrayModifier arrayModifier );
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface IASTArrayModifier extends IASTNode {
|
||||
|
||||
public static final ASTNodeProperty CONSTANT_EXPRESSION = new ASTNodeProperty( "Constant Expression"); //$NON-NLS-1$
|
||||
public IASTExpression getConstantExpression();
|
||||
public void setConstantExpression( IASTExpression expression );
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface IASTArraySubscriptExpression extends IASTExpression {
|
||||
|
||||
public static final ASTNodeProperty ARRAY = new ASTNodeProperty( "Array"); //$NON-NLS-1$
|
||||
public IASTExpression getArrayExpression();
|
||||
public void setArrayExpression( IASTExpression expression );
|
||||
public static final ASTNodeProperty SUBSCRIPT = new ASTNodeProperty( "Subscript"); //$NON-NLS-1$
|
||||
public IASTExpression getSubscriptExpression();
|
||||
public void setSubscriptExpression( IASTExpression expression );
|
||||
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTBinaryExpression extends IASTExpression {
|
||||
|
||||
public static final ASTNodeProperty OPERAND_ONE = new ASTNodeProperty( "Operand 1"); //$NON-NLS-1$
|
||||
public static final ASTNodeProperty OPERAND_TWO = new ASTNodeProperty( "Operand 2"); //$NON-NLS-1$
|
||||
|
||||
public void setOperator( int op );
|
||||
public int getOperator();
|
||||
public static final int op_multiply = 1;
|
||||
public static final int op_divide = 2;
|
||||
public static final int op_modulo = 3;
|
||||
public static final int op_plus = 4;
|
||||
public static final int op_minus = 5;
|
||||
public static final int op_shiftLeft = 6;
|
||||
public static final int op_shiftRight = 7;
|
||||
public static final int op_lessThan = 8;
|
||||
public static final int op_greaterThan = 9;
|
||||
public static final int op_lessEqual = 10;
|
||||
public static final int op_greaterEqual = 11;
|
||||
public static final int op_binaryAnd = 12;
|
||||
public static final int op_binaryXor = 13;
|
||||
public static final int op_binaryOr = 14;
|
||||
public static final int op_logicalAnd = 15;
|
||||
public static final int op_logicalOr = 16;
|
||||
public static final int op_assign = 17;
|
||||
public static final int op_multiplyAssign = 18;
|
||||
public static final int op_divideAssign = 19;
|
||||
public static final int op_moduloAssign = 20;
|
||||
public static final int op_plusAssign = 21;
|
||||
public static final int op_minusAssign = 22;
|
||||
public static final int op_shiftLeftAssign = 23;
|
||||
public static final int op_shiftRightAssign = 24;
|
||||
public static final int op_binaryAndAssign = 25;
|
||||
public static final int op_binaryXorAssign = 26;
|
||||
public static final int op_binaryOrAssign = 27;
|
||||
public static final int op_equals = 28;
|
||||
public static final int op_notequals = 29;
|
||||
public static final int op_last = op_notequals;
|
||||
|
||||
public IASTExpression getOperand1();
|
||||
public void setOperand1( IASTExpression expression );
|
||||
public IASTExpression getOperand2();
|
||||
public void setOperand2( IASTExpression expression );
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* This is the break clause in a loop.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTBreakStatement extends IASTStatement {
|
||||
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* This is a case in a switch statement. Note that in the grammar,
|
||||
* a statement is part of the clause. For the AST, just go on to the
|
||||
* next statement to find it. It's really only there to ensure that there
|
||||
* is at least one statement following this clause.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTCaseStatement extends IASTStatement {
|
||||
|
||||
public static final ASTNodeProperty EXPRESSION = new ASTNodeProperty("expression"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* The expression that determines whether this case should be
|
||||
* taken.
|
||||
* @return
|
||||
*/
|
||||
public IASTExpression getExpression();
|
||||
|
||||
public void setExpression(IASTExpression expression);
|
||||
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTCompositeTypeSpecifier extends IASTDeclSpecifier {
|
||||
|
||||
public static final ASTNodeProperty TYPE_NAME = new ASTNodeProperty( "Type Name"); //$NON-NLS-1$
|
||||
public static final ASTNodeProperty MEMBER_DECLARATION = new ASTNodeProperty( "Member Declaration"); //$NON-NLS-1$
|
||||
/**
|
||||
* Is this a struct or a union or some other type of composite type.
|
||||
*
|
||||
* @return key for this type
|
||||
*/
|
||||
public int getKey();
|
||||
public static final int k_struct = 1;
|
||||
public static final int k_union = 2;
|
||||
|
||||
|
||||
public void setKey( int key );
|
||||
/**
|
||||
* Return the name for this composite type. If this is an anonymous
|
||||
* type, this will return null.
|
||||
*
|
||||
* @return the name of the type or null
|
||||
*/
|
||||
public IASTName getName();
|
||||
|
||||
public void setName( IASTName name );
|
||||
|
||||
/**
|
||||
* Returns a list of member declarations.
|
||||
*
|
||||
* @return List of IASTDeclaration
|
||||
*/
|
||||
public List getMembers();
|
||||
|
||||
public void addMemberDeclaration( IASTDeclaration declaration );
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This represents a block of statements.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTCompoundStatement extends IASTStatement {
|
||||
|
||||
ASTNodeProperty NESTED_STATEMENT = new ASTNodeProperty( "Nested Statement" ); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Gets the statements in this block.
|
||||
*
|
||||
* @return List of IASTStatement
|
||||
*/
|
||||
public List getStatements();
|
||||
|
||||
public void addStatement( IASTStatement statement );
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface IASTConditionalExpression extends IASTExpression {
|
||||
|
||||
public static final ASTNodeProperty LOGICAL_CONDITION = new ASTNodeProperty( "Logical Condition"); //$NON-NLS-1$
|
||||
public static final ASTNodeProperty POSITIVE_RESULT = new ASTNodeProperty( "Positive Result" ); //$NON-NLS-1$
|
||||
public static final ASTNodeProperty NEGATIVE_RESULT = new ASTNodeProperty( "Negative Result" ); //$NON-NLS-1$
|
||||
|
||||
public IASTExpression getLogicalConditionExpression();
|
||||
public void setLogicalConditionExpression( IASTExpression expression );
|
||||
|
||||
public IASTExpression getPositiveResultExpression();
|
||||
public void setPositiveResultExpression(IASTExpression expression);
|
||||
|
||||
public IASTExpression getNegativeResultExpression();
|
||||
public void setNegativeResultExpression(IASTExpression expression);
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* This is the continue clause in a loop.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTContinueStatement extends IASTStatement {
|
||||
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTDeclSpecifier extends IASTNode {
|
||||
|
||||
// Storage class
|
||||
public int getStorageClass();
|
||||
public static final int sc_unspecified = 0;
|
||||
public static final int sc_typedef = 1;
|
||||
public static final int sc_extern = 2;
|
||||
public static final int sc_static = 3;
|
||||
public static final int sc_auto = 4;
|
||||
public static final int sc_register = 5;
|
||||
public static final int sc_last = sc_register;
|
||||
|
||||
public void setStorageClass( int storageClass );
|
||||
|
||||
// Type qualifier
|
||||
public boolean isConst();
|
||||
public void setConst( boolean value );
|
||||
public boolean isVolatile();
|
||||
public void setVolatile( boolean value );
|
||||
|
||||
// Function specifier
|
||||
public boolean isInline();
|
||||
public void setInline( boolean value );
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* This is the root class of all declarations.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTDeclaration extends IASTNode {
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* A declaration statement that introduces a declaration.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTDeclarationStatement extends IASTStatement {
|
||||
|
||||
public static final ASTNodeProperty DECLARATION = new ASTNodeProperty( "Declaration"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Gets the declaration introduced by this statement.
|
||||
*
|
||||
* @return the declaration
|
||||
*/
|
||||
public IASTDeclaration getDeclaration();
|
||||
|
||||
public void setDeclaration( IASTDeclaration declaration );
|
||||
|
||||
}
|
|
@ -0,0 +1,64 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTDeclarator extends IASTNode {
|
||||
|
||||
ASTNodeProperty POINTER_OPERATOR = new ASTNodeProperty( "Pointer Operator"); //$NON-NLS-1$
|
||||
ASTNodeProperty INITIALIZER = new ASTNodeProperty( "Initializer"); //$NON-NLS-1$
|
||||
ASTNodeProperty NESTED_DECLARATOR = new ASTNodeProperty( "Nested Declarator"); //$NON-NLS-1$
|
||||
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 List of IASTPointerOperator
|
||||
*/
|
||||
public List getPointerOperators();
|
||||
|
||||
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
|
||||
*/
|
||||
public IASTDeclarator getNestedDeclarator();
|
||||
|
||||
public void setNestedDeclarator( IASTDeclarator nested );
|
||||
|
||||
/**
|
||||
* This returns the name of the declarator. If this is an abstract
|
||||
* declarator, this will return null.
|
||||
*
|
||||
* @return the name of the declarator or null
|
||||
*/
|
||||
public IASTName getName();
|
||||
|
||||
public void setName( IASTName name );
|
||||
|
||||
/**
|
||||
* This is the optional initializer for this declarator.
|
||||
*
|
||||
* @return the initializer expression or null
|
||||
*/
|
||||
public IASTInitializer getInitializer();
|
||||
|
||||
public void setInitializer( IASTInitializer initializer );
|
||||
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* next statement to find it. It's really only there to ensure that there
|
||||
* is at least one statement following this clause.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTDefaultStatement extends IASTStatement {
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* Ye ol' do statement.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTDoStatement extends IASTStatement {
|
||||
|
||||
public static final ASTNodeProperty BODY = new ASTNodeProperty("body"); //$NON-NLS-1$
|
||||
public static final ASTNodeProperty CONDITION = new ASTNodeProperty("condition"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* The body of the loop.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IASTStatement getBody();
|
||||
|
||||
public void setBody(IASTStatement body);
|
||||
|
||||
/**
|
||||
* The condition on the loop.
|
||||
*
|
||||
* @return the expression for the condition
|
||||
*/
|
||||
public IASTExpression getCondition();
|
||||
|
||||
public void setCondition(IASTExpression condition);
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface IASTElaboratedTypeSpecifier extends IASTDeclSpecifier {
|
||||
|
||||
public static final int k_struct = 0;
|
||||
public static final int k_union = 1;
|
||||
public static final int k_enum = 2;
|
||||
|
||||
public int getKind();
|
||||
public void setKind( int value );
|
||||
|
||||
public static final ASTNodeProperty TYPE_NAME = new ASTNodeProperty( "Type Name"); //$NON-NLS-1$
|
||||
public IASTName getName();
|
||||
public void setName( IASTName name );
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface IASTEnumerationSpecifier extends IASTDeclSpecifier {
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface IASTEnumerator extends IASTNode {
|
||||
|
||||
public static final ASTNodeProperty ENUMERATOR_NAME = new ASTNodeProperty( "Enumerator Name"); //$NON-NLS-1$
|
||||
public void setName( IASTName name );
|
||||
public IASTName getName();
|
||||
|
||||
public static final ASTNodeProperty ENUMERATOR_VALUE = new ASTNodeProperty( "Enumerator Value"); //$NON-NLS-1$
|
||||
public void setValue( IASTExpression expression );
|
||||
public IASTExpression getValue();
|
||||
|
||||
}
|
||||
|
||||
public static final ASTNodeProperty ENUMERATOR = new ASTNodeProperty( "Enumerator" ); //$NON-NLS-1$
|
||||
public void addEnumerator( IASTEnumerator enumerator );
|
||||
public List getEnumerators();
|
||||
|
||||
public static final ASTNodeProperty ENUMERATION_NAME = new ASTNodeProperty( "Enum Name"); //$NON-NLS-1$
|
||||
public void setName( IASTName name );
|
||||
public IASTName getName();
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* This is the root class of expressions.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTExpression extends IASTNode {
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface IASTExpressionList extends IASTExpression {
|
||||
|
||||
public static final ASTNodeProperty NESTED_EXPRESSION = new ASTNodeProperty( "Nested Expression"); //$NON-NLS-1$
|
||||
|
||||
public List getExpressions();
|
||||
|
||||
public void addExpression( IASTExpression expression );
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTExpressionStatement extends IASTStatement {
|
||||
|
||||
public static final ASTNodeProperty EXPFRESSION = new ASTNodeProperty( "Expression"); //$NON-NLS-1$
|
||||
/**
|
||||
* Get the expression in this statement.
|
||||
*
|
||||
* @return the expression
|
||||
*/
|
||||
public IASTExpression getExpression();
|
||||
|
||||
public void setExpression( IASTExpression expression );
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* This represents a field in a struct. This allows for the specification of
|
||||
* size for a bit field.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTFieldDeclarator extends IASTDeclarator {
|
||||
|
||||
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.
|
||||
*/
|
||||
public IASTExpression getBitFieldSize();
|
||||
|
||||
public void setBitFieldSize( IASTExpression size );
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTFieldReference extends IASTExpression {
|
||||
|
||||
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$
|
||||
|
||||
/**
|
||||
* This returns an expression for the object containing the field.
|
||||
*
|
||||
* @return the field owner
|
||||
*/
|
||||
public IASTExpression getFieldOwner();
|
||||
|
||||
public void setFieldOwner( IASTExpression expression );
|
||||
|
||||
/**
|
||||
* This returns the name of the field being dereferenced.
|
||||
*
|
||||
* @return the name of the field
|
||||
*/
|
||||
public IASTName getFieldName();
|
||||
|
||||
public void setFieldName( IASTName name );
|
||||
|
||||
/**
|
||||
* This returns true of this is the arrow operator and not the
|
||||
* dot operator.
|
||||
*
|
||||
* @return is this a pointer dereference
|
||||
*/
|
||||
public boolean isPointerDereference();
|
||||
|
||||
public void setIsPointerDereference( boolean value );
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* Represents a node location that is directly in the source file.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTFileLocation extends IASTNodeLocation {
|
||||
|
||||
/**
|
||||
* The name of the file.
|
||||
*
|
||||
* @return the name of the file
|
||||
*/
|
||||
public String getFileName();
|
||||
|
||||
}
|
|
@ -0,0 +1,71 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* The for statement. The initialization clause can be an expression or
|
||||
* a declaration but not both.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTForStatement extends IASTStatement {
|
||||
|
||||
public static final ASTNodeProperty INITEXPRESSION = new ASTNodeProperty("initExpression"); //$NON-NLS-1$
|
||||
public static final ASTNodeProperty INITDECLARATION = new ASTNodeProperty("initDeclaration"); //$NON-NLS-1$
|
||||
public static final ASTNodeProperty CONDITION = new ASTNodeProperty("condition"); //$NON-NLS-1$
|
||||
public static final ASTNodeProperty ITERATION = new ASTNodeProperty("iteration"); //$NON-NLS-1$
|
||||
public static final ASTNodeProperty BODY = new ASTNodeProperty("body"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
public IASTExpression getInitExpression();
|
||||
|
||||
public void setInit(IASTExpression expression);
|
||||
|
||||
/**
|
||||
* The initial declaration for the loop. Returns null if there is
|
||||
* none. You can not have both an initial declaration and an initial
|
||||
* declaration.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IASTDeclaration getInitDeclaration();
|
||||
|
||||
public void setInit(IASTDeclaration declaration);
|
||||
|
||||
/**
|
||||
* The condition for the loop.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IASTExpression getCondition();
|
||||
|
||||
public void setCondition(IASTExpression condition);
|
||||
|
||||
/**
|
||||
* The expression that is evaluated after the completion of an iteration
|
||||
* of the loop.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IASTExpression getIterationExpression();
|
||||
|
||||
public void setIterationExpression(IASTExpression iterator);
|
||||
|
||||
public IASTStatement getBody();
|
||||
public void setBody( IASTStatement statement );
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface IASTFunctionCallExpression extends IASTExpression {
|
||||
|
||||
public static final ASTNodeProperty FUNCTION_NAME = new ASTNodeProperty( "Function Name"); //$NON-NLS-1$
|
||||
public void setFunctionNameExpression( IASTExpression expression );
|
||||
public IASTExpression getFunctionNameExpression();
|
||||
|
||||
public static final ASTNodeProperty PARAMETERS = new ASTNodeProperty( "Parameters"); //$NON-NLS-1$
|
||||
public void setParameterExpression( IASTExpression expression );
|
||||
public IASTExpression getParameterExpression();
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This is a declarator for a function.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTFunctionDeclarator extends IASTDeclarator {
|
||||
|
||||
ASTNodeProperty FUNCTION_PARAMETER = new ASTNodeProperty( "Parameter"); //$NON-NLS-1$
|
||||
/**
|
||||
* Gets the parameter declarations for the function
|
||||
*
|
||||
* @return List of IASTParameterDeclaration
|
||||
*/
|
||||
public List getParameters();
|
||||
|
||||
public void addParameterDeclaration( IASTParameterDeclaration parameter );
|
||||
|
||||
public boolean takesVarArgs();
|
||||
|
||||
public void setVarArgs( boolean value );
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* This is a function definition, i.e. it has a body.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTFunctionDefinition extends IASTDeclaration {
|
||||
|
||||
ASTNodeProperty DECL_SPECIFIER = new ASTNodeProperty( "Decl Specifier"); //$NON-NLS-1$
|
||||
ASTNodeProperty DECLARATOR = new ASTNodeProperty( "Declarator"); //$NON-NLS-1$
|
||||
ASTNodeProperty FUNCTION_BODY = new ASTNodeProperty( "Function Body"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* The decl specifier for the function.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IASTDeclSpecifier getDeclSpecifier();
|
||||
|
||||
public void setDeclSpecifier( IASTDeclSpecifier declSpec );
|
||||
|
||||
/**
|
||||
* The declarator for the function.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IASTFunctionDeclarator getDeclarator();
|
||||
|
||||
public void setDeclarator( IASTFunctionDeclarator declarator );
|
||||
|
||||
/**
|
||||
* This is the body of the function. This is usually a compound statement
|
||||
* but C++ also has a function try block.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IASTStatement getBody();
|
||||
|
||||
public void setBody( IASTStatement statement );
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* Represents a goto statement.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTGotoStatement extends IASTStatement {
|
||||
|
||||
public static final ASTNodeProperty NAME = new ASTNodeProperty("name"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Returns the name of the label. The name resolves to a ILabel binding.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IASTName getName();
|
||||
|
||||
public void setName(IASTName name);
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* This is a name used in an expression.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTIdExpression extends IASTExpression {
|
||||
|
||||
public static final ASTNodeProperty ID_NAME = new ASTNodeProperty( "IdExpression Name"); //$NON-NLS-1$
|
||||
/**
|
||||
* Returns the name used in the expression.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
public IASTName getName();
|
||||
|
||||
public void setName( IASTName name );
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* The if statement including the optional else clause.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTIfStatement extends IASTStatement {
|
||||
|
||||
public static final ASTNodeProperty CONDITION = new ASTNodeProperty("condition"); //$NON-NLS-1$
|
||||
public static final ASTNodeProperty THEN = new ASTNodeProperty("then"); //$NON-NLS-1$
|
||||
public static final ASTNodeProperty ELSE = new ASTNodeProperty("else"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* The condition in the if statement.
|
||||
*
|
||||
* @return the condition expression
|
||||
*/
|
||||
public IASTExpression getCondition();
|
||||
|
||||
public void setCondition(IASTExpression condition);
|
||||
|
||||
/**
|
||||
* The statement that is executed if the condition is true.
|
||||
*
|
||||
* @return the then clause
|
||||
*/
|
||||
public IASTStatement getThenClause();
|
||||
|
||||
public void setThenClause(IASTStatement thenClause);
|
||||
|
||||
/**
|
||||
* The statement that is executed if the condition is false. This
|
||||
* clause is optional and returns null if there is none.
|
||||
*
|
||||
* @return the else clause or null
|
||||
*/
|
||||
public IASTStatement getElseClause();
|
||||
|
||||
public void setElseClause(IASTStatement elseClause);
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* This represents an initializer for a declarator.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTInitializer extends IASTNode {
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* This is an initializer that is simply an expression.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTInitializerExpression extends IASTInitializer {
|
||||
|
||||
public ASTNodeProperty INITIALIZER_EXPRESSION = new ASTNodeProperty( "Initializer Expression"); //$NON-NLS-1$
|
||||
/**
|
||||
* Get the expression for the initializer.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IASTExpression getExpression();
|
||||
|
||||
public void setExpression( IASTExpression expression );
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This is an an initializer that is a list of initializers.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTInitializerList extends IASTInitializer {
|
||||
|
||||
public ASTNodeProperty NESTED_INITIALIZER = new ASTNodeProperty( "Nested Initializer" ); //$NON-NLS-1$
|
||||
/**
|
||||
* Get the list of initializers.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List getInitializers();
|
||||
|
||||
public void addInitializer( IASTInitializer initializer );
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* Represents a label statement.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTLabelStatement extends IASTStatement {
|
||||
|
||||
public static final ASTNodeProperty NAME = new ASTNodeProperty("name"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* The name for the label. The name resolves to an ILabel binding.
|
||||
*
|
||||
* @return the name for the label
|
||||
*/
|
||||
public IASTName getName();
|
||||
|
||||
public void setName(IASTName name);
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* This expression represents a literal in the program.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTLiteralExpression extends IASTExpression {
|
||||
|
||||
public static final int lk_integer_constant = 0;
|
||||
public static final int lk_float_constant = 1;
|
||||
public static final int lk_char_constant = 2;
|
||||
public static final int lk_string_literal = 3;
|
||||
|
||||
public int getKind();
|
||||
public void setKind( int value );
|
||||
|
||||
public void setValue( String value );
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* This represents the definition of a macro.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTMacroDefinition {
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTMacroExpansion {
|
||||
|
||||
/**
|
||||
* The macro definition used for the expansion
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IASTMacroDefinition getMacroDefinition();
|
||||
|
||||
/**
|
||||
* The source location for for the macro expansion. This is the location
|
||||
* in the original source that expansion occured and was replaced.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IASTNodeLocation getExpansionLocation();
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* This class represents a name in the program that represents a semantic
|
||||
* object in the program.
|
||||
*
|
||||
* The toString method produces a string representation of the name as
|
||||
* appropriate for the language.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTName extends IASTNode {
|
||||
|
||||
/**
|
||||
* Return the semantic object this name is referring to.
|
||||
*
|
||||
* @return binding
|
||||
*/
|
||||
public IBinding resolveBinding();
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* This is the root node in the physical AST. A physical node represents
|
||||
* a chunk of text in the source program.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTNode {
|
||||
|
||||
public IASTTranslationUnit getTranslationUnit();
|
||||
|
||||
/**
|
||||
* Get the parent node of this node in the tree.
|
||||
*
|
||||
* @return the parent node of this node
|
||||
*/
|
||||
public IASTNode getParent();
|
||||
|
||||
public void setParent( IASTNode node );
|
||||
|
||||
/**
|
||||
* In order to properly understand the relationship between this child
|
||||
* node and it's parent, a node property object is used.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ASTNodeProperty getPropertyInParent();
|
||||
|
||||
public void setPropertyInParent( ASTNodeProperty property );
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* A NodeLocation represents the source location of a given node. Most
|
||||
* often this is a file it may be other fancy things like macro
|
||||
* expansions.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTNodeLocation {
|
||||
|
||||
/**
|
||||
* This is the offset into the actual source location that this node
|
||||
* starts at.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getNodeOffset();
|
||||
|
||||
/**
|
||||
* This is the length of the node contained in this location.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getNodeLength();
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* This class represents a parameter declaration
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTParameterDeclaration extends IASTNode {
|
||||
|
||||
ASTNodeProperty DECL_SPECIFIER = new ASTNodeProperty( "Decl Specifier"); //$NON-NLS-1$
|
||||
ASTNodeProperty DECLARATOR = new ASTNodeProperty( "Declarator"); //$NON-NLS-1$
|
||||
|
||||
public IASTDeclSpecifier getDeclSpecifier();
|
||||
|
||||
public IASTDeclarator getDeclarator();
|
||||
|
||||
/**
|
||||
* @param declSpec
|
||||
*/
|
||||
public void setDeclSpecifier(IASTDeclSpecifier declSpec);
|
||||
|
||||
/**
|
||||
* @param declarator2
|
||||
*/
|
||||
public void setDeclarator(IASTDeclarator declarator);
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* This represents the good ol' * pointer operator.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTPointer extends IASTPointerOperator {
|
||||
|
||||
// Qualifiers applied to the pointer type
|
||||
public boolean isConst();
|
||||
public boolean isVolatile();
|
||||
|
||||
public void setConst( boolean value );
|
||||
public void setVolatile( boolean value );
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTPointerOperator extends IASTNode {
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTReturnStatement extends IASTStatement {
|
||||
|
||||
public static final ASTNodeProperty RETURNVALUE = new ASTNodeProperty("returnValue"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* This is the optional return value for this function.
|
||||
*
|
||||
* @return the return expression or null.
|
||||
*/
|
||||
public IASTExpression getReturnValue();
|
||||
|
||||
public void setReturnValue(IASTExpression returnValue);
|
||||
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* This represents a decl specifier for a built-in type.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTSimpleDeclSpecifier extends IASTDeclSpecifier {
|
||||
|
||||
/**
|
||||
* This returns the built-in type for the declaration. The type is
|
||||
* then refined by qualifiers for signed/unsigned and short/long.
|
||||
* The type could also be unspecified which usually means int.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getType();
|
||||
|
||||
public static final int t_unspecified = 0;
|
||||
public static final int t_void = 1;
|
||||
public static final int t_char = 2;
|
||||
public static final int t_int = 3;
|
||||
public static final int t_float = 4;
|
||||
public static final int t_double = 5;
|
||||
public static final int t_last = t_double; // used only in subclasses
|
||||
|
||||
public void setType( int type );
|
||||
|
||||
public boolean isSigned();
|
||||
public boolean isUnsigned();
|
||||
public boolean isShort();
|
||||
public boolean isLong();
|
||||
|
||||
public void setSigned( boolean value );
|
||||
public void setUnsigned( boolean value );
|
||||
public void setLong( boolean value );
|
||||
public void setShort( boolean value );
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This is a simple declaration which contains a sequence of declSpecifiers
|
||||
* followed by a list of declarators.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTSimpleDeclaration extends IASTDeclaration, IASTNode {
|
||||
|
||||
ASTNodeProperty DECL_SPECIFIER = new ASTNodeProperty( "Decl Specifier"); //$NON-NLS-1$
|
||||
ASTNodeProperty DECLARATOR = new ASTNodeProperty( "Declarator"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* This returns the object representing the declSpecifiers for this
|
||||
* declaration.
|
||||
*
|
||||
* @return the declSpecifier object
|
||||
*/
|
||||
public IASTDeclSpecifier getDeclSpecifier();
|
||||
|
||||
public void setDeclSpecifier( IASTDeclSpecifier declSpec );
|
||||
|
||||
/**
|
||||
* This returns the list of declarators in this declaration.
|
||||
*
|
||||
* @return list of IASTDeclarator
|
||||
*/
|
||||
public List getDeclarators();
|
||||
|
||||
public void addDeclarator( IASTDeclarator declarator );
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* This is the root interface for statements.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTStatement extends IASTNode {
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* The switch statement.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
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$
|
||||
|
||||
/**
|
||||
* This returns the expression which determines which case to take.
|
||||
*
|
||||
* @return the controller expression
|
||||
*/
|
||||
public IASTExpression getController();
|
||||
|
||||
public void setController(IASTExpression controller);
|
||||
|
||||
/**
|
||||
* The body of the switch statement.
|
||||
*
|
||||
* TODO - finding the cases could be a logical thing
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IASTStatement getBody();
|
||||
|
||||
public void setBody(IASTStatement body);
|
||||
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* The translation unit represents a compilable unit of source.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTTranslationUnit extends IASTNode {
|
||||
|
||||
ASTNodeProperty OWNED_DECLARATION = new ASTNodeProperty( "OWNED" ); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* A translation unit contains an ordered sequence of declarations.
|
||||
*
|
||||
* @return List of IASTDeclaration
|
||||
*/
|
||||
public List getDeclarations();
|
||||
|
||||
public void addDeclaration( IASTDeclaration declaration );
|
||||
|
||||
/**
|
||||
* This returns the global scope for the translation unit.
|
||||
*
|
||||
* @return the global scope
|
||||
*/
|
||||
public IScope getScope();
|
||||
|
||||
/**
|
||||
* 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 List getDeclarations(IBinding binding);
|
||||
|
||||
/**
|
||||
* 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 List getReferences(IBinding binding);
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface IASTTypeId extends IASTNode {
|
||||
|
||||
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 IASTDeclSpecifier getDeclSpecifier();
|
||||
public void setDeclSpecifier( IASTDeclSpecifier declSpec );
|
||||
public IASTDeclarator getAbstractDeclarator();
|
||||
public void setAbstractDeclarator( IASTDeclarator abstractDeclarator );
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface IASTTypeIdExpression extends IASTExpression {
|
||||
|
||||
public static final int op_sizeof = 0;
|
||||
public static final int op_last = op_sizeof;
|
||||
|
||||
public int getOperator();
|
||||
public void setOperator( int value );
|
||||
|
||||
public static final ASTNodeProperty TYPE_ID = new ASTNodeProperty( "Type Id"); //$NON-NLS-1$
|
||||
public void setTypeId( IASTTypeId typeId );
|
||||
public IASTTypeId getTypeId();
|
||||
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* Represents the use of a typedef name in an decl specifier.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTTypedefNameSpecifier extends IASTDeclSpecifier {
|
||||
|
||||
public static final ASTNodeProperty NAME = new ASTNodeProperty( "Name"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* @return the typedef name.
|
||||
*/
|
||||
public IASTName getName();
|
||||
|
||||
public void setName( IASTName name );
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface IASTUnaryExpression extends IASTExpression {
|
||||
|
||||
public static final int op_prefixIncr = 0;
|
||||
public static final int op_prefixDecr = 1;
|
||||
public static final int op_plus = 2;
|
||||
public static final int op_minus = 3;
|
||||
public static final int op_star = 4;
|
||||
public static final int op_amper = 5;
|
||||
public static final int op_tilde = 6;
|
||||
public static final int op_not = 7;
|
||||
public static final int op_sizeof = 8;
|
||||
public static final int op_postFixIncr = 9;
|
||||
public static final int op_postFixDecr = 10;
|
||||
public static final int op_last = op_postFixDecr;
|
||||
|
||||
public int getOperator();
|
||||
public void setOperator( int value );
|
||||
|
||||
public static final ASTNodeProperty OPERAND = new ASTNodeProperty( "Operand" ); //$NON-NLS-1$
|
||||
|
||||
|
||||
public IASTExpression getOperand();
|
||||
public void setOperand( IASTExpression expression );
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface IASTUnaryTypeIdExpression extends IASTExpression {
|
||||
|
||||
public static final int op_cast = 0;
|
||||
public static final int op_last = op_cast;
|
||||
|
||||
public int getOperator();
|
||||
public void setOperator( int value );
|
||||
|
||||
public static final ASTNodeProperty OPERAND = new ASTNodeProperty( "Operand" ); //$NON-NLS-1$
|
||||
public IASTExpression getOperand();
|
||||
public void setOperand( IASTExpression expression );
|
||||
|
||||
public static final ASTNodeProperty TYPE_ID = new ASTNodeProperty( "Type Id"); //$NON-NLS-1$
|
||||
|
||||
public void setTypeId( IASTTypeId typeId );
|
||||
public IASTTypeId getTypeId();
|
||||
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* Ye ol' while statement.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IASTWhileStatement extends IASTStatement {
|
||||
|
||||
public static final ASTNodeProperty CONDITION = new ASTNodeProperty("condition"); //$NON-NLS-1$
|
||||
public static final ASTNodeProperty BODY = new ASTNodeProperty("body"); //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* The condition on the while loop
|
||||
*
|
||||
* @return expression for the condition
|
||||
*/
|
||||
public IASTExpression getCondition();
|
||||
|
||||
public void setCondition(IASTExpression condition);
|
||||
|
||||
/**
|
||||
* The body of the loop.
|
||||
*
|
||||
* @return the body
|
||||
*/
|
||||
public IASTStatement getBody();
|
||||
|
||||
public void setBody(IASTStatement body);
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IBinding {
|
||||
|
||||
/**
|
||||
* The name of the binding.
|
||||
*
|
||||
* @return name
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/**
|
||||
* Every name has a scope.
|
||||
*
|
||||
* @return the scope of this name
|
||||
*/
|
||||
public IScope getScope();
|
||||
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface ICompositeType extends IType {
|
||||
|
||||
/**
|
||||
* Returns the fields for this type.
|
||||
*
|
||||
* @return List of IField
|
||||
*/
|
||||
public List getFields();
|
||||
|
||||
/**
|
||||
* returns the field that matches name,
|
||||
* or null if there is no such field.
|
||||
*
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public IField findField( String name );
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IField extends IVariable {
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This represents a function in the program. A function is also a scope
|
||||
* for other bindings.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IFunction extends IBinding {
|
||||
|
||||
/**
|
||||
* This gets the parameters to the function which are IVariables.
|
||||
*
|
||||
* @return List of IParameter
|
||||
*/
|
||||
public List getParameters();
|
||||
|
||||
/**
|
||||
* Get the function scope
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IScope getFunctionScope();
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* Represents the mapping between goto statements and the label statements
|
||||
* the go to.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface ILabel extends IBinding {
|
||||
|
||||
/**
|
||||
* Returns the label statement for this label.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IASTLabelStatement getLabelStatement();
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* Represents a parameter to a function. The scope of the parameter is
|
||||
* the function that declared this parameter.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IParameter extends IVariable {
|
||||
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IScope {
|
||||
|
||||
/**
|
||||
* Scopes are arranged hierarchically. Lookups will generally
|
||||
* flow upward to find resolution.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IScope getParent();
|
||||
|
||||
/**
|
||||
* This is the general lookup entry point. It returns the list of
|
||||
* valid bindings for a given name.
|
||||
*
|
||||
* @param searchString
|
||||
* @return List of IBinding
|
||||
*/
|
||||
public List find(String name);
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IType extends IBinding {
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface ITypedef extends IType {
|
||||
|
||||
/**
|
||||
* Returns the type that this thing is a typedef of
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IType getType();
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface IVariable extends IBinding {
|
||||
|
||||
/**
|
||||
* @return the type of the variable
|
||||
*/
|
||||
public IType getType();
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface IASTNullStatement extends IASTStatement {
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICASTArrayDesignator extends ICASTDesignator {
|
||||
|
||||
public static final ASTNodeProperty SUBSCRIPT_EXPRESSION = new ASTNodeProperty( "Subscript Expression" ); //$NON-NLS-1$
|
||||
|
||||
public IASTExpression getSubscriptExpression();
|
||||
public void setSubscriptExpression( IASTExpression value );
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICASTArrayModifier extends IASTArrayModifier {
|
||||
|
||||
public boolean isConst();
|
||||
public boolean isStatic();
|
||||
public boolean isRestrict();
|
||||
public boolean isVolatile();
|
||||
|
||||
public void setConst( boolean value );
|
||||
public void setVolatile( boolean value );
|
||||
public void setRestrict( boolean value );
|
||||
public void setStatic( boolean value );
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompositeTypeSpecifier;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICASTCompositeTypeSpecifier extends
|
||||
IASTCompositeTypeSpecifier, ICASTDeclSpecifier {
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface ICASTDeclSpecifier extends IASTDeclSpecifier {
|
||||
|
||||
// Extra type qualifier in C
|
||||
public boolean isRestrict();
|
||||
|
||||
public void setRestrict( boolean value );
|
||||
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICASTDesignator extends IASTNode {
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTElaboratedTypeSpecifier;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICASTElaboratedTypeSpecifier extends
|
||||
IASTElaboratedTypeSpecifier, ICASTDeclSpecifier {
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICASTEnumerationSpecifier extends ICASTDeclSpecifier,
|
||||
IASTEnumerationSpecifier {
|
||||
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICASTFieldDesignator extends ICASTDesignator {
|
||||
|
||||
public static final ASTNodeProperty FIELD_NAME = new ASTNodeProperty( "Designator Field Name"); //$NON-NLS-1$
|
||||
|
||||
public IASTName getName();
|
||||
public void setName( IASTName name );
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTPointer;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICASTPointer extends IASTPointer {
|
||||
|
||||
boolean isRestrict();
|
||||
void setRestrict( boolean value );
|
||||
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
|
||||
|
||||
/**
|
||||
* This interface represents a built-in type in C.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface ICASTSimpleDeclSpecifier extends IASTSimpleDeclSpecifier, ICASTDeclSpecifier {
|
||||
|
||||
// Extra types in C
|
||||
public static final int t_Bool = IASTSimpleDeclSpecifier.t_last + 1;
|
||||
public static final int t_Complex = IASTSimpleDeclSpecifier.t_last + 2;
|
||||
public static final int t_Imaginary = IASTSimpleDeclSpecifier.t_last + 3;
|
||||
public static final int t_last = t_Imaginary;
|
||||
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICASTTypeIdInitializerExpression extends IASTExpression {
|
||||
|
||||
public static final ASTNodeProperty TYPE_ID = new ASTNodeProperty( "TypeId"); //$NON-NLS-1$
|
||||
public static final ASTNodeProperty INITIALIZER = new ASTNodeProperty( "Initializer"); //$NON-NLS-1$
|
||||
|
||||
public IASTTypeId getTypeId();
|
||||
public void setTypeId( IASTTypeId typeId );
|
||||
public IASTInitializer getInitializer();
|
||||
public void setInitializer( IASTInitializer initializer );
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast.c;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTTypedefNameSpecifier;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface ICASTTypedefNameSpecifier extends IASTTypedefNameSpecifier,
|
||||
ICASTDeclSpecifier {
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTInitializer;
|
||||
|
||||
/**
|
||||
* This is an initializer that is a call to the constructor for the
|
||||
* declarator.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface ICPPASTConstructorInitializer extends IASTInitializer {
|
||||
|
||||
/**
|
||||
* Get the arguments to the constructor.
|
||||
*
|
||||
* @return List of IASTExpression
|
||||
*/
|
||||
public List getExpressions();
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface ICPPASTDeclSpecifier extends IASTDeclSpecifier {
|
||||
|
||||
// Extra storage class in C++
|
||||
public static final int sc_mutable = IASTDeclSpecifier.sc_last + 1;
|
||||
|
||||
// A declaration in C++ can be a friend declaration
|
||||
public boolean isFriend();
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
||||
|
||||
/**
|
||||
* C++ adds a few things to function declarators.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface ICPPASTFunctionDeclarator extends IASTFunctionDeclarator {
|
||||
|
||||
public boolean isConst();
|
||||
public boolean isVolatile();
|
||||
|
||||
// TODO add in exception specification
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
|
||||
|
||||
/**
|
||||
* This is a pointer to member pointer operator for declarators.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface ICPPASTPointerToMember extends IASTPointerOperator {
|
||||
|
||||
// TODO fill this in with a qualified name for the class containing
|
||||
// the member
|
||||
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTPointerOperator;
|
||||
|
||||
/**
|
||||
* This is C++'s reference operator, i.e. &, used in a declarator.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface ICPPASTReferenceOperator extends IASTPointerOperator {
|
||||
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclSpecifier;
|
||||
|
||||
/**
|
||||
* This interface represents a built-in type in C++.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface ICPPASTSimpleDeclSpecifier extends IASTSimpleDeclSpecifier, ICPPASTDeclSpecifier {
|
||||
// Extra types
|
||||
public static final int t_bool = IASTSimpleDeclSpecifier.t_last + 1;
|
||||
public static final int t_wchar_t = IASTSimpleDeclSpecifier.t_last + 2;
|
||||
public static final int t_last = t_wchar_t;
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
/**
|
||||
* Represents the relationship between a class and one of its base classes.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface ICPPBase {
|
||||
|
||||
/**
|
||||
* The base class.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ICPPClassType getBaseClass();
|
||||
|
||||
/**
|
||||
* The visibility qualifier applied to the base class.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getVisibility();
|
||||
|
||||
public static final int v_private = 1;
|
||||
public static final int v_protected = 2;
|
||||
public static final int v_public = 3;
|
||||
|
||||
/**
|
||||
* Whether this is a virtual base class.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isVirtual();
|
||||
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ICompositeType;
|
||||
|
||||
/**
|
||||
* Represents a C++ class.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface ICPPClassType extends ICompositeType {
|
||||
|
||||
/**
|
||||
* Returns a list of base class relationships. The list is empty if
|
||||
* there are none.
|
||||
*
|
||||
* @return List of ICPPBase
|
||||
*/
|
||||
public List getBases();
|
||||
|
||||
/**
|
||||
* Get fields is restated here just to point out that this method returns
|
||||
* a list of ICPPField objects representing all fields, declared or inherited.
|
||||
*/
|
||||
public List getFields();
|
||||
|
||||
/**
|
||||
* Returns a list of ICPPField objects representing fields declared in this
|
||||
* class. It does not include fields inherited from base classes.
|
||||
*
|
||||
* @return List of ICPPField
|
||||
*/
|
||||
public List getDeclaredFields();
|
||||
|
||||
/**
|
||||
* Returns a list of ICPPMethod objects representing all methods defined for
|
||||
* this class including those declared, inherited, or generated (e.g. default
|
||||
* constructors and the like).
|
||||
*
|
||||
* @return List of ICPPMethod
|
||||
*/
|
||||
public List getMethods();
|
||||
|
||||
/**
|
||||
* Returns a list of ICPPMethod objects representing all method explicitly
|
||||
* declared by this class and inherited from base classes. It does not include
|
||||
* automatically generated methods.
|
||||
*
|
||||
* @return List of ICPPMethod
|
||||
*/
|
||||
public List getAllDeclaredMethods();
|
||||
|
||||
/**
|
||||
* Returns a list of ICPPMethod objects representing all methods explicitly
|
||||
* declared by this class. It does not include inherited methods or automatically
|
||||
* generated methods.
|
||||
*
|
||||
* @return List of ICPPMethod
|
||||
*/
|
||||
public List getDeclaredMethods();
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IField;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface ICPPField extends IField, ICPPMember {
|
||||
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
/**
|
||||
* Represents a member of a class. Adds in the visibility attribute.
|
||||
*
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface ICPPMember {
|
||||
|
||||
/**
|
||||
* The visibility.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getVisibility();
|
||||
|
||||
public static final int v_private = 1;
|
||||
public static final int v_protected = 2;
|
||||
public static final int v_public = 3;
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface ICPPMethod extends IFunction, ICPPMember {
|
||||
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface ICPPTemplateDefinition {
|
||||
|
||||
/**
|
||||
* Returns the list of template parameters. If this is a template
|
||||
* specialization, the parameters will be substituted by the arguments
|
||||
* determined in the specialization.
|
||||
*
|
||||
* @return List of ICPPTemplateParameter, IType, or IASTExpression.
|
||||
* The type or expression are arguments in a specialization.
|
||||
*/
|
||||
public List getParameters();
|
||||
|
||||
/**
|
||||
* Returns whether this is a template specialization.
|
||||
*
|
||||
* @return is this a template specialization
|
||||
*/
|
||||
public boolean isSpecialization();
|
||||
|
||||
/**
|
||||
* If this is a template specialization, this returns the template
|
||||
* definition this is specializing. It returns null if this template
|
||||
* is not a specialization.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ICPPTemplateDefinition getSpecializes();
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
import org.eclipse.cdt.core.dom.ast.IVariable;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface ICPPTemplateNonTypeParameter extends ICPPTemplateParameter, IVariable {
|
||||
|
||||
/**
|
||||
* The default value for this parameter.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IASTExpression getDefault();
|
||||
|
||||
}
|
|
@ -0,0 +1,18 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface ICPPTemplateParameter {
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 IBM Corporation and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM - Initial API and implementation
|
||||
**********************************************************************/
|
||||
package org.eclipse.cdt.core.dom.ast.cpp;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.IType;
|
||||
|
||||
/**
|
||||
* @author Doug Schaefer
|
||||
*/
|
||||
public interface ICPPTemplateTypeParameter extends ICPPTemplateParameter, IType {
|
||||
|
||||
/**
|
||||
* The default type for this parameter.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public IType getDefault();
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002-2004 IBM Canada and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v0.5
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v05.html
|
||||
*
|
||||
* Contributors:
|
||||
* IBM Rational Software - Initial API and implementation */
|
||||
package org.eclipse.cdt.core.dom.ast.gnu;
|
||||
|
||||
import org.eclipse.cdt.core.dom.ast.ASTNodeProperty;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTCompoundStatement;
|
||||
import org.eclipse.cdt.core.dom.ast.IASTExpression;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*/
|
||||
public interface IGNUASTCompoundStatementExpression extends IASTExpression {
|
||||
|
||||
public static final ASTNodeProperty STATEMENT = new ASTNodeProperty( "Statement"); //$NON-NLS-1$
|
||||
public IASTCompoundStatement getCompoundStatement();
|
||||
public void setCompoundStatement( IASTCompoundStatement statement );
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue