diff --git a/core/org.eclipse.cdt.core.tests/ChangeLog b/core/org.eclipse.cdt.core.tests/ChangeLog index c4e99cdc6ef..20fb1b28e75 100644 --- a/core/org.eclipse.cdt.core.tests/ChangeLog +++ b/core/org.eclipse.cdt.core.tests/ChangeLog @@ -1,3 +1,7 @@ +2003-09-08 John Camelon + Added CompleteParseASTTest::testThrowStatement(), testScoping(), testEnumeratorReferences(). + Removed LineNumberTest source as it is obsolete. + 2003-09-08 Andrew Niefer Modified calls to ParserFactory to specify which language to use Add CC nature to projects in BaseSearchTest & IndexManagerTests diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java index beb83e36065..afd94f1cfd9 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java @@ -21,7 +21,9 @@ import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration; import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier; import org.eclipse.cdt.core.parser.ast.IASTClassReference; import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier; +import org.eclipse.cdt.core.parser.ast.IASTCodeScope; import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier; +import org.eclipse.cdt.core.parser.ast.IASTEnumerationReference; import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier; import org.eclipse.cdt.core.parser.ast.IASTEnumerator; import org.eclipse.cdt.core.parser.ast.IASTField; @@ -743,4 +745,53 @@ public class CompleteParseASTTest extends CompleteParseBaseTest assertFalse( i.hasNext() ); assertEquals( callback.getReferences().size(), 3 ); } + + public void testThrowStatement() throws Exception + { + Iterator i = parse( "class A { }; void foo() throw ( A ) { throw A; throw; } ").getDeclarations(); + IASTClassSpecifier classA = (IASTClassSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier(); + IASTFunction functionF = (IASTFunction)i.next(); + assertFalse( i.hasNext() ); + assertEquals( callback.getReferences().size(), 2 ); + for( int j = 0; j < 2; ++j ) + assertEquals( ((IASTReference)callback.getReferences().get(j) ).getReferencedElement(), classA ); + } + + public void testScoping() throws Exception + { + Iterator i = parse( "void foo() { int x = 3; if( x == 1 ) { int x = 4; } else int x = 2; }").getDeclarations(); + IASTFunction f = (IASTFunction)i.next(); + Iterator subDeclarations = getDeclarations(f); + IASTVariable topX = (IASTVariable)subDeclarations.next(); + assertEquals( topX.getInitializerClause().getAssigmentExpression().getLiteralString(), "3"); + assertEquals( topX.getName(), "x"); + assertFalse( subDeclarations.hasNext() ); + assertFalse( i.hasNext() ); + assertEquals( callback.getReferences().size(), 1 ); + assertEquals( ((IASTReference)callback.getReferences().get(0)).getReferencedElement(), topX ); + + Iterator level1 = getNestedScopes( f ); + IASTCodeScope codeScope = (IASTCodeScope)level1.next(); + Iterator subSubDeclarations = getDeclarations(codeScope); + IASTVariable secondX = (IASTVariable)subSubDeclarations.next(); + assertEquals( secondX.getInitializerClause().getAssigmentExpression().getLiteralString(), "4"); + codeScope = (IASTCodeScope)level1.next(); + assertFalse( level1.hasNext() ); + subSubDeclarations = getDeclarations(codeScope); + IASTVariable thirdX = (IASTVariable)subSubDeclarations.next(); + assertEquals( thirdX.getInitializerClause().getAssigmentExpression().getLiteralString(), "2"); + + } + + public void testEnumeratorReferences() throws Exception + { + Iterator i = parse( "enum E { e1, e2, e3 }; E anE = e1;").getDeclarations(); + IASTEnumerationSpecifier enumE = (IASTEnumerationSpecifier)((IASTAbstractTypeSpecifierDeclaration)i.next()).getTypeSpecifier(); + IASTVariable anE = (IASTVariable)i.next(); + IASTEnumerator e1 = (IASTEnumerator)enumE.getEnumerators().next(); + assertFalse( i.hasNext() ); + assertEquals( callback.getReferences().size(), 2 ); + assertEquals( ((IASTReference)callback.getReferences().get(0)).getReferencedElement(), enumE ); + assertEquals( ((IASTReference)callback.getReferences().get(1)).getReferencedElement(), e1 ); + } } diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseBaseTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseBaseTest.java index 9ef3a26ab4e..346cc132dd9 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseBaseTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/CompleteParseBaseTest.java @@ -29,11 +29,13 @@ import org.eclipse.cdt.core.parser.ast.IASTASMDefinition; import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration; import org.eclipse.cdt.core.parser.ast.IASTClassReference; import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier; +import org.eclipse.cdt.core.parser.ast.IASTCodeScope; import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit; import org.eclipse.cdt.core.parser.ast.IASTDeclaration; import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.parser.ast.IASTEnumerationReference; import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier; +import org.eclipse.cdt.core.parser.ast.IASTEnumeratorReference; import org.eclipse.cdt.core.parser.ast.IASTField; import org.eclipse.cdt.core.parser.ast.IASTFieldReference; import org.eclipse.cdt.core.parser.ast.IASTFunction; @@ -108,6 +110,58 @@ public class CompleteParseBaseTest extends TestCase return scope; } } + + public static class CodeScope extends Scope implements IASTCodeScope + { + private List nestedScopes = new ArrayList(); + /** + * @param scope + */ + public CodeScope(IASTCodeScope scope) + { + super(scope); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTCodeScope#getOwnerCodeScope() + */ + public IASTCodeScope getOwnerCodeScope() + { + return ((IASTCodeScope)getScope()).getOwnerCodeScope(); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor) + */ + public void acceptElement(ISourceElementRequestor requestor) + { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor) + */ + public void enterScope(ISourceElementRequestor requestor) + { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor) + */ + public void exitScope(ISourceElementRequestor requestor) + { + } + + public void addNewScope( IASTCodeScope s ) + { + nestedScopes.add( s ); + } + + public Iterator getCodeBlocks() + { + return nestedScopes.iterator(); + } + } + public static class FullParseCallback implements ISourceElementRequestor { private List references = new ArrayList(); @@ -183,7 +237,6 @@ public class CompleteParseBaseTest extends TestCase public void acceptAbstractTypeSpecDeclaration(IASTAbstractTypeSpecifierDeclaration abstractDeclaration) { getCurrentScope().addDeclaration( abstractDeclaration ); - } /* (non-Javadoc) @@ -191,7 +244,7 @@ public class CompleteParseBaseTest extends TestCase */ public void enterFunctionBody(IASTFunction function) { - pushScope( function ); + pushCodeScope( function ); } /* (non-Javadoc) @@ -290,7 +343,7 @@ public class CompleteParseBaseTest extends TestCase */ public void enterMethodBody(IASTMethod method) { - pushScope(method); + pushCodeScope(method); } /* (non-Javadoc) @@ -398,6 +451,11 @@ public class CompleteParseBaseTest extends TestCase return (Scope)scopes.peek(); } + protected CodeScope getCurrentCodeScope() + { + return (CodeScope)scopes.peek(); + } + protected Scope popScope() { Scope s = (Scope)scopes.pop(); @@ -416,6 +474,12 @@ public class CompleteParseBaseTest extends TestCase { return (Scope)h.get(s); } + + public CodeScope lookup( IASTCodeScope s ) + { + return (CodeScope)h.get(s); + } + /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptProblem(org.eclipse.cdt.core.parser.IProblem) @@ -466,7 +530,6 @@ public class CompleteParseBaseTest extends TestCase public void acceptEnumerationReference(IASTEnumerationReference reference) { references.add( reference ); - } /* (non-Javadoc) @@ -528,19 +591,43 @@ public class CompleteParseBaseTest extends TestCase /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope) */ - public void enterCodeBlock(IASTScope scope) { - // TODO Auto-generated method stub - + public void enterCodeBlock(IASTCodeScope scope) { + pushCodeScope( scope ); } - /* (non-Javadoc) + /** + * @param scope + */ + protected void pushCodeScope(IASTCodeScope scope) + { + scopes.push( new CodeScope( scope ) ); + } + + /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope) */ - public void exitCodeBlock(IASTScope scope) { - // TODO Auto-generated method stub - + public void exitCodeBlock(IASTCodeScope scope) { + popScope(); + getCurrentCodeScope().addNewScope(scope); } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumeratorReference(org.eclipse.cdt.core.parser.ast.IASTEnumerationReference) + */ + public void acceptEnumeratorReference(IASTEnumeratorReference reference) + { + references.add( reference ); + } + } + + protected Iterator getNestedScopes( IASTCodeScope scope ) + { + CodeScope s = callback.lookup( scope ); + if( s != null ) + return s.getCodeBlocks(); + return null; + } protected Iterator getDeclarations(IASTScope scope) { diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/LineNumberTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/LineNumberTest.java deleted file mode 100644 index 873b9778eb6..00000000000 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/LineNumberTest.java +++ /dev/null @@ -1,119 +0,0 @@ -/********************************************************************** - * 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.core.parser.tests; - -import java.io.FileInputStream; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.util.List; - -import junit.framework.TestCase; - -import org.eclipse.cdt.core.parser.IParser; -import org.eclipse.cdt.core.parser.ParserLanguage; -import org.eclipse.cdt.core.parser.ParserFactory; -import org.eclipse.cdt.core.parser.ParserMode; -import org.eclipse.cdt.internal.core.dom.ClassSpecifier; -import org.eclipse.cdt.internal.core.dom.DOMBuilder; -import org.eclipse.cdt.internal.core.dom.EnumerationSpecifier; -import org.eclipse.cdt.internal.core.dom.IOffsetable; -import org.eclipse.cdt.internal.core.dom.NamespaceDefinition; -import org.eclipse.cdt.internal.core.dom.SimpleDeclaration; -import org.eclipse.cdt.internal.core.dom.TemplateDeclaration; -import org.eclipse.cdt.internal.core.parser.ScannerInfo; -import org.eclipse.core.runtime.Path; - -/** - * @author jcamelon - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public class LineNumberTest extends TestCase { - - public LineNumberTest( String arg ) - { - super( arg ); - } - private InputStream fileIn; - - protected void setUp() throws Exception { - String fileName =org.eclipse.core.runtime.Platform.getPlugin("org.eclipse.cdt.core.tests").find(new Path("/")).getFile() + "resources/parser/LineNumberTest.h"; - fileIn = new FileInputStream(fileName); - } - - - public void testDOMLineNos() throws Exception - { - DOMBuilder domBuilder = new DOMBuilder(); - IParser parser = ParserFactory.createParser( ParserFactory.createScanner( new InputStreamReader( fileIn ), null, new ScannerInfo(), ParserMode.QUICK_PARSE, ParserLanguage.CPP, domBuilder ), domBuilder, ParserMode.QUICK_PARSE, ParserLanguage.CPP); - //parser.mapLineNumbers(true); - if( ! parser.parse() ) fail( "Parse of file failed"); - - List macros = domBuilder.getTranslationUnit().getMacros(); - List inclusions = domBuilder.getTranslationUnit().getInclusions(); - List declarations = domBuilder.getTranslationUnit().getDeclarations(); - - assertEquals( 3, macros.size() ); - assertEquals( 1, inclusions.size() ); - assertEquals( declarations.size(), 4 ); - validateLineNumbers( (IOffsetable)inclusions.get(0), 2, 2 ); - validateLineNumbers( (IOffsetable)macros.get(0), 5, 5 ); - validateLineNumbers( (IOffsetable)macros.get(1), 6, 6 ); - validateLineNumbers( (IOffsetable)macros.get(2), 30, 31 ); - - NamespaceDefinition namespaceDecl = (NamespaceDefinition)declarations.get(0); - validateLineNumbers( namespaceDecl, 8, 22 ); - List namespaceMembers = namespaceDecl.getDeclarations(); - assertEquals( namespaceMembers.size(), 1 ); - ClassSpecifier Hello = (ClassSpecifier)((SimpleDeclaration)namespaceMembers.get(0)).getTypeSpecifier(); - validateLineNumbers( Hello, 10, 21); - List classMembers = Hello.getDeclarations(); - assertEquals( classMembers.size(), 3 ); - for( int i = 0; i < 3; ++i ) - { - SimpleDeclaration memberDeclaration = (SimpleDeclaration)Hello.getDeclarations().get(i); - switch( i ) - { - case 0: - validateLineNumbers(memberDeclaration, 13, 13 ); - break; - case 1: - validateLineNumbers(memberDeclaration, 15, 15 ); - break; - case 2: - validateLineNumbers(memberDeclaration, 18, 20 ); - break; - default: - break; - } - } - - validateLineNumbers( (SimpleDeclaration)declarations.get(1), 25, 27); - validateLineNumbers( (TemplateDeclaration)declarations.get(2), 34, 35); - SimpleDeclaration d = (SimpleDeclaration)declarations.get(3); - validateLineNumbers( d, 38, 43); - validateLineNumbers( ((EnumerationSpecifier)d.getTypeSpecifier()), 38, 43); - - } - - protected void tearDown() throws Exception { - if( fileIn != null ) fileIn.close(); - } - - protected void validateLineNumbers( IOffsetable offsetable, int top, int bottom ) - { - assertNotNull( offsetable ); - assertEquals( offsetable.getTopLine(), top ); - assertEquals( offsetable.getBottomLine(), bottom ); - } -} diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/TortureTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/TortureTest.java index 935500b2b57..14bb6efc569 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/TortureTest.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/TortureTest.java @@ -24,10 +24,9 @@ import junit.framework.Test; import org.eclipse.cdt.core.parser.ILineOffsetReconciler; import org.eclipse.cdt.core.parser.IParser; -import org.eclipse.cdt.core.parser.ParserLanguage; 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.internal.core.dom.DOMBuilder; import org.eclipse.cdt.internal.core.parser.ScannerInfo; import org.eclipse.core.runtime.Path; @@ -278,7 +277,6 @@ public class TortureTest extends FractionalAutomatedTest { public void run(){ try { - DOMBuilder domBuilder = new DOMBuilder(); ParserMode parserMode = quickParse ? ParserMode.QUICK_PARSE : ParserMode.COMPLETE_PARSE; ParserLanguage language = cppNature ? ParserLanguage.CPP : ParserLanguage.C; parser = ParserFactory.createParser( diff --git a/core/org.eclipse.cdt.core/.classpath b/core/org.eclipse.cdt.core/.classpath index 7bd429f256a..6d45156cec7 100644 --- a/core/org.eclipse.cdt.core/.classpath +++ b/core/org.eclipse.cdt.core/.classpath @@ -6,7 +6,6 @@ - diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ASMDefinition.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ASMDefinition.java deleted file mode 100644 index 3fc53d87cac..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ASMDefinition.java +++ /dev/null @@ -1,35 +0,0 @@ -/********************************************************************** - * Created on Mar 26, 2003 - * - * 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: - * Rational Software - Initial API and implementation -***********************************************************************/ -package org.eclipse.cdt.internal.core.dom; - -/** - * @author jcamelon - * - */ -public class ASMDefinition extends Declaration { - - final private String assemblyCode; - - public ASMDefinition( IScope scope, String code ) - { - super( scope ); - assemblyCode = code; - } - /** - * @return String - */ - public String getAssemblyCode() { - return assemblyCode; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/AccessSpecifier.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/AccessSpecifier.java deleted file mode 100644 index 95f2a0c552d..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/AccessSpecifier.java +++ /dev/null @@ -1,34 +0,0 @@ -/********************************************************************** - * Created on Mar 26, 2003 - * - * 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: - * Rational Software - Initial API and implementation -***********************************************************************/ -package org.eclipse.cdt.internal.core.dom; - -/** - * @author jcamelon - * - */ -public class AccessSpecifier { - - public static final int v_private = 0; - public static final int v_protected = 1; - public static final int v_public = 2; - public static final int v_unknown = 3; - - private int access; - public void setAccess(int access) { this.access = access; } - public int getAccess() { return access; } - - public AccessSpecifier( int value ) - { - setAccess( value ); - } -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ArrayQualifier.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ArrayQualifier.java deleted file mode 100644 index 9512a5106bd..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ArrayQualifier.java +++ /dev/null @@ -1,34 +0,0 @@ -/********************************************************************** - * Created on Mar 23, 2003 - * - * 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: - * Rational Software - Initial API and implementation -***********************************************************************/ -package org.eclipse.cdt.internal.core.dom; - -/** - * @author jcamelon - * - */ -public class ArrayQualifier { - - public ArrayQualifier( Declarator owner ) - { - ownerDeclarator = owner; - } - - private Declarator ownerDeclarator; - /** - * @return Declarator - */ - public Declarator getOwnerDeclarator() { - return ownerDeclarator; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/BaseSpecifier.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/BaseSpecifier.java deleted file mode 100644 index 4b471011dc4..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/BaseSpecifier.java +++ /dev/null @@ -1,45 +0,0 @@ -package org.eclipse.cdt.internal.core.dom; - - - -/** - * @author dschaefe - * - * To change this generated comment edit the template variable "typecomment": - * Window>Preferences>Java>Templates. - * To enable and disable the creation of type comments go to - * Window>Preferences>Java>Code Generation. - */ -public class BaseSpecifier { - - public BaseSpecifier(ClassSpecifier classSpecifier) { - this.classSpecifier = classSpecifier; - classSpecifier.addBaseSpecifier(this); - - switch (classSpecifier.getClassKey()) { - case ClassKey.t_class: - access.setAccess(AccessSpecifier.v_private); - break; - case ClassKey.t_struct: - default: - access.setAccess(AccessSpecifier.v_public); - break; - } - } - - private ClassSpecifier classSpecifier; - public ClassSpecifier getClassSpecifier() { return classSpecifier; } - - private boolean isVirtual = false; - public void setVirtual(boolean isVirtual) { this.isVirtual = isVirtual; } - public boolean isVirtual() { return isVirtual; } - - - private AccessSpecifier access = new AccessSpecifier( AccessSpecifier.v_unknown ); - public void setAccess(int access) { this.access.setAccess(access); } - public int getAccess() { return access.getAccess(); } - - private String name; - public void setName(String name) { this.name = name; } - public String getName() { return name; } -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/BitField.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/BitField.java deleted file mode 100644 index 4037ec48da2..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/BitField.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001 IBM 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 Corp. - Rational Software - initial implementation - ******************************************************************************/ -package org.eclipse.cdt.internal.core.dom; - -/** - * @author jcamelon - * - */ -public class BitField { - - - public BitField( Declarator owner ) - { - ownerDeclarator= owner; - } - private final Declarator ownerDeclarator; - - /** - * @return - */ - public Declarator getOwnerDeclarator() { - return ownerDeclarator; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ClassKey.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ClassKey.java deleted file mode 100644 index 21d4b57a47c..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ClassKey.java +++ /dev/null @@ -1,44 +0,0 @@ -/********************************************************************** - * Created on Mar 26, 2003 - * - * 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: - * Rational Software - Initial API and implementation -***********************************************************************/ -package org.eclipse.cdt.internal.core.dom; - -/** - * @author jcamelon - * - */ -public class ClassKey { - - public static final int t_class = 0; - public static final int t_struct = 1; - public static final int t_union = 2; - public static final int t_enum = 3; - - private int classKey = t_class; - - - /** - * @return int - */ - public int getClassKey() { - return classKey; - } - - /** - * Sets the classKey. - * @param classKey The classKey to set - */ - public void setClassKey(int classKey) { - this.classKey = classKey; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ClassSpecifier.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ClassSpecifier.java deleted file mode 100644 index d276114a9d2..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ClassSpecifier.java +++ /dev/null @@ -1,146 +0,0 @@ -package org.eclipse.cdt.internal.core.dom; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -public class ClassSpecifier extends TypeSpecifier implements IScope, IOffsetable, IAccessable { - - private String classKeyImage = null; - private AccessSpecifier access = new AccessSpecifier( AccessSpecifier.v_private ); - private ClassKey key = new ClassKey(); - private int startingOffset = 0, totalLength = 0, nameOffset = 0; - private int topLine = 0, bottomLine = 0; - - public int getClassKey() { return key.getClassKey(); } - - public ClassSpecifier(int classKey, TypeSpecifier.IOwner declaration) { - super(declaration); - this.key.setClassKey(classKey); - if( classKey == ClassKey.t_class ) - classKeyImage = "class"; - else if( classKey == ClassKey.t_struct ) - classKeyImage = "struct"; - else if( classKey == ClassKey.t_union ) - classKeyImage = "union"; - } - - private String name; - public void setName(String n) { name = n; } - public String getName() { return name; } - - private List baseSpecifiers = new LinkedList(); - public void addBaseSpecifier(BaseSpecifier baseSpecifier) { - baseSpecifiers.add(baseSpecifier); - } - public List getBaseSpecifiers() { return Collections.unmodifiableList(baseSpecifiers); } - - private List declarations = new LinkedList(); - - public void addDeclaration(Declaration declaration) { - declarations.add(declaration); - } - - public List getDeclarations() { - return Collections.unmodifiableList( declarations ); - } - /** - * @return int - */ - public int getVisibility() { - return access.getAccess(); - } - - /** - * Sets the currentVisiblity. - * @param currentVisiblity The currentVisiblity to set - */ - public void setVisibility(int currentVisiblity) { - access.setAccess(currentVisiblity); - } - - /** - * @return - */ - public int getStartingOffset() { - return startingOffset; - } - - public int getClassKeyEndOffset() - { - return startingOffset + classKeyImage.length(); - } - /** - * @return - */ - public int getTotalLength() { - return totalLength; - } - - /** - * @param i - */ - public void setStartingOffset(int i) { - startingOffset = i; - } - - /** - * @param i - */ - public void setTotalLength(int i) { - totalLength = i; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#setTopLine(int) - */ - public void setTopLine(int lineNumber) { - topLine = lineNumber; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#setBottomLine(int) - */ - public void setBottomLine(int lineNumber) { - bottomLine = lineNumber; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#getTopLine() - */ - public int getTopLine() { - return topLine; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#getBottomLine() - */ - public int getBottomLine() { - return bottomLine; - } - - /** - * @return - */ - public String getClassKeyImage() - { - return classKeyImage; - } - - /** - * @return - */ - public int getNameOffset() - { - return nameOffset; - } - - /** - * @param i - */ - public void setNameOffset(int i) - { - nameOffset = i; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ConstructorChain.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ConstructorChain.java deleted file mode 100644 index 10b777b0629..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ConstructorChain.java +++ /dev/null @@ -1,52 +0,0 @@ -/********************************************************************** - * Created on Mar 28, 2003 - * - * 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: - * Rational Software - Initial API and implementation -***********************************************************************/ -package org.eclipse.cdt.internal.core.dom; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * @author jcamelon - * - */ -public class ConstructorChain { - - private List chainElements = new ArrayList(); - - /** - * @return List - */ - public List getChainElements() { - return Collections.unmodifiableList( chainElements ); - } - - public void addChainElement( ConstructorChainElement chainElement ) - { - chainElements.add( chainElement ); - } - - public ConstructorChain( Declarator declarator ) - { - this.ownerDeclarator = declarator; - } - - private final Declarator ownerDeclarator; - /** - * @return Declarator - */ - public Declarator getOwnerDeclarator() { - return ownerDeclarator; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ConstructorChainElement.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ConstructorChainElement.java deleted file mode 100644 index 8dacc88d58e..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ConstructorChainElement.java +++ /dev/null @@ -1,55 +0,0 @@ -/********************************************************************** - * Created on Mar 28, 2003 - * - * 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: - * Rational Software - Initial API and implementation -***********************************************************************/ -package org.eclipse.cdt.internal.core.dom; - - - -/** - * @author jcamelon - * - */ -public class ConstructorChainElement { - - private String name; - private final ConstructorChain ownerChain; - - ConstructorChainElement( ConstructorChain chain ) - { - ownerChain = chain; - } - - /** - * @return Name - */ - public String getName() { - return name; - } - - /** - * Sets the name. - * @param name The name to set - */ - public void setName(String name) { - this.name = name; - } - - - /** - * @return ConstructorChain - */ - public ConstructorChain getOwnerChain() { - return ownerChain; - } - - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/DOMBuilder.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/DOMBuilder.java deleted file mode 100644 index 18e92a2f58e..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/DOMBuilder.java +++ /dev/null @@ -1,977 +0,0 @@ -package org.eclipse.cdt.internal.core.dom; -import java.util.Iterator; -import java.util.List; -import org.eclipse.cdt.core.parser.IProblem; -import org.eclipse.cdt.core.parser.ISourceElementRequestor; -import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility; -import org.eclipse.cdt.core.parser.ast.ASTClassKind; -import org.eclipse.cdt.core.parser.ast.ASTPointerOperator; -import org.eclipse.cdt.core.parser.ast.IASTASMDefinition; -import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration; -import org.eclipse.cdt.core.parser.ast.IASTArrayModifier; -import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier; -import org.eclipse.cdt.core.parser.ast.IASTClassReference; -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.IASTEnumerationReference; -import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier; -import org.eclipse.cdt.core.parser.ast.IASTEnumerator; -import org.eclipse.cdt.core.parser.ast.IASTExpression; -import org.eclipse.cdt.core.parser.ast.IASTField; -import org.eclipse.cdt.core.parser.ast.IASTFieldReference; -import org.eclipse.cdt.core.parser.ast.IASTFunction; -import org.eclipse.cdt.core.parser.ast.IASTFunctionReference; -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.IASTMethodReference; -import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition; -import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference; -import org.eclipse.cdt.core.parser.ast.IASTScope; -import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier; -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.IASTTypeSpecifier; -import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration; -import org.eclipse.cdt.core.parser.ast.IASTTypedefReference; -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.core.parser.ast.IASTVariableReference; -/** - * This is the parser callback that creates objects in the DOM. - */ -public class DOMBuilder implements ISourceElementRequestor -{ - public DOMBuilder() - { - } - protected TranslationUnit translationUnit = new TranslationUnit(); - public TranslationUnit getTranslationUnit() - { - return translationUnit; - } - public SimpleDeclaration getTypeSpecOwner( - IScope scope, - int startingOffset) - { - List declarations = scope.getDeclarations(); - for (int i = 0; i < declarations.size(); ++i) - { - if (declarations.get(i) instanceof SimpleDeclaration ) - { - SimpleDeclaration s = (SimpleDeclaration)declarations.get(i); - if (s.getStartingOffset() == startingOffset) - return s; - } - } - return null; - } - protected void createPDC(Declarator decl) - { - ParameterDeclarationClause clause = - new ParameterDeclarationClause(decl); - } - // /** - // * @see org.eclipse.cdt.internal.core.newparser.IParserCallback#oldKRParametersBegin() - // */ - // public Object oldKRParametersBegin( Object parameterDeclarationClause ) { - // ParameterDeclarationClause clause = ((ParameterDeclarationClause)parameterDeclarationClause); - // OldKRParameterDeclarationClause KRclause = new OldKRParameterDeclarationClause( clause ); - // domScopes.push(KRclause); - // return KRclause; - // } - // - // /** - // * @see org.eclipse.cdt.internal.core.newparser.IParserCallback#oldKRParametersEnd() - // */ - // public void oldKRParametersEnd(Object oldKRParameterDeclarationClause) { - // domScopes.pop(); - // } - // - // - // /** - // * @see org.eclipse.cdt.internal.core.newparser.IParserCallback#declaratorBegin() - // */ - // public Object declaratorBegin(Object container) { - // if( container instanceof DeclSpecifier.IContainer ) - // { - // DeclSpecifier.IContainer decl = (DeclSpecifier.IContainer )container; - // Declarator declarator = new Declarator(decl); - // return declarator; - // } - // else if( container instanceof IDeclaratorOwner ) - // { - // IDeclaratorOwner owner = (IDeclaratorOwner)container; - // Declarator declarator = new Declarator(owner); - // return declarator; - // } - // return null; - // } - // - // /** - // * @see org.eclipse.cdt.internal.core.newparser.IParserCallback#declaratorEnd() - // */ - // public void declaratorEnd(Object declarator) { - // Declarator d = (Declarator)declarator; - // if( d.getDeclaration() != null ) - // d.getDeclaration().addDeclarator(d); - // else if( d.getOwnerDeclarator() != null ) - // d.getOwnerDeclarator().setDeclarator(d); - // } - // - // /** - // * @see org.eclipse.cdt.internal.core.newparser.IParserCallback#declaratorId(org.eclipse.cdt.internal.core.newparser.Token) - // */ - // public void declaratorId(Object declarator) { - // ((Declarator)declarator).setName(currName); - // } - // - // /** - // * @see org.eclipse.cdt.internal.core.newparser.IParserCallback#declSpecifier(org.eclipse.cdt.internal.core.newparser.Token) - // */ - // public void simpleDeclSpecifier(Object Container, IToken specifier) { - // DeclSpecifier.IContainer decl = (DeclSpecifier.IContainer)Container; - // DeclSpecifier declSpec = decl.getDeclSpecifier(); - // declSpec.setType( specifier ); - // } - // - // /** - // * @see org.eclipse.cdt.internal.core.newparser.IParserCallback#functionBodyBegin() - // */ - // public Object functionBodyBegin(Object declaration) { - // SimpleDeclaration simpleDec = (SimpleDeclaration)declaration; - // simpleDec.setFunctionDefinition(true); - // return null; - // } - // - // /** - // * @see org.eclipse.cdt.internal.core.newparser.IParserCallback#simpleDeclarationBegin(org.eclipse.cdt.internal.core.newparser.Token) - // */ - // public Object simpleDeclarationBegin(Object container, IToken firstToken) { - // SimpleDeclaration decl = new SimpleDeclaration( getCurrentDOMScope() ); - // if( getCurrentDOMScope() instanceof IAccessable ) - // decl.setAccessSpecifier(new AccessSpecifier( ((IAccessable)getCurrentDOMScope()).getVisibility() )); - // ((IOffsetable)decl).setStartingOffset( firstToken.getOffset() ); - // } - // - // /** - // * @see org.eclipse.cdt.internal.core.newparser.IParserCallback#simpleDeclarationEnd(org.eclipse.cdt.internal.core.newparser.Token) - // */ - // public void simpleDeclarationEnd(Object declaration, IToken lastToken) { - // SimpleDeclaration decl = (SimpleDeclaration)declaration; - // IOffsetable offsetable = (IOffsetable)decl; - // offsetable.setTotalLength( lastToken.getOffset() + lastToken.getLength() - offsetable.getStartingOffset()); - // getCurrentDOMScope().addDeclaration(decl); - // } - // - // - // - protected void createBaseSpecifier(ClassSpecifier cs, IASTBaseSpecifier bs) - { - BaseSpecifier baseSpec = new BaseSpecifier(cs); - baseSpec.setVirtual(bs.isVirtual()); - int access = AccessSpecifier.v_public; - if (bs.getAccess() == ASTAccessVisibility.PUBLIC) - access = AccessSpecifier.v_public; - else if (bs.getAccess() == ASTAccessVisibility.PROTECTED) - access = AccessSpecifier.v_protected; - else if (bs.getAccess() == ASTAccessVisibility.PRIVATE) - access = AccessSpecifier.v_private; - baseSpec.setAccess(access); - baseSpec.setName(bs.getParentClassName()); - } - // - // public Object parameterDeclarationBegin( Object container ) - // { - // IScope clause = (IScope)container; - // ParameterDeclaration pd = new ParameterDeclaration(clause); - // return pd; - // } - // - // public void parameterDeclarationEnd( Object declaration ){ - // ParameterDeclaration d = (ParameterDeclaration)declaration; - // d.getOwnerScope().addDeclaration(d); - // } - // - - - // - // /** - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#simpleDeclSpecifierName(java.lang.Object) - // */ - // public void simpleDeclSpecifierName(Object declaration) { - // DeclSpecifier.IContainer decl = (DeclSpecifier.IContainer)declaration; - // DeclSpecifier declSpec = decl.getDeclSpecifier(); - // declSpec.setName( currName ); - // } - // - // - protected void addPointerOperator( - Declarator d, - ASTPointerOperator pointerOp, - String name) - { - PointerOperator ptrOp = new PointerOperator(d); - if (pointerOp == ASTPointerOperator.REFERENCE) - { - ptrOp.setType(PointerOperator.t_reference); - } - else if (pointerOp == ASTPointerOperator.POINTER) - { - ptrOp.setType(PointerOperator.t_pointer); - } - else if (pointerOp == ASTPointerOperator.CONST_POINTER) - { - ptrOp.setType(PointerOperator.t_pointer); - ptrOp.setConst(true); - } - else if (pointerOp == ASTPointerOperator.VOLATILE_POINTER) - { - ptrOp.setType(PointerOperator.t_pointer); - ptrOp.setVolatile(true); - } - if (d != null) - d.addPointerOperator(ptrOp); - } - // - // /* (non-Javadoc) - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorCVModifier(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token) - // */ - // public void declaratorCVModifier(Object declarator, IToken modifier) { - // Declarator decl = (Declarator)declarator; - // switch( modifier.getType() ) - // { - // case IToken.t_const: - // decl.setConst(true); - // break; - // case IToken.t_volatile: - // decl.setVolatile( true ); - // break; - // default: - // break; - // } - // - // } - protected void addArrayDeclarator( - Declarator decl, - IASTArrayModifier arrayModifier) - { - ArrayQualifier qual = new ArrayQualifier(decl); - decl.addArrayQualifier(qual); - } - // /* (non-Javadoc) - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#exceptionSpecificationTypename(java.lang.Object) - // */ - // public void declaratorThrowExceptionName(Object declarator ) - // { - // Declarator decl = (Declarator)declarator; - // decl.getExceptionSpecifier().addTypeName( currName ); - // } - // - // /* (non-Javadoc) - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorThrowsException(java.lang.Object) - // */ - // public void declaratorThrowsException(Object declarator) { - // Declarator decl = (Declarator)declarator; - // decl.getExceptionSpecifier().setThrowsException(true); - // } - // - // - // /* (non-Javadoc) - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#constructorChainBegin(java.lang.Object) - // */ - // public Object constructorChainBegin(Object declarator) { - // Declarator d = (Declarator)declarator; - // ConstructorChain chain = new ConstructorChain(d); - // return chain; - // } - // - // /* (non-Javadoc) - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#constructorChainEnd(java.lang.Object) - // */ - // public void constructorChainEnd(Object ctor) { - // ConstructorChain chain = (ConstructorChain)ctor; - // chain.getOwnerDeclarator().setCtorChain(chain); - // } - // - // /* (non-Javadoc) - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#constructorChainElementBegin(java.lang.Object) - // */ - // public Object constructorChainElementBegin(Object ctor) { - // return new ConstructorChainElement( (ConstructorChain)ctor ); - // } - // - // /* (non-Javadoc) - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#constructorChainElementEnd(java.lang.Object) - // */ - // public void constructorChainElementEnd(Object element) { - // ConstructorChainElement ele = (ConstructorChainElement)element; - // ele.getOwnerChain().addChainElement( ele ); - // } - // - // /* (non-Javadoc) - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#constructorChainId(java.lang.Object) - // */ - // public void constructorChainElementId(Object element) { - // ConstructorChainElement ele = (ConstructorChainElement)element; - // ele.setName(currName); - // } - // - // /* (non-Javadoc) - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitInstantiationBegin(java.lang.Object) - // */ - // public Object explicitInstantiationBegin(Object container) { - // ExplicitTemplateDeclaration etd = new ExplicitTemplateDeclaration( getCurrentDOMScope(), ExplicitTemplateDeclaration.k_instantiation ); - // domScopes.push( etd ); - // return etd; - // } - // - // /* (non-Javadoc) - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitInstantiationEnd(java.lang.Object) - // */ - // public void explicitInstantiationEnd(Object instantiation) { - // ExplicitTemplateDeclaration declaration = (ExplicitTemplateDeclaration)domScopes.pop(); - // declaration.getOwnerScope().addDeclaration(declaration); - // } - // - // /* (non-Javadoc) - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitSpecializationBegin(java.lang.Object) - // */ - // public Object explicitSpecializationBegin(Object container) { - // ExplicitTemplateDeclaration etd = new ExplicitTemplateDeclaration( getCurrentDOMScope(), ExplicitTemplateDeclaration.k_specialization); - // domScopes.push( etd ); - // return etd; - // } - // - // /* (non-Javadoc) - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#explicitSpecializationEnd(java.lang.Object) - // */ - // public void explicitSpecializationEnd(Object instantiation) { - // ExplicitTemplateDeclaration etd = (ExplicitTemplateDeclaration)domScopes.pop(); - // etd.getOwnerScope().addDeclaration(etd); - // } - // - // /* (non-Javadoc) - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#declaratorPureVirtual(java.lang.Object) - // */ - // public void declaratorPureVirtual(Object declarator) { - // Declarator d = (Declarator)declarator; - // d.setPureVirtual(true); - // } - // - // /* (non-Javadoc) - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#templateDeclarationBegin(java.lang.Object, boolean) - // */ - // public Object templateDeclarationBegin(Object container, IToken exported) { - // TemplateDeclaration d = new TemplateDeclaration( (IScope)getCurrentDOMScope(), exported ); - // if( getCurrentDOMScope() instanceof IAccessable ) - // d.setVisibility( ((IAccessable)container).getVisibility() ); - // d.setStartingOffset( exported.getOffset() ); - // domScopes.push( d ); - // return d; - // } - // - // - // /* (non-Javadoc) - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#templateDeclarationEnd(java.lang.Object) - // */ - // public void templateDeclarationEnd(Object templateDecl, IToken lastToken) { - // TemplateDeclaration decl = (TemplateDeclaration)domScopes.pop(); - // decl.setLastToken(lastToken); - // decl.getOwnerScope().addDeclaration(decl); - // decl.setTotalLength(lastToken.getOffset() + lastToken.getLength() - decl.getStartingOffset() ); - // } - // - // /* (non-Javadoc) - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#templateTypeParameterBegin(java.lang.Object, org.eclipse.cdt.internal.core.parser.Token) - // */ - // public Object templateTypeParameterBegin(Object templDecl, IToken kind) { - // TemplateParameterList list = (TemplateParameterList)templDecl; - // int k; - // switch( kind.getType() ) - // { - // case IToken.t_class: - // k = TemplateParameter.k_class; - // break; - // case IToken.t_typename: - // k= TemplateParameter.k_typename; - // break; - // case IToken.t_template: - // k= TemplateParameter.k_template; - // break; - // default: - // k = 0; - // } - // TemplateParameter p = new TemplateParameter( list, k ); - // return p; - // } - // - // /* (non-Javadoc) - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#templateTypeParameterName(java.lang.Object) - // */ - // public void templateTypeParameterName(Object typeParm) { - // ((TemplateParameter)typeParm).setName( currName ); - // } - // - // /* (non-Javadoc) - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#templateTypeInitialTypeId(java.lang.Object) - // */ - // public void templateTypeParameterInitialTypeId(Object typeParm) { - // ((TemplateParameter)typeParm).setTypeId( currName ); - // } - // - // /* (non-Javadoc) - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#templateTypeParameterEnd(java.lang.Object) - // */ - // public void templateTypeParameterEnd(Object typeParm) { - // TemplateParameter parameter = (TemplateParameter)typeParm; - // parameter.getOwnerScope().addDeclaration( parameter ); - // } - // - // - // - // - // /* (non-Javadoc) - // * @see org.eclipse.cdt.internal.core.parser.IParserCallback#templateParameterListBegin(java.lang.Object) - // */ - // public Object templateParameterListBegin(Object declaration) { - // ITemplateParameterListOwner d = (ITemplateParameterListOwner)declaration; - // TemplateParameterList list = new TemplateParameterList(); - // d.setTemplateParms(list); - // return list; - // } - protected void addBitfield( - Declarator declarator, - IASTExpression bitfieldExpression) - { - declarator.setBitField(new BitField(declarator)); - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptProblem(org.eclipse.cdt.core.parser.IProblem) - */ - public void acceptProblem(IProblem problem) - { - // ignore - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptMacro(org.eclipse.cdt.core.parser.ast.IASTMacro) - */ - public void acceptMacro(IASTMacro macro) - { - Macro m = - new Macro( - macro.getName(), - macro.getNameOffset(), - macro.getStartingOffset(), - macro.getEndingOffset() - - macro.getStartingOffset()); - translationUnit.addMacro(m); - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptVariable(org.eclipse.cdt.core.parser.ast.IASTVariable) - */ - public void acceptVariable(IASTVariable variable) - { - SimpleDeclaration declaration = - createStructuralSimpleDeclaration(variable); - Declarator d = new Declarator(declaration); - d.setName(variable.getName()); - declaration.addDeclarator(d); - } - protected SimpleDeclaration createStructuralSimpleDeclaration(IASTVariable variable) - { - SimpleDeclaration declaration = - getTypeSpecOwner( - getCurrentDOMScope(), - variable.getStartingOffset()); - if (declaration == null) - { - declaration = - startSimpleDeclaration(variable.getStartingOffset()); - declaration.getDeclSpecifier().setConst( - variable.getAbstractDeclaration().isConst()); - declaration.getDeclSpecifier().setExtern(variable.isExtern()); - declaration.getDeclSpecifier().setAuto(variable.isAuto()); - declaration.getDeclSpecifier().setRegister(variable.isRegister()); - declaration.getDeclSpecifier().setStatic(variable.isStatic()); - IASTTypeSpecifier typeSpec = - variable.getAbstractDeclaration().getTypeSpecifier(); - if (typeSpec == null) - { - // what to do here? - } - else if (typeSpec instanceof IASTSimpleTypeSpecifier) - { - IASTSimpleTypeSpecifier simpleTypeSpec = - (IASTSimpleTypeSpecifier)typeSpec; - declaration.getDeclSpecifier().setLong(simpleTypeSpec.isLong()); - declaration.getDeclSpecifier().setShort( - simpleTypeSpec.isShort()); - declaration.getDeclSpecifier().setUnsigned( - simpleTypeSpec.isUnsigned()); - if (simpleTypeSpec.getType() - == IASTSimpleTypeSpecifier.Type.BOOL) - declaration.getDeclSpecifier().setType( - DeclSpecifier.t_bool); - else if ( - simpleTypeSpec.getType() - == IASTSimpleTypeSpecifier.Type.CHAR) - declaration.getDeclSpecifier().setType( - DeclSpecifier.t_char); - else if ( - simpleTypeSpec.getType() - == IASTSimpleTypeSpecifier.Type.DOUBLE) - declaration.getDeclSpecifier().setType( - DeclSpecifier.t_double); - else if ( - simpleTypeSpec.getType() - == IASTSimpleTypeSpecifier.Type.FLOAT) - declaration.getDeclSpecifier().setType( - DeclSpecifier.t_float); - else if ( - simpleTypeSpec.getType() - == IASTSimpleTypeSpecifier.Type.INT) - declaration.getDeclSpecifier().setType(DeclSpecifier.t_int); - else if ( - simpleTypeSpec.getType() - == IASTSimpleTypeSpecifier.Type.TEMPLATE) - declaration.getDeclSpecifier().setType( - DeclSpecifier.t_type); - else if ( - simpleTypeSpec.getType() - == IASTSimpleTypeSpecifier.Type.CLASS_OR_TYPENAME) - declaration.getDeclSpecifier().setType( - DeclSpecifier.t_type); - else if ( - simpleTypeSpec.getType() - == IASTSimpleTypeSpecifier.Type.VOID) - declaration.getDeclSpecifier().setType( - DeclSpecifier.t_void); - else if ( - simpleTypeSpec.getType() - == IASTSimpleTypeSpecifier.Type.WCHAR_T) - declaration.getDeclSpecifier().setType( - DeclSpecifier.t_wchar_t); - } - else if (typeSpec instanceof IASTClassSpecifier) - { - } - else if (typeSpec instanceof IASTEnumerationSpecifier) - { - } - else if (typeSpec instanceof IASTElaboratedTypeSpecifier) - { - } - getCurrentDOMScope().addDeclaration(declaration); - } - return declaration; - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptFunctionDeclaration(org.eclipse.cdt.core.parser.ast.IASTFunction) - */ - public void acceptFunctionDeclaration(IASTFunction function) - { - SimpleDeclaration simpleDeclaration = - getTypeSpecOwner( - getCurrentDOMScope(), - function.getStartingOffset()); - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptUsageDirective(org.eclipse.cdt.core.parser.ast.IASTUsageDirective) - */ - public void acceptUsingDirective(IASTUsingDirective usageDirective) - { - UsingDirective directive = new UsingDirective(getCurrentDOMScope()); - directive.setNamespaceName(usageDirective.getNamespaceName()); - directive.getOwnerScope().addDeclaration(directive); - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptUsageDeclaration(org.eclipse.cdt.core.parser.ast.IASTUsageDeclaration) - */ - public void acceptUsingDeclaration(IASTUsingDeclaration usageDeclaration) - { - UsingDeclaration declaration = - new UsingDeclaration(getCurrentDOMScope()); - declaration.setTypename(usageDeclaration.isTypename()); - declaration.setMappedName(usageDeclaration.usingTypeName()); - declaration.getOwnerScope().addDeclaration(declaration); - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptASMDefinition(org.eclipse.cdt.core.parser.ast.IASTASMDefinition) - */ - public void acceptASMDefinition(IASTASMDefinition asmDefinition) - { - IScope scope = getCurrentDOMScope(); - ASMDefinition definition = - new ASMDefinition(scope, asmDefinition.getBody()); - scope.addDeclaration(definition); - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedef(org.eclipse.cdt.core.parser.ast.IASTTypedef) - */ - public void acceptTypedefDeclaration(IASTTypedefDeclaration typedef) - { - // 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) - { - // ignore - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitFunctionBody(org.eclipse.cdt.core.parser.ast.IASTFunction) - */ - public void exitFunctionBody(IASTFunction function) - { - //ignore - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterCompilationUnit(org.eclipse.cdt.core.parser.ast.IASTCompilationUnit) - */ - public void enterCompilationUnit(IASTCompilationUnit compilationUnit) - { - domScopes.push(translationUnit); - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterInclusion(org.eclipse.cdt.core.parser.ast.IASTInclusion) - */ - public void enterInclusion(IASTInclusion inclusion) - { - Inclusion i = - new Inclusion( - inclusion.getName(), - inclusion.getNameOffset(), - inclusion.getStartingOffset(), - inclusion.getEndingOffset(), - inclusion.isLocal()); - translationUnit.addInclusion(i); - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterNamespaceDefinition(org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition) - */ - public void enterNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition) - { - NamespaceDefinition namespaceDef = - new NamespaceDefinition(getCurrentDOMScope()); - namespaceDef.setName(namespaceDefinition.getName()); - ((IOffsetable)namespaceDef).setStartingOffset( - namespaceDefinition.getStartingOffset()); - if (!namespaceDefinition.getName().equals("")) - namespaceDef.setNameOffset( - namespaceDefinition.getNameOffset()); - this.domScopes.push(namespaceDef); - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecification) - */ - public void enterClassSpecifier(IASTClassSpecifier classSpecification) - { - SimpleDeclaration decl = - startSimpleDeclaration( - classSpecification.getStartingOffset()); - int kind = ClassKey.t_struct; - int visibility = AccessSpecifier.v_public; - if (classSpecification.getClassKind() == ASTClassKind.CLASS) - { - kind = ClassKey.t_class; - visibility = AccessSpecifier.v_private; - } - else if (classSpecification.getClassKind() == ASTClassKind.STRUCT) - { - kind = ClassKey.t_struct; - } - else if (classSpecification.getClassKind() == ASTClassKind.UNION) - { - kind = ClassKey.t_union; - } - ClassSpecifier classSpecifier = new ClassSpecifier(kind, decl); - classSpecifier.setVisibility(visibility); - classSpecifier.setStartingOffset( - classSpecification.getStartingOffset()); - decl.setTypeSpecifier(classSpecifier); - classSpecifier.setName(classSpecification.getName()); - classSpecifier.setNameOffset(classSpecification.getNameOffset()); - domScopes.push(classSpecifier); - } - protected SimpleDeclaration startSimpleDeclaration(int startingOffset) - { - SimpleDeclaration decl = new SimpleDeclaration(getCurrentDOMScope()); - if (getCurrentDOMScope() instanceof IAccessable) - decl.setAccessSpecifier( - new AccessSpecifier( - ((IAccessable)getCurrentDOMScope()).getVisibility())); - ((IOffsetable)decl).setStartingOffset(startingOffset); - return decl; - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterLinkageSpecification(org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification) - */ - public void enterLinkageSpecification(IASTLinkageSpecification linkageSpec) - { - LinkageSpecification linkage = - new LinkageSpecification( - getCurrentDOMScope(), - linkageSpec.getLinkageString()); - domScopes.push(linkage); - } - /* (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 enterTemplateInstantiation(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) - { - // ignore - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitMethodBody(org.eclipse.cdt.core.parser.ast.IASTMethod) - */ - public void exitMethodBody(IASTMethod method) - { - // ignore - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptField(org.eclipse.cdt.core.parser.ast.IASTField) - */ - public void acceptField(IASTField field) - { - SimpleDeclaration declaration = - createStructuralSimpleDeclaration(field); - Declarator d = new Declarator(declaration); - d.setName(field.getName()); - declaration.addDeclarator(d); - } - /* (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) - { - LinkageSpecification linkage = (LinkageSpecification)domScopes.pop(); - getCurrentDOMScope().addDeclaration(linkage); - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecification) - */ - public void exitClassSpecifier(IASTClassSpecifier classSpecification) - { - ClassSpecifier c = (ClassSpecifier)getCurrentDOMScope(); - c.setTotalLength( - classSpecification.getEndingOffset() - + 1 - - classSpecification.getStartingOffset()); - domScopes.pop(); - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitNamespaceDefinition(org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition) - */ - public void exitNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition) - { - NamespaceDefinition definition = (NamespaceDefinition)domScopes.pop(); - definition.setTotalLength( - namespaceDefinition.getEndingOffset() - - namespaceDefinition.getStartingOffset()); - getCurrentDOMScope().addDeclaration(definition); - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitInclusion(org.eclipse.cdt.core.parser.ast.IASTInclusion) - */ - public void exitInclusion(IASTInclusion inclusion) - { - // ignore - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitCompilationUnit(org.eclipse.cdt.core.parser.ast.IASTCompilationUnit) - */ - public void exitCompilationUnit(IASTCompilationUnit compilationUnit) - { - domScopes.pop(); - } - private ScopeStack domScopes = new ScopeStack(); - private IScope getCurrentDOMScope() - { - return domScopes.peek(); - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumerationSpecifier(org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier) - */ - public void acceptEnumerationSpecifier(IASTEnumerationSpecifier enumeration) - { - SimpleDeclaration decl = - startSimpleDeclaration(enumeration.getStartingOffset()); - EnumerationSpecifier es = new EnumerationSpecifier(decl); - es.setStartingOffset(enumeration.getStartingOffset()); - es.setStartImage("enum"); - decl.setTypeSpecifier(es); - es.setName(enumeration.getName()); - es.setTotalLength( - enumeration.getEndingOffset() - + 1 - - enumeration.getStartingOffset()); - Iterator i = enumeration.getEnumerators(); - while (i.hasNext()) - { - IASTEnumerator enumerator = (IASTEnumerator)i.next(); - EnumeratorDefinition definition = new EnumeratorDefinition(); - es.addEnumeratorDefinition(definition); - definition.setName(enumerator.getName()); - ((IOffsetable)definition).setStartingOffset( - enumerator.getNameOffset()); - definition.setTotalLength( - enumerator.getEndingOffset() - + 1 - - enumerator.getStartingOffset()); - } - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptClassReference(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier, int) - */ - public void acceptClassReference(IASTClassReference reference) - { - // ignore - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptAbstractTypeSpecDeclaration(org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration) - */ - public void acceptAbstractTypeSpecDeclaration(IASTAbstractTypeSpecifierDeclaration abstractDeclaration) - { - // TODO Auto-generated method stub - - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptPointerToMethod(org.eclipse.cdt.core.parser.ast.IASTPointerToMethod) - */ - - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedefReference(org.eclipse.cdt.core.parser.ast.IASTTypedefReference) - */ - public void acceptTypedefReference(IASTTypedefReference reference) - { - // TODO Auto-generated method stub - - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptNamespaceReference(org.eclipse.cdt.core.parser.ast.IASTNamespaceReference) - */ - public void acceptNamespaceReference(IASTNamespaceReference reference) - { - // TODO Auto-generated method stub - - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumerationReference(org.eclipse.cdt.core.parser.ast.IASTEnumerationReference) - */ - public void acceptEnumerationReference(IASTEnumerationReference reference) - { - // TODO Auto-generated method stub - - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptVariableReference(org.eclipse.cdt.core.parser.ast.IASTVariableReference) - */ - public void acceptVariableReference(IASTVariableReference reference) - { - // TODO Auto-generated method stub - - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptFunctionReference(org.eclipse.cdt.core.parser.ast.IASTFunctionReference) - */ - public void acceptFunctionReference(IASTFunctionReference reference) - { - // TODO Auto-generated method stub - - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptFieldReference(org.eclipse.cdt.core.parser.ast.IASTFieldReference) - */ - public void acceptFieldReference(IASTFieldReference reference) - { - // TODO Auto-generated method stub - - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptMethodReference(org.eclipse.cdt.core.parser.ast.IASTMethodReference) - */ - public void acceptMethodReference(IASTMethodReference reference) - { - // TODO Auto-generated method stub - - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptElaboratedForewardDeclaration(org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier) - */ - public void acceptElaboratedForewardDeclaration(IASTElaboratedTypeSpecifier elaboratedType) - { - // TODO Auto-generated method stub - - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope) - */ - public void enterCodeBlock(IASTScope scope) { - // TODO Auto-generated method stub - - } - /* (non-Javadoc) - * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope) - */ - public void exitCodeBlock(IASTScope scope) { - // TODO Auto-generated method stub - - } -} \ No newline at end of file diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/DeclSpecifier.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/DeclSpecifier.java deleted file mode 100644 index 773ffbf99d2..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/DeclSpecifier.java +++ /dev/null @@ -1,280 +0,0 @@ -package org.eclipse.cdt.internal.core.dom; - -import java.util.List; - - -/** - * @author jcamelon - * - * To change this generated comment edit the template variable "typecomment": - * Window>Preferences>Java>Templates. - * To enable and disable the creation of type comments go to - * Window>Preferences>Java>Code Generation. - */ -public class DeclSpecifier { - - // DeclSpecifier layed out as bit array - // leftmost 5 bits are type - public static final int typeMask = 0x001f; - public static final int isAuto = 0x0020; - public static final int isRegister = 0x0040; - public static final int isStatic = 0x0080; - public static final int isExtern = 0x0100; - public static final int isMutable = 0x0200; - public static final int isInline = 0x0400; - public static final int isVirtual = 0x0800; - public static final int isExplicit = 0x1000; - public static final int isTypedef = 0x2000; - public static final int isFriend = 0x4000; - public static final int isConst = 0x8000; - public static final int isVolatile = 0x10000; - public static final int isUnsigned = 0x20000; - public static final int isShort = 0x40000; - public static final int isLong = 0x80000; - - private int declSpecifierSeq = 0; - private boolean isTypename = false; - public int getDeclSpecifierSeq() { - return declSpecifierSeq; - } - - // Convenience methods - private void setBit(boolean b, int mask) { - if (b) - declSpecifierSeq = declSpecifierSeq | mask; - else - declSpecifierSeq = declSpecifierSeq & ~mask; - } - - private boolean checkBit(int mask) { - int masked = (declSpecifierSeq & mask); - return (masked != 0); - } - - public void setAuto(boolean b) { - setBit(b, isAuto); - } - public boolean isAuto() { - return checkBit(isAuto); - } - - public void setRegister(boolean b) { - setBit(b, isRegister); - } - public boolean isRegister() { - return checkBit(isRegister); - } - - public void setStatic(boolean b) { - setBit(b, isStatic); - } - public boolean isStatic() { - return checkBit(isStatic); - } - - public void setExtern(boolean b) { - setBit(b, isExtern); - } - public boolean isExtern() { - return checkBit(isExtern); - } - - public void setMutable(boolean b) { - setBit(b, isMutable); - } - public boolean isMutable() { - return checkBit(isMutable); - } - - public void setInline(boolean b) { - setBit(b, isInline); - } - public boolean isInline() { - return checkBit(isInline); - } - - public void setVirtual(boolean b) { - setBit(b, isVirtual); - } - public boolean isVirtual() { - return checkBit(isVirtual); - } - - public void setExplicit(boolean b) { - setBit(b, isExplicit); - } - public boolean isExplicit() { - return checkBit(isExplicit); - } - - public void setTypedef(boolean b) { - setBit(b, isTypedef); - } - public boolean isTypedef() { - return checkBit(isTypedef); - } - - public void setFriend(boolean b) { - setBit(b, isFriend); - } - public boolean isFriend() { - return checkBit(isFriend); - } - - public void setConst(boolean b) { - setBit(b, isConst); - } - public boolean isConst() { - return checkBit(isConst); - } - - public void setVolatile(boolean b) { - setBit(b, isVolatile); - } - public boolean isVolatile() { - return checkBit(isVolatile); - } - - public void setUnsigned(boolean b) { - setBit(b, isUnsigned); - } - public boolean isUnsigned() { - return checkBit(isUnsigned); - } - - public void setShort(boolean b) { - setBit(b, isShort); - } - public boolean isShort() { - return checkBit(isShort); - } - - public void setLong(boolean b) { - setBit(b, isLong); - } - public boolean isLong() { - return checkBit(isLong); - } - - // Simple Types - public static final int t_type = 0; // Type Specifier - public static final int t_char = 1; - public static final int t_wchar_t = 2; - public static final int t_bool = 3; - public static final int t_int = 4; - public static final int t_float = 5; - public static final int t_double = 6; - public static final int t_void = 7; - - - - public void setType(int t) { - declSpecifierSeq = declSpecifierSeq & ~typeMask | t; - } - - public int getType() { - return declSpecifierSeq & typeMask; - } - - public interface IContainer { - - public DeclSpecifier getDeclSpecifier(); - public void addDeclarator(Object declarator); - public List getDeclarators(); - - }; - - String name = null; - - /** - * Returns the name. - * @return Name - */ - public String getName() { - return name; - } - - /** - * Sets the name. - * @param name The name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * Returns the type as a String - * @return String - */ - public String getTypeName() { - StringBuffer type = new StringBuffer(); - switch (getType()) { - case t_char : - if (isUnsigned()) - type.append("unsigned "); - type.append("char"); - break; - case t_wchar_t : - if (isUnsigned()) - type.append("unsigned "); - type.append("wchar_t"); - break; - case t_bool : - type.append("bool"); - break; - case t_int : - if (isUnsigned()) - type.append("unsigned "); - if (isShort()) - type.append("short "); - if (isLong()) - type.append("long "); - type.append("int"); - break; - case t_float : - type.append("float"); - break; - case t_double : - if (isLong()) - type.append("long "); - type.append("double"); - break; - case t_void : - type.append("void"); - break; - case t_type : - if (isTypename() ) - type.append("typename "); - if (getName() != null) - type.append(getName().toString()); - else { - if (isUnsigned()) - type.append("unsigned "); - if (isShort()) - type.append("short "); - if (isLong()) - type.append("long "); - - } - break; - default : - return ""; - } - return type.toString(); - } - - /** - * @return - */ - public boolean isTypename() { - return isTypename; - } - - /** - * @param b - */ - public void setTypename(boolean b) { - isTypename = b; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/Declaration.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/Declaration.java deleted file mode 100644 index b6bfff66a40..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/Declaration.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.eclipse.cdt.internal.core.dom; - -/** - */ -public class Declaration implements IOffsetable { - - public Declaration( IScope scope ) - { - ownerScope = scope; - } - - private final IScope ownerScope; - - /** - * @return - */ - public IScope getOwnerScope() { - return ownerScope; - } - - - private int startingOffset, endingOffset; - private int startingLine, endingLine; - private int totalLength; - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#getStartingOffset() - */ - public int getStartingOffset() - { - return startingOffset; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#getTotalLength() - */ - public int getTotalLength() - { - return totalLength; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#setStartingOffset(int) - */ - public void setStartingOffset(int i) - { - startingOffset = i; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#setTotalLength(int) - */ - public void setTotalLength(int i) - { - totalLength = i; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#setTopLine(int) - */ - public void setTopLine(int lineNumber) - { - startingLine = lineNumber; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#setBottomLine(int) - */ - public void setBottomLine(int lineNumber) - { - endingLine = lineNumber; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#getTopLine() - */ - public int getTopLine() - { - return startingLine; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#getBottomLine() - */ - public int getBottomLine() - { - return endingLine; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/Declarator.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/Declarator.java deleted file mode 100644 index d365937c93f..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/Declarator.java +++ /dev/null @@ -1,229 +0,0 @@ -package org.eclipse.cdt.internal.core.dom; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - - - - -public class Declarator implements IDeclaratorOwner { - - public Declarator(DeclSpecifier.IContainer declaration) { - this.declaration = declaration; - this.ownerDeclarator = null; - } - - public Declarator( IDeclaratorOwner owner ) - { - this.ownerDeclarator = owner; - this.declaration = null; - } - - private final DeclSpecifier.IContainer declaration; - private final IDeclaratorOwner ownerDeclarator; - private int nameOffset; - - /** - * Returns the declaration. - * @return SimpleDeclaration - */ - public DeclSpecifier.IContainer getDeclaration() { - return declaration; - } - - /** - * Sets the declaration. - * @param declaration The declaration to set - */ - public void setDeclaration(SimpleDeclaration declaration) { - - } - - private String name; - - /** - * Returns the name. - * @return Name - */ - public String getName() { - return name; - } - - /** - * Sets the name. - * @param name The name to set - */ - public void setName(String name) { - this.name = name; - } - - ParameterDeclarationClause parms = null; - - public void addParms( ParameterDeclarationClause parms ) - { - this.parms = parms; - } - - /** - * Returns the parms. - * @return ParameterDeclarationClause - */ - public ParameterDeclarationClause getParms() { - return parms; - } - - List pointerOperators = new ArrayList(); - List arrayQualifiers = new ArrayList(); - - /** - * @return List - */ - public List getPointerOperators() { - return Collections.unmodifiableList(pointerOperators); - } - - public void addPointerOperator( PointerOperator po ) - { - pointerOperators.add(po); - } - - ExceptionSpecifier exceptionSpecifier = new ExceptionSpecifier(); - - public ExceptionSpecifier getExceptionSpecifier() - { - return exceptionSpecifier; - } - - boolean isConst = false; - boolean isVolatile = false; - boolean isPureVirtual = false; - /** - * @return boolean - */ - public boolean isConst() { - return isConst; - } - - /** - * @return boolean - */ - public boolean isVolatile() { - return isVolatile; - } - - /** - * Sets the isConst. - * @param isConst The isConst to set - */ - public void setConst(boolean isConst) { - this.isConst = isConst; - } - - /** - * Sets the isVolatile. - * @param isVolatile The isVolatile to set - */ - public void setVolatile(boolean isVolatile) { - this.isVolatile = isVolatile; - } - - /** - * @return List - */ - public List getArrayQualifiers() { - return Collections.unmodifiableList( arrayQualifiers ); - } - - public void addArrayQualifier( ArrayQualifier q ) - { - arrayQualifiers.add(q); - } - - private ConstructorChain ctorChain = null; - - /** - * @return ConstructorChain - */ - public ConstructorChain getCtorChain() { - return ctorChain; - } - - /** - * Sets the ctorChain. - * @param ctorChain The ctorChain to set - */ - public void setCtorChain(ConstructorChain ctorChain) { - this.ctorChain = ctorChain; - } - - /** - * @return boolean - */ - public boolean isPureVirtual() { - return isPureVirtual; - } - - /** - * Sets the isPureVirtual. - * @param isPureVirtual The isPureVirtual to set - */ - public void setPureVirtual(boolean isPureVirtual) { - this.isPureVirtual = isPureVirtual; - } - - private Declarator innerDeclarator = null; - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IDeclaratorOwner#getDeclarator() - */ - public Declarator getDeclarator() { - return innerDeclarator; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IDeclaratorOwner#setDeclarator(org.eclipse.cdt.internal.core.dom.Declarator) - */ - public void setDeclarator(Declarator input) { - innerDeclarator = input; - } - - /** - * @return - */ - public IDeclaratorOwner getOwnerDeclarator() { - return ownerDeclarator; - } - - private BitField bitField = null; - - /** - * @return - */ - public BitField getBitField() { - return bitField; - } - - /** - * @param field - */ - public void setBitField(BitField field) { - bitField = field; - } - - /** - * @return - */ - public int getNameOffset() - { - return nameOffset; - } - - /** - * @param i - */ - public void setNameOffset(int i) - { - nameOffset = i; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ElaboratedTypeSpecifier.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ElaboratedTypeSpecifier.java deleted file mode 100644 index 9b129a648b5..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ElaboratedTypeSpecifier.java +++ /dev/null @@ -1,49 +0,0 @@ -package org.eclipse.cdt.internal.core.dom; - - - -/** - * @author jcamelon - * - * To change this generated comment edit the template variable -"typecomment": - * Window>Preferences>Java>Templates. - * To enable and disable the creation of type comments go to - * Window>Preferences>Java>Code Generation. - */ -public class ElaboratedTypeSpecifier extends TypeSpecifier { - - ClassKey classKey = new ClassKey(); - public int getClassKey() { return classKey.getClassKey(); } - - public void setClassKey( int classKey ) - { - this.classKey.setClassKey( classKey ); - } - - public ElaboratedTypeSpecifier(int classKey, TypeSpecifier.IOwner owner) { - super(owner); - this.classKey.setClassKey( classKey ); - } - - private String name; - public void setName(String n) { name = n; } - public String getName() { return name; } - - private ClassSpecifier classSpec = null; - - /** - * @return - */ - public ClassSpecifier getClassSpec() { - return classSpec; - } - - /** - * @param specifier - */ - public void setClassSpec(ClassSpecifier specifier) { - classSpec = specifier; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/EnumerationSpecifier.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/EnumerationSpecifier.java deleted file mode 100644 index 886024d033b..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/EnumerationSpecifier.java +++ /dev/null @@ -1,155 +0,0 @@ -/********************************************************************** - * Created on Mar 25, 2003 - * - * 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: - * Rational Software - Initial API and implementation -***********************************************************************/ -package org.eclipse.cdt.internal.core.dom; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * @author jcamelon - * - */ -public class EnumerationSpecifier extends TypeSpecifier implements IOffsetable { - - public EnumerationSpecifier(IOwner declaration) { - super(declaration); - } - - private String name = null; - private List enumeratorDefinitions = new ArrayList(); - private int startingOffset = 0, totalLength = 0; - private int nameOffset = 0; - private String startImage = null; - - public void addEnumeratorDefinition( EnumeratorDefinition def ) - { - enumeratorDefinitions.add( def ); - } - - - /** - * @return List - */ - public List getEnumeratorDefinitions() { - return Collections.unmodifiableList( enumeratorDefinitions ); - } - - /** - * @return Name - */ - public String getName() { - return name; - } - - /** - * Sets the name. - * @param name The name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return - */ - public int getStartingOffset() { - return startingOffset; - } - - /** - * @return - */ - public int getTotalLength() { - return totalLength; - } - - /** - * @param i - */ - public void setStartingOffset(int i) { - startingOffset = i; - } - - /** - * @param i - */ - public void setTotalLength(int i) { - totalLength = i; - } - - /** - * Returns the startToken. - * @return Token - */ - public String getStartImage() { - return startImage; - } - - /** - * Sets the startToken. - * @param startToken The startToken to set - */ - public void setStartImage(String startImage) { - this.startImage= startImage; - } - - private int topLine = 0, bottomLine = 0; - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#setTopLine(int) - */ - public void setTopLine(int lineNumber) { - topLine = lineNumber; - } - - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#setBottomLine(int) - */ - public void setBottomLine(int lineNumber) { - bottomLine = lineNumber; - } - - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#getTopLine() - */ - public int getTopLine() { - return topLine; - } - - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#getBottomLine() - */ - public int getBottomLine() { - return bottomLine; - } - - /** - * @return - */ - public int getNameOffset() - { - return nameOffset; - } - - /** - * @param i - */ - public void setNameOffset(int i) - { - nameOffset = i; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/EnumeratorDefinition.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/EnumeratorDefinition.java deleted file mode 100644 index 6ea8a0f2747..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/EnumeratorDefinition.java +++ /dev/null @@ -1,99 +0,0 @@ -/********************************************************************** - * Created on Mar 25, 2003 - * - * 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: - * Rational Software - Initial API and implementation -***********************************************************************/ -package org.eclipse.cdt.internal.core.dom; - - - -/** - * @author jcamelon - * - */ -public class EnumeratorDefinition implements IOffsetable { - - private String name = null; - private int startingOffset = 0, totalLength = 0; - - /** - * @return Name - */ - public String getName() { - return name; - } - - /** - * Sets the name. - * @param name The name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * @return - */ - public int getStartingOffset() { - return startingOffset; - } - - /** - * @return - */ - public int getTotalLength() { - return totalLength; - } - - /** - * @param i - */ - public void setStartingOffset(int i) { - startingOffset = i; - } - - /** - * @param i - */ - public void setTotalLength(int i) { - totalLength = i; - } - - int bottomLine = 0, topLine = 0; - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#setTopLine(int) - */ - public void setTopLine(int lineNumber) { - topLine = lineNumber; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#setBottomLine(int) - */ - public void setBottomLine(int lineNumber) { - bottomLine = lineNumber; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#getTopLine() - */ - public int getTopLine() { - return topLine; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#getBottomLine() - */ - public int getBottomLine() { - return bottomLine; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ExceptionSpecifier.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ExceptionSpecifier.java deleted file mode 100644 index 252e0c596dd..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ExceptionSpecifier.java +++ /dev/null @@ -1,56 +0,0 @@ -/********************************************************************** - * Created on Mar 26, 2003 - * - * 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: - * Rational Software - Initial API and implementation -***********************************************************************/ -package org.eclipse.cdt.internal.core.dom; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - - -/** - * @author jcamelon - * - */ -public class ExceptionSpecifier { - - private List typeNames = new LinkedList(); - private boolean throwsException = false; - - /** - * @return List - */ - public List getTypeNames() { - return Collections.unmodifiableList( typeNames ); - } - - public void addTypeName( String name ) - { - typeNames.add( name ); - } - - /** - * Sets the throwsException. - * @param throwsException The throwsException to set - */ - public void setThrowsException(boolean throwsException) { - this.throwsException = throwsException; - } - - /** - * @return boolean - */ - public boolean throwsException() { - return throwsException; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ExplicitTemplateDeclaration.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ExplicitTemplateDeclaration.java deleted file mode 100644 index 901f75741f7..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ExplicitTemplateDeclaration.java +++ /dev/null @@ -1,60 +0,0 @@ -/********************************************************************** - * Created on Mar 29, 2003 - * - * 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: - * Rational Software - Initial API and implementation -***********************************************************************/ -package org.eclipse.cdt.internal.core.dom; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * @author jcamelon - * - */ -public class ExplicitTemplateDeclaration extends Declaration implements IScope { - - private final int kind; - - public final static int k_specialization = 1; - public final static int k_instantiation = 2; - - public ExplicitTemplateDeclaration( IScope scope, int kind ) - { - super( scope ); - this.kind = kind; - } - - - private List declarations = new ArrayList(); - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IScope#addDeclaration(org.eclipse.cdt.internal.core.dom.Declaration) - */ - public void addDeclaration(Declaration declaration) { - declarations.add( declaration ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IScope#getDeclarations() - */ - public List getDeclarations() { - return Collections.unmodifiableList( declarations ); - } - - - /** - * @return int - */ - public int getKind() { - return kind; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/IAccessable.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/IAccessable.java deleted file mode 100644 index cb6246bf099..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/IAccessable.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Created on Apr 10, 2003 - * - * To change the template for this generated file go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -package org.eclipse.cdt.internal.core.dom; - -/** - * @author jcamelon - * - * To change the template for this generated type comment go to - * Window>Preferences>Java>Code Generation>Code and Comments - */ -public interface IAccessable { - /** - * @return int - */ - public abstract int getVisibility(); - /** - * Sets the currentVisiblity. - * @param currentVisiblity The currentVisiblity to set - */ - public abstract void setVisibility(int currentVisiblity); -} \ No newline at end of file diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/IDeclaratorOwner.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/IDeclaratorOwner.java deleted file mode 100644 index e256ec86860..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/IDeclaratorOwner.java +++ /dev/null @@ -1,23 +0,0 @@ -/********************************************************************** - * Created on Apr 13, 2003 - * - * Copyright (c) 2002,2003 IBM/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 Ltd. - Rational Software - Initial API and implementation -************************************************************************/ -package org.eclipse.cdt.internal.core.dom; - -/** - * @author jcamelon - * - */ -public interface IDeclaratorOwner { - - public Declarator getDeclarator(); - public void setDeclarator( Declarator input ); -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/IOffsetable.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/IOffsetable.java deleted file mode 100644 index a6b6f4ee55c..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/IOffsetable.java +++ /dev/null @@ -1,44 +0,0 @@ -/********************************************************************** - * Created on Apr 7, 2003 - * - * Copyright (c) 2002,2003 IBM/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 Ltd. - Rational Software - Initial API and implementation -************************************************************************/ -package org.eclipse.cdt.internal.core.dom; - - -/** - * @author jcamelon - * - */ -public interface IOffsetable { - - /** - * @return - */ - public abstract int getStartingOffset(); - /** - * @return - */ - public abstract int getTotalLength(); - /** - * @param i - */ - public abstract void setStartingOffset(int i); - /** - * @param i - */ - public abstract void setTotalLength(int i); - - public abstract void setTopLine( int lineNumber ); - public abstract void setBottomLine( int lineNumber ); - public abstract int getTopLine(); - public abstract int getBottomLine(); - -} \ No newline at end of file diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/IScope.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/IScope.java deleted file mode 100644 index 3be079cf891..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/IScope.java +++ /dev/null @@ -1,16 +0,0 @@ -package org.eclipse.cdt.internal.core.dom; - -import java.util.List; - - -/** - * A scope contains a set of declarations that are defined - * in that scope. - **/ - -public interface IScope { - - public void addDeclaration(Declaration declaration); - public List getDeclarations(); - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ITemplateParameterListOwner.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ITemplateParameterListOwner.java deleted file mode 100644 index b2728a39cf2..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ITemplateParameterListOwner.java +++ /dev/null @@ -1,25 +0,0 @@ -/********************************************************************** - * Created on Mar 29, 2003 - * - * Copyright (c) 2002,2003 IBM/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 Ltd. - Rational Software - Initial API and implementation -***********************************************************************/ - -package org.eclipse.cdt.internal.core.dom; - -/** - * @author jcamelon - * - */ -public interface ITemplateParameterListOwner -{ - public TemplateParameterList getTemplateParms(); - public void setTemplateParms(TemplateParameterList list); -} - \ No newline at end of file diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/Inclusion.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/Inclusion.java deleted file mode 100644 index 4f8acb7415a..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/Inclusion.java +++ /dev/null @@ -1,35 +0,0 @@ -/********************************************************************** - * Created on Apr 7, 2003 - * - * Copyright (c) 2002,2003 IBM/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 Ltd. - Rational Software - Initial API and implementation -************************************************************************/ -package org.eclipse.cdt.internal.core.dom; - -/** - * @author jcamelon - * - */ -public class Inclusion extends PreprocessorStatement { - - private final boolean local; - - public Inclusion( String name, int nameOffset, int startingOffset, int totalLength, boolean local ) - { - super( name, nameOffset, startingOffset, totalLength ); - this.local = local; - } - /** - * @return - */ - public boolean isLocal() { - return local; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/LinkageSpecification.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/LinkageSpecification.java deleted file mode 100644 index 8ecf2b1bc44..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/LinkageSpecification.java +++ /dev/null @@ -1,56 +0,0 @@ -/********************************************************************** - * Created on Mar 25, 2003 - * - * 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: - * Rational Software - Initial API and implementation -***********************************************************************/ -package org.eclipse.cdt.internal.core.dom; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -/** - * @author jcamelon - * - */ -public class LinkageSpecification extends Declaration implements IScope { - - private List declarations = new LinkedList(); - private String languageLinkage; - - LinkageSpecification( IScope owner, String linkage ) - { - super( owner ); - languageLinkage = linkage; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IScope#addDeclaration(org.eclipse.cdt.internal.core.dom.Declaration) - */ - public void addDeclaration(Declaration declaration) { - declarations.add( declaration ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IScope#getDeclarations() - */ - public List getDeclarations() { - return Collections.unmodifiableList( declarations ); - } - - - /** - * @return String - */ - public String getLanguageLinkage() { - return languageLinkage; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/Macro.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/Macro.java deleted file mode 100644 index 78b217f4a49..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/Macro.java +++ /dev/null @@ -1,26 +0,0 @@ -/********************************************************************** - * Created on Apr 7, 2003 - * - * Copyright (c) 2002,2003 IBM/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 Ltd. - Rational Software - Initial API and implementation -************************************************************************/ -package org.eclipse.cdt.internal.core.dom; - -/** - * @author jcamelon - * - */ -public class Macro extends PreprocessorStatement { - - public Macro( String name, int nameOffset, int startingOffset, int totalLength ) - { - super( name, nameOffset, startingOffset, totalLength ); - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/NamespaceDefinition.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/NamespaceDefinition.java deleted file mode 100644 index 9b9673c848d..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/NamespaceDefinition.java +++ /dev/null @@ -1,103 +0,0 @@ -/********************************************************************** - * Created on Mar 25, 2003 - * - * 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: - * Rational Software - Initial API and implementation -***********************************************************************/ -package org.eclipse.cdt.internal.core.dom; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - -/** - * @author jcamelon - * - */ -public class NamespaceDefinition extends Declaration implements IScope { - - private List declarations = new LinkedList(); - private String name = "namespace"; - int startingOffset = 0; - int nameOffset = 0; - int endOffset = 0; - - public NamespaceDefinition( IScope owner ) - { - super( owner ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IScope#addDeclaration(org.eclipse.cdt.internal.core.dom.Declaration) - */ - public void addDeclaration(Declaration declaration) { - declarations.add( declaration ); - - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IScope#getDeclarations() - */ - public List getDeclarations() { - return Collections.unmodifiableList( declarations ); - } - - - /** - * @return String - */ - public String getName() { - return name; - } - - /** - * Sets the name. - * @param name The name to set - */ - public void setName(String name) { - this.name = name; - } - - - public int getStartOffset() - { - return startingOffset; - } - - public int getNameOffset() - { - return nameOffset; - } - - public int getEndOffset() - { - return endOffset; - } - /** - * @param i - */ - public void setEndOffset(int i) { - endOffset = i; - } - - /** - * @param i - */ - public void setNameOffset(int i) { - nameOffset = i; - } - - /** - * @param i - */ - public void setStartingOffset(int i) { - startingOffset = i; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/OldKRParameterDeclarationClause.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/OldKRParameterDeclarationClause.java deleted file mode 100644 index c347cf8a28d..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/OldKRParameterDeclarationClause.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.eclipse.cdt.internal.core.dom; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - - -/** - * @author vmozgin - * - * To change this generated comment edit the template variable "typecomment": - * Window>Preferences>Java>Templates. - * To enable and disable the creation of type comments go to - * Window>Preferences>Java>Code Generation. - */ -public class OldKRParameterDeclarationClause implements IScope { - - /** - * @see org.eclipse.cdt.core.dom.IScope#addDeclaration(org.eclipse.cdt.internal.core.dom.Declaration) - */ - public void addDeclaration( Declaration declaration) { - declarations.add( declaration ); - } - - /** - * @see org.eclipse.cdt.core.dom.IScope#getDeclarations() - */ - public List getDeclarations() { - return Collections.unmodifiableList( declarations ); - } - - private List declarations = new LinkedList(); - private ParameterDeclarationClause owner; - - OldKRParameterDeclarationClause( ParameterDeclarationClause owner ) - { - this.owner = owner; - this.owner.addOldKRParms( this ); - } -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ParameterDeclaration.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ParameterDeclaration.java deleted file mode 100644 index 0580ef94542..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ParameterDeclaration.java +++ /dev/null @@ -1,64 +0,0 @@ -package org.eclipse.cdt.internal.core.dom; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - - - -/** - * @author jcamelon - * - * To change this generated comment edit the template variable "typecomment": - * Window>Preferences>Java>Templates. - * To enable and disable the creation of type comments go to - * Window>Preferences>Java>Code Generation. - */ -public class ParameterDeclaration extends Declaration implements DeclSpecifier.IContainer, TypeSpecifier.IOwner { - - private DeclSpecifier declSpec = null; - private TypeSpecifier typeSpecifier; - - public ParameterDeclaration( IScope scope ) - { - super( scope ); - } - - /** - * Returns the typeSpecifier. - * @return TypeSpecifier - */ - public TypeSpecifier getTypeSpecifier() { - return typeSpecifier; - } - - /** - * Sets the typeSpecifier. - * @param typeSpecifier The typeSpecifier to set - */ - public void setTypeSpecifier(TypeSpecifier typeSpecifier) { - getDeclSpecifier().setType(DeclSpecifier.t_type); - this.typeSpecifier = typeSpecifier; - } - - /** - * @see org.eclipse.cdt.internal.core.dom.DeclarationSpecifier.CElementWrapper#getDeclSpecifier() - */ - public DeclSpecifier getDeclSpecifier() { - if( declSpec == null ) - declSpec = new DeclSpecifier(); - - return declSpec; - } - - private List declarators = new LinkedList(); - - public void addDeclarator(Object declarator) { - declarators.add(declarator); - } - - public List getDeclarators() { - return Collections.unmodifiableList( declarators ); - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ParameterDeclarationClause.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ParameterDeclarationClause.java deleted file mode 100644 index 67e40432855..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ParameterDeclarationClause.java +++ /dev/null @@ -1,55 +0,0 @@ -package org.eclipse.cdt.internal.core.dom; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - - -/** - * @author jcamelon - * - * To change this generated comment edit the template variable "typecomment": - * Window>Preferences>Java>Templates. - * To enable and disable the creation of type comments go to - * Window>Preferences>Java>Code Generation. - */ -public class ParameterDeclarationClause implements IScope { - - /** - * @see org.eclipse.cdt.core.dom.IScope#addDeclaration(org.eclipse.cdt.internal.core.dom.Declaration) - */ - public void addDeclaration( Declaration declaration) { - declarations.add( declaration ); - } - - /** - * @see org.eclipse.cdt.core.dom.IScope#getDeclarations() - */ - public List getDeclarations() { - return Collections.unmodifiableList( declarations ); - } - - private List declarations = new LinkedList(); - private Declarator owner; - - ParameterDeclarationClause( Declarator owner ) - { - this.owner = owner; - this.owner.addParms( this ); - } - - OldKRParameterDeclarationClause oldKRparms = null; - - public void addOldKRParms( OldKRParameterDeclarationClause oldKRparms ) - { - this.oldKRparms = oldKRparms; - } - - /** - * Returns the parms. - * @return OldKRParameterDeclarationClause - */ - public OldKRParameterDeclarationClause getOldKRParms() { - return oldKRparms; - } -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/PointerOperator.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/PointerOperator.java deleted file mode 100644 index 89d705e403d..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/PointerOperator.java +++ /dev/null @@ -1,106 +0,0 @@ -/********************************************************************** - * Created on Mar 23, 2003 - * - * 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: - * Rational Software - Initial API and implementation -***********************************************************************/ -package org.eclipse.cdt.internal.core.dom; - -/** - * @author jcamelon - * - */ -public class PointerOperator { - - public final static int t_undefined = 0; - public final static int t_pointer = 1; - public final static int t_reference = 2; - public final static int t_pointer_to_member = 3; - private int type = t_undefined; - - /** - * @return int - */ - public int getType() { - return type; - } - - /** - * Sets the type. - * @param type The type to set - */ - public void setType(int type) { - this.type = type; - } - - private boolean isConst = false; - private boolean isVolatile = false; - - /** - * @return boolean - */ - public boolean isConst() { - return isConst; - } - - /** - * @return boolean - */ - public boolean isVolatile() { - return isVolatile; - } - - /** - * Sets the isConst. - * @param isConst The isConst to set - */ - public void setConst(boolean isConst) { - this.isConst = isConst; - } - - /** - * Sets the isVolatile. - * @param isVolatile The isVolatile to set - */ - public void setVolatile(boolean isVolatile) { - this.isVolatile = isVolatile; - } - - public PointerOperator( Declarator decl ) - { - ownerDeclarator = decl; - } - - private Declarator ownerDeclarator = null; - /** - * @return Declarator - */ - public Declarator getOwnerDeclarator() { - return ownerDeclarator; - } - - - // This is not a complete name, it is something like A::B::, i.e. ends with :: - private String nameSpecifier = null; - - /** - * @return Class name specifier for pointers to members - */ - public String getNameSpecifier() { - return nameSpecifier; - } - - /** - * Sets the class name specifier for pointers to members. - * @param name The name specifier to set - */ - public void setNameSpecifier(String name) { - this.nameSpecifier = name; - } -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/PreprocessorStatement.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/PreprocessorStatement.java deleted file mode 100644 index c9927b430a3..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/PreprocessorStatement.java +++ /dev/null @@ -1,107 +0,0 @@ -/********************************************************************** - * Created on Apr 7, 2003 - * - * Copyright (c) 2002,2003 IBM/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 Ltd. - Rational Software - Initial API and implementation -************************************************************************/ -package org.eclipse.cdt.internal.core.dom; - -/** - * @author jcamelon - * - */ -public class PreprocessorStatement implements IOffsetable { - - private int startingOffset, totalLength; - private final int nameOffset; - private final String name; - - public PreprocessorStatement( String name, int nameOffset, int startingOffset, int totalLength ) - { - this.name =name; - this.nameOffset = nameOffset; - this.startingOffset = startingOffset; - this.totalLength = totalLength; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsettable#getStartingOffset() - */ - public int getStartingOffset() { - return startingOffset; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsettable#getTotalLength() - */ - public int getTotalLength() { - return totalLength; - } - - - /** - * @return - */ - public String getName() { - return name; - } - - /** - * @return - */ - public int getNameOffset() { - return nameOffset; - } - - public int getNameLength() { - return name.length(); - } - /** - * @see org.eclipse.cdt.internal.core.dom.IOffsettable#setStartingOffset(int) - */ - public void setStartingOffset(int i) { - startingOffset = i; - } - /** - * @see org.eclipse.cdt.internal.core.dom.IOffsettable#setTotalLength(int) - */ - public void setTotalLength(int i) { - totalLength = i; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#setTopLine(int) - */ - public void setTopLine(int lineNumber) { - topLine = lineNumber; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#setBottomLine(int) - */ - public void setBottomLine(int lineNumber) { - bottomLine = lineNumber; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#getTopLine() - */ - public int getTopLine() { - return topLine; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IOffsetable#getBottomLine() - */ - public int getBottomLine() { - return bottomLine; - } - private int topLine = 0, bottomLine = 0; - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ScopeStack.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ScopeStack.java deleted file mode 100644 index 2a7ddecb5ff..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/ScopeStack.java +++ /dev/null @@ -1,38 +0,0 @@ -/********************************************************************** - * 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.dom; - -import java.util.Stack; - -/** - * @author jcamelon - * - */ -public class ScopeStack { - - public IScope peek() - { - return (IScope)scopes.peek(); - } - - public IScope pop() - { - return (IScope)scopes.pop(); - } - - public void push( IScope scope ) - { - scopes.push( scope ); - } - - private Stack scopes = new Stack(); - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/SimpleDeclaration.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/SimpleDeclaration.java deleted file mode 100644 index cda769596e3..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/SimpleDeclaration.java +++ /dev/null @@ -1,104 +0,0 @@ -package org.eclipse.cdt.internal.core.dom; - -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - - -public class SimpleDeclaration extends Declaration implements DeclSpecifier.IContainer, TypeSpecifier.IOwner { - - private AccessSpecifier accessSpecifier = null; - private DeclSpecifier declSpec = null; - private boolean isFunctionDefinition = false; - private int nameOffset; - - - public SimpleDeclaration(IScope owner ) - { - super( owner ); - } - - public DeclSpecifier getDeclSpecifier() - { - if( declSpec == null ) - declSpec = new DeclSpecifier(); - return declSpec; - } - - /** - * This is valid when the type is t_type. It points to a - * classSpecifier, etc. - */ - private TypeSpecifier typeSpecifier; - - /** - * Returns the typeSpecifier. - * @return TypeSpecifier - */ - public TypeSpecifier getTypeSpecifier() { - return typeSpecifier; - } - - /** - * Sets the typeSpecifier. - * @param typeSpecifier The typeSpecifier to set - */ - public void setTypeSpecifier(TypeSpecifier typeSpecifier) { - getDeclSpecifier().setType(DeclSpecifier.t_type); - this.typeSpecifier = typeSpecifier; - } - - private List declarators = new LinkedList(); - - public void addDeclarator(Object declarator) { - declarators.add(declarator); - } - - public List getDeclarators() { - return Collections.unmodifiableList( declarators ); - } - - /** - * @return - */ - public AccessSpecifier getAccessSpecifier() { - return accessSpecifier; - } - - /** - * @param specifier - */ - public void setAccessSpecifier(AccessSpecifier specifier) { - accessSpecifier = specifier; - } - - /** - * @return - */ - public boolean isFunctionDefinition() { - return isFunctionDefinition; - } - - /** - * @param b - */ - public void setFunctionDefinition(boolean b) { - isFunctionDefinition = b; - } - /** - * @return - */ - public int getNameOffset() - { - return nameOffset; - } - - /** - * @param i - */ - public void setNameOffset(int i) - { - nameOffset = i; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/TemplateDeclaration.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/TemplateDeclaration.java deleted file mode 100644 index df6abb87342..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/TemplateDeclaration.java +++ /dev/null @@ -1,105 +0,0 @@ -/********************************************************************** - * Created on Mar 30, 2003 - * - * 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: - * Rational Software - Initial API and implementation -***********************************************************************/ -package org.eclipse.cdt.internal.core.dom; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * @author jcamelon - * - */ -public class TemplateDeclaration extends Declaration implements IScope, IAccessable, ITemplateParameterListOwner { - - private final boolean exported; - private AccessSpecifier visibility = null; - - private List declarations = new ArrayList(); - private TemplateParameterList templateParms = null; - - public TemplateDeclaration( IScope ownerScope, boolean exported ) - { - super( ownerScope ); - this.exported = exported; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IScope#addDeclaration(org.eclipse.cdt.internal.core.dom.Declaration) - */ - public void addDeclaration(Declaration declaration) { - declarations.add( declaration ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IScope#getDeclarations() - */ - public List getDeclarations() { - return Collections.unmodifiableList( declarations ); - } - - /** - * @return boolean - */ - public boolean isExported() { - return exported; - } - - /** - * @return - */ - public TemplateParameterList getTemplateParms() { - return templateParms; - } - - /** - * @param list - */ - public void setTemplateParms(TemplateParameterList list) { - templateParms = list; - } - - - /** - * @param token - */ - public void setFirstOffset(int startingOffset) { - setStartingOffset( startingOffset ); - } - - /** - * @param token - */ - public void setLastOffset(int lastOffset) { - setTotalLength( lastOffset - getStartingOffset() ); - } - - /** - * @return - */ - public int getVisibility() { - if( visibility == null ) return AccessSpecifier.v_unknown; - return visibility.getAccess(); - } - - /** - * @param specifier - */ - public void setVisibility(int visibility) { - if( this.visibility == null ) this.visibility = new AccessSpecifier(visibility); - else this.visibility.setAccess(visibility); - } - - - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/TemplateParameter.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/TemplateParameter.java deleted file mode 100644 index d6fe7fa1b6d..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/TemplateParameter.java +++ /dev/null @@ -1,93 +0,0 @@ -/********************************************************************** - * Created on Mar 30, 2003 - * - * 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: - * Rational Software - Initial API and implementation -***********************************************************************/ -package org.eclipse.cdt.internal.core.dom; - - - -/** - * @author jcamelon - * - */ -public class TemplateParameter extends Declaration implements ITemplateParameterListOwner { - - private final int kind; - - public final static int k_class = 2; - public final static int k_typename = 3; - public final static int k_template = 4; - - - public TemplateParameter( IScope scope, int kind ) - { - super( scope ); - this.kind = kind; - } - - private String name = null; - private String typeId = null; - - - /** - * @return int - */ - public int getKind() { - return kind; - } - - /** - * @return Name - */ - public String getName() { - return name; - } - - /** - * @return Name - */ - public String getTypeId() { - return typeId; - } - - /** - * Sets the name. - * @param name The name to set - */ - public void setName(String name) { - this.name = name; - } - - /** - * Sets the typeId. - * @param typeId The typeId to set - */ - public void setTypeId(String typeId) { - this.typeId = typeId; - } - - TemplateParameterList list; - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.ITemplateParameterListOwner#getTemplateParms() - */ - public TemplateParameterList getTemplateParms() { - return list; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.ITemplateParameterListOwner#setTemplateParms(org.eclipse.cdt.internal.core.dom.TemplateParameterList) - */ - public void setTemplateParms(TemplateParameterList list) { - this.list = list; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/TemplateParameterList.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/TemplateParameterList.java deleted file mode 100644 index beed9856a45..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/TemplateParameterList.java +++ /dev/null @@ -1,39 +0,0 @@ -/********************************************************************** - * Created on Mar 29, 2003 - * - * Copyright (c) 2002,2003 IBM/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 Ltd. - Rational Software - Initial API and implementation -***********************************************************************/ -package org.eclipse.cdt.internal.core.dom; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -/** - * @author jcamelon - */ -public class TemplateParameterList implements IScope { - - private List parameters = new ArrayList(); - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IScope#addDeclaration(org.eclipse.cdt.internal.core.dom.Declaration) - */ - public void addDeclaration(Declaration declaration) { - parameters.add( declaration ); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.internal.core.dom.IScope#getDeclarations() - */ - public List getDeclarations() { - return Collections.unmodifiableList( parameters ); - } -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/TranslationUnit.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/TranslationUnit.java deleted file mode 100644 index 090a9217152..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/TranslationUnit.java +++ /dev/null @@ -1,170 +0,0 @@ -package org.eclipse.cdt.internal.core.dom; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.NoSuchElementException; - - -/** - */ -public class TranslationUnit implements IScope { - - private boolean parseSuccessful = true; - private List declarations = new ArrayList(); - private List macros = new ArrayList(); - private List inclusions = new ArrayList(); - - public void addDeclaration(Declaration declaration) { - declarations.add(declaration); - } - - public List getDeclarations() { - return Collections.unmodifiableList( declarations ); - } - - /** - * @return - */ - public List getInclusions() { - return Collections.unmodifiableList( inclusions ); - } - - /** - * @return - */ - public List getMacros() { - return Collections.unmodifiableList( macros ); - } - - public void addMacro(Macro macro) { - macros.add(macro); - } - - public void addInclusion(Inclusion inclusion) { - inclusions.add(inclusion); - } - - - public Iterator iterateOffsetableElements() - { - return new OffsetableIterator(); - } - - public class OffsetableIterator implements Iterator - { - private final Iterator declarationIter; - private final Iterator inclusionIter; - private final Iterator macroIter; - - private IOffsetable currentMacro = null, currentInclusion= null, currentDeclaration= null; - - public OffsetableIterator() - { - declarationIter = getDeclarations().iterator(); - inclusionIter = getInclusions().iterator(); - macroIter = getMacros().iterator(); - updateInclusionIterator(); - updateDeclarationIterator(); - updateMacroIterator(); - } - - private Object updateDeclarationIterator() - { - Object offsetable = currentDeclaration; - currentDeclaration = ( declarationIter.hasNext() ) ? (IOffsetable)declarationIter.next() : null; - return offsetable; - } - - private Object updateMacroIterator() - { - Object offsetable = currentMacro; - currentMacro = ( macroIter.hasNext() ) ? (IOffsetable)macroIter.next() : null; - return offsetable; - } - - private Object updateInclusionIterator() - { - Object offsetable = currentInclusion; - currentInclusion = ( inclusionIter.hasNext() ) ? (IOffsetable)inclusionIter.next() : null; - return offsetable; - } - /* (non-Javadoc) - * @see java.util.Iterator#hasNext() - */ - public boolean hasNext() { - return (( currentMacro == null && currentInclusion == null && currentDeclaration == null ) ? - false : true); - } - - /* (non-Javadoc) - * @see java.util.Iterator#next() - */ - public Object next() { - // case 1: all are null - if( ! hasNext() ) - throw new NoSuchElementException(); - - // case 2: two of three are null - if( currentMacro == null && currentInclusion == null ) - return updateDeclarationIterator(); - if( currentDeclaration == null && currentInclusion == null ) - return updateMacroIterator(); - if( currentMacro == null && currentDeclaration == null ) - return updateInclusionIterator(); - - // case 3: 1 is null - if( currentMacro == null ) - if( currentDeclaration.getStartingOffset() < currentInclusion.getStartingOffset() ) - return updateDeclarationIterator(); - else - return updateInclusionIterator(); - - if( currentInclusion == null ) - if( currentDeclaration.getStartingOffset() < currentMacro.getStartingOffset() ) - return updateDeclarationIterator(); - else - return updateMacroIterator(); - - if( currentDeclaration == null ) - if( currentInclusion.getStartingOffset() < currentMacro.getStartingOffset() ) - return updateInclusionIterator(); - else - return updateMacroIterator(); - - // case 4: none are null - if( currentInclusion.getStartingOffset() < currentMacro.getStartingOffset() && - currentInclusion.getStartingOffset() < currentDeclaration.getStartingOffset() ) - return updateInclusionIterator(); - - if( currentMacro.getStartingOffset() < currentInclusion.getStartingOffset() && - currentMacro.getStartingOffset() < currentDeclaration.getStartingOffset() ) - return updateMacroIterator(); - // only remaining case - return updateDeclarationIterator(); - } - - /* (non-Javadoc) - * @see java.util.Iterator#remove() - */ - public void remove() { - throw new UnsupportedOperationException( "OffsetableIterator is a const iterator"); - } - } - - /** - * @return - */ - public boolean isParseSuccessful() { - return parseSuccessful; - } - - /** - * @param b - */ - public void setParseSuccessful(boolean b) { - parseSuccessful = b; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/TypeSpecifier.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/TypeSpecifier.java deleted file mode 100644 index c855cc5042e..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/TypeSpecifier.java +++ /dev/null @@ -1,29 +0,0 @@ -package org.eclipse.cdt.internal.core.dom; - -public class TypeSpecifier { - - interface IOwner - { - public TypeSpecifier getTypeSpecifier(); - public void setTypeSpecifier( TypeSpecifier typespec ); - } - - public TypeSpecifier(IOwner owner) { - this.owner = owner; - } - - /** - * Owner declaration. - */ - private IOwner owner; - - /** - * Returns the declaration. - * @return SimpleDeclaration - */ - public IOwner getOwner() { - return owner; - } - - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/UsingDeclaration.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/UsingDeclaration.java deleted file mode 100644 index 6dbe36c0b1a..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/UsingDeclaration.java +++ /dev/null @@ -1,60 +0,0 @@ -/********************************************************************** - * Created on Mar 25, 2003 - * - * 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: - * Rational Software - Initial API and implementation -***********************************************************************/ -package org.eclipse.cdt.internal.core.dom; - - - -/** - * @author jcamelon - * - */ -public class UsingDeclaration extends Declaration { - - private String mappedName; - boolean isTypename = false; - - public UsingDeclaration( IScope owner ) - { - super( owner ); - } - /** - * @return String - */ - public String getMappedName() { - return mappedName; - } - - /** - * Sets the mapping. - * @param mapping The mapping to set - */ - public void setMappedName(String mapping) { - this.mappedName = mapping; - } - - /** - * @return boolean - */ - public boolean isTypename() { - return isTypename; - } - - /** - * Sets the isTypename. - * @param isTypename The isTypename to set - */ - public void setTypename(boolean isTypename) { - this.isTypename = isTypename; - } - -} diff --git a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/UsingDirective.java b/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/UsingDirective.java deleted file mode 100644 index d13028e648f..00000000000 --- a/core/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/UsingDirective.java +++ /dev/null @@ -1,44 +0,0 @@ -/********************************************************************** - * Created on Mar 25, 2003 - * - * 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: - * Rational Software - Initial API and implementation -***********************************************************************/ -package org.eclipse.cdt.internal.core.dom; - - - -/** - * @author jcamelon - * - */ -public class UsingDirective extends Declaration { - - private String namespaceName; - - public UsingDirective( IScope owner ) - { - super( owner ); - } - - /** - * @return String - */ - public String getNamespaceName() { - return namespaceName; - } - - /** - * Sets the namespaceName. - * @param namespaceName The namespaceName to set - */ - public void setNamespaceName(String namespaceName) { - this.namespaceName = namespaceName; - } -} diff --git a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexerRequestor.java b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexerRequestor.java index aac49d5652e..9bb8039c5af 100644 --- a/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexerRequestor.java +++ b/core/org.eclipse.cdt.core/index/org/eclipse/cdt/internal/core/search/indexing/SourceIndexerRequestor.java @@ -21,10 +21,12 @@ import org.eclipse.cdt.core.parser.ast.IASTASMDefinition; import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration; import org.eclipse.cdt.core.parser.ast.IASTClassReference; import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier; +import org.eclipse.cdt.core.parser.ast.IASTCodeScope; import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit; import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.parser.ast.IASTEnumerationReference; import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier; +import org.eclipse.cdt.core.parser.ast.IASTEnumeratorReference; import org.eclipse.cdt.core.parser.ast.IASTField; import org.eclipse.cdt.core.parser.ast.IASTFieldReference; import org.eclipse.cdt.core.parser.ast.IASTFunction; @@ -420,15 +422,23 @@ public class SourceIndexerRequestor implements ISourceElementRequestor, IIndexCo /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope) */ - public void enterCodeBlock(IASTScope scope) { + public void enterCodeBlock(IASTCodeScope scope) { // TODO Auto-generated method stub } /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope) */ - public void exitCodeBlock(IASTScope scope) { + public void exitCodeBlock(IASTCodeScope scope) { // TODO Auto-generated method stub } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumeratorReference(org.eclipse.cdt.core.parser.ast.IASTEnumerationReference) + */ + public void acceptEnumeratorReference(IASTEnumeratorReference reference) + { + // TODO Auto-generated method stub + + } } diff --git a/core/org.eclipse.cdt.core/parser/ChangeLog b/core/org.eclipse.cdt.core/parser/ChangeLog index bbc897c2e63..214b392eb65 100644 --- a/core/org.eclipse.cdt.core/parser/ChangeLog +++ b/core/org.eclipse.cdt.core/parser/ChangeLog @@ -1,3 +1,9 @@ +2003-09-08 John Camelon + Made scoping support more robust in CompleteParse mode. + Refactored ISourceElementRequestor (enter|exit)CodeBlock() to take IASTCodeScope rather than IASTScope. + Removed the now obsolete DOM. +` Added enumerator references to ISourceElementRequestor. + 2003-09-08 Andrew Niefer - Created ParserLanguage.java - Updated Factories to take language as parameter when create scanner & parser diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java index ea598be8975..04268bcb44b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ISourceElementRequestor.java @@ -14,10 +14,12 @@ import org.eclipse.cdt.core.parser.ast.IASTASMDefinition; import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration; import org.eclipse.cdt.core.parser.ast.IASTClassReference; import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier; +import org.eclipse.cdt.core.parser.ast.IASTCodeScope; import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit; import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.parser.ast.IASTEnumerationReference; import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier; +import org.eclipse.cdt.core.parser.ast.IASTEnumeratorReference; import org.eclipse.cdt.core.parser.ast.IASTField; import org.eclipse.cdt.core.parser.ast.IASTFieldReference; import org.eclipse.cdt.core.parser.ast.IASTFunction; @@ -29,7 +31,6 @@ import org.eclipse.cdt.core.parser.ast.IASTMethod; import org.eclipse.cdt.core.parser.ast.IASTMethodReference; import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition; import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference; -import org.eclipse.cdt.core.parser.ast.IASTScope; import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration; import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation; import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization; @@ -61,8 +62,9 @@ public interface ISourceElementRequestor { public void enterFunctionBody( IASTFunction function ); public void exitFunctionBody( IASTFunction function ); - public void enterCodeBlock( IASTScope scope ); - public void exitCodeBlock( IASTScope scope ); + + public void enterCodeBlock( IASTCodeScope scope ); + public void exitCodeBlock( IASTCodeScope scope ); public void enterCompilationUnit( IASTCompilationUnit compilationUnit ); public void enterInclusion( IASTInclusion inclusion ); @@ -87,6 +89,7 @@ public interface ISourceElementRequestor { public void acceptFunctionReference( IASTFunctionReference reference ); public void acceptFieldReference( IASTFieldReference reference ); public void acceptMethodReference( IASTMethodReference reference ); + public void acceptEnumeratorReference( IASTEnumeratorReference reference ); public void exitTemplateDeclaration( IASTTemplateDeclaration declaration ); public void exitTemplateSpecialization( IASTTemplateSpecialization specialization ); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTCodeScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTCodeScope.java index c41163f2365..ceaa395ac1b 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTCodeScope.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTCodeScope.java @@ -16,4 +16,6 @@ import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate; */ public interface IASTCodeScope extends IASTScope, ISourceElementCallbackDelegate{ + public IASTCodeScope getOwnerCodeScope(); + } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFunction.java index b7d40c516c9..4d112f489c1 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFunction.java @@ -16,7 +16,7 @@ import java.util.Iterator; * @author jcamelon * */ -public interface IASTFunction extends IASTScope, IASTOffsetableNamedElement, IASTTemplatedDeclaration, IASTDeclaration, IASTQualifiedNameElement { +public interface IASTFunction extends IASTCodeScope, IASTOffsetableNamedElement, IASTTemplatedDeclaration, IASTDeclaration, IASTQualifiedNameElement { public boolean isInline(); public boolean isFriend(); diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/NullSourceElementRequestor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/NullSourceElementRequestor.java index 08d81b5ecc1..f615c3e6eb8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/NullSourceElementRequestor.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/NullSourceElementRequestor.java @@ -6,10 +6,12 @@ import org.eclipse.cdt.core.parser.ast.IASTASMDefinition; import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration; import org.eclipse.cdt.core.parser.ast.IASTClassReference; import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier; +import org.eclipse.cdt.core.parser.ast.IASTCodeScope; import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit; import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.parser.ast.IASTEnumerationReference; import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier; +import org.eclipse.cdt.core.parser.ast.IASTEnumeratorReference; import org.eclipse.cdt.core.parser.ast.IASTField; import org.eclipse.cdt.core.parser.ast.IASTFieldReference; import org.eclipse.cdt.core.parser.ast.IASTFunction; @@ -21,7 +23,6 @@ import org.eclipse.cdt.core.parser.ast.IASTMethod; import org.eclipse.cdt.core.parser.ast.IASTMethodReference; import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition; import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference; -import org.eclipse.cdt.core.parser.ast.IASTScope; import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration; import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation; import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization; @@ -411,7 +412,7 @@ public class NullSourceElementRequestor implements ISourceElementRequestor /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope) */ - public void enterCodeBlock(IASTScope scope) { + public void enterCodeBlock(IASTCodeScope scope) { // TODO Auto-generated method stub } @@ -419,8 +420,17 @@ public class NullSourceElementRequestor implements ISourceElementRequestor /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope) */ - public void exitCodeBlock(IASTScope scope) { + public void exitCodeBlock(IASTCodeScope scope) { // TODO Auto-generated method stub - } + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumeratorReference(org.eclipse.cdt.core.parser.ast.IASTEnumerationReference) + */ + public void acceptEnumeratorReference(IASTEnumeratorReference reference) + { + // TODO Auto-generated method stub + + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java index 18b59dbea47..ef6818a68cb 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java @@ -2632,14 +2632,14 @@ public class Parser implements IParser condition( scope ); consume(IToken.tRPAREN); if( LT(1) != IToken.tLBRACE ) - statement( astFactory.createNewCodeBlock( scope ) ); + singleStatementScope(scope); else - statement(scope); + statement( scope ); if (LT(1) == IToken.t_else) { consume( IToken.t_else ); if( LT(1) != IToken.tLBRACE ) - statement( astFactory.createNewCodeBlock( scope ) ); + singleStatementScope(scope); else statement( scope ); } @@ -2657,14 +2657,14 @@ public class Parser implements IParser condition(scope); consume(IToken.tRPAREN); if( LT(1) != IToken.tLBRACE ) - statement(astFactory.createNewCodeBlock(scope)); + singleStatementScope(scope); else statement(scope); return; case IToken.t_do : consume(IToken.t_do); if( LT(1) != IToken.tLBRACE ) - statement(astFactory.createNewCodeBlock(scope)); + singleStatementScope(scope); else statement(scope); consume(IToken.t_while); @@ -2753,6 +2753,19 @@ public class Parser implements IParser declaration(scope, null); } } + protected void singleStatementScope(IASTScope scope) throws Backtrack + { + IASTCodeScope newScope = astFactory.createNewCodeBlock( scope ); + newScope.enterScope( requestor ); + try + { + statement( newScope ); + } + finally + { + newScope.exitScope( requestor ); + } + } /** * @throws Backtrack diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCodeScope.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCodeScope.java index 6d86a7f0097..d062d1854c7 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCodeScope.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCodeScope.java @@ -18,11 +18,16 @@ import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol; */ public class ASTCodeScope extends ASTScope implements IASTCodeScope { - /** + private final IASTCodeScope ownerCodeScope; + + /** * @param newScope */ public ASTCodeScope(IContainerSymbol newScope) { super( newScope ); + ownerCodeScope = ( newScope.getContainingSymbol().getASTExtension().getPrimaryDeclaration() instanceof IASTCodeScope ) ? + (IASTCodeScope) newScope.getContainingSymbol().getASTExtension().getPrimaryDeclaration() : null; + } /* (non-Javadoc) @@ -45,4 +50,12 @@ public class ASTCodeScope extends ASTScope implements IASTCodeScope { requestor.exitCodeBlock( this ); } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTCodeScope#getOwnerCodeScope() + */ + public IASTCodeScope getOwnerCodeScope() + { + return ownerCodeScope; + } + } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumeratorReference.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumeratorReference.java new file mode 100644 index 00000000000..cf14c4b51f8 --- /dev/null +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTEnumeratorReference.java @@ -0,0 +1,63 @@ +/********************************************************************** + * 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.complete; + +import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate; +import org.eclipse.cdt.core.parser.ISourceElementRequestor; +import org.eclipse.cdt.core.parser.ast.IASTEnumerator; +import org.eclipse.cdt.core.parser.ast.IASTEnumeratorReference; + +/** + * @author jcamelon + * + */ +public class ASTEnumeratorReference extends ASTReference implements IASTEnumeratorReference +{ + + private final IASTEnumerator enumerator; + /** + * @param offset + * @param string + * @param enumerator + */ + public ASTEnumeratorReference(int offset, String string, IASTEnumerator enumerator) + { + super( offset, string ); + this.enumerator = enumerator; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTReference#getReferencedElement() + */ + public ISourceElementCallbackDelegate getReferencedElement() + { + return enumerator; + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor) + */ + public void acceptElement(ISourceElementRequestor requestor) + { + requestor.acceptEnumeratorReference( this ); + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor) + */ + public void enterScope(ISourceElementRequestor requestor) + { + } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor) + */ + public void exitScope(ISourceElementRequestor requestor) + { + } +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunction.java index 6ac052448f6..0c1f4316dce 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTFunction.java @@ -16,6 +16,7 @@ import java.util.List; import org.eclipse.cdt.core.parser.ISourceElementRequestor; import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration; import org.eclipse.cdt.core.parser.ast.IASTArrayModifier; +import org.eclipse.cdt.core.parser.ast.IASTCodeScope; import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification; import org.eclipse.cdt.core.parser.ast.IASTFunction; import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration; @@ -239,4 +240,14 @@ public class ASTFunction extends ASTScope implements IASTFunction { requestor.exitFunctionBody( this ); } + + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTCodeScope#getOwnerCodeScope() + */ + public IASTCodeScope getOwnerCodeScope() + { + return ( getSymbol().getContainingSymbol().getASTExtension().getPrimaryDeclaration() ) instanceof IASTCodeScope ? + (IASTCodeScope) getSymbol().getContainingSymbol().getASTExtension().getPrimaryDeclaration() : null; + } } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java index a4ab01f1bf8..88874b72c6c 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java @@ -33,6 +33,7 @@ import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit; import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer; 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.IASTExceptionSpecification; import org.eclipse.cdt.core.parser.ast.IASTExpression; import org.eclipse.cdt.core.parser.ast.IASTFactory; @@ -585,6 +586,8 @@ public class CompleteParseASTFactory extends BaseASTFactory implements IASTFacto } else if( symbol.getType() == TypeInfo.t_enumeration ) return new ASTEnumerationReference( offset, string, (IASTEnumerationSpecifier)symbol.getASTExtension().getPrimaryDeclaration() ); + else if( symbol.getType() == TypeInfo.t_enumerator ) + return new ASTEnumeratorReference( offset, string, (IASTEnumerator)symbol.getASTExtension().getPrimaryDeclaration() ); else if( symbol.getType() == TypeInfo.t_function ) { if( symbol.getContainingSymbol().getTypeInfo().isType( TypeInfo.t_class, TypeInfo.t_union ) ) diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java index 3c43d26496e..6f5de727206 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java @@ -16,6 +16,7 @@ import java.util.List; import org.eclipse.cdt.core.parser.ISourceElementRequestor; import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration; +import org.eclipse.cdt.core.parser.ast.IASTCodeScope; import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification; import org.eclipse.cdt.core.parser.ast.IASTFunction; import org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement; @@ -210,4 +211,11 @@ public class ASTFunction extends ASTDeclaration implements IASTFunction public boolean hasFunctionBody() { return hasFunctionBody; } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ast.IASTCodeScope#getOwnerCodeScope() + */ + public IASTCodeScope getOwnerCodeScope() + { + return null; + } } diff --git a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java index 271129f61f3..c6dfd681bfd 100644 --- a/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java +++ b/core/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java @@ -39,10 +39,12 @@ import org.eclipse.cdt.core.parser.ast.IASTASMDefinition; import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration; import org.eclipse.cdt.core.parser.ast.IASTClassReference; import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier; +import org.eclipse.cdt.core.parser.ast.IASTCodeScope; import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit; import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.parser.ast.IASTEnumerationReference; import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier; +import org.eclipse.cdt.core.parser.ast.IASTEnumeratorReference; import org.eclipse.cdt.core.parser.ast.IASTField; import org.eclipse.cdt.core.parser.ast.IASTFieldReference; import org.eclipse.cdt.core.parser.ast.IASTFunction; @@ -466,7 +468,7 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope) */ - public void enterCodeBlock(IASTScope scope) { + public void enterCodeBlock(IASTCodeScope scope) { // TODO Auto-generated method stub } @@ -474,9 +476,18 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope) */ - public void exitCodeBlock(IASTScope scope) { + public void exitCodeBlock(IASTCodeScope scope) { // TODO Auto-generated method stub } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumeratorReference(org.eclipse.cdt.core.parser.ast.IASTEnumerationReference) + */ + public void acceptEnumeratorReference(IASTEnumeratorReference reference) + { + // TODO Auto-generated method stub + + } + } diff --git a/core/org.eclipse.cdt.ui/ChangeLog b/core/org.eclipse.cdt.ui/ChangeLog index 70735aa8a39..31a16fa27cd 100644 --- a/core/org.eclipse.cdt.ui/ChangeLog +++ b/core/org.eclipse.cdt.ui/ChangeLog @@ -1,3 +1,7 @@ +2003-09-08 John Camelon + Refactored ISourceElementRequestor (enter|exit)CodeBlock() to take IASTCodeScope rather than IASTScope. + Added enumerator references to ISourceElementRequestor. + 2003-09-08 Andrew Niefer - Modified call to ParserFactory in CStructureCreator to specify which language to use diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/SourceElementRequestorAdapter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/SourceElementRequestorAdapter.java index 6658c3c3040..93b55e3c639 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/SourceElementRequestorAdapter.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/SourceElementRequestorAdapter.java @@ -17,10 +17,12 @@ import org.eclipse.cdt.core.parser.ast.IASTASMDefinition; import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration; import org.eclipse.cdt.core.parser.ast.IASTClassReference; import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier; +import org.eclipse.cdt.core.parser.ast.IASTCodeScope; import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit; import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier; import org.eclipse.cdt.core.parser.ast.IASTEnumerationReference; import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier; +import org.eclipse.cdt.core.parser.ast.IASTEnumeratorReference; import org.eclipse.cdt.core.parser.ast.IASTField; import org.eclipse.cdt.core.parser.ast.IASTFieldReference; import org.eclipse.cdt.core.parser.ast.IASTFunction; @@ -296,7 +298,7 @@ public class SourceElementRequestorAdapter implements ISourceElementRequestor { /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope) */ - public void enterCodeBlock(IASTScope scope) { + public void enterCodeBlock(IASTCodeScope scope) { // TODO Auto-generated method stub } @@ -304,9 +306,18 @@ public class SourceElementRequestorAdapter implements ISourceElementRequestor { /* (non-Javadoc) * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitCodeBlock(org.eclipse.cdt.core.parser.ast.IASTScope) */ - public void exitCodeBlock(IASTScope scope) { + public void exitCodeBlock(IASTCodeScope scope) { // TODO Auto-generated method stub } + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumeratorReference(org.eclipse.cdt.core.parser.ast.IASTEnumerationReference) + */ + public void acceptEnumeratorReference(IASTEnumeratorReference reference) + { + // TODO Auto-generated method stub + + } + }