mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Updates for ISourceElementRequestor - elaborated types & enumerations.
This commit is contained in:
parent
c3af12a619
commit
effbc07d12
27 changed files with 524 additions and 320 deletions
|
@ -1,3 +1,6 @@
|
|||
2003-06-24 John Camelon
|
||||
Updates for ISourceElementRequestor - elaborated types & enumerations.
|
||||
|
||||
2003-06-23 John Camelon
|
||||
Factory/constructor signature updates.
|
||||
|
||||
|
|
|
@ -266,10 +266,10 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
IDerivableContainerSymbol c = table.newDerivableContainerSymbol("C");
|
||||
|
||||
IDerivableContainerSymbol a = table.newDerivableContainerSymbol("A");
|
||||
a.addParent( c, true, AccessVisibility.v_public );
|
||||
a.addParent( c, true, AccessVisibility.PUBLIC );
|
||||
|
||||
IDerivableContainerSymbol b = table.newDerivableContainerSymbol("B");
|
||||
b.addParent( c, true, AccessVisibility.v_public );
|
||||
b.addParent( c, true, AccessVisibility.PUBLIC );
|
||||
|
||||
decl.addParent( a );
|
||||
decl.addParent( b );
|
||||
|
|
|
@ -18,29 +18,11 @@ import java.util.Map;
|
|||
import junit.framework.TestCase;
|
||||
|
||||
import org.eclipse.cdt.core.parser.IPreprocessor;
|
||||
import org.eclipse.cdt.core.parser.IProblem;
|
||||
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
|
||||
import org.eclipse.cdt.core.parser.ParserFactory;
|
||||
import org.eclipse.cdt.core.parser.ParserMode;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTConstructor;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTField;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTFunction;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTMacro;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTMethod;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypedef;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTVariable;
|
||||
import org.eclipse.cdt.internal.core.parser.NullSourceElementRequestor;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
@ -48,7 +30,7 @@ import org.eclipse.cdt.core.parser.ast.IASTVariable;
|
|||
*/
|
||||
public class PreprocessorTest extends TestCase {
|
||||
|
||||
public static class Callback implements ISourceElementRequestor
|
||||
public static class Callback extends NullSourceElementRequestor implements ISourceElementRequestor
|
||||
{
|
||||
private List enteredInc = new ArrayList(), exitedInc = new ArrayList();
|
||||
|
||||
|
@ -57,102 +39,6 @@ public class PreprocessorTest extends TestCase {
|
|||
return( ( enteredInc.size() - exitedInc.size() ) == balance );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptProblem(org.eclipse.cdt.core.parser.IProblem)
|
||||
*/
|
||||
public void acceptProblem(IProblem problem) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptMacro(org.eclipse.cdt.core.parser.ast.IASTMacro)
|
||||
*/
|
||||
public void acceptMacro(IASTMacro macro) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptVariable(org.eclipse.cdt.core.parser.ast.IASTVariable)
|
||||
*/
|
||||
public void acceptVariable(IASTVariable variable) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptFunctionDeclaration(org.eclipse.cdt.core.parser.ast.IASTFunction)
|
||||
*/
|
||||
public void acceptFunctionDeclaration(IASTFunction function) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptUsingDirective(org.eclipse.cdt.core.parser.ast.IASTUsingDirective)
|
||||
*/
|
||||
public void acceptUsingDirective(IASTUsingDirective usageDirective) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptUsingDeclaration(org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration)
|
||||
*/
|
||||
public void acceptUsingDeclaration(IASTUsingDeclaration usageDeclaration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptASMDefinition(org.eclipse.cdt.core.parser.ast.IASTASMDefinition)
|
||||
*/
|
||||
public void acceptASMDefinition(IASTASMDefinition asmDefinition) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedef(org.eclipse.cdt.core.parser.ast.IASTTypedef)
|
||||
*/
|
||||
public void acceptTypedef(IASTTypedef typedef) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumerationSpecifier(org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier)
|
||||
*/
|
||||
public void acceptEnumerationSpecifier(IASTEnumerationSpecifier enumeration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterFunctionBody(org.eclipse.cdt.core.parser.ast.IASTFunction)
|
||||
*/
|
||||
public void enterFunctionBody(IASTFunction function) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitFunctionBody(org.eclipse.cdt.core.parser.ast.IASTFunction)
|
||||
*/
|
||||
public void exitFunctionBody(IASTFunction function) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterCompilationUnit(org.eclipse.cdt.core.parser.ast.IASTCompilationUnit)
|
||||
*/
|
||||
public void enterCompilationUnit(IASTCompilationUnit compilationUnit) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterInclusion(org.eclipse.cdt.core.parser.ast.IASTInclusion)
|
||||
*/
|
||||
|
@ -160,164 +46,12 @@ public class PreprocessorTest extends TestCase {
|
|||
enteredInc.add( inclusion );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterNamespaceDefinition(org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition)
|
||||
*/
|
||||
public void enterNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier)
|
||||
*/
|
||||
public void enterClassSpecifier(IASTClassSpecifier classSpecification) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterLinkageSpecification(org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification)
|
||||
*/
|
||||
public void enterLinkageSpecification(IASTLinkageSpecification linkageSpec) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterTemplateDeclaration(org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration)
|
||||
*/
|
||||
public void enterTemplateDeclaration(IASTTemplateDeclaration declaration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterTemplateSpecialization(org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization)
|
||||
*/
|
||||
public void enterTemplateSpecialization(IASTTemplateSpecialization specialization) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterTemplateExplicitInstantiation(org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation)
|
||||
*/
|
||||
public void enterTemplateExplicitInstantiation(IASTTemplateInstantiation instantiation) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptMethodDeclaration(org.eclipse.cdt.core.parser.ast.IASTMethod)
|
||||
*/
|
||||
public void acceptMethodDeclaration(IASTMethod method) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterMethodBody(org.eclipse.cdt.core.parser.ast.IASTMethod)
|
||||
*/
|
||||
public void enterMethodBody(IASTMethod method) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitMethodBody(org.eclipse.cdt.core.parser.ast.IASTMethod)
|
||||
*/
|
||||
public void exitMethodBody(IASTMethod method) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptField(org.eclipse.cdt.core.parser.ast.IASTField)
|
||||
*/
|
||||
public void acceptField(IASTField field) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptConstructor(org.eclipse.cdt.core.parser.ast.IASTConstructor)
|
||||
*/
|
||||
public void acceptConstructor(IASTConstructor constructor) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptClassReference(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier, int)
|
||||
*/
|
||||
public void acceptClassReference(IASTClassSpecifier classSpecifier, int referenceOffset) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitTemplateDeclaration(org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration)
|
||||
*/
|
||||
public void exitTemplateDeclaration(IASTTemplateDeclaration declaration) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitTemplateSpecialization(org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization)
|
||||
*/
|
||||
public void exitTemplateSpecialization(IASTTemplateSpecialization specialization) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitTemplateExplicitInstantiation(org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation)
|
||||
*/
|
||||
public void exitTemplateExplicitInstantiation(IASTTemplateInstantiation instantiation) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitLinkageSpecification(org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification)
|
||||
*/
|
||||
public void exitLinkageSpecification(IASTLinkageSpecification linkageSpec) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier)
|
||||
*/
|
||||
public void exitClassSpecifier(IASTClassSpecifier classSpecification) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitNamespaceDefinition(org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition)
|
||||
*/
|
||||
public void exitNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitInclusion(org.eclipse.cdt.core.parser.ast.IASTInclusion)
|
||||
*/
|
||||
public void exitInclusion(IASTInclusion inclusion) {
|
||||
exitedInc.add( inclusion );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitCompilationUnit(org.eclipse.cdt.core.parser.ast.IASTCompilationUnit)
|
||||
*/
|
||||
public void exitCompilationUnit(IASTCompilationUnit compilationUnit) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public PreprocessorTest( String name )
|
||||
|
|
|
@ -10,6 +10,7 @@ import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTConstructor;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTField;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTFunction;
|
||||
|
@ -1284,4 +1285,13 @@ public class DOMBuilder implements IParserCallback, ISourceElementRequestor
|
|||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptElaboratedTypeSpecifier(org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier)
|
||||
*/
|
||||
public void acceptElaboratedTypeSpecifier(IASTElaboratedTypeSpecifier elaboratedTypeSpec)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
|
@ -1,3 +1,6 @@
|
|||
2003-06-24 John Camelon
|
||||
Updates for ISourceElementRequestor - elaborated types & enumerations.
|
||||
|
||||
2003-06-23 John Camelon
|
||||
Updating SimpleDeclarations to move towards new Callback structure.
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTConstructor;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTField;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTFunction;
|
||||
|
@ -77,4 +78,6 @@ public interface ISourceElementRequestor {
|
|||
public void exitNamespaceDefinition( IASTNamespaceDefinition namespaceDefinition );
|
||||
public void exitInclusion( IASTInclusion inclusion );
|
||||
public void exitCompilationUnit( IASTCompilationUnit compilationUnit );
|
||||
|
||||
public void acceptElaboratedTypeSpecifier(IASTElaboratedTypeSpecifier elaboratedTypeSpec);
|
||||
}
|
||||
|
|
|
@ -11,8 +11,8 @@
|
|||
package org.eclipse.cdt.core.parser;
|
||||
|
||||
import java.io.Reader;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTFactory;
|
||||
import org.eclipse.cdt.internal.core.parser.NullSourceElementRequestor;
|
||||
|
|
|
@ -16,9 +16,9 @@ package org.eclipse.cdt.core.parser.ast;
|
|||
*/
|
||||
public class AccessVisibility {
|
||||
|
||||
public static final AccessVisibility v_public = new AccessVisibility( 1 );
|
||||
public static final AccessVisibility v_protected = new AccessVisibility( 2 );
|
||||
public static final AccessVisibility v_private = new AccessVisibility( 3 );
|
||||
public static final AccessVisibility PUBLIC = new AccessVisibility( 1 );
|
||||
public static final AccessVisibility PROTECTED = new AccessVisibility( 2 );
|
||||
public static final AccessVisibility PRIVATE = new AccessVisibility( 3 );
|
||||
|
||||
private AccessVisibility( int constant)
|
||||
{
|
||||
|
|
|
@ -16,11 +16,12 @@ package org.eclipse.cdt.core.parser.ast;
|
|||
*/
|
||||
public class ClassKind {
|
||||
|
||||
public final static ClassKind k_class = new ClassKind( 1 );
|
||||
public final static ClassKind k_struct = new ClassKind( 2 );
|
||||
public final static ClassKind k_union = new ClassKind( 3 );
|
||||
public final static ClassKind CLASS = new ClassKind( 1 );
|
||||
public final static ClassKind STRUCT = new ClassKind( 2 );
|
||||
public final static ClassKind UNION = new ClassKind( 3 );
|
||||
public final static ClassKind ENUM = new ClassKind( 4 );
|
||||
|
||||
private ClassKind( int value )
|
||||
protected ClassKind( int value )
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ package org.eclipse.cdt.core.parser.ast;
|
|||
*/
|
||||
public class ClassNameType {
|
||||
|
||||
public static final ClassNameType t_identifier = new ClassNameType( 1 );
|
||||
public static final ClassNameType t_template = new ClassNameType( 2 );
|
||||
public static final ClassNameType IDENTIFIER = new ClassNameType( 1 );
|
||||
public static final ClassNameType TEMPLATE = new ClassNameType( 2 );
|
||||
|
||||
private final int type;
|
||||
private ClassNameType( int t )
|
||||
|
|
|
@ -10,10 +10,14 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser.ast;
|
||||
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTElaboratedTypeSpecifier extends IASTTypeSpecifier {
|
||||
public interface IASTElaboratedTypeSpecifier extends IASTTypeSpecifier, IASTOffsetableElement {
|
||||
|
||||
public String getTypeName();
|
||||
public ClassKind getClassKind();
|
||||
|
||||
}
|
||||
|
|
|
@ -10,10 +10,14 @@
|
|||
***********************************************************************/
|
||||
package org.eclipse.cdt.core.parser.ast;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTEnumerationSpecifier extends IASTTypeSpecifier {
|
||||
public interface IASTEnumerationSpecifier extends IASTTypeSpecifier, IASTOffsetableNamedElement {
|
||||
|
||||
public void addEnumerator( IASTEnumerator enumerator );
|
||||
public Iterator getEnumerators();
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ package org.eclipse.cdt.core.parser.ast;
|
|||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public interface IASTEnumerator {
|
||||
public interface IASTEnumerator extends IASTOffsetableNamedElement {
|
||||
|
||||
public IASTEnumerationSpecifier getOwnerEnumerationSpecifier();
|
||||
// public IASTExpression getInitialValue();
|
||||
}
|
||||
|
|
|
@ -54,6 +54,7 @@ public interface IASTFactory {
|
|||
ClassNameType type,
|
||||
AccessVisibility access,
|
||||
IASTTemplateDeclaration ownerTemplateDeclaration, int startingOffset, int nameOffset );
|
||||
|
||||
/**
|
||||
* @param astClassSpec
|
||||
* @param isVirtual
|
||||
|
@ -62,4 +63,8 @@ public interface IASTFactory {
|
|||
*/
|
||||
public void addBaseSpecifier(IASTClassSpecifier astClassSpec, boolean isVirtual, AccessVisibility visibility, String string);
|
||||
|
||||
public IASTElaboratedTypeSpecifier createElaboratedTypeSpecifier(ClassKind elaboratedClassKind, String typeName, int startingOffset, int endOffset );
|
||||
public IASTEnumerationSpecifier createEnumerationSpecifier(String name, int startingOffset, int nameOffset );
|
||||
public void addEnumerator(IASTEnumerationSpecifier enumeration, String string, int startingOffset, int endingOffset);
|
||||
|
||||
}
|
|
@ -16,11 +16,11 @@ package org.eclipse.cdt.core.parser.ast;
|
|||
*/
|
||||
public class TemplateDeclarationType {
|
||||
|
||||
public static final TemplateDeclarationType t_class = new TemplateDeclarationType(1);
|
||||
public static final TemplateDeclarationType t_function = new TemplateDeclarationType( 2 );
|
||||
public static final TemplateDeclarationType t_memberClass = new TemplateDeclarationType( 3 );
|
||||
public static final TemplateDeclarationType t_method = new TemplateDeclarationType( 4 );
|
||||
public static final TemplateDeclarationType t_field = new TemplateDeclarationType( 5 );
|
||||
public static final TemplateDeclarationType CLASS = new TemplateDeclarationType(1);
|
||||
public static final TemplateDeclarationType FUNCTION = new TemplateDeclarationType( 2 );
|
||||
public static final TemplateDeclarationType MEMBERCLASS = new TemplateDeclarationType( 3 );
|
||||
public static final TemplateDeclarationType METHOD = new TemplateDeclarationType( 4 );
|
||||
public static final TemplateDeclarationType FIELD = new TemplateDeclarationType( 5 );
|
||||
|
||||
|
||||
private final int type;
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.util.Collections;
|
|||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTScope;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
|
@ -23,6 +24,7 @@ import org.eclipse.cdt.core.parser.ast.IASTScope;
|
|||
public class DeclarationWrapper
|
||||
{
|
||||
private final IASTScope scope;
|
||||
private IASTTypeSpecifier typeSpecifier;
|
||||
private List declarators = new ArrayList();
|
||||
private boolean typeNamed = false;
|
||||
private String name = null;
|
||||
|
@ -282,5 +284,21 @@ public class DeclarationWrapper
|
|||
return Collections.unmodifiableList( declarators );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
public IASTTypeSpecifier getTypeSpecifier()
|
||||
{
|
||||
return typeSpecifier;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param specifier
|
||||
*/
|
||||
public void setTypeSpecifier(IASTTypeSpecifier specifier)
|
||||
{
|
||||
typeSpecifier = specifier;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTConstructor;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTField;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTFunction;
|
||||
|
@ -886,4 +887,13 @@ public class NullSourceElementRequestor implements ISourceElementRequestor, IPar
|
|||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptElaboratedTypeSpecifier(org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier)
|
||||
*/
|
||||
public void acceptElaboratedTypeSpecifier(IASTElaboratedTypeSpecifier elaboratedTypeSpec)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@ import org.eclipse.cdt.core.parser.ast.ClassNameType;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTFactory;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||
|
@ -1580,19 +1582,19 @@ public class Parser implements IParser
|
|||
{
|
||||
try
|
||||
{
|
||||
classSpecifier(decl, sdw.getScope());
|
||||
classSpecifier(decl, sdw );
|
||||
return;
|
||||
}
|
||||
catch (Backtrack bt)
|
||||
{
|
||||
elaboratedTypeSpecifier(decl);
|
||||
elaboratedTypeSpecifier(decl, sdw);
|
||||
flags.setEncounteredTypename(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
elaboratedTypeSpecifier(decl);
|
||||
elaboratedTypeSpecifier(decl, sdw);
|
||||
flags.setEncounteredTypename(true);
|
||||
break;
|
||||
}
|
||||
|
@ -1601,20 +1603,20 @@ public class Parser implements IParser
|
|||
{
|
||||
try
|
||||
{
|
||||
enumSpecifier(decl);
|
||||
enumSpecifier(decl, sdw);
|
||||
break;
|
||||
}
|
||||
catch (Backtrack bt)
|
||||
{
|
||||
// this is an elaborated class specifier
|
||||
elaboratedTypeSpecifier(decl);
|
||||
elaboratedTypeSpecifier(decl, sdw);
|
||||
flags.setEncounteredTypename(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
elaboratedTypeSpecifier(decl);
|
||||
elaboratedTypeSpecifier(decl, sdw);
|
||||
flags.setEncounteredTypename(true);
|
||||
break;
|
||||
}
|
||||
|
@ -1629,18 +1631,47 @@ public class Parser implements IParser
|
|||
* @param decl Declaration which owns the elaborated type
|
||||
* @throws Backtrack request a backtrack
|
||||
*/
|
||||
private void elaboratedTypeSpecifier(Object decl) throws Backtrack
|
||||
protected void elaboratedTypeSpecifier(Object decl, DeclarationWrapper sdw) throws Backtrack
|
||||
{
|
||||
// this is an elaborated class specifier
|
||||
Object elab = null;
|
||||
IToken t = consume();
|
||||
ClassKind eck = null;
|
||||
|
||||
switch( t.getType() )
|
||||
{
|
||||
case Token.t_class:
|
||||
eck = ClassKind.CLASS;
|
||||
break;
|
||||
case Token.t_struct:
|
||||
eck = ClassKind.STRUCT;
|
||||
break;
|
||||
case Token.t_union:
|
||||
eck = ClassKind.UNION;
|
||||
break;
|
||||
case Token.t_enum:
|
||||
eck = ClassKind.ENUM;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
try
|
||||
{
|
||||
elab = callback.elaboratedTypeSpecifierBegin(decl, consume());
|
||||
elab = callback.elaboratedTypeSpecifierBegin(decl, t );
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
name();
|
||||
|
||||
TokenDuple d = name();
|
||||
|
||||
IASTElaboratedTypeSpecifier elaboratedTypeSpec = astFactory.createElaboratedTypeSpecifier( eck, d.toString(), t.getOffset(),
|
||||
d.getLastToken().getEndOffset() );
|
||||
|
||||
sdw.setTypeSpecifier( elaboratedTypeSpec );
|
||||
|
||||
requestor.acceptElaboratedTypeSpecifier( elaboratedTypeSpec );
|
||||
|
||||
try
|
||||
{
|
||||
callback.elaboratedTypeSpecifierName(elab);
|
||||
|
@ -2563,10 +2594,11 @@ public class Parser implements IParser
|
|||
* @param owner IParserCallback object that represents the declaration that owns this type specifier.
|
||||
* @throws Backtrack request a backtrack
|
||||
*/
|
||||
protected void enumSpecifier(Object owner) throws Backtrack
|
||||
protected void enumSpecifier(Object owner, DeclarationWrapper sdw) throws Backtrack
|
||||
{
|
||||
Object enumSpecifier = null;
|
||||
IToken mark = mark();
|
||||
IToken identifier = null;
|
||||
try
|
||||
{
|
||||
enumSpecifier =
|
||||
|
@ -2577,7 +2609,7 @@ public class Parser implements IParser
|
|||
}
|
||||
if (LT(1) == IToken.tIDENTIFIER)
|
||||
{
|
||||
identifier();
|
||||
identifier = identifier();
|
||||
try
|
||||
{
|
||||
callback.enumSpecifierId(enumSpecifier);
|
||||
|
@ -2588,12 +2620,18 @@ public class Parser implements IParser
|
|||
}
|
||||
if (LT(1) == IToken.tLBRACE)
|
||||
{
|
||||
IASTEnumerationSpecifier enumeration = astFactory.createEnumerationSpecifier(
|
||||
( ( identifier == null ) ? "" : identifier.getImage()),
|
||||
mark.getOffset(),
|
||||
( ( identifier == null ) ? mark.getOffset() : identifier.getOffset()) );
|
||||
consume(IToken.tLBRACE);
|
||||
while (LT(1) != IToken.tRBRACE)
|
||||
{
|
||||
Object defn;
|
||||
IToken enumeratorIdentifier = null;
|
||||
if (LT(1) == IToken.tIDENTIFIER)
|
||||
{
|
||||
|
||||
defn = null;
|
||||
try
|
||||
{
|
||||
|
@ -2602,7 +2640,7 @@ public class Parser implements IParser
|
|||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
identifier();
|
||||
enumeratorIdentifier = identifier();
|
||||
try
|
||||
{
|
||||
callback.enumeratorId(defn);
|
||||
|
@ -2650,7 +2688,10 @@ public class Parser implements IParser
|
|||
{
|
||||
}
|
||||
if (LT(1) == IToken.tRBRACE)
|
||||
{
|
||||
astFactory.addEnumerator( enumeration, enumeratorIdentifier.toString(), enumeratorIdentifier.getOffset(), enumeratorIdentifier.getEndOffset() );
|
||||
break;
|
||||
}
|
||||
if (LT(1) != IToken.tCOMMA)
|
||||
{
|
||||
try
|
||||
|
@ -2662,17 +2703,24 @@ public class Parser implements IParser
|
|||
}
|
||||
throw backtrack;
|
||||
}
|
||||
astFactory.addEnumerator( enumeration, enumeratorIdentifier.toString(), enumeratorIdentifier.getOffset(), enumeratorIdentifier.getEndOffset() );
|
||||
consume(IToken.tCOMMA);
|
||||
}
|
||||
|
||||
IToken t = consume(IToken.tRBRACE);
|
||||
try
|
||||
{
|
||||
|
||||
callback.enumSpecifierEnd(
|
||||
enumSpecifier,
|
||||
consume(IToken.tRBRACE));
|
||||
t );
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
enumeration.setEndingOffset( t.getEndOffset() );
|
||||
requestor.acceptEnumerationSpecifier( enumeration );
|
||||
sdw.setTypeSpecifier( enumeration );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2690,12 +2738,12 @@ public class Parser implements IParser
|
|||
* @param owner IParserCallback object that represents the declaration that owns this classSpecifier
|
||||
* @throws Backtrack request a backtrack
|
||||
*/
|
||||
protected void classSpecifier(Object owner, IASTScope scope)
|
||||
protected void classSpecifier(Object owner, DeclarationWrapper sdw )
|
||||
throws Backtrack
|
||||
{
|
||||
ClassNameType nameType = ClassNameType.t_identifier;
|
||||
ClassNameType nameType = ClassNameType.IDENTIFIER;
|
||||
ClassKind classKind = null;
|
||||
AccessVisibility access = AccessVisibility.v_public;
|
||||
AccessVisibility access = AccessVisibility.PUBLIC;
|
||||
IToken classKey = null;
|
||||
IToken mark = mark();
|
||||
// class key
|
||||
|
@ -2703,16 +2751,16 @@ public class Parser implements IParser
|
|||
{
|
||||
case IToken.t_class :
|
||||
classKey = consume();
|
||||
classKind = ClassKind.k_class;
|
||||
access = AccessVisibility.v_private;
|
||||
classKind = ClassKind.CLASS;
|
||||
access = AccessVisibility.PRIVATE;
|
||||
break;
|
||||
case IToken.t_struct :
|
||||
classKey = consume();
|
||||
classKind = ClassKind.k_struct;
|
||||
classKind = ClassKind.STRUCT;
|
||||
break;
|
||||
case IToken.t_union :
|
||||
classKey = consume();
|
||||
classKind = ClassKind.k_union;
|
||||
classKind = ClassKind.UNION;
|
||||
break;
|
||||
default :
|
||||
throw backtrack;
|
||||
|
@ -2739,7 +2787,7 @@ public class Parser implements IParser
|
|||
}
|
||||
}
|
||||
if (duple != null && !duple.isIdentifier())
|
||||
nameType = ClassNameType.t_template;
|
||||
nameType = ClassNameType.TEMPLATE;
|
||||
if (LT(1) != IToken.tCOLON && LT(1) != IToken.tLBRACE)
|
||||
{
|
||||
// this is not a classSpecification
|
||||
|
@ -2757,14 +2805,15 @@ public class Parser implements IParser
|
|||
IASTClassSpecifier astClassSpecifier =
|
||||
astFactory
|
||||
.createClassSpecifier(
|
||||
scope,
|
||||
sdw.getScope(),
|
||||
duple == null ? "" : duple.toString(),
|
||||
classKind,
|
||||
nameType,
|
||||
access,
|
||||
null, //TODO add TemplateDeclaration here
|
||||
classKey.getOffset(),
|
||||
duple == null ? 0 : duple.getFirstToken().getOffset());
|
||||
classKey.getOffset(),
|
||||
duple == null ? 0 : duple.getFirstToken().getOffset());
|
||||
sdw.setTypeSpecifier(astClassSpecifier);
|
||||
// base clause
|
||||
if (LT(1) == IToken.tCOLON)
|
||||
{
|
||||
|
@ -2852,7 +2901,7 @@ public class Parser implements IParser
|
|||
{
|
||||
}
|
||||
boolean isVirtual = false;
|
||||
AccessVisibility visibility = AccessVisibility.v_public;
|
||||
AccessVisibility visibility = AccessVisibility.PUBLIC;
|
||||
TokenDuple nameDuple = null;
|
||||
baseSpecifierLoop : for (;;)
|
||||
{
|
||||
|
@ -2890,10 +2939,10 @@ public class Parser implements IParser
|
|||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
visibility = AccessVisibility.v_protected;
|
||||
visibility = AccessVisibility.PROTECTED;
|
||||
break;
|
||||
case IToken.t_private :
|
||||
visibility = AccessVisibility.v_private;
|
||||
visibility = AccessVisibility.PRIVATE;
|
||||
try
|
||||
{
|
||||
callback.baseSpecifierVisibility(
|
||||
|
@ -2924,7 +2973,7 @@ public class Parser implements IParser
|
|||
visibility,
|
||||
nameDuple.toString());
|
||||
isVirtual = false;
|
||||
visibility = AccessVisibility.v_public;
|
||||
visibility = AccessVisibility.PUBLIC;
|
||||
nameDuple = null;
|
||||
callback.baseSpecifierEnd(baseSpecifier);
|
||||
baseSpecifier =
|
||||
|
|
|
@ -19,6 +19,8 @@ import org.eclipse.cdt.core.parser.ast.ClassNameType;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTFactory;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||
|
@ -166,4 +168,31 @@ public class FullParseASTFactory extends BaseASTFactory implements IASTFactory {
|
|||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createElaboratedTypeSpecifier(org.eclipse.cdt.core.parser.ast.ClassKind, java.lang.String, int, int)
|
||||
*/
|
||||
public IASTElaboratedTypeSpecifier createElaboratedTypeSpecifier(ClassKind elaboratedClassKind, String typeName, int startingOffset, int endOffset )
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createEnumerationSpecifier(java.lang.String, int)
|
||||
*/
|
||||
public IASTEnumerationSpecifier createEnumerationSpecifier(String name, int startingOffset, int nameOffset)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#addEnumerator(org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier, java.lang.String, int, int)
|
||||
*/
|
||||
public void addEnumerator(IASTEnumerationSpecifier enumeration, String string, int startingOffset, int endingOffset)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,83 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation 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.internal.core.parser.ast.quick;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.ClassKind;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.Offsets;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class ASTElaboratedTypeSpecifier implements IASTElaboratedTypeSpecifier
|
||||
{
|
||||
|
||||
private Offsets offsets = new Offsets();
|
||||
private final String typeName;
|
||||
private final ClassKind classKind;
|
||||
/**
|
||||
* @param elaboratedClassKind
|
||||
* @param typeName
|
||||
* @param startingOffset
|
||||
* @param endOffset
|
||||
*/
|
||||
public ASTElaboratedTypeSpecifier(ClassKind elaboratedClassKind, String typeName, int startingOffset, int endOffset)
|
||||
{
|
||||
classKind = elaboratedClassKind;
|
||||
this.typeName = typeName;
|
||||
offsets.setStartingOffset( startingOffset );
|
||||
offsets.setEndingOffset( endOffset );
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier#getTypeName()
|
||||
*/
|
||||
public String getTypeName()
|
||||
{
|
||||
return typeName;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier#getClassKind()
|
||||
*/
|
||||
public ClassKind getClassKind()
|
||||
{
|
||||
return classKind;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
|
||||
*/
|
||||
public void setStartingOffset(int o)
|
||||
{
|
||||
offsets.setStartingOffset(o);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
|
||||
*/
|
||||
public void setEndingOffset(int o)
|
||||
{
|
||||
offsets.setEndingOffset(o);
|
||||
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
|
||||
*/
|
||||
public int getElementStartingOffset()
|
||||
{
|
||||
return offsets.getElementStartingOffset();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
|
||||
*/
|
||||
public int getElementEndingOffset()
|
||||
{
|
||||
return offsets.getElementEndingOffset();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,108 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation 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.internal.core.parser.ast.quick;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class ASTEnumerationSpecifier
|
||||
implements IASTEnumerationSpecifier, IASTOffsetableNamedElement
|
||||
{
|
||||
private final String name;
|
||||
private NamedOffsets offsets = new NamedOffsets();
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @param startingOffset
|
||||
*/
|
||||
public ASTEnumerationSpecifier(String name, int startingOffset, int nameOffset)
|
||||
{
|
||||
this.name = name;
|
||||
offsets.setNameOffset( nameOffset );
|
||||
offsets.setStartingOffset( startingOffset);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
|
||||
*/
|
||||
public int getElementNameOffset()
|
||||
{
|
||||
return offsets.getElementNameOffset();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
|
||||
*/
|
||||
public void setNameOffset(int o)
|
||||
{
|
||||
offsets.setNameOffset(o);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
|
||||
*/
|
||||
public void setStartingOffset(int o)
|
||||
{
|
||||
offsets.setStartingOffset(o);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
|
||||
*/
|
||||
public void setEndingOffset(int o)
|
||||
{
|
||||
offsets.setEndingOffset(o);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
|
||||
*/
|
||||
public int getElementStartingOffset()
|
||||
{
|
||||
return offsets.getElementStartingOffset();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
|
||||
*/
|
||||
public int getElementEndingOffset()
|
||||
{
|
||||
return offsets.getElementEndingOffset();
|
||||
}
|
||||
|
||||
private List enumerators = new ArrayList();
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier#getEnumerators()
|
||||
*/
|
||||
public Iterator getEnumerators()
|
||||
{
|
||||
return Collections.unmodifiableList( enumerators ).iterator();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier#addEnumerator(org.eclipse.cdt.core.parser.ast.IASTEnumerator)
|
||||
*/
|
||||
public void addEnumerator(IASTEnumerator enumerator)
|
||||
{
|
||||
enumerators.add(enumerator);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,99 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003 Rational Software Corporation 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.internal.core.parser.ast.quick;
|
||||
|
||||
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement;
|
||||
import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
|
||||
|
||||
/**
|
||||
* @author jcamelon
|
||||
*
|
||||
*/
|
||||
public class ASTEnumerator
|
||||
implements IASTEnumerator, IASTOffsetableNamedElement
|
||||
{
|
||||
private final String name;
|
||||
private final IASTEnumerationSpecifier enumeration;
|
||||
private final NamedOffsets offsets = new NamedOffsets();
|
||||
/**
|
||||
* @param enumeration
|
||||
* @param string
|
||||
* @param startingOffset
|
||||
* @param endingOffset
|
||||
*/
|
||||
public ASTEnumerator(IASTEnumerationSpecifier enumeration, String string, int startingOffset, int endingOffset)
|
||||
{
|
||||
this.enumeration = enumeration;
|
||||
name = string;
|
||||
offsets.setStartingOffset( startingOffset );
|
||||
offsets.setNameOffset( startingOffset );
|
||||
offsets.setEndingOffset( endingOffset );
|
||||
enumeration.addEnumerator(this);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
|
||||
*/
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
|
||||
*/
|
||||
public int getElementNameOffset()
|
||||
{
|
||||
return offsets.getElementNameOffset();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
|
||||
*/
|
||||
public void setNameOffset(int o)
|
||||
{
|
||||
offsets.setNameOffset(o);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
|
||||
*/
|
||||
public void setStartingOffset(int o)
|
||||
{
|
||||
offsets.setStartingOffset(o);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
|
||||
*/
|
||||
public void setEndingOffset(int o)
|
||||
{
|
||||
offsets.setEndingOffset(o);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
|
||||
*/
|
||||
public int getElementStartingOffset()
|
||||
{
|
||||
return offsets.getElementStartingOffset();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
|
||||
*/
|
||||
public int getElementEndingOffset()
|
||||
{
|
||||
return offsets.getElementEndingOffset();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTEnumerator#getOwnerEnumerationSpecifier()
|
||||
*/
|
||||
public IASTEnumerationSpecifier getOwnerEnumerationSpecifier()
|
||||
{
|
||||
return enumeration;
|
||||
}
|
||||
}
|
|
@ -17,6 +17,9 @@ import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
|
|||
import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTFactory;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
|
||||
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
|
||||
|
@ -100,4 +103,28 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
|
|||
((IASTQClassSpecifier)astClassSpec).addBaseClass(baseSpecifier);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createElaboratedTypeSpecifier(org.eclipse.cdt.core.parser.ast.ClassKind, java.lang.String, int, int)
|
||||
*/
|
||||
public IASTElaboratedTypeSpecifier createElaboratedTypeSpecifier(ClassKind elaboratedClassKind, String typeName, int startingOffset, int endOffset)
|
||||
{
|
||||
return new ASTElaboratedTypeSpecifier( elaboratedClassKind, typeName, startingOffset, endOffset );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createEnumerationSpecifier(java.lang.String, int)
|
||||
*/
|
||||
public IASTEnumerationSpecifier createEnumerationSpecifier(String name, int startingOffset, int nameOffset)
|
||||
{
|
||||
return new ASTEnumerationSpecifier( name, startingOffset, nameOffset );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#addEnumerator(org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier, java.lang.String, int, int)
|
||||
*/
|
||||
public void addEnumerator(IASTEnumerationSpecifier enumeration, String string, int startingOffset, int endingOffset)
|
||||
{
|
||||
IASTEnumerator enumerator = new ASTEnumerator( enumeration, string, startingOffset, endingOffset );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2337,7 +2337,7 @@ public class ParserSymbolTable {
|
|||
}
|
||||
|
||||
public void addParent( ISymbol parent ){
|
||||
addParent( parent, false, AccessVisibility.v_public );
|
||||
addParent( parent, false, AccessVisibility.PUBLIC );
|
||||
}
|
||||
public void addParent( ISymbol parent, boolean virtual, AccessVisibility visibility ){
|
||||
if( _parentScopes == null ){
|
||||
|
|
|
@ -321,4 +321,13 @@ public class MatchLocator implements ISourceElementRequestor {
|
|||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptElaboratedTypeSpecifier(org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier)
|
||||
*/
|
||||
public void acceptElaboratedTypeSpecifier(IASTElaboratedTypeSpecifier elaboratedTypeSpec)
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
2003-06-24 John Camelon
|
||||
Updates for ISourceElementRequestor - elaborated types & enumerations.
|
||||
|
||||
2003-06-23 John Camelon
|
||||
Updated Factory infrastructure, constructors, etc.
|
||||
Introduced Preprocessor class for transitive closure calc. client.
|
||||
|
|
|
@ -267,10 +267,10 @@ public class ParserSymbolTableTest extends TestCase {
|
|||
IDerivableContainerSymbol c = table.newDerivableContainerSymbol("C");
|
||||
|
||||
IDerivableContainerSymbol a = table.newDerivableContainerSymbol("A");
|
||||
a.addParent( c, true, AccessVisibility.v_public );
|
||||
a.addParent( c, true, AccessVisibility.PUBLIC );
|
||||
|
||||
IDerivableContainerSymbol b = table.newDerivableContainerSymbol("B");
|
||||
b.addParent( c, true, AccessVisibility.v_public );
|
||||
b.addParent( c, true, AccessVisibility.PUBLIC );
|
||||
|
||||
decl.addParent( a );
|
||||
decl.addParent( b );
|
||||
|
|
Loading…
Add table
Reference in a new issue