[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] Applied [HEAD] Parser Patch Per Diem
|
CORE
Fleshed out basic declarations for FullParse AST.
Fixed Bug 40554 - Fields coming back as Vars
Fixed Bug 40555 - Methods come back as Functions
TESTS
Created CompleteParseASTTest and added it to ParserTestSuite.
JohnC
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/ChangeLog,v
retrieving revision 1.25
diff -u -r1.25 ChangeLog
--- ChangeLog 18 Jul 2003 16:39:12 -0000 1.25
+++ ChangeLog 21 Jul 2003 17:28:32 -0000
@@ -1,3 +1,6 @@
+2003-07-21 John Camelon
+ Created CompleteParseASTTest and added it to ParserTestSuite.
+
2003-07-18 John Camelon
Updated ParserSymbolTableTests to remove dependencies on parser.ast.full classes.
Updated Parser test suites for updates to ParserFactory.
Index: parser/org/eclipse/cdt/core/parser/tests/BaseASTTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/BaseASTTest.java,v
retrieving revision 1.3
diff -u -r1.3 BaseASTTest.java
--- parser/org/eclipse/cdt/core/parser/tests/BaseASTTest.java 18 Jul 2003 16:39:12 -0000 1.3
+++ parser/org/eclipse/cdt/core/parser/tests/BaseASTTest.java 21 Jul 2003 17:28:32 -0000
@@ -19,6 +19,7 @@
import org.eclipse.cdt.core.parser.IQuickParseCallback;
import org.eclipse.cdt.core.parser.ParserFactory;
import org.eclipse.cdt.core.parser.ParserMode;
+import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTFunction;
@@ -58,7 +59,23 @@
protected IASTDeclaration assertSoleDeclaration( String code ) throws ParserException
{
- Iterator declarationIter = parse( code ).getDeclarations();
+ Iterator declarationIter = null;
+ try
+ {
+ try
+ {
+ declarationIter = parse(code).getDeclarations();
+ }
+ catch (ASTNotImplementedException e1)
+ {
+ // TODO Auto-generated catch block
+ }
+ }
+ catch (ParserException e)
+ {
+ // TODO Auto-generated catch block
+ }
+ assertNotNull( declarationIter );
assertTrue( declarationIter.hasNext() );
IASTDeclaration returnValue = (IASTDeclaration)declarationIter.next();
assertFalse( declarationIter.hasNext() );
Index: parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java
===================================================================
RCS file: parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java
diff -N parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/core/parser/tests/CompleteParseASTTest.java 21 Jul 2003 17:28:32 -0000
@@ -0,0 +1,458 @@
+/**********************************************************************
+ * 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.StringReader;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Stack;
+
+import junit.framework.TestCase;
+
+import org.eclipse.cdt.core.parser.IParser;
+import org.eclipse.cdt.core.parser.ISourceElementRequestor;
+import org.eclipse.cdt.core.parser.ParserFactory;
+import org.eclipse.cdt.core.parser.ParserMode;
+import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
+import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
+import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
+import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
+import org.eclipse.cdt.core.parser.ast.IASTField;
+import org.eclipse.cdt.core.parser.ast.IASTFunction;
+import org.eclipse.cdt.core.parser.ast.IASTInclusion;
+import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
+import org.eclipse.cdt.core.parser.ast.IASTMethod;
+import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
+import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
+import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
+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;
+import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
+import org.eclipse.cdt.core.parser.ast.IASTVariable;
+import org.eclipse.cdt.internal.core.parser.NullSourceElementRequestor;
+import org.eclipse.cdt.internal.core.parser.ParserException;
+import org.eclipse.cdt.internal.core.parser.ScannerInfo;
+
+
+/**
+ * @author jcamelon
+ *
+ */
+public class CompleteParseASTTest extends TestCase
+{
+ public class Scope implements IASTScope
+ {
+ private List decls = new ArrayList();
+ private final IASTScope scope;
+ public Scope( IASTScope scope )
+ {
+ this.scope = scope;
+ }
+
+ public void addDeclaration( IASTDeclaration d )
+ {
+ decls.add(d);
+ }
+
+ public Iterator getDeclarations()
+ {
+ return decls.iterator();
+ }
+ }
+
+ public class FullParseCallback extends NullSourceElementRequestor implements ISourceElementRequestor
+ {
+
+ private Stack inclusions = new Stack();
+ private Scope compilationUnit;
+
+ public IASTScope getCompilationUnit()
+ {
+ return compilationUnit;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptVariable(org.eclipse.cdt.core.parser.ast.IASTVariable)
+ */
+ public void acceptVariable(IASTVariable variable)
+ {
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptFunctionDeclaration(org.eclipse.cdt.core.parser.ast.IASTFunction)
+ */
+ public void acceptFunctionDeclaration(IASTFunction function)
+ {
+ getCurrentScope().addDeclaration(function);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptUsingDirective(org.eclipse.cdt.core.parser.ast.IASTUsingDirective)
+ */
+ public void acceptUsingDirective(IASTUsingDirective usageDirective)
+ {
+ getCurrentScope().addDeclaration(usageDirective);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptUsingDeclaration(org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration)
+ */
+ public void acceptUsingDeclaration(IASTUsingDeclaration usageDeclaration)
+ {
+ getCurrentScope().addDeclaration(usageDeclaration);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptASMDefinition(org.eclipse.cdt.core.parser.ast.IASTASMDefinition)
+ */
+ public void acceptASMDefinition(IASTASMDefinition asmDefinition)
+ {
+ getCurrentScope().addDeclaration(asmDefinition);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedefDeclaration(org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration)
+ */
+ public void acceptTypedefDeclaration(IASTTypedefDeclaration typedef)
+ {
+ getCurrentScope().addDeclaration(typedef);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumerationSpecifier(org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier)
+ */
+ public void acceptEnumerationSpecifier(IASTEnumerationSpecifier enumeration)
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptAbstractTypeSpecDeclaration(org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration)
+ */
+ public void acceptAbstractTypeSpecDeclaration(IASTAbstractTypeSpecifierDeclaration abstractDeclaration)
+ {
+ getCurrentScope().addDeclaration( abstractDeclaration );
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterFunctionBody(org.eclipse.cdt.core.parser.ast.IASTFunction)
+ */
+ public void enterFunctionBody(IASTFunction function)
+ {
+ pushScope( function );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitFunctionBody(org.eclipse.cdt.core.parser.ast.IASTFunction)
+ */
+ public void exitFunctionBody(IASTFunction function)
+ {
+ popScope();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterCompilationUnit(org.eclipse.cdt.core.parser.ast.IASTCompilationUnit)
+ */
+ public void enterCompilationUnit(IASTCompilationUnit compilationUnit)
+ {
+ pushScope( compilationUnit );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterInclusion(org.eclipse.cdt.core.parser.ast.IASTInclusion)
+ */
+ public void enterInclusion(IASTInclusion inclusion)
+ {
+ pushInclusion( inclusion );
+ }
+
+ /**
+ * @param inclusion
+ */
+ private void pushInclusion(IASTInclusion inclusion)
+ {
+ inclusions.push( inclusion );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterNamespaceDefinition(org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition)
+ */
+ public void enterNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition)
+ {
+ pushScope( namespaceDefinition );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#entesrClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier)
+ */
+ public void enterClassSpecifier(IASTClassSpecifier classSpecification)
+ {
+ pushScope( classSpecification );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterLinkageSpecification(org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification)
+ */
+ public void enterLinkageSpecification(IASTLinkageSpecification linkageSpec)
+ {
+ pushScope( linkageSpec );
+ }
+
+ /* (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#enterTemplateInstantiation(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)
+ {
+ getCurrentScope().addDeclaration( method );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterMethodBody(org.eclipse.cdt.core.parser.ast.IASTMethod)
+ */
+ public void enterMethodBody(IASTMethod method)
+ {
+ pushScope(method);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitMethodBody(org.eclipse.cdt.core.parser.ast.IASTMethod)
+ */
+ public void exitMethodBody(IASTMethod method)
+ {
+ popScope();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptField(org.eclipse.cdt.core.parser.ast.IASTField)
+ */
+ public void acceptField(IASTField field)
+ {
+ getCurrentScope().addDeclaration(field);
+
+ }
+
+
+ /* (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)
+ {
+ popScope();
+ getCurrentScope().addDeclaration(linkageSpec);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier)
+ */
+ public void exitClassSpecifier(IASTClassSpecifier classSpecification)
+ {
+ popScope();
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitNamespaceDefinition(org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition)
+ */
+ public void exitNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition)
+ {
+ popScope();
+ getCurrentScope().addDeclaration(namespaceDefinition);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitInclusion(org.eclipse.cdt.core.parser.ast.IASTInclusion)
+ */
+ public void exitInclusion(IASTInclusion inclusion)
+ {
+ popInclusion();
+ }
+
+ /**
+ *
+ */
+ private void popInclusion()
+ {
+ inclusions.pop();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitCompilationUnit(org.eclipse.cdt.core.parser.ast.IASTCompilationUnit)
+ */
+ public void exitCompilationUnit(IASTCompilationUnit compilationUnit)
+ {
+ this.compilationUnit = popScope();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptPointerToFunction(org.eclipse.cdt.core.parser.ast.IASTPointerToFunction)
+ */
+ public void acceptPointerToFunction(IASTPointerToFunction function)
+ {
+ getCurrentScope().addDeclaration(function);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptPointerToMethod(org.eclipse.cdt.core.parser.ast.IASTPointerToMethod)
+ */
+ public void acceptPointerToMethod(IASTPointerToMethod method)
+ {
+ getCurrentScope().addDeclaration(method); }
+
+
+ private Stack scopes = new Stack();
+ protected Scope getCurrentScope()
+ {
+ return (Scope)scopes.peek();
+ }
+
+ protected Scope popScope()
+ {
+ return (Scope)scopes.pop();
+ }
+
+ protected void pushScope( IASTScope scope )
+ {
+ scopes.push( new Scope( scope ));
+ }
+
+ }
+
+
+ protected FullParseCallback callback;
+
+ protected IASTScope parse( String code )throws ParserException
+ {
+ callback = new FullParseCallback();
+ IParser parser = ParserFactory.createParser(
+ ParserFactory.createScanner( new StringReader( code ), "test-code", new ScannerInfo(),
+ ParserMode.COMPLETE_PARSE, callback ), callback, ParserMode.COMPLETE_PARSE
+ );
+ parser.parse();
+ return callback.getCompilationUnit();
+ }
+
+ /**
+ * @param a
+ */
+ public CompleteParseASTTest(String a)
+ {
+ super(a);
+ }
+
+ public void testEmptyCompilationUnit() throws Exception
+ {
+ IASTScope compilationUnit = parse( "// no real code ");
+ assertNotNull( compilationUnit );
+ assertFalse( compilationUnit.getDeclarations().hasNext() );
+ }
+
+ public void testSimpleNamespace() throws Exception
+ {
+ Iterator declarations = parse( "namespace A { }").getDeclarations();
+ IASTNamespaceDefinition namespaceDefinition = (IASTNamespaceDefinition)declarations.next();
+ assertEquals( namespaceDefinition.getName(), "A" );
+ assertFalse( namespaceDefinition.getDeclarations().hasNext() );
+ }
+
+ public void testMultipleNamespaceDefinitions() throws Exception
+ {
+ Iterator declarations = parse( "namespace A { } namespace A { }").getDeclarations();
+ IASTNamespaceDefinition namespaceDefinition = (IASTNamespaceDefinition)declarations.next();
+ assertEquals( namespaceDefinition.getName(), "A" );
+ namespaceDefinition = (IASTNamespaceDefinition)declarations.next();
+ assertEquals( namespaceDefinition.getName(), "A" );
+ assertFalse( namespaceDefinition.getDeclarations().hasNext() );
+ }
+
+ public void testNestedNamespaceDefinitions() throws Exception
+ {
+ Iterator declarations = parse( "namespace A { namespace B { } }").getDeclarations();
+ IASTNamespaceDefinition namespaceDefinition = (IASTNamespaceDefinition)declarations.next();
+ assertEquals( namespaceDefinition.getName(), "A" );
+ assertFalse( declarations.hasNext() );
+ Iterator subDeclarations = namespaceDefinition.getDeclarations();
+ IASTNamespaceDefinition subDeclaration = (IASTNamespaceDefinition)subDeclarations.next();
+ assertEquals( subDeclaration.getName(), "B" );
+ assertFalse( subDeclarations.hasNext() );
+ }
+
+// public void testEmptyClassDeclaration() throws Exception
+// {
+// Iterator declarations = parse( "class A { };").getDeclarations();
+// IASTClassSpecifier classSpec = (IASTClassSpecifier)declarations.next();
+// assertEquals( classSpec.getName(), "A");
+// assertFalse( classSpec.getDeclarations().hasNext() );
+// assertFalse( declarations.hasNext() );
+// }
+}
Index: parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java,v
retrieving revision 1.7
diff -u -r1.7 ParserSymbolTableTest.java
--- parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java 18 Jul 2003 16:39:12 -0000 1.7
+++ parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java 21 Jul 2003 17:28:33 -0000
@@ -18,12 +18,12 @@
import junit.framework.TestCase;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
-import org.eclipse.cdt.internal.core.parser.ast.complete.SymbolExtension;
+import org.eclipse.cdt.internal.core.parser.ast.complete.ASTSymbol;
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension;
import org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol;
import org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol;
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
+import org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension;
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable;
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTableException;
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.Mark;
@@ -102,20 +102,60 @@
assertEquals( look, null );
}
+ protected class NullSymbolExtension implements ISymbolASTExtension
+ {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension#getPrimaryDeclaration()
+ */
+ public ASTSymbol getPrimaryDeclaration()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension#getAllDefinitions()
+ */
+ public Iterator getAllDefinitions()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension#addDefinition(org.eclipse.cdt.internal.core.parser.ast.complete.ASTSymbol)
+ */
+ public void addDefinition(ASTSymbol definition) throws ExtensionException
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.parser.pst.ISymbolOwner#getSymbol()
+ */
+ public ISymbol getSymbol()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ }
+
public void testSimpleSetGetObject() throws Exception{
newTable();
IContainerSymbol x = table.new Declaration("x");
- ISymbolASTExtension extension = new SymbolExtension( null, null ); // cheating!
+ ISymbolASTExtension extension = new NullSymbolExtension ();
- x.setASTNode( extension );
+ x.setASTExtension( extension );
table.getCompilationUnit().addSymbol( x );
ISymbol look = table.getCompilationUnit().Lookup( "x" );
- assertEquals( look.getASTNode(), extension );
+ assertEquals( look.getASTExtension(), extension );
}
/**
Index: parser/org/eclipse/cdt/core/parser/tests/ParserTestSuite.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ParserTestSuite.java,v
retrieving revision 1.6
diff -u -r1.6 ParserTestSuite.java
--- parser/org/eclipse/cdt/core/parser/tests/ParserTestSuite.java 18 Jul 2003 12:40:43 -0000 1.6
+++ parser/org/eclipse/cdt/core/parser/tests/ParserTestSuite.java 21 Jul 2003 17:28:33 -0000
@@ -36,6 +36,7 @@
suite.addTestSuite( PreprocessorTest.class );
suite.addTestSuite( PreprocessorConditionalTest.class );
suite.addTestSuite( QuickParseASTQualifiedNameTest.class);
+ suite.addTestSuite( CompleteParseASTTest.class );
return suite;
}
Index: parser/org/eclipse/cdt/core/parser/tests/QuickParseASTTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/QuickParseASTTests.java,v
retrieving revision 1.1
diff -u -r1.1 QuickParseASTTests.java
--- parser/org/eclipse/cdt/core/parser/tests/QuickParseASTTests.java 17 Jul 2003 20:15:03 -0000 1.1
+++ parser/org/eclipse/cdt/core/parser/tests/QuickParseASTTests.java 21 Jul 2003 17:28:34 -0000
@@ -1156,16 +1156,16 @@
assertFalse( inclusions.hasNext());
assertEquals( i.getName(), "stdio.h");
- assertEquals( i.getElementStartingOffset(), 0 );
- assertEquals( i.getElementNameOffset(), 10 );
- assertEquals( i.getElementEndingOffset(), 18 );
+ assertEquals( i.getStartingOffset(), 0 );
+ assertEquals( i.getNameOffset(), 10 );
+ assertEquals( i.getEndingOffset(), 18 );
IASTMacro m = (IASTMacro)macros.next();
assertEquals( m.getName(), "DEF" );
- assertEquals( m.getElementStartingOffset(), 19 );
- assertEquals( m.getElementNameOffset(), 27 );
- assertEquals( m.getElementEndingOffset(), 18 + 19);
+ assertEquals( m.getStartingOffset(), 19 );
+ assertEquals( m.getNameOffset(), 27 );
+ assertEquals( m.getEndingOffset(), 18 + 19);
}
public void testTemplateDeclarationOfFunction() throws Exception
Index: dom/org/eclipse/cdt/internal/core/dom/DOMBuilder.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/dom/org/eclipse/cdt/internal/core/dom/DOMBuilder.java,v
retrieving revision 1.43
diff -u -r1.43 DOMBuilder.java
--- dom/org/eclipse/cdt/internal/core/dom/DOMBuilder.java 18 Jul 2003 16:39:22 -0000 1.43
+++ dom/org/eclipse/cdt/internal/core/dom/DOMBuilder.java 21 Jul 2003 17:27:26 -0000
@@ -466,10 +466,10 @@
Macro m =
new Macro(
macro.getName(),
- macro.getElementNameOffset(),
- macro.getElementStartingOffset(),
- macro.getElementEndingOffset()
- - macro.getElementStartingOffset());
+ macro.getNameOffset(),
+ macro.getStartingOffset(),
+ macro.getEndingOffset()
+ - macro.getStartingOffset());
translationUnit.addMacro(m);
}
/* (non-Javadoc)
@@ -488,11 +488,11 @@
SimpleDeclaration declaration =
getTypeSpecOwner(
getCurrentDOMScope(),
- variable.getElementStartingOffset());
+ variable.getStartingOffset());
if (declaration == null)
{
declaration =
- startSimpleDeclaration(variable.getElementStartingOffset());
+ startSimpleDeclaration(variable.getStartingOffset());
declaration.getDeclSpecifier().setConst(
variable.getAbstractDeclaration().isConst());
declaration.getDeclSpecifier().setExtern(variable.isExtern());
@@ -579,7 +579,7 @@
SimpleDeclaration simpleDeclaration =
getTypeSpecOwner(
getCurrentDOMScope(),
- function.getElementStartingOffset());
+ function.getStartingOffset());
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptUsageDirective(org.eclipse.cdt.core.parser.ast.IASTUsageDirective)
@@ -647,9 +647,9 @@
Inclusion i =
new Inclusion(
inclusion.getName(),
- inclusion.getElementNameOffset(),
- inclusion.getElementStartingOffset(),
- inclusion.getElementEndingOffset(),
+ inclusion.getNameOffset(),
+ inclusion.getStartingOffset(),
+ inclusion.getEndingOffset(),
inclusion.isLocal());
translationUnit.addInclusion(i);
}
@@ -662,10 +662,10 @@
new NamespaceDefinition(getCurrentDOMScope());
namespaceDef.setName(namespaceDefinition.getName());
((IOffsetable)namespaceDef).setStartingOffset(
- namespaceDefinition.getElementStartingOffset());
+ namespaceDefinition.getStartingOffset());
if (!namespaceDefinition.getName().equals(""))
namespaceDef.setNameOffset(
- namespaceDefinition.getElementNameOffset());
+ namespaceDefinition.getNameOffset());
this.domScopes.push(namespaceDef);
}
/* (non-Javadoc)
@@ -675,7 +675,7 @@
{
SimpleDeclaration decl =
startSimpleDeclaration(
- classSpecification.getElementStartingOffset());
+ classSpecification.getStartingOffset());
int kind = ClassKey.t_struct;
int visibility = AccessSpecifier.v_public;
if (classSpecification.getClassKind() == ASTClassKind.CLASS)
@@ -694,10 +694,10 @@
ClassSpecifier classSpecifier = new ClassSpecifier(kind, decl);
classSpecifier.setVisibility(visibility);
classSpecifier.setStartingOffset(
- classSpecification.getElementStartingOffset());
+ classSpecification.getStartingOffset());
decl.setTypeSpecifier(classSpecifier);
classSpecifier.setName(classSpecification.getName());
- classSpecifier.setNameOffset(classSpecification.getElementNameOffset());
+ classSpecifier.setNameOffset(classSpecification.getNameOffset());
domScopes.push(classSpecifier);
}
protected SimpleDeclaration startSimpleDeclaration(int startingOffset)
@@ -810,9 +810,9 @@
{
ClassSpecifier c = (ClassSpecifier)getCurrentDOMScope();
c.setTotalLength(
- classSpecification.getElementEndingOffset()
+ classSpecification.getEndingOffset()
+ 1
- - classSpecification.getElementStartingOffset());
+ - classSpecification.getStartingOffset());
domScopes.pop();
}
/* (non-Javadoc)
@@ -822,8 +822,8 @@
{
NamespaceDefinition definition = (NamespaceDefinition)domScopes.pop();
definition.setTotalLength(
- namespaceDefinition.getElementEndingOffset()
- - namespaceDefinition.getElementStartingOffset());
+ namespaceDefinition.getEndingOffset()
+ - namespaceDefinition.getStartingOffset());
getCurrentDOMScope().addDeclaration(definition);
}
/* (non-Javadoc)
@@ -851,16 +851,16 @@
public void acceptEnumerationSpecifier(IASTEnumerationSpecifier enumeration)
{
SimpleDeclaration decl =
- startSimpleDeclaration(enumeration.getElementStartingOffset());
+ startSimpleDeclaration(enumeration.getStartingOffset());
EnumerationSpecifier es = new EnumerationSpecifier(decl);
- es.setStartingOffset(enumeration.getElementStartingOffset());
+ es.setStartingOffset(enumeration.getStartingOffset());
es.setStartImage("enum");
decl.setTypeSpecifier(es);
es.setName(enumeration.getName());
es.setTotalLength(
- enumeration.getElementEndingOffset()
+ enumeration.getEndingOffset()
+ 1
- - enumeration.getElementStartingOffset());
+ - enumeration.getStartingOffset());
Iterator i = enumeration.getEnumerators();
while (i.hasNext())
{
@@ -869,11 +869,11 @@
es.addEnumeratorDefinition(definition);
definition.setName(enumerator.getName());
((IOffsetable)definition).setStartingOffset(
- enumerator.getElementNameOffset());
+ enumerator.getNameOffset());
definition.setTotalLength(
- enumerator.getElementEndingOffset()
+ enumerator.getEndingOffset()
+ 1
- - enumerator.getElementStartingOffset());
+ - enumerator.getStartingOffset());
}
}
/* (non-Javadoc)
Index: parser/ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/ChangeLog,v
retrieving revision 1.80
diff -u -r1.80 ChangeLog
--- parser/ChangeLog 18 Jul 2003 16:39:22 -0000 1.80
+++ parser/ChangeLog 21 Jul 2003 17:27:27 -0000
@@ -1,3 +1,8 @@
+2003-07-21 John Camelon
+ Fleshed out basic declarations for FullParse AST.
+ Fixed Bug 40554 - Fields coming back as Vars
+ Fixed Bug 40555 - Methods come back as Functions
+
2003-07-18 John Camelon
Added ISourceElementCallbackDelegate interface for AST constructs to allow the Parser to delegate callback's to the nodes themselves.
Got rid of ParserMode.STRUCTURAL_PARSE for the time being.
Index: parser/org/eclipse/cdt/core/parser/ast/ASTSemanticException.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/ASTSemanticException.java,v
retrieving revision 1.1
diff -u -r1.1 ASTSemanticException.java
--- parser/org/eclipse/cdt/core/parser/ast/ASTSemanticException.java 18 Jul 2003 16:39:22 -0000 1.1
+++ parser/org/eclipse/cdt/core/parser/ast/ASTSemanticException.java 21 Jul 2003 17:27:27 -0000
@@ -20,6 +20,12 @@
{
private final IProblem theProblem;
+ public ASTSemanticException()
+ {
+ theProblem = null;
+ }
+
+
/**
*
*/
@@ -33,7 +39,7 @@
/**
* @return
*/
- public IProblem getTheProblem()
+ public IProblem getProblem()
{
return theProblem;
}
Index: parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java,v
retrieving revision 1.13
diff -u -r1.13 IASTFactory.java
--- parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java 18 Jul 2003 16:39:22 -0000 1.13
+++ parser/org/eclipse/cdt/core/parser/ast/IASTFactory.java 21 Jul 2003 17:27:27 -0000
@@ -15,7 +15,6 @@
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType;
import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor;
import org.eclipse.cdt.internal.core.parser.ast.IASTArrayModifier;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension;
/**
* @author jcamelon
*
@@ -51,7 +50,7 @@
IASTScope scope,
String identifier,
int startingOffset,
- int nameOffset);
+ int nameOffset) throws ASTSemanticException;
public IASTCompilationUnit createCompilationUnit();
public IASTLinkageSpecification createLinkageSpecification(
IASTScope scope,
@@ -62,9 +61,8 @@
ASTClassKind kind,
ClassNameType type,
ASTAccessVisibility access,
- IASTTemplate ownerTemplateDeclaration,
int startingOffset,
- int nameOffset);
+ int nameOffset) throws ASTSemanticException;
/**
* @param astClassSpec
* @param isVirtual
@@ -216,5 +214,4 @@
boolean isPureVirtual,
ASTAccessVisibility visibility, ASTPointerOperator pointerOperator);
- public ISymbolASTExtension createSymbolTableDeclarationExtension( IASTDeclaration declaration, IASTDeclaration definition ) throws ASTNotImplementedException;
}
Index: parser/org/eclipse/cdt/core/parser/ast/IASTOffsetableElement.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTOffsetableElement.java,v
retrieving revision 1.2
diff -u -r1.2 IASTOffsetableElement.java
--- parser/org/eclipse/cdt/core/parser/ast/IASTOffsetableElement.java 13 Jun 2003 15:01:22 -0000 1.2
+++ parser/org/eclipse/cdt/core/parser/ast/IASTOffsetableElement.java 21 Jul 2003 17:27:27 -0000
@@ -19,8 +19,7 @@
public void setStartingOffset( int o );
public void setEndingOffset( int o );
- public int getElementStartingOffset();
- public int getElementEndingOffset();
-
+ public int getStartingOffset();
+ public int getEndingOffset();
}
Index: parser/org/eclipse/cdt/core/parser/ast/IASTOffsetableNamedElement.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTOffsetableNamedElement.java,v
retrieving revision 1.3
diff -u -r1.3 IASTOffsetableNamedElement.java
--- parser/org/eclipse/cdt/core/parser/ast/IASTOffsetableNamedElement.java 17 Jul 2003 20:15:13 -0000 1.3
+++ parser/org/eclipse/cdt/core/parser/ast/IASTOffsetableNamedElement.java 21 Jul 2003 17:27:27 -0000
@@ -18,6 +18,6 @@
public interface IASTOffsetableNamedElement extends IASTOffsetableElement {
public String getName();
- public int getElementNameOffset();
- public void setElementNameOffset( int o );
+ public int getNameOffset();
+ public void setNameOffset( int o );
}
Index: parser/org/eclipse/cdt/core/parser/ast/IASTScope.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTScope.java,v
retrieving revision 1.2
diff -u -r1.2 IASTScope.java
--- parser/org/eclipse/cdt/core/parser/ast/IASTScope.java 13 Jun 2003 15:01:22 -0000 1.2
+++ parser/org/eclipse/cdt/core/parser/ast/IASTScope.java 21 Jul 2003 17:27:27 -0000
@@ -18,5 +18,5 @@
*/
public interface IASTScope {
- public Iterator getDeclarations();
+ public Iterator getDeclarations() throws ASTNotImplementedException;
}
Index: parser/org/eclipse/cdt/core/parser/ast/IASTScopedElement.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTScopedElement.java,v
retrieving revision 1.1
diff -u -r1.1 IASTScopedElement.java
--- parser/org/eclipse/cdt/core/parser/ast/IASTScopedElement.java 17 Jul 2003 20:15:13 -0000 1.1
+++ parser/org/eclipse/cdt/core/parser/ast/IASTScopedElement.java 21 Jul 2003 17:27:27 -0000
@@ -16,5 +16,5 @@
*/
public interface IASTScopedElement
{
- IASTScope getOwnerScope();
+ IASTScope getOwnerScope();
}
Index: parser/org/eclipse/cdt/core/parser/ast/IASTUsingDirective.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/ast/IASTUsingDirective.java,v
retrieving revision 1.3
diff -u -r1.3 IASTUsingDirective.java
--- parser/org/eclipse/cdt/core/parser/ast/IASTUsingDirective.java 17 Jul 2003 20:15:13 -0000 1.3
+++ parser/org/eclipse/cdt/core/parser/ast/IASTUsingDirective.java 21 Jul 2003 17:27:27 -0000
@@ -17,4 +17,5 @@
public interface IASTUsingDirective extends IASTDeclaration, IASTOffsetableElement {
public String getNamespaceName();
+ public IASTNamespaceDefinition getNamespaceDefinition() throws ASTNotImplementedException;
}
Index: parser/org/eclipse/cdt/internal/core/parser/ContextStack.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ContextStack.java,v
retrieving revision 1.10
diff -u -r1.10 ContextStack.java
--- parser/org/eclipse/cdt/internal/core/parser/ContextStack.java 18 Jul 2003 16:39:22 -0000 1.10
+++ parser/org/eclipse/cdt/internal/core/parser/ContextStack.java 21 Jul 2003 17:27:27 -0000
@@ -55,7 +55,9 @@
}
undoStack.clear();
- push( new ScannerContext().initialize(reader, filename, type, null, macroOffset, macroLength, startLine ), requestor );
+ IScannerContext context = new ScannerContext().initialize(reader, filename, type, null, macroOffset, macroLength, startLine );
+ context.setExtension(inclusion);
+ push( context, requestor );
}
protected void push( IScannerContext context, ISourceElementRequestor requestor ) throws ScannerException
Index: parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java,v
retrieving revision 1.7
diff -u -r1.7 DeclarationWrapper.java
--- parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java 17 Jul 2003 20:15:13 -0000 1.7
+++ parser/org/eclipse/cdt/internal/core/parser/DeclarationWrapper.java 21 Jul 2003 17:27:27 -0000
@@ -312,7 +312,7 @@
*/
private IASTDeclaration createASTNode(Declarator declarator)
{
- boolean isWithinClass = (getScope() instanceof IASTClassSpecifier);
+ boolean isWithinClass = (getScope() instanceof IASTClassSpecifier); //TODO fix this for COMPLETE_PARSE
boolean isFunction = declarator.isFunction();
boolean hasInnerDeclarator = ( declarator.getOwnedDeclarator() != null );
Index: parser/org/eclipse/cdt/internal/core/parser/Parser.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/Parser.java,v
retrieving revision 1.72
diff -u -r1.72 Parser.java
--- parser/org/eclipse/cdt/internal/core/parser/Parser.java 18 Jul 2003 16:39:22 -0000 1.72
+++ parser/org/eclipse/cdt/internal/core/parser/Parser.java 21 Jul 2003 17:27:29 -0000
@@ -684,12 +684,21 @@
if (LT(1) == IToken.tLBRACE)
{
consume();
- IASTNamespaceDefinition namespaceDefinition =
- astFactory.createNamespaceDefinition(
- scope,
- (identifier == null ? "" : identifier.getImage()),
- first.getOffset(),
- (identifier == null ? 0 : identifier.getOffset()));
+ IASTNamespaceDefinition namespaceDefinition = null;
+ try
+ {
+ namespaceDefinition =
+ astFactory.createNamespaceDefinition(
+ scope,
+ (identifier == null ? "" : identifier.getImage()),
+ first.getOffset(),
+ (identifier == null ? 0 : identifier.getOffset()));
+ }
+ catch (ASTSemanticException e)
+ {
+ // TODO Auto-generated catch block
+
+ }
namespaceDefinition.enterScope( requestor );
namepsaceDeclarationLoop : while (LT(1) != IToken.tRBRACE)
{
@@ -2215,17 +2224,25 @@
backup(mark);
throw backtrack;
}
- IASTClassSpecifier astClassSpecifier =
- astFactory
- .createClassSpecifier(
- sdw.getScope(),
- duple == null ? "" : duple.toString(),
- classKind,
- nameType,
- access,
- null, //TODO add TemplateDeclaration here
- classKey.getOffset(),
- duple == null ? 0 : duple.getFirstToken().getOffset());
+ IASTClassSpecifier astClassSpecifier = null;
+
+ try
+ {
+ astClassSpecifier =
+ astFactory
+ .createClassSpecifier(
+ sdw.getScope(),
+ duple == null ? "" : duple.toString(),
+ classKind,
+ nameType,
+ access,
+ classKey.getOffset(),
+ duple == null ? 0 : duple.getFirstToken().getOffset());
+ }
+ catch (ASTSemanticException e)
+ {
+ // TODO Auto-generated catch block`
+ }
sdw.setTypeSpecifier(astClassSpecifier);
// base clause
if (LT(1) == IToken.tCOLON)
Index: parser/org/eclipse/cdt/internal/core/parser/QuickParseCallback.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/QuickParseCallback.java,v
retrieving revision 1.1
diff -u -r1.1 QuickParseCallback.java
--- parser/org/eclipse/cdt/internal/core/parser/QuickParseCallback.java 17 Jul 2003 20:15:13 -0000 1.1
+++ parser/org/eclipse/cdt/internal/core/parser/QuickParseCallback.java 21 Jul 2003 17:27:29 -0000
@@ -16,6 +16,7 @@
import java.util.NoSuchElementException;
import org.eclipse.cdt.core.parser.IQuickParseCallback;
+import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
import org.eclipse.cdt.core.parser.ast.IASTMacro;
@@ -63,7 +64,7 @@
public class OffsetableIterator implements Iterator
{
- private final Iterator declarationIter;
+ private Iterator declarationIter;
private final Iterator inclusionIter;
private final Iterator macroIter;
@@ -71,7 +72,14 @@
public OffsetableIterator()
{
- declarationIter = compilationUnit.getDeclarations();
+ try
+ {
+ declarationIter = compilationUnit.getDeclarations();
+ }
+ catch (ASTNotImplementedException ne )
+ {
+
+ }
inclusionIter = inclusions.iterator();
macroIter = macros.iterator();
updateInclusionIterator();
@@ -125,30 +133,30 @@
// case 3: 1 is null
if( currentMacro == null )
- if( currentDeclaration.getElementStartingOffset() < currentInclusion.getElementStartingOffset() )
+ if( currentDeclaration.getStartingOffset() < currentInclusion.getStartingOffset() )
return updateDeclarationIterator();
else
return updateInclusionIterator();
if( currentInclusion == null )
- if( currentDeclaration.getElementStartingOffset() < currentMacro.getElementStartingOffset() )
+ if( currentDeclaration.getStartingOffset() < currentMacro.getStartingOffset() )
return updateDeclarationIterator();
else
return updateMacroIterator();
if( currentDeclaration == null )
- if( currentInclusion.getElementStartingOffset() < currentMacro.getElementStartingOffset() )
+ if( currentInclusion.getStartingOffset() < currentMacro.getStartingOffset() )
return updateInclusionIterator();
else
return updateMacroIterator();
// case 4: none are null
- if( currentInclusion.getElementStartingOffset() < currentMacro.getElementStartingOffset() &&
- currentInclusion.getElementStartingOffset() < currentDeclaration.getElementStartingOffset() )
+ if( currentInclusion.getStartingOffset() < currentMacro.getStartingOffset() &&
+ currentInclusion.getStartingOffset() < currentDeclaration.getStartingOffset() )
return updateInclusionIterator();
- if( currentMacro.getElementStartingOffset() < currentInclusion.getElementStartingOffset() &&
- currentMacro.getElementStartingOffset() < currentDeclaration.getElementStartingOffset() )
+ if( currentMacro.getStartingOffset() < currentInclusion.getStartingOffset() &&
+ currentMacro.getStartingOffset() < currentDeclaration.getStartingOffset() )
return updateMacroIterator();
// only remaining case
return updateDeclarationIterator();
Index: parser/org/eclipse/cdt/internal/core/parser/TokenDuple.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/TokenDuple.java,v
retrieving revision 1.6
diff -u -r1.6 TokenDuple.java
--- parser/org/eclipse/cdt/internal/core/parser/TokenDuple.java 17 Jul 2003 20:15:13 -0000 1.6
+++ parser/org/eclipse/cdt/internal/core/parser/TokenDuple.java 21 Jul 2003 17:27:29 -0000
@@ -11,6 +11,7 @@
package org.eclipse.cdt.internal.core.parser;
import java.util.Iterator;
+import java.util.NoSuchElementException;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.ITokenDuple;
@@ -61,6 +62,8 @@
* @see java.util.Iterator#next()
*/
public Object next() {
+ if( ! hasNext() )
+ throw new NoSuchElementException();
IToken temp = iter;
iter = iter.getNext();
return temp;
Index: parser/org/eclipse/cdt/internal/core/parser/ast/ASTInclusion.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTInclusion.java,v
retrieving revision 1.4
diff -u -r1.4 ASTInclusion.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/ASTInclusion.java 18 Jul 2003 16:39:22 -0000 1.4
+++ parser/org/eclipse/cdt/internal/core/parser/ast/ASTInclusion.java 21 Jul 2003 17:27:30 -0000
@@ -55,21 +55,21 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementStartingOffset()
*/
- public int getElementStartingOffset() {
+ public int getStartingOffset() {
return startingOffset;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementEndingOffset()
*/
- public int getElementEndingOffset() {
+ public int getEndingOffset() {
return endingOffset;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementNameOffset()
*/
- public int getElementNameOffset() {
+ public int getNameOffset() {
return nameOffset;
}
@@ -91,7 +91,7 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.ast.IOffsetableElementRW#setNameOffset(int)
*/
- public void setElementNameOffset(int o) {
+ public void setNameOffset(int o) {
nameOffset = o;
}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/ASTMacro.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/ASTMacro.java,v
retrieving revision 1.4
diff -u -r1.4 ASTMacro.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/ASTMacro.java 18 Jul 2003 16:39:22 -0000 1.4
+++ parser/org/eclipse/cdt/internal/core/parser/ast/ASTMacro.java 21 Jul 2003 17:27:30 -0000
@@ -48,25 +48,25 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElementRW#setNameOffset(int)
*/
- public void setElementNameOffset(int o) {
+ public void setNameOffset(int o) {
nameOffset = o;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementStartingOffset()
*/
- public int getElementStartingOffset() {
+ public int getStartingOffset() {
return startingOffset;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementEndingOffset()
*/
- public int getElementEndingOffset() {
+ public int getEndingOffset() {
return endingOffset;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementNameOffset()
*/
- public int getElementNameOffset() {
+ public int getNameOffset() {
return nameOffset;
}
/* (non-Javadoc)
Index: parser/org/eclipse/cdt/internal/core/parser/ast/ASTQualifiedNamedElement.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ast/ASTQualifiedNamedElement.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ast/ASTQualifiedNamedElement.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/parser/ast/ASTQualifiedNamedElement.java 21 Jul 2003 17:27:30 -0000
@@ -0,0 +1,69 @@
+/**********************************************************************
+ * 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;
+
+import java.util.Stack;
+
+import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
+import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
+import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement;
+import org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement;
+import org.eclipse.cdt.core.parser.ast.IASTScope;
+import org.eclipse.cdt.core.parser.ast.IASTScopedElement;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class ASTQualifiedNamedElement implements IASTQualifiedNameElement
+{
+
+ /**
+ * @param scope
+ */
+ public ASTQualifiedNamedElement(IASTScope scope, String name )
+ {
+ Stack names = new Stack();
+ IASTScope parent = scope;
+
+ names.push( name ); // push on our own name
+ while (parent != null)
+ {
+ if (parent instanceof IASTNamespaceDefinition
+ || parent instanceof IASTClassSpecifier )
+ {
+ names.push(((IASTOffsetableNamedElement)parent).getName());
+ if( parent instanceof IASTScopedElement )
+ parent = ((IASTScopedElement)parent).getOwnerScope();
+ }
+ else
+ break;
+ }
+ if (names.size() != 0)
+ {
+ qualifiedNames = new String[names.size()];
+ int counter = 0;
+ while (!names.empty())
+ qualifiedNames[counter++] = (String)names.pop();
+ }
+ else
+ qualifiedNames = null;
+
+ }
+
+ public String[] getFullyQualifiedName()
+ {
+ return qualifiedNames;
+ }
+
+ private final String[] qualifiedNames;
+
+}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java,v
retrieving revision 1.3
diff -u -r1.3 BaseASTFactory.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java 17 Jul 2003 20:15:13 -0000 1.3
+++ parser/org/eclipse/cdt/internal/core/parser/ast/BaseASTFactory.java 21 Jul 2003 17:27:30 -0000
@@ -27,7 +27,7 @@
IASTMacro m = new ASTMacro( name );
m.setStartingOffset( startingOffset );
m.setEndingOffset( endingOffset );
- m.setElementNameOffset( nameOffset );
+ m.setNameOffset( nameOffset );
return m;
}
@@ -38,7 +38,7 @@
IASTInclusion inclusion = new ASTInclusion( name, fileName, local );
inclusion.setStartingOffset( startingOffset );
inclusion.setEndingOffset( endingOffset );
- inclusion.setElementNameOffset( nameOffset );
+ inclusion.setNameOffset( nameOffset );
return inclusion;
}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/NamedOffsets.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/NamedOffsets.java,v
retrieving revision 1.2
diff -u -r1.2 NamedOffsets.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/NamedOffsets.java 13 Jun 2003 15:01:22 -0000 1.2
+++ parser/org/eclipse/cdt/internal/core/parser/ast/NamedOffsets.java 21 Jul 2003 17:27:30 -0000
@@ -22,7 +22,7 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
*/
- public int getElementNameOffset() {
+ public int getNameOffset() {
return nameOffset;
}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/Offsets.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/Offsets.java,v
retrieving revision 1.2
diff -u -r1.2 Offsets.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/Offsets.java 13 Jun 2003 15:01:22 -0000 1.2
+++ parser/org/eclipse/cdt/internal/core/parser/ast/Offsets.java 21 Jul 2003 17:27:30 -0000
@@ -28,11 +28,11 @@
endingOffset = o;
}
- public int getElementStartingOffset() {
+ public int getStartingOffset() {
return startingOffset;
}
- public int getElementEndingOffset() {
+ public int getEndingOffset() {
return endingOffset;
}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTAbstractTypeSpecifierDeclaration.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTAbstractTypeSpecifierDeclaration.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTAbstractTypeSpecifierDeclaration.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTAbstractTypeSpecifierDeclaration.java 21 Jul 2003 17:27:30 -0000
@@ -0,0 +1,113 @@
+/**********************************************************************
+ * 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.ISourceElementRequestor;
+import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTTemplate;
+import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
+import org.eclipse.cdt.internal.core.parser.ast.Offsets;
+import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
+
+
+/**
+ * @author jcamelon
+ *
+ */
+public class ASTAbstractTypeSpecifierDeclaration
+ extends ASTAnonymousDeclaration
+ implements IASTAbstractTypeSpecifierDeclaration
+{
+ private final IASTTypeSpecifier typeSpec;
+ private final IASTTemplate ownerTemplate;
+ private Offsets offsets = new Offsets();
+ /**
+ * @param ownerScope
+ */
+ public ASTAbstractTypeSpecifierDeclaration(IContainerSymbol ownerScope, IASTTypeSpecifier typeSpecifier, IASTTemplate ownerTemplate, int startingOffset, int endingOffset )
+ {
+ super(ownerScope);
+ this.typeSpec = typeSpecifier;
+ this.ownerTemplate = ownerTemplate;
+ setStartingOffset(startingOffset);
+ setEndingOffset(endingOffset);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+ */
+ public void acceptElement(ISourceElementRequestor requestor)
+ {
+ requestor.acceptAbstractTypeSpecDeclaration(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)
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTTypeSpecifierOwner#getTypeSpecifier()
+ */
+ public IASTTypeSpecifier getTypeSpecifier()
+ {
+ return typeSpec;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTTemplatedDeclaration#getOwnerTemplateDeclaration()
+ */
+ public IASTTemplate getOwnerTemplateDeclaration()
+ {
+ return ownerTemplate;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
+ */
+ public void setStartingOffset(int o)
+ {
+ offsets.setStartingOffset(o);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
+ */
+ public void setEndingOffset(int o)
+ {
+ offsets.setEndingOffset(o);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
+ */
+ public int getStartingOffset()
+ {
+ return offsets.getStartingOffset();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
+ */
+ public int getEndingOffset()
+ {
+ return offsets.getEndingOffset();
+ }
+}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTAnonymousDeclaration.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTAnonymousDeclaration.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTAnonymousDeclaration.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTAnonymousDeclaration.java 21 Jul 2003 17:27:30 -0000
@@ -0,0 +1,39 @@
+/**********************************************************************
+ * 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.ast.IASTDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTScope;
+import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
+
+/**
+ * @author jcamelon
+ *
+ */
+public abstract class ASTAnonymousDeclaration implements IASTDeclaration
+{
+ private final IContainerSymbol ownerScope;
+ /**
+ *
+ */
+ public ASTAnonymousDeclaration( IContainerSymbol ownerScope )
+ {
+ this.ownerScope = ownerScope;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTScopedElement#getOwnerScope()
+ */
+ public IASTScope getOwnerScope()
+ {
+ return (IASTScope)ownerScope.getASTExtension().getPrimaryDeclaration();
+ }
+
+}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassSpecifier.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassSpecifier.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassSpecifier.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTClassSpecifier.java 21 Jul 2003 17:27:30 -0000
@@ -0,0 +1,171 @@
+/**********************************************************************
+ * 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 java.util.Iterator;
+
+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.IASTClassSpecifier;
+import org.eclipse.cdt.core.parser.ast.IASTScope;
+import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
+import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
+import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class ASTClassSpecifier extends ASTScope implements IASTClassSpecifier
+{
+ private NamedOffsets offsets = new NamedOffsets();
+ private final ClassNameType classNameType;
+ private final ASTClassKind classKind;
+ private ASTAccessVisibility currentVisibility;
+ private final ASTQualifiedNamedElement qualifiedName;
+
+ /**
+ * @param symbol
+ */
+ public ASTClassSpecifier(ISymbol symbol, ASTClassKind kind, ClassNameType type, ASTAccessVisibility access, int startingOffset, int nameOffset )
+ {
+ super(symbol);
+ classKind = kind;
+ classNameType = type;
+ currentVisibility = access;
+ setStartingOffset(startingOffset);
+ setNameOffset(nameOffset);
+ qualifiedName = new ASTQualifiedNamedElement( getOwnerScope(), symbol.getName() );
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getClassNameType()
+ */
+ public ClassNameType getClassNameType()
+ {
+ return classNameType;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getClassKind()
+ */
+ public ASTClassKind getClassKind()
+ {
+ return classKind;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getBaseClauses()
+ */
+ public Iterator getBaseClauses()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getCurrentVisibilityMode()
+ */
+ public ASTAccessVisibility getCurrentVisibilityMode()
+ {
+ return currentVisibility;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#setCurrentVisibility(org.eclipse.cdt.core.parser.ast.ASTAccessVisibility)
+ */
+ public void setCurrentVisibility(ASTAccessVisibility visibility)
+ {
+ currentVisibility = visibility;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
+ */
+ public String getName()
+ {
+ return symbol.getName();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameOffset()
+ */
+ public int getNameOffset()
+ {
+ return offsets.getNameOffset();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
+ */
+ public void setNameOffset(int o)
+ {
+ offsets.setNameOffset(o);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.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)
+ {
+ //TODO Iterate baseClauses and callback on their references
+ requestor.enterClassSpecifier(this);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+ */
+ public void exitScope(ISourceElementRequestor requestor)
+ {
+ requestor.exitClassSpecifier(this);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
+ */
+ public void setStartingOffset(int o)
+ {
+ offsets.setStartingOffset(o);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
+ */
+ public void setEndingOffset(int o)
+ {
+ offsets.setEndingOffset(o);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
+ */
+ public int getStartingOffset()
+ {
+ return offsets.getStartingOffset();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
+ */
+ public int getEndingOffset()
+ {
+ return offsets.getEndingOffset();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
+ */
+ public String[] getFullyQualifiedName()
+ {
+ return qualifiedName.getFullyQualifiedName();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTScopedElement#getOwnerScope()
+ */
+ public IASTScope getOwnerScope()
+ {
+ return (IASTScope)symbol.getContainingSymbol().getASTExtension().getPrimaryDeclaration();
+ }
+}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCompilationUnit.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCompilationUnit.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCompilationUnit.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTCompilationUnit.java 21 Jul 2003 17:27:30 -0000
@@ -0,0 +1,53 @@
+/**********************************************************************
+ * 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.ISourceElementRequestor;
+import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
+import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class ASTCompilationUnit
+ extends ASTScope
+ implements IASTCompilationUnit
+{
+ /**
+ * @param symbol
+ */
+ public ASTCompilationUnit(ISymbol symbol)
+ {
+ super(symbol);
+ }
+
+ /* (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)
+ {
+ requestor.enterCompilationUnit( this );
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+ */
+ public void exitScope(ISourceElementRequestor requestor)
+ {
+ requestor.exitCompilationUnit( this );
+ }
+}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceDefinition.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceDefinition.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceDefinition.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTNamespaceDefinition.java 21 Jul 2003 17:27:30 -0000
@@ -0,0 +1,131 @@
+/**********************************************************************
+ * 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.ISourceElementRequestor;
+import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
+import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
+import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
+import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class ASTNamespaceDefinition
+ extends ASTScope
+ implements IASTNamespaceDefinition
+{
+
+ private NamedOffsets namedOffsets = new NamedOffsets();
+ private final ASTQualifiedNamedElement qualifiedName;
+
+ /**
+ * @param namespaceSymbol
+ * @param startingOffset
+ * @param nameOffset
+ */
+ public ASTNamespaceDefinition(ISymbol namespaceSymbol, int startingOffset, int nameOffset)
+ {
+ super( namespaceSymbol );
+ setStartingOffset( startingOffset );
+ setNameOffset( nameOffset );
+ qualifiedName = new ASTQualifiedNamedElement( getOwnerScope(), namespaceSymbol.getName() );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
+ */
+ public String getName()
+ {
+ return symbol.getName();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getNameOffset()
+ */
+ public int getNameOffset()
+ {
+ return namedOffsets.getNameOffset();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
+ */
+ public void setNameOffset(int o)
+ {
+ namedOffsets.setNameOffset( o );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
+ */
+ public void setStartingOffset(int o)
+ {
+ namedOffsets.setStartingOffset(o);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
+ */
+ public void setEndingOffset(int o)
+ {
+ namedOffsets.setEndingOffset(o);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getStartingOffset()
+ */
+ public int getStartingOffset()
+ {
+ return namedOffsets.getStartingOffset();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getEndingOffset()
+ */
+ public int getEndingOffset()
+ {
+ return namedOffsets.getEndingOffset();
+ }
+
+ /* (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)
+ {
+ requestor.enterNamespaceDefinition( this );
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+ */
+ public void exitScope(ISourceElementRequestor requestor)
+ {
+ requestor.exitNamespaceDefinition( this );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
+ */
+ public String[] getFullyQualifiedName()
+ {
+ return qualifiedName.getFullyQualifiedName();
+ }
+}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTScope.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTScope.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTScope.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTScope.java 21 Jul 2003 17:27:30 -0000
@@ -0,0 +1,46 @@
+/**********************************************************************
+ * 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 java.util.Iterator;
+
+import org.eclipse.cdt.core.parser.ast.IASTScope;
+import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
+import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
+
+/**
+ * @author jcamelon
+ *
+ */
+public abstract class ASTScope extends ASTSymbol implements IASTScope
+{
+ /**
+ * @param symbol
+ */
+ public ASTScope(ISymbol symbol)
+ {
+ super(symbol);
+ }
+
+ public IContainerSymbol getContainerSymbol()
+ {
+ return (IContainerSymbol)symbol;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTScope#getDeclarations()
+ */
+ public Iterator getDeclarations()
+ {
+ return new ScopeIterator( getContainerSymbol().getContainedSymbols() );
+ }
+
+}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSymbol.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSymbol.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSymbol.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSymbol.java 21 Jul 2003 17:27:30 -0000
@@ -0,0 +1,38 @@
+/**********************************************************************
+ * 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.ast.IASTDeclaration;
+import org.eclipse.cdt.core.parser.ast.IASTScope;
+import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
+import org.eclipse.cdt.internal.core.parser.pst.ISymbolOwner;
+
+/**
+ * @author jcamelon
+ *
+ */
+public abstract class ASTSymbol extends ASTSymbolOwner implements ISymbolOwner, IASTDeclaration
+{
+
+ public ASTSymbol( ISymbol symbol )
+ {
+ super(symbol);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTScopedElement#getOwnerScope()
+ */
+ public IASTScope getOwnerScope()
+ {
+ return (IASTScope)symbol.getContainingSymbol().getASTExtension().getPrimaryDeclaration();
+ }
+
+}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSymbolOwner.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSymbolOwner.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSymbolOwner.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTSymbolOwner.java 21 Jul 2003 17:27:30 -0000
@@ -0,0 +1,37 @@
+/**********************************************************************
+ * 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.internal.core.parser.pst.ISymbol;
+import org.eclipse.cdt.internal.core.parser.pst.ISymbolOwner;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class ASTSymbolOwner implements ISymbolOwner
+{
+ protected final ISymbol symbol;
+ /**
+ *
+ */
+ public ASTSymbolOwner( ISymbol symbol )
+ {
+ this.symbol = symbol;
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.parser.pst.ISymbolOwner#getSymbol()
+ */
+ public ISymbol getSymbol()
+ {
+ return symbol;
+ }
+}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTUsingDirective.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTUsingDirective.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTUsingDirective.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/ASTUsingDirective.java 21 Jul 2003 17:27:30 -0000
@@ -0,0 +1,114 @@
+/**********************************************************************
+ * 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.ISourceElementRequestor;
+import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
+import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
+import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
+import org.eclipse.cdt.internal.core.parser.ast.Offsets;
+import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class ASTUsingDirective extends ASTAnonymousDeclaration implements IASTUsingDirective
+{
+ private final IASTNamespaceDefinition namespace;
+ private Offsets offsets = new Offsets();
+ /**
+ * @param namespaceDefinition
+ * @param startingOffset
+ * @param endingOffset
+ */
+ public ASTUsingDirective(IContainerSymbol ownerSymbol, IASTNamespaceDefinition namespaceDefinition, int startingOffset, int endingOffset)
+ {
+ super( ownerSymbol );
+ namespace = namespaceDefinition;
+ setStartingOffset(startingOffset);
+ setEndingOffset(endingOffset);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTUsingDirective#getNamespaceName()
+ */
+ public String getNamespaceName()
+ {
+ String [] fqn = namespace.getFullyQualifiedName();
+ StringBuffer buffer = new StringBuffer();
+ for( int i = 0; i < fqn.length; ++i )
+ {
+ buffer.append( fqn[ i ] );
+ if( i + 1 != fqn.length )
+ buffer.append( "::");
+ }
+ return buffer.toString();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
+ */
+ public void setStartingOffset(int o)
+ {
+ offsets.setStartingOffset(o);
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
+ */
+ public void setEndingOffset(int o)
+ {
+ offsets.setEndingOffset( o );
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
+ */
+ public int getStartingOffset()
+ {
+ return offsets.getStartingOffset();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
+ */
+ public int getEndingOffset()
+ {
+ return offsets.getEndingOffset();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+ */
+ public void acceptElement(ISourceElementRequestor requestor)
+ {
+ // TODO Auto-generated method stub
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+ */
+ public void enterScope(ISourceElementRequestor requestor)
+ {
+ // TODO Auto-generated method stub
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
+ */
+ public void exitScope(ISourceElementRequestor requestor)
+ {
+ // TODO Auto-generated method stub
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTUsingDirective#getNamespaceDefinition()
+ */
+ public IASTNamespaceDefinition getNamespaceDefinition() throws ASTNotImplementedException
+ {
+ return namespace;
+ }
+}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java,v
retrieving revision 1.1
diff -u -r1.1 CompleteParseASTFactory.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java 18 Jul 2003 16:39:22 -0000 1.1
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/CompleteParseASTFactory.java 21 Jul 2003 17:27:30 -0000
@@ -10,12 +10,13 @@
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.complete;
+import java.util.Iterator;
import java.util.List;
+import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.ITokenDuple;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.core.parser.ast.ASTClassKind;
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
import org.eclipse.cdt.core.parser.ast.ASTSemanticException;
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
@@ -24,7 +25,6 @@
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
@@ -58,7 +58,16 @@
import org.eclipse.cdt.core.parser.ast.IASTTemplateParameter.ParamKind;
import org.eclipse.cdt.internal.core.parser.ast.BaseASTFactory;
import org.eclipse.cdt.internal.core.parser.ast.IASTArrayModifier;
+import org.eclipse.cdt.internal.core.parser.pst.ForewardDeclaredSymbolExtension;
+import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
+import org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol;
+import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
import org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension;
+import org.eclipse.cdt.internal.core.parser.pst.NamespaceSymbolExtension;
+import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable;
+import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTableException;
+import org.eclipse.cdt.internal.core.parser.pst.StandardSymbolExtension;
+import org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension.ExtensionException;
/**
* @author jcamelon
@@ -84,8 +93,62 @@
int endingOffset)
throws ASTSemanticException
{
- // TODO Auto-generated method stub
- return null;
+ Iterator iter = duple.iterator();
+ if( ! iter.hasNext() )
+ throw new ASTSemanticException();
+
+ IToken t1 = (IToken)iter.next();
+ IContainerSymbol symbol = null;
+
+ symbol = getScopeToSearchUpon(scope, t1 );
+
+ while( iter.hasNext() )
+ {
+ IToken t = (IToken)iter.next();
+ if( t.getType() == IToken.tCOLONCOLON ) continue;
+ try
+ {
+ symbol = symbol.LookupNestedNameSpecifier( t.getImage() );
+ }
+ catch( ParserSymbolTableException pste )
+ {
+ throw new ASTSemanticException();
+ }
+ }
+
+ try {
+ ((ASTScope)scope).getContainerSymbol().addUsingDirective( symbol );
+ } catch (ParserSymbolTableException pste) {
+ }
+
+ IASTUsingDirective astUD = new ASTUsingDirective( scopeToSymbol(scope), ((IASTNamespaceDefinition)symbol.getASTExtension().getPrimaryDeclaration()), startingOffset, endingOffset );
+ return astUD;
+ }
+
+
+ protected IContainerSymbol getScopeToSearchUpon(
+ IASTScope currentScope,
+ IToken firstToken )
+ {
+ IContainerSymbol symbol = null;
+ if( firstToken.getType() == IToken.tCOLONCOLON )
+ symbol = pst.getCompilationUnit();
+ else
+ {
+ try
+ {
+ symbol = (IContainerSymbol)scopeToSymbol(currentScope).Lookup( firstToken.getImage() );
+ }
+ catch( ParserSymbolTableException pste )
+ {
+
+ }
+ }
+ return symbol;
+ }
+ protected IContainerSymbol scopeToSymbol(IASTScope currentScope)
+ {
+ return ((ASTScope)currentScope).getContainerSymbol();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createUsingDeclaration(org.eclipse.cdt.core.parser.ast.IASTScope, boolean, org.eclipse.cdt.core.parser.ITokenDuple, int, int)
@@ -119,19 +182,99 @@
IASTScope scope,
String identifier,
int startingOffset,
- int nameOffset)
+ int nameOffset) throws ASTSemanticException
{
- // TODO Auto-generated method stub
- return null;
+ // first we look up the symbol in the PST see if it already exists
+ // if not we create it
+ // TODO : handle the anonymous case
+
+ IContainerSymbol pstScope = scopeToSymbol(scope);
+ ISymbol namespaceSymbol = null;
+ try
+ {
+ namespaceSymbol = pstScope.Lookup( identifier );
+ }
+ catch (ParserSymbolTableException e)
+ {
+ throw new ASTSemanticException();
+ }
+
+ if( namespaceSymbol != null )
+ {
+ if( namespaceSymbol.getType() != ParserSymbolTable.TypeInfo.t_namespace )
+ throw new ASTSemanticException();
+ }
+ else
+ {
+ namespaceSymbol = pst.newContainerSymbol( identifier, ParserSymbolTable.TypeInfo.t_namespace );
+ try
+ {
+ pstScope.addSymbol( namespaceSymbol );
+ }
+ catch (ParserSymbolTableException e1)
+ {
+ // not overloading, should never happen
+ }
+ }
+
+ ASTNamespaceDefinition namespaceDef = new ASTNamespaceDefinition( namespaceSymbol, startingOffset, nameOffset );
+ try
+ {
+ attachSymbolExtension( namespaceSymbol, namespaceDef );
+ }
+ catch (ExtensionException e1)
+ {
+ // will not happen with namespaces
+ }
+ return namespaceDef;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createCompilationUnit()
*/
public IASTCompilationUnit createCompilationUnit()
{
- // TODO Auto-generated method stub
- return null;
- }
+ ISymbol symbol = pst.getCompilationUnit();
+ ASTCompilationUnit compilationUnit = new ASTCompilationUnit( symbol );
+ try
+ {
+ attachSymbolExtension(symbol, compilationUnit );
+ }
+ catch (ExtensionException e)
+ {
+ //should not happen with CompilationUnit
+ }
+ return compilationUnit;
+ }
+
+
+ protected void attachSymbolExtension(
+ ISymbol symbol,
+ ASTSymbol astSymbol ) throws ExtensionException
+ {
+ ISymbolASTExtension extension = symbol.getASTExtension();
+ if( extension == null )
+ {
+ if( astSymbol instanceof IASTNamespaceDefinition )
+ extension = new NamespaceSymbolExtension( symbol, astSymbol );
+ else if( astSymbol instanceof IASTFunction ) // TODO : other foreward declare cases
+ {
+ extension = new ForewardDeclaredSymbolExtension( symbol, astSymbol );
+ }
+ else
+ {
+ extension = new StandardSymbolExtension( symbol, astSymbol );
+ }
+ symbol.setASTExtension( extension );
+ }
+ else
+ {
+ extension.addDefinition( astSymbol );
+ }
+
+
+
+ }
+
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createLinkageSpecification(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, int)
*/
@@ -152,12 +295,41 @@
ASTClassKind kind,
ClassNameType type,
ASTAccessVisibility access,
- IASTTemplate ownerTemplateDeclaration,
int startingOffset,
- int nameOffset)
+ int nameOffset) throws ASTSemanticException
{
- // TODO Auto-generated method stub
- return null;
+ IContainerSymbol containerSymbol = scopeToSymbol(scope);
+ ParserSymbolTable.TypeInfo.eType pstType = null;
+
+ if( kind == ASTClassKind.CLASS )
+ pstType = ParserSymbolTable.TypeInfo.t_class;
+ else if( kind == ASTClassKind.STRUCT )
+ pstType = ParserSymbolTable.TypeInfo.t_struct;
+ else if( kind == ASTClassKind.UNION )
+ pstType = ParserSymbolTable.TypeInfo.t_union;
+ else
+ throw new ASTSemanticException();
+
+ IDerivableContainerSymbol classSymbol = pst.newDerivableContainerSymbol( name, pstType );
+ try
+ {
+ containerSymbol.addSymbol( classSymbol );
+ }
+ catch (ParserSymbolTableException e)
+ {
+ throw new ASTSemanticException();
+ }
+
+ ASTClassSpecifier classSpecifier = new ASTClassSpecifier( classSymbol, kind, type, access, startingOffset, nameOffset );
+ try
+ {
+ attachSymbolExtension(classSymbol, classSpecifier );
+ }
+ catch (ExtensionException e1)
+ {
+ throw new ASTSemanticException();
+ }
+ return classSpecifier;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#addBaseSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility, java.lang.String)
@@ -463,8 +635,7 @@
int startingOffset,
int endingOffset)
{
- // TODO Auto-generated method stub
- return null;
+ return new ASTAbstractTypeSpecifierDeclaration( scopeToSymbol(scope), typeSpecifier, template, startingOffset, endingOffset);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createPointerToFunction(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, java.util.List, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.IASTTemplate, org.eclipse.cdt.core.parser.ast.ASTPointerOperator)
@@ -514,11 +685,6 @@
// TODO Auto-generated method stub
return null;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createSymbolTableDeclarationExtension(org.eclipse.cdt.core.parser.ast.IASTDeclaration, org.eclipse.cdt.core.parser.ast.IASTDeclaration)
- */
- public ISymbolASTExtension createSymbolTableDeclarationExtension(IASTDeclaration declaration, IASTDeclaration definition) throws ASTNotImplementedException
- {
- return new SymbolExtension( declaration, definition );
- }
+
+ protected ParserSymbolTable pst = new ParserSymbolTable();
}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ScopeIterator.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ast/complete/ScopeIterator.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ast/complete/ScopeIterator.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/parser/ast/complete/ScopeIterator.java 21 Jul 2003 17:27:31 -0000
@@ -0,0 +1,73 @@
+/**********************************************************************
+ * 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 java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+
+import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
+import org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class ScopeIterator implements Iterator
+{
+ private final Map sourceMap;
+ private final Iterator keyIter;
+ private Iterator subIterator = null;
+
+ public ScopeIterator( Map in )
+ {
+ sourceMap = in;
+ if( sourceMap != null )
+ keyIter = in.keySet().iterator();
+ else
+ keyIter = null;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#hasNext()
+ */
+ public boolean hasNext() {
+ if( keyIter == null )
+ return false;
+ if( subIterator != null && subIterator.hasNext() )
+ return true;
+ subIterator = null;
+ return keyIter.hasNext();
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#next()
+ */
+ public Object next() {
+ if( ! hasNext() )
+ throw new NoSuchElementException();
+
+ if( subIterator != null )
+ return subIterator.next();
+
+
+ ISymbolASTExtension symbol = ((ISymbol)sourceMap.get( keyIter.next() )).getASTExtension();
+ subIterator = symbol.getAllDefinitions();
+ return next();
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#remove()
+ */
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/complete/SymbolExtension.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ast/complete/SymbolExtension.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ast/complete/SymbolExtension.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/complete/SymbolExtension.java 18 Jul 2003 16:39:22 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,82 +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.parser.ast.complete;
-
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
-
-/**
- * @author jcamelon
- *
- */
-public class SymbolExtension implements ISymbolASTExtension
-{
- private ISymbol symbol;
- private final IASTDeclaration declaration;
- private IASTDeclaration definition;
-
- /**
- *
- */
- public SymbolExtension( IASTDeclaration declaration, IASTDeclaration definition )
- {
- this.declaration = declaration;
- this.definition = definition;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IDeclarationExtension#getDeclaration()
- */
- public IASTDeclaration getDeclaration()
- {
- return declaration;
- }
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IDeclarationExtension#getDefinition()
- */
- public IASTDeclaration getDefinition()
- {
- return definition;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IDeclarationExtension#setDefinition(org.eclipse.cdt.core.parser.ast.IASTDeclaration)
- */
- public void setDefinition(IASTDeclaration definition)
- {
- this.definition = definition;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IDeclarationExtension#hasBeenDefined()
- */
- public boolean hasBeenDefined()
- {
- return ( definition != null );
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IDeclarationExtension#getSymbol()
- */
- public ISymbol getSymbol()
- {
- return symbol;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.internal.core.parser.pst.IDeclarationExtension#setSymbol(org.eclipse.cdt.internal.core.parser.pst.ISymbol)
- */
- public void setSymbol(ISymbol s)
- {
- symbol = s;
- }
-}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTASMDefinition.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTASMDefinition.java,v
retrieving revision 1.3
diff -u -r1.3 ASTASMDefinition.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTASMDefinition.java 18 Jul 2003 16:39:22 -0000 1.3
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTASMDefinition.java 21 Jul 2003 17:27:31 -0000
@@ -57,15 +57,15 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
*/
- public int getElementStartingOffset() {
- return offsets.getElementStartingOffset();
+ public int getStartingOffset() {
+ return offsets.getStartingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
*/
- public int getElementEndingOffset() {
- return offsets.getElementEndingOffset();
+ public int getEndingOffset() {
+ return offsets.getEndingOffset();
}
/* (non-Javadoc)
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTAbstractTypeSpecifierDeclaration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTAbstractTypeSpecifierDeclaration.java,v
retrieving revision 1.2
diff -u -r1.2 ASTAbstractTypeSpecifierDeclaration.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTAbstractTypeSpecifierDeclaration.java 18 Jul 2003 16:39:22 -0000 1.2
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTAbstractTypeSpecifierDeclaration.java 21 Jul 2003 17:27:31 -0000
@@ -74,16 +74,16 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
*/
- public int getElementStartingOffset()
+ public int getStartingOffset()
{
- return offsets.getElementStartingOffset();
+ return offsets.getStartingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
*/
- public int getElementEndingOffset()
+ public int getEndingOffset()
{
- return offsets.getElementEndingOffset();
+ return offsets.getEndingOffset();
}
private Offsets offsets = new Offsets();
/* (non-Javadoc)
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTClassSpecifier.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTClassSpecifier.java,v
retrieving revision 1.10
diff -u -r1.10 ASTClassSpecifier.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTClassSpecifier.java 18 Jul 2003 16:39:22 -0000 1.10
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTClassSpecifier.java 21 Jul 2003 17:27:31 -0000
@@ -19,7 +19,7 @@
import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTTemplate;
+import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
/**
* @author jcamelon
@@ -34,8 +34,7 @@
String name,
ASTClassKind kind,
ClassNameType type,
- ASTAccessVisibility access,
- IASTTemplate ownerTemplate)
+ ASTAccessVisibility access)
{
super( scope, name );
this.scope = scope;
@@ -99,14 +98,14 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
*/
- public int getElementNameOffset()
+ public int getNameOffset()
{
- return offsets.getElementNameOffset();
+ return offsets.getNameOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
*/
- public void setElementNameOffset(int o)
+ public void setNameOffset(int o)
{
offsets.setNameOffset(o);
}
@@ -128,16 +127,16 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
*/
- public int getElementStartingOffset()
+ public int getStartingOffset()
{
- return offsets.getElementStartingOffset();
+ return offsets.getStartingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
*/
- public int getElementEndingOffset()
+ public int getEndingOffset()
{
- return offsets.getElementEndingOffset();
+ return offsets.getEndingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.ast.quick.IASTQScope#addDeclaration(org.eclipse.cdt.core.parser.ast.IASTDeclaration)
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTElaboratedTypeSpecifier.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTElaboratedTypeSpecifier.java,v
retrieving revision 1.3
diff -u -r1.3 ASTElaboratedTypeSpecifier.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTElaboratedTypeSpecifier.java 17 Jul 2003 20:15:13 -0000 1.3
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTElaboratedTypeSpecifier.java 21 Jul 2003 17:27:31 -0000
@@ -69,15 +69,15 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
*/
- public int getElementStartingOffset()
+ public int getStartingOffset()
{
- return offsets.getElementStartingOffset();
+ return offsets.getStartingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
*/
- public int getElementEndingOffset()
+ public int getEndingOffset()
{
- return offsets.getElementEndingOffset();
+ return offsets.getEndingOffset();
}
}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerationSpecifier.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerationSpecifier.java,v
retrieving revision 1.4
diff -u -r1.4 ASTEnumerationSpecifier.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerationSpecifier.java 18 Jul 2003 16:39:22 -0000 1.4
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerationSpecifier.java 21 Jul 2003 17:27:31 -0000
@@ -53,14 +53,14 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
*/
- public int getElementNameOffset()
+ public int getNameOffset()
{
- return offsets.getElementNameOffset();
+ return offsets.getNameOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
*/
- public void setElementNameOffset(int o)
+ public void setNameOffset(int o)
{
offsets.setNameOffset(o);
}
@@ -81,16 +81,16 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
*/
- public int getElementStartingOffset()
+ public int getStartingOffset()
{
- return offsets.getElementStartingOffset();
+ return offsets.getStartingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
*/
- public int getElementEndingOffset()
+ public int getEndingOffset()
{
- return offsets.getElementEndingOffset();
+ return offsets.getEndingOffset();
}
private List enumerators = new ArrayList();
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerator.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerator.java,v
retrieving revision 1.4
diff -u -r1.4 ASTEnumerator.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerator.java 17 Jul 2003 20:15:13 -0000 1.4
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTEnumerator.java 21 Jul 2003 17:27:31 -0000
@@ -54,14 +54,14 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
*/
- public int getElementNameOffset()
+ public int getNameOffset()
{
- return offsets.getElementNameOffset();
+ return offsets.getNameOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
*/
- public void setElementNameOffset(int o)
+ public void setNameOffset(int o)
{
offsets.setNameOffset(o);
}
@@ -82,16 +82,16 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
*/
- public int getElementStartingOffset()
+ public int getStartingOffset()
{
- return offsets.getElementStartingOffset();
+ return offsets.getStartingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
*/
- public int getElementEndingOffset()
+ public int getEndingOffset()
{
- return offsets.getElementEndingOffset();
+ return offsets.getEndingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTEnumerator#getOwnerEnumerationSpecifier()
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTField.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTField.java,v
retrieving revision 1.2
diff -u -r1.2 ASTField.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTField.java 10 Jul 2003 21:31:34 -0000 1.2
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTField.java 21 Jul 2003 17:27:31 -0000
@@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.quick;
+import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTExpression;
@@ -60,4 +61,18 @@
{
return visibility;
}
+
+ public void acceptElement( ISourceElementRequestor requestor )
+ {
+ requestor.acceptField( this );
+ }
+
+ public void enterScope( ISourceElementRequestor requestor )
+ {
+ }
+
+ public void exitScope( ISourceElementRequestor requestor )
+ {
+ }
+
}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java,v
retrieving revision 1.5
diff -u -r1.5 ASTFunction.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java 18 Jul 2003 16:39:22 -0000 1.5
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTFunction.java 21 Jul 2003 17:27:31 -0000
@@ -21,6 +21,7 @@
import org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTTemplate;
+import org.eclipse.cdt.internal.core.parser.ast.*;
import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
/**
@@ -114,14 +115,14 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
*/
- public int getElementNameOffset()
+ public int getNameOffset()
{
- return offsets.getElementNameOffset();
+ return offsets.getNameOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
*/
- public void setElementNameOffset(int o)
+ public void setNameOffset(int o)
{
offsets.setNameOffset( o );
}
@@ -149,16 +150,16 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
*/
- public int getElementStartingOffset()
+ public int getStartingOffset()
{
- return offsets.getElementStartingOffset();
+ return offsets.getStartingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
*/
- public int getElementEndingOffset()
+ public int getEndingOffset()
{
- return offsets.getElementEndingOffset();
+ return offsets.getEndingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTScope#getDeclarations()
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTLinkageSpecification.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTLinkageSpecification.java,v
retrieving revision 1.4
diff -u -r1.4 ASTLinkageSpecification.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTLinkageSpecification.java 18 Jul 2003 16:39:22 -0000 1.4
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTLinkageSpecification.java 21 Jul 2003 17:27:31 -0000
@@ -76,16 +76,16 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
*/
- public int getElementStartingOffset()
+ public int getStartingOffset()
{
- return offsets.getElementStartingOffset();
+ return offsets.getStartingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
*/
- public int getElementEndingOffset()
+ public int getEndingOffset()
{
- return offsets.getElementEndingOffset();
+ return offsets.getEndingOffset();
}
private Offsets offsets = new Offsets();
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTMethod.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTMethod.java,v
retrieving revision 1.3
diff -u -r1.3 ASTMethod.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTMethod.java 18 Jul 2003 12:40:48 -0000 1.3
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTMethod.java 21 Jul 2003 17:27:31 -0000
@@ -11,6 +11,7 @@
package org.eclipse.cdt.internal.core.parser.ast.quick;
import java.util.List;
+import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
@@ -18,6 +19,7 @@
import org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTTemplate;
+import org.eclipse.cdt.internal.core.parser.ast.ASTQualifiedNamedElement;
/**
* @author jcamelon
*
@@ -155,4 +157,20 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTMember#getOwnerClassSpecifier()
*/
+
+
+ public void acceptElement( ISourceElementRequestor requestor )
+ {
+ requestor.acceptMethodDeclaration( this );
+ }
+
+ public void enterScope( ISourceElementRequestor requestor )
+ {
+ requestor.enterMethodBody(this);
+ }
+
+ public void exitScope( ISourceElementRequestor requestor )
+ {
+ requestor.exitMethodBody(this);
+ }
}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceDefinition.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceDefinition.java,v
retrieving revision 1.5
diff -u -r1.5 ASTNamespaceDefinition.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceDefinition.java 18 Jul 2003 16:39:22 -0000 1.5
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTNamespaceDefinition.java 21 Jul 2003 17:27:32 -0000
@@ -18,6 +18,7 @@
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
import org.eclipse.cdt.core.parser.ast.IASTScope;
+import org.eclipse.cdt.internal.core.parser.ast.*;
import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
/**
@@ -46,14 +47,14 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
*/
- public int getElementNameOffset() {
- return offsets.getElementNameOffset();
+ public int getNameOffset() {
+ return offsets.getNameOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
*/
- public void setElementNameOffset(int o) {
+ public void setNameOffset(int o) {
offsets.setNameOffset( o );
}
@@ -75,15 +76,15 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
*/
- public int getElementStartingOffset() {
- return offsets.getElementStartingOffset();
+ public int getStartingOffset() {
+ return offsets.getStartingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
*/
- public int getElementEndingOffset() {
- return offsets.getElementEndingOffset();
+ public int getEndingOffset() {
+ return offsets.getEndingOffset();
}
private List declarations = new ArrayList();
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTQualifiedNamedElement.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTQualifiedNamedElement.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTQualifiedNamedElement.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTQualifiedNamedElement.java 18 Jul 2003 12:40:48 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,69 +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.parser.ast.quick;
-
-import java.util.Stack;
-
-import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
-import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
-import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement;
-import org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement;
-import org.eclipse.cdt.core.parser.ast.IASTScope;
-import org.eclipse.cdt.core.parser.ast.IASTScopedElement;
-
-/**
- * @author jcamelon
- *
- */
-public class ASTQualifiedNamedElement implements IASTQualifiedNameElement
-{
-
- /**
- * @param scope
- */
- public ASTQualifiedNamedElement(IASTScope scope, String name )
- {
- Stack names = new Stack();
- IASTScope parent = scope;
-
- names.push( name ); // push on our own name
- while (parent != null)
- {
- if (parent instanceof IASTNamespaceDefinition
- || parent instanceof IASTClassSpecifier )
- {
- names.push(((IASTOffsetableNamedElement)parent).getName());
- if( parent instanceof IASTScopedElement )
- parent = ((IASTScopedElement)parent).getOwnerScope();
- }
- else
- break;
- }
- if (names.size() != 0)
- {
- qualifiedNames = new String[names.size()];
- int counter = 0;
- while (!names.empty())
- qualifiedNames[counter++] = (String)names.pop();
- }
- else
- qualifiedNames = null;
-
- }
-
- public String[] getFullyQualifiedName()
- {
- return qualifiedNames;
- }
-
- private final String[] qualifiedNames;
-
-}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTScopedTypeSpecifier.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTScopedTypeSpecifier.java,v
retrieving revision 1.1
diff -u -r1.1 ASTScopedTypeSpecifier.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTScopedTypeSpecifier.java 18 Jul 2003 12:40:48 -0000 1.1
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTScopedTypeSpecifier.java 21 Jul 2003 17:27:32 -0000
@@ -12,6 +12,7 @@
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTScopedTypeSpecifier;
+import org.eclipse.cdt.internal.core.parser.ast.*;
/**
* @author jcamelon
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateDeclaration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateDeclaration.java,v
retrieving revision 1.3
diff -u -r1.3 ASTTemplateDeclaration.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateDeclaration.java 18 Jul 2003 16:39:22 -0000 1.3
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateDeclaration.java 21 Jul 2003 17:27:32 -0000
@@ -72,16 +72,16 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
*/
- public int getElementStartingOffset()
+ public int getStartingOffset()
{
- return offsets.getElementStartingOffset();
+ return offsets.getStartingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
*/
- public int getElementEndingOffset()
+ public int getEndingOffset()
{
- return offsets.getElementEndingOffset();
+ return offsets.getEndingOffset();
}
/* (non-Javadoc)
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateInstantiation.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateInstantiation.java,v
retrieving revision 1.2
diff -u -r1.2 ASTTemplateInstantiation.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateInstantiation.java 18 Jul 2003 16:39:22 -0000 1.2
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateInstantiation.java 21 Jul 2003 17:27:32 -0000
@@ -69,17 +69,17 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
*/
- public int getElementStartingOffset()
+ public int getStartingOffset()
{
- return offsets.getElementStartingOffset();
+ return offsets.getStartingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
*/
- public int getElementEndingOffset()
+ public int getEndingOffset()
{
- return offsets.getElementEndingOffset();
+ return offsets.getEndingOffset();
}
/* (non-Javadoc)
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateSpecialization.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateSpecialization.java,v
retrieving revision 1.2
diff -u -r1.2 ASTTemplateSpecialization.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateSpecialization.java 18 Jul 2003 16:39:22 -0000 1.2
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTemplateSpecialization.java 21 Jul 2003 17:27:32 -0000
@@ -57,16 +57,16 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
*/
- public int getElementStartingOffset()
+ public int getStartingOffset()
{
- return offsets.getElementStartingOffset();
+ return offsets.getStartingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
*/
- public int getElementEndingOffset()
+ public int getEndingOffset()
{
- return offsets.getElementEndingOffset();
+ return offsets.getEndingOffset();
}
/* (non-Javadoc)
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypedefDeclaration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypedefDeclaration.java,v
retrieving revision 1.2
diff -u -r1.2 ASTTypedefDeclaration.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypedefDeclaration.java 18 Jul 2003 16:39:22 -0000 1.2
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTTypedefDeclaration.java 21 Jul 2003 17:27:32 -0000
@@ -14,6 +14,7 @@
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
+import org.eclipse.cdt.internal.core.parser.ast.*;
import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
/**
@@ -37,7 +38,7 @@
this.name = name;
this.mapping = mapping;
setStartingOffset(startingOffset);
- setElementNameOffset(nameOffset);
+ setNameOffset(nameOffset);
qualifiedName = new ASTQualifiedNamedElement( scope, name );
}
/* (non-Javadoc)
@@ -57,14 +58,14 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
*/
- public int getElementNameOffset()
+ public int getNameOffset()
{
- return offsets.getElementNameOffset();
+ return offsets.getNameOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
*/
- public void setElementNameOffset(int o)
+ public void setNameOffset(int o)
{
offsets.setNameOffset(o);
}
@@ -86,16 +87,16 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
*/
- public int getElementStartingOffset()
+ public int getStartingOffset()
{
- return offsets.getElementStartingOffset();
+ return offsets.getStartingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
*/
- public int getElementEndingOffset()
+ public int getEndingOffset()
{
- return offsets.getElementEndingOffset();
+ return offsets.getEndingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTUsingDeclaration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTUsingDeclaration.java,v
retrieving revision 1.4
diff -u -r1.4 ASTUsingDeclaration.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTUsingDeclaration.java 18 Jul 2003 16:39:22 -0000 1.4
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTUsingDeclaration.java 21 Jul 2003 17:27:32 -0000
@@ -65,16 +65,16 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
*/
- public int getElementStartingOffset()
+ public int getStartingOffset()
{
- return offsets.getElementStartingOffset();
+ return offsets.getStartingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
*/
- public int getElementEndingOffset()
+ public int getEndingOffset()
{
- return offsets.getElementEndingOffset();
+ return offsets.getEndingOffset();
}
private Offsets offsets = new Offsets();
/* (non-Javadoc)
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTUsingDirective.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTUsingDirective.java,v
retrieving revision 1.4
diff -u -r1.4 ASTUsingDirective.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTUsingDirective.java 18 Jul 2003 16:39:22 -0000 1.4
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTUsingDirective.java 21 Jul 2003 17:27:32 -0000
@@ -11,6 +11,8 @@
package org.eclipse.cdt.internal.core.parser.ast.quick;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
+import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
+import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.internal.core.parser.ast.Offsets;
@@ -57,16 +59,16 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
*/
- public int getElementStartingOffset()
+ public int getStartingOffset()
{
- return offsets.getElementStartingOffset();
+ return offsets.getStartingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
*/
- public int getElementEndingOffset()
+ public int getEndingOffset()
{
- return offsets.getElementEndingOffset();
+ return offsets.getEndingOffset();
}
private Offsets offsets = new Offsets();
/* (non-Javadoc)
@@ -87,5 +89,12 @@
*/
public void exitScope(ISourceElementRequestor requestor)
{
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.parser.ast.IASTUsingDirective#getNamespaceDefinition()
+ */
+ public IASTNamespaceDefinition getNamespaceDefinition() throws ASTNotImplementedException
+ {
+ throw new ASTNotImplementedException();
}
}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTVariable.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTVariable.java,v
retrieving revision 1.5
diff -u -r1.5 ASTVariable.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTVariable.java 18 Jul 2003 16:39:22 -0000 1.5
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/ASTVariable.java 21 Jul 2003 17:27:32 -0000
@@ -16,6 +16,7 @@
import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTVariable;
+import org.eclipse.cdt.internal.core.parser.ast.*;
import org.eclipse.cdt.internal.core.parser.ast.NamedOffsets;
/**
@@ -141,28 +142,28 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
*/
- public int getElementStartingOffset()
+ public int getStartingOffset()
{
- return offsets.getElementStartingOffset();
+ return offsets.getStartingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
*/
- public int getElementEndingOffset()
+ public int getEndingOffset()
{
- return offsets.getElementEndingOffset();
+ return offsets.getEndingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
*/
- public int getElementNameOffset()
+ public int getNameOffset()
{
- return offsets.getElementNameOffset();
+ return offsets.getNameOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
*/
- public void setElementNameOffset(int o)
+ public void setNameOffset(int o)
{
offsets.setNameOffset(o);
}
Index: parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java,v
retrieving revision 1.13
diff -u -r1.13 QuickParseASTFactory.java
--- parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java 18 Jul 2003 16:39:22 -0000 1.13
+++ parser/org/eclipse/cdt/internal/core/parser/ast/quick/QuickParseASTFactory.java 21 Jul 2003 17:27:32 -0000
@@ -15,7 +15,6 @@
import org.eclipse.cdt.core.parser.ITokenDuple;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.core.parser.ast.ASTClassKind;
-import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
import org.eclipse.cdt.core.parser.ast.ASTSemanticException;
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
@@ -25,7 +24,6 @@
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
@@ -59,7 +57,6 @@
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type;
import org.eclipse.cdt.internal.core.parser.ast.BaseASTFactory;
import org.eclipse.cdt.internal.core.parser.ast.IASTArrayModifier;
-import org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension;
/**
* @author jcamelon
@@ -90,7 +87,7 @@
public IASTNamespaceDefinition createNamespaceDefinition(IASTScope scope, String identifier, int first, int nameOffset) {
IASTNamespaceDefinition definition = new ASTNamespaceDefinition( scope, identifier );
definition.setStartingOffset( first );
- definition.setElementNameOffset( nameOffset );
+ definition.setNameOffset( nameOffset );
return definition;
}
@@ -118,10 +115,10 @@
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, org.eclipse.cdt.core.parser.ast.ClassKind, org.eclipse.cdt.core.parser.ast.ClassNameType, org.eclipse.cdt.core.parser.ast.AccessVisibility, org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration)
*/
- public IASTClassSpecifier createClassSpecifier(IASTScope scope, String name, ASTClassKind kind, ClassNameType type, ASTAccessVisibility access, IASTTemplate ownerTemplateDeclaration, int startingOffset, int nameOffset) {
- IASTClassSpecifier spec = new ASTClassSpecifier( scope, name, kind, type, access, ownerTemplateDeclaration );
+ public IASTClassSpecifier createClassSpecifier(IASTScope scope, String name, ASTClassKind kind, ClassNameType type, ASTAccessVisibility access, int startingOffset, int nameOffset) throws ASTSemanticException {
+ IASTClassSpecifier spec = new ASTClassSpecifier( scope, name, kind, type, access );
spec.setStartingOffset( startingOffset );
- spec.setElementNameOffset( nameOffset );
+ spec.setNameOffset( nameOffset );
return spec;
}
@@ -321,14 +318,4 @@
{
return new ASTPointerToMethod(scope, name, parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, nameOffset, ownerTemplate, isConst, isVolatile, isConstructor, isDestructor, isVirtual, isExplicit, isPureVirtual, visibility, pointerOperator);
}
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.core.parser.ast.IASTFactory#createSymbolTableDeclarationExtension(org.eclipse.cdt.core.parser.ast.IASTDeclaration, org.eclipse.cdt.core.parser.ast.IASTDeclaration)
- */
- public ISymbolASTExtension createSymbolTableDeclarationExtension(IASTDeclaration declaration, IASTDeclaration definition) throws ASTNotImplementedException
- {
- throw new ASTNotImplementedException();
- }
-
-
}
Index: parser/org/eclipse/cdt/internal/core/parser/pst/AbstractSymbolExtension.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/pst/AbstractSymbolExtension.java
diff -N parser/org/eclipse/cdt/internal/core/parser/pst/AbstractSymbolExtension.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/parser/pst/AbstractSymbolExtension.java 21 Jul 2003 17:27:32 -0000
@@ -0,0 +1,45 @@
+/**********************************************************************
+ * 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.pst;
+
+import org.eclipse.cdt.internal.core.parser.ast.complete.ASTSymbol;
+
+/**
+ * @author jcamelon
+ *
+ */
+public abstract class AbstractSymbolExtension implements ISymbolASTExtension
+{
+ protected final ISymbol symbol;
+ protected final ASTSymbol primaryDeclaration;
+
+ /**
+ *
+ */
+ public AbstractSymbolExtension( ISymbol symbol, ASTSymbol primaryDeclaration )
+ {
+ this.symbol = symbol;
+ this.primaryDeclaration = primaryDeclaration;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.parser.pst.ISymbolOwner#getSymbol()
+ */
+ public ISymbol getSymbol()
+ {
+ return symbol;
+ }
+
+ public ASTSymbol getPrimaryDeclaration()
+ {
+ return primaryDeclaration;
+ }
+}
Index: parser/org/eclipse/cdt/internal/core/parser/pst/ForewardDeclaredSymbolExtension.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/pst/ForewardDeclaredSymbolExtension.java
diff -N parser/org/eclipse/cdt/internal/core/parser/pst/ForewardDeclaredSymbolExtension.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/parser/pst/ForewardDeclaredSymbolExtension.java 21 Jul 2003 17:27:32 -0000
@@ -0,0 +1,109 @@
+/**********************************************************************
+ * 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.pst;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.eclipse.cdt.internal.core.parser.ast.complete.ASTSymbol;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class ForewardDeclaredSymbolExtension extends AbstractSymbolExtension
+{
+ /**
+ * @author jcamelon
+ *
+ */
+ private class DualIterator implements Iterator
+ {
+ private int state = 0;
+ /**
+ *
+ */
+ public DualIterator()
+ {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#hasNext()
+ */
+ public boolean hasNext()
+ {
+ if( state == 0 ) return true;
+ if( state == 1 && definitionSymbol != null ) return true;
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#next()
+ */
+ public Object next()
+ {
+ switch( state )
+ {
+ case 0:
+ state = 1;
+ return primaryDeclaration;
+ case 1:
+ if( definitionSymbol != null )
+ {
+ state = 2;
+ return definitionSymbol;
+ }
+ break;
+ }
+ throw new NoSuchElementException();
+
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#remove()
+ */
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+
+ protected ASTSymbol definitionSymbol = null;
+ /**
+ * @param symbol
+ * @param primaryDeclaration
+ */
+ public ForewardDeclaredSymbolExtension(
+ ISymbol symbol,
+ ASTSymbol primaryDeclaration)
+ {
+ super(symbol, primaryDeclaration);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension#getAllDefinitions()
+ */
+ public Iterator getAllDefinitions()
+ {
+ return new DualIterator();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension#addDefinition(org.eclipse.cdt.internal.core.parser.ast.complete.ASTSymbol)
+ */
+ public void addDefinition(ASTSymbol definition) throws ExtensionException
+ {
+ if( definitionSymbol != null )
+ throw new ExtensionException();
+ definitionSymbol = definition;
+ }
+}
Index: parser/org/eclipse/cdt/internal/core/parser/pst/ISymbol.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISymbol.java,v
retrieving revision 1.3
diff -u -r1.3 ISymbol.java
--- parser/org/eclipse/cdt/internal/core/parser/pst/ISymbol.java 18 Jul 2003 16:39:22 -0000 1.3
+++ parser/org/eclipse/cdt/internal/core/parser/pst/ISymbol.java 21 Jul 2003 17:27:32 -0000
@@ -25,8 +25,8 @@
public Object clone();
- public ISymbolASTExtension getASTNode();
- public void setASTNode( ISymbolASTExtension obj );
+ public ISymbolASTExtension getASTExtension();
+ public void setASTExtension( ISymbolASTExtension obj );
public String getName();
Index: parser/org/eclipse/cdt/internal/core/parser/pst/ISymbolASTExtension.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISymbolASTExtension.java,v
retrieving revision 1.1
diff -u -r1.1 ISymbolASTExtension.java
--- parser/org/eclipse/cdt/internal/core/parser/pst/ISymbolASTExtension.java 18 Jul 2003 16:39:22 -0000 1.1
+++ parser/org/eclipse/cdt/internal/core/parser/pst/ISymbolASTExtension.java 21 Jul 2003 17:27:32 -0000
@@ -10,7 +10,9 @@
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.pst;
-import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
+import java.util.Iterator;
+
+import org.eclipse.cdt.internal.core.parser.ast.complete.ASTSymbol;
/**
* @author jcamelon
@@ -18,8 +20,13 @@
*/
public interface ISymbolASTExtension extends ISymbolOwner
{
- public IASTDeclaration getDeclaration();
- public IASTDeclaration getDefinition();
- public void setDefinition( IASTDeclaration definition );
- public boolean hasBeenDefined();
+ public class ExtensionException extends Exception
+ {
+ }
+
+
+ public ASTSymbol getPrimaryDeclaration();
+ public Iterator getAllDefinitions();
+ public void addDefinition( ASTSymbol definition ) throws ExtensionException;
+
}
Index: parser/org/eclipse/cdt/internal/core/parser/pst/ISymbolOwner.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ISymbolOwner.java,v
retrieving revision 1.1
diff -u -r1.1 ISymbolOwner.java
--- parser/org/eclipse/cdt/internal/core/parser/pst/ISymbolOwner.java 18 Jul 2003 16:39:22 -0000 1.1
+++ parser/org/eclipse/cdt/internal/core/parser/pst/ISymbolOwner.java 21 Jul 2003 17:27:32 -0000
@@ -17,6 +17,4 @@
public interface ISymbolOwner
{
public ISymbol getSymbol();
- public void setSymbol( ISymbol s );
-
}
Index: parser/org/eclipse/cdt/internal/core/parser/pst/NamespaceSymbolExtension.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/pst/NamespaceSymbolExtension.java
diff -N parser/org/eclipse/cdt/internal/core/parser/pst/NamespaceSymbolExtension.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/parser/pst/NamespaceSymbolExtension.java 21 Jul 2003 17:27:32 -0000
@@ -0,0 +1,99 @@
+/**********************************************************************
+ * Copyright (c) 2002,2003 Rational Software Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v0.5
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v05.html
+ *
+ * Contributors:
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+package org.eclipse.cdt.internal.core.parser.pst;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+import org.eclipse.cdt.internal.core.parser.ast.complete.ASTSymbol;
+
+/**
+ * @author jcamelon
+ *
+ */
+public class NamespaceSymbolExtension extends AbstractSymbolExtension
+{
+ /**
+ * @author jcamelon
+ *
+ */
+ private class LocalIterator implements Iterator
+ {
+ private boolean donePrimary = false;
+ private Iterator secondaries = otherDefinitions.iterator();
+ /**
+ *
+ */
+ public LocalIterator()
+ {
+ super();
+ }
+ /* (non-Javadoc)
+ * @see java.util.Iterator#hasNext()
+ */
+ public boolean hasNext()
+ {
+ if( ! donePrimary ) return true;
+ return secondaries.hasNext();
+ }
+ /* (non-Javadoc)
+ * @see java.util.Iterator#next()
+ */
+ public Object next()
+ {
+ if( ! hasNext() )
+ throw new NoSuchElementException();
+
+ if( ! donePrimary )
+ {
+ donePrimary = true;
+ return primaryDeclaration;
+ }
+
+ return secondaries.next();
+ }
+ /* (non-Javadoc)
+ * @see java.util.Iterator#remove()
+ */
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+ protected List otherDefinitions = new ArrayList();
+ /**
+ * @param symbol
+ * @param primaryDeclaration
+ */
+ public NamespaceSymbolExtension(
+ ISymbol symbol,
+ ASTSymbol primaryDeclaration)
+ {
+ super(symbol, primaryDeclaration);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension#getAllDefinitions()
+ */
+ public Iterator getAllDefinitions()
+ {
+ return new LocalIterator();
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension#addDefinition(org.eclipse.cdt.internal.core.parser.ast.complete.ASTSymbol)
+ */
+ public void addDefinition(ASTSymbol definition) throws ExtensionException
+ {
+ otherDefinitions.add( definition );
+ }
+}
Index: parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java,v
retrieving revision 1.5
diff -u -r1.5 ParserSymbolTable.java
--- parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java 18 Jul 2003 16:39:22 -0000 1.5
+++ parser/org/eclipse/cdt/internal/core/parser/pst/ParserSymbolTable.java 21 Jul 2003 17:27:34 -0000
@@ -2067,8 +2067,8 @@
public String getName() { return _name; }
public void setName(String name) { _name = name; }
- public ISymbolASTExtension getASTNode() { return _object; }
- public void setASTNode( ISymbolASTExtension obj ) { _object = obj; }
+ public ISymbolASTExtension getASTExtension() { return _object; }
+ public void setASTExtension( ISymbolASTExtension obj ) { _object = obj; }
public IContainerSymbol getContainingSymbol() { return _containingScope; }
public void setContainingSymbol( IContainerSymbol scope ){
Index: parser/org/eclipse/cdt/internal/core/parser/pst/StandardSymbolExtension.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/pst/StandardSymbolExtension.java
diff -N parser/org/eclipse/cdt/internal/core/parser/pst/StandardSymbolExtension.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ parser/org/eclipse/cdt/internal/core/parser/pst/StandardSymbolExtension.java 21 Jul 2003 17:27:34 -0000
@@ -0,0 +1,95 @@
+/**********************************************************************
+ * 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.pst;
+
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.eclipse.cdt.internal.core.parser.ast.complete.ASTSymbol;
+
+
+/**
+ * @author jcamelon
+ *
+ */
+public class StandardSymbolExtension extends AbstractSymbolExtension
+{
+
+ /**
+ * @author jcamelon
+ *
+ */
+ private class SimpleIterator implements Iterator
+ {
+ boolean hasNext = true;
+ /**
+ *
+ */
+ public SimpleIterator()
+ {
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#hasNext()
+ */
+ public boolean hasNext()
+ {
+ return hasNext;
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#next()
+ */
+ public Object next()
+ {
+ if( hasNext )
+ {
+ hasNext = false;
+ return primaryDeclaration;
+ }
+
+ throw new NoSuchElementException();
+ }
+
+ /* (non-Javadoc)
+ * @see java.util.Iterator#remove()
+ */
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+ /**
+ * @param symbol
+ * @param primaryDeclaration
+ */
+ public StandardSymbolExtension(ISymbol symbol, ASTSymbol primaryDeclaration)
+ {
+ super(symbol, primaryDeclaration);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension#getAllDefinitions()
+ */
+ public Iterator getAllDefinitions()
+ {
+ return this.new SimpleIterator();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension#addDefinition(org.eclipse.cdt.internal.core.parser.ast.complete.ASTSymbol)
+ */
+ public void addDefinition(ASTSymbol definition) throws ExtensionException
+ {
+ throw new ExtensionException();
+ }
+
+}
Index: search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java,v
retrieving revision 1.9
diff -u -r1.9 MatchLocator.java
--- search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java 18 Jul 2003 16:39:22 -0000 1.9
+++ search/org/eclipse/cdt/internal/core/search/matching/MatchLocator.java 21 Jul 2003 17:27:34 -0000
@@ -328,9 +328,9 @@
}
}
- int offset = node.getElementNameOffset();
+ int offset = node.getNameOffset();
if( offset == 0 )
- offset = node.getElementStartingOffset();
+ offset = node.getStartingOffset();
if( currentResource != null ){