Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Parser_SymbolTable: Moved Symbol Table and added interface


This is meant to be applied to the Parser_SymbolTable branch

Core:
Moved the Parser Symbol table to org.eclipse.cdt.internal.core.pst
Started an interface and modified the table to use that interface

UI.Tests
updated the ParserSymbolTableTests to use the new interface

pst.zip unzips in org.eclipse.cdt.core\parser\org\eclipse\cdt\internal\core

-Andrew


Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/ChangeLog,v
retrieving revision 1.51.2.2
diff -u -r1.51.2.2 ChangeLog
--- ChangeLog	8 May 2003 20:51:31 -0000	1.51.2.2
+++ ChangeLog	13 May 2003 14:48:13 -0000
@@ -1,3 +1,6 @@
+2003-05-13 Andrew Niefer	
+	Modified ParserSymbolTableTest to use new interface
+
 2003-05-08 Andrew Niefer
 	Added ParserSymbolTableTest::testMarkRollback
 
Index: parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java,v
retrieving revision 1.13.2.2
diff -u -r1.13.2.2 ParserSymbolTableTest.java
--- parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java	8 May 2003 20:51:31 -0000	1.13.2.2
+++ parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java	13 May 2003 14:48:13 -0000
@@ -17,11 +17,15 @@
 
 import junit.framework.TestCase;
 
-import org.eclipse.cdt.internal.core.parser.ParserSymbolTable;
-import org.eclipse.cdt.internal.core.parser.ParserSymbolTable.Declaration;
-import org.eclipse.cdt.internal.core.parser.ParserSymbolTable.TypeInfo;
-import org.eclipse.cdt.internal.core.parser.ParserSymbolTable.Mark;
-import org.eclipse.cdt.internal.core.parser.ParserSymbolTableException;
+import org.eclipse.cdt.internal.core.pst.IContainerSymbol;
+import org.eclipse.cdt.internal.core.pst.IDerivableContainerSymbol;
+import org.eclipse.cdt.internal.core.pst.IParameterizedSymbol;
+import org.eclipse.cdt.internal.core.pst.ISymbol;
+import org.eclipse.cdt.internal.core.pst.ParserSymbolTable;
+import org.eclipse.cdt.internal.core.pst.ParserSymbolTableException;
+//import org.eclipse.cdt.internal.core.pst.ParserSymbolTable.Declaration;
+import org.eclipse.cdt.internal.core.pst.ParserSymbolTable.Mark;
+import org.eclipse.cdt.internal.core.pst.ParserSymbolTable.TypeInfo;
 
 /**
  * @author aniefer
@@ -54,15 +58,15 @@
 	public void testSimpleAdd() throws Exception{
 		newTable(); //create the symbol table
 		
-		ParserSymbolTable.Declaration x = table.new Declaration( "x" );
-		ParserSymbolTable.Declaration compUnit = (ParserSymbolTable.Declaration) table.getCompilationUnit();
-		compUnit.addDeclaration( x );
+		ISymbol x = table.newSymbol( "x" );
+		IContainerSymbol compUnit = table.getCompilationUnit();
+		compUnit.addSymbol( x );
 	
-		Map declarations = compUnit.getContainedDeclarations();
+		Map declarations = compUnit.getContainedSymbols();
 		assertEquals( 1, declarations.size() );
 		
 		Iterator iter = declarations.values().iterator();
-		ParserSymbolTable.Declaration contained = (ParserSymbolTable.Declaration) iter.next();
+		ISymbol contained = (ISymbol) iter.next();
 		
 		assertEquals( false, iter.hasNext() );
 		assertEquals( x, contained );
@@ -77,10 +81,10 @@
 	public void testSimpleLookup() throws Exception{
 		newTable(); //new symbol table
 		
-		ParserSymbolTable.Declaration x = table.new Declaration( "x" );
-		table.getCompilationUnit().addDeclaration( x );
+		ISymbol x = table.new Declaration( "x" );
+		table.getCompilationUnit().addSymbol( x );
 		
-		ParserSymbolTable.Declaration look = table.getCompilationUnit().Lookup( "x" );
+		ISymbol look = table.getCompilationUnit().Lookup( "x" );
 		
 		assertEquals( x, look );
 	}
@@ -88,41 +92,21 @@
 	public void testLookupNonExistant() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration look = table.getCompilationUnit().Lookup("boo");
+		ISymbol look = table.getCompilationUnit().Lookup("boo");
 		assertEquals( look, null );
 	}
 	
-	/**
-	 * testSimplePushPop
-	 * test pushing and popping
-	 * @throws Exception
-	 *//*
-	public void testSimplePushPop() throws Exception{
-		newTable();
-		
-		Declaration pushing = new Declaration( "class" );
-		assertEquals( pushing.getContainingScope(), null );
-		
-		table.push( pushing );
-		assertEquals( pushing, table.peek() );
-		assertEquals( pushing.getContainingScope(), table.getCompilationUnit() );
-		
-		Declaration popped = table.pop();
-		assertEquals( pushing, popped );
-		assertEquals( table.peek(), table.getCompilationUnit() );
-	}*/
-
 	public void testSimpleSetGetObject() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration x = table.new Declaration("x");
+		ISymbol x = table.new Declaration("x");
 		
 		Object obj = new Object();
 		x.setCallbackExtension( obj );
 				
-		table.getCompilationUnit().addDeclaration( x );
+		table.getCompilationUnit().addSymbol( x );
 		
-		ParserSymbolTable.Declaration look = table.getCompilationUnit().Lookup( "x" );
+		ISymbol look = table.getCompilationUnit().Lookup( "x" );
 		
 		assertEquals( look.getCallbackExtension(), obj );
 	}
@@ -136,18 +120,18 @@
 	public void testHide() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration firstX = table.new Declaration("x");
-		table.getCompilationUnit().addDeclaration( firstX );
+		ISymbol firstX = table.newSymbol("x");
+		table.getCompilationUnit().addSymbol( firstX );
 		
-		ParserSymbolTable.Declaration firstClass = table.new Declaration("class");
+		IDerivableContainerSymbol firstClass = table.newDerivableContainerSymbol("class");
 		firstClass.setType( ParserSymbolTable.TypeInfo.t_class );
-		table.getCompilationUnit().addDeclaration( firstClass );
+		table.getCompilationUnit().addSymbol( firstClass );
 
-		ParserSymbolTable.Declaration look = firstClass.Lookup( "x" );
+		ISymbol look = firstClass.Lookup( "x" );
 		assertEquals( look, firstX );
 		
-		ParserSymbolTable.Declaration secondX = table.new Declaration("x");
-		firstClass.addDeclaration( secondX );
+		ISymbol secondX = table.newSymbol("x");
+		firstClass.addSymbol( secondX );
 		
 		look = firstClass.Lookup( "x" );
 		assertEquals( look, secondX );
@@ -164,14 +148,14 @@
 	public void testContainingScopeLookup() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration x = table.new Declaration("x");
-		table.getCompilationUnit().addDeclaration( x );
+		ISymbol x = table.newSymbol("x");
+		table.getCompilationUnit().addSymbol( x );
 
-		ParserSymbolTable.Declaration decl = table.new Declaration("class");
+		IDerivableContainerSymbol decl = table.newDerivableContainerSymbol("class");
 		decl.setType( ParserSymbolTable.TypeInfo.t_class );
-		table.getCompilationUnit().addDeclaration( decl );
+		table.getCompilationUnit().addSymbol( decl );
 		
-		ParserSymbolTable.Declaration look = decl.Lookup( "x" );
+		ISymbol look = decl.Lookup( "x" );
 		
 		assertEquals( x, look );
 	}
@@ -185,20 +169,20 @@
 	public void testParentLookup() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration parent = table.new Declaration("parent");
+		IDerivableContainerSymbol parent = table.newDerivableContainerSymbol("parent");
 		parent.setType( ParserSymbolTable.TypeInfo.t_class );
 
-		ParserSymbolTable.Declaration class1 = table.new Declaration("class");
+		IDerivableContainerSymbol class1 = table.newDerivableContainerSymbol("class");
 		class1.setType( ParserSymbolTable.TypeInfo.t_class );
 		class1.addParent( parent );
 		
-		ParserSymbolTable.Declaration decl = table.new Declaration("x");
-		parent.addDeclaration( decl );
+		ISymbol decl = table.new Declaration("x");
+		parent.addSymbol( decl );
 		
-		table.getCompilationUnit().addDeclaration( parent );
-		table.getCompilationUnit().addDeclaration( class1 );
+		table.getCompilationUnit().addSymbol( parent );
+		table.getCompilationUnit().addSymbol( class1 );
 		
-		ParserSymbolTable.Declaration look = class1.Lookup( "x" );
+		ISymbol look = class1.Lookup( "x" );
 		assertEquals( look, decl );
 	}
 
@@ -214,14 +198,14 @@
 	public void testAmbiguousParentLookup() throws Exception{
 		testParentLookup();
 	
-		ParserSymbolTable.Declaration parent2 = table.new Declaration("parent2");
-		table.getCompilationUnit().addDeclaration( parent2 );
+		IDerivableContainerSymbol parent2 = table.newDerivableContainerSymbol("parent2");
+		table.getCompilationUnit().addSymbol( parent2 );
 		
-		ParserSymbolTable.Declaration class1 = table.getCompilationUnit().Lookup( "class" );
+		IDerivableContainerSymbol class1 = (IDerivableContainerSymbol) table.getCompilationUnit().Lookup( "class" );
 		class1.addParent( parent2 );
 		
-		ParserSymbolTable.Declaration decl = table.new Declaration("x");
-		parent2.addDeclaration( decl );
+		ISymbol decl = table.new Declaration("x");
+		parent2.addSymbol( decl );
 				
 		try{
 			class1.Lookup( "x" );
@@ -240,17 +224,17 @@
 	public void testCircularParentLookup() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration a = table.new Declaration("a");
-		table.getCompilationUnit().addDeclaration( a );
+		IDerivableContainerSymbol a = table.newDerivableContainerSymbol("a");
+		table.getCompilationUnit().addSymbol( a );
 		
-		ParserSymbolTable.Declaration b = table.new Declaration("b");
+		IDerivableContainerSymbol b = table.newDerivableContainerSymbol("b");
 		b.addParent( a );
-		table.getCompilationUnit().addDeclaration( b );
+		table.getCompilationUnit().addSymbol( b );
 			
 		a.addParent( b );
 		 
 		try{
-			ParserSymbolTable.Declaration look = a.Lookup("foo");
+			ISymbol look = a.Lookup("foo");
 			assertTrue( false );
 		} catch ( ParserSymbolTableException e) {
 			assertEquals( e.reason, ParserSymbolTableException.r_CircularInheritance );
@@ -272,29 +256,29 @@
 	public void testVirtualParentLookup() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration decl = table.new Declaration("class");
-		ParserSymbolTable.Declaration c    = table.new Declaration("C");
+		IDerivableContainerSymbol decl = table.newDerivableContainerSymbol("class");
+		IDerivableContainerSymbol c    = table.newDerivableContainerSymbol("C");
 		
-		ParserSymbolTable.Declaration a    = table.new Declaration("A");
+		IDerivableContainerSymbol a    = table.newDerivableContainerSymbol("A");
 		a.addParent( c, true );
 		
-		ParserSymbolTable.Declaration b    = table.new Declaration("B");
+		IDerivableContainerSymbol b    = table.newDerivableContainerSymbol("B");
 		b.addParent( c, true );
 		
 		decl.addParent( a );
 		decl.addParent( b );
 		
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
-		compUnit.addDeclaration( c );
+		IContainerSymbol compUnit = table.getCompilationUnit();
+		compUnit.addSymbol( c );
 		
-		ParserSymbolTable.Declaration x = table.new Declaration( "x" );
-		c.addDeclaration( x );
+		ISymbol x = table.new Declaration( "x" );
+		c.addSymbol( x );
 		
-		compUnit.addDeclaration( decl );
-		compUnit.addDeclaration( a );
-		compUnit.addDeclaration( b );
+		compUnit.addSymbol( decl );
+		compUnit.addSymbol( a );
+		compUnit.addSymbol( b );
 		
-		ParserSymbolTable.Declaration look = decl.Lookup( "x" ); 
+		ISymbol look = decl.Lookup( "x" ); 
 		
 		assertEquals( look, x );
 	}
@@ -313,11 +297,11 @@
 	public void testAmbiguousVirtualParentLookup() throws Exception{
 		testVirtualParentLookup();
 		
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+		IContainerSymbol compUnit = table.getCompilationUnit();
 		
-		ParserSymbolTable.Declaration cls = compUnit.Lookup("class");
-		ParserSymbolTable.Declaration c   = compUnit.Lookup("C");
-		ParserSymbolTable.Declaration d   = table.new Declaration("D");
+		IDerivableContainerSymbol cls = (IDerivableContainerSymbol) compUnit.Lookup("class");
+		IDerivableContainerSymbol c   = (IDerivableContainerSymbol) compUnit.Lookup("C");
+		IDerivableContainerSymbol d   = table.newDerivableContainerSymbol("D");
 		
 		d.addParent( c );
 		cls.addParent( d );
@@ -347,34 +331,34 @@
 	public void testStaticEnumParentLookup() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration a = table.new Declaration( "a" );
-		ParserSymbolTable.Declaration b = table.new Declaration( "b" );
-		ParserSymbolTable.Declaration c = table.new Declaration( "c" );
-		ParserSymbolTable.Declaration d = table.new Declaration( "d" );
-	
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
-		
-		compUnit.addDeclaration( a );
-		compUnit.addDeclaration( b );
-		compUnit.addDeclaration( c );
-		compUnit.addDeclaration( d );
+		IDerivableContainerSymbol a = table.newDerivableContainerSymbol("a" );
+		IDerivableContainerSymbol b = table.newDerivableContainerSymbol( "b" );
+		IDerivableContainerSymbol c = table.newDerivableContainerSymbol( "c" );
+		IDerivableContainerSymbol d = table.newDerivableContainerSymbol( "d" );
+	
+		IContainerSymbol compUnit = table.getCompilationUnit();
+		
+		compUnit.addSymbol( a );
+		compUnit.addSymbol( b );
+		compUnit.addSymbol( c );
+		compUnit.addSymbol( d );
 		
-		ParserSymbolTable.Declaration enum = table.new Declaration("enum");
+		IContainerSymbol enum = table.new Declaration("enum");
 		enum.setType( ParserSymbolTable.TypeInfo.t_enumeration );
 		
-		ParserSymbolTable.Declaration enumerator = table.new Declaration( "enumerator" );
+		ISymbol enumerator = table.new Declaration( "enumerator" );
 		enumerator.setType( ParserSymbolTable.TypeInfo.t_enumerator );
 		
-		ParserSymbolTable.Declaration stat = table.new Declaration("static");
+		ISymbol stat = table.new Declaration("static");
 		stat.getTypeInfo().setBit( true, ParserSymbolTable.TypeInfo.isStatic );
 		
-		ParserSymbolTable.Declaration x = table.new Declaration("x");
+		ISymbol x = table.new Declaration("x");
 		
-		d.addDeclaration( enum );
-		d.addDeclaration( stat );
-		d.addDeclaration( x );
+		d.addSymbol( enum );
+		d.addSymbol( stat );
+		d.addSymbol( x );
 		
-		enum.addDeclaration( enumerator );
+		enum.addSymbol( enumerator );
 		
 		a.addParent( b );
 		a.addParent( c );
@@ -414,33 +398,33 @@
 	public void testElaboratedLookup() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration cls = table.new Declaration( "class" );
+		IDerivableContainerSymbol cls = table.newDerivableContainerSymbol( "class" );
 		cls.setType( ParserSymbolTable.TypeInfo.t_class );
 		
-		ParserSymbolTable.Declaration struct = table.new Declaration("struct");
+		IDerivableContainerSymbol struct = table.newDerivableContainerSymbol("struct");
 		struct.setType( ParserSymbolTable.TypeInfo.t_struct );
 		
-		ParserSymbolTable.Declaration union = table.new Declaration("union");
+		IContainerSymbol union = table.newContainerSymbol("union");
 		union.setType( ParserSymbolTable.TypeInfo.t_union );
 		
-		ParserSymbolTable.Declaration hideCls = table.new Declaration( "class" );
-		ParserSymbolTable.Declaration hideStruct = table.new Declaration("struct");
-		ParserSymbolTable.Declaration hideUnion = table.new Declaration("union");
-		
-		ParserSymbolTable.Declaration a = table.new Declaration("a");
-		ParserSymbolTable.Declaration b = table.new Declaration("b");
-		
-		a.addDeclaration(hideCls);
-		a.addDeclaration(hideStruct);
-		a.addDeclaration(hideUnion);
+		IDerivableContainerSymbol hideCls = table.newDerivableContainerSymbol( "class" );
+		IDerivableContainerSymbol hideStruct = table.newDerivableContainerSymbol("struct");
+		IContainerSymbol hideUnion = table.newContainerSymbol("union");
+		
+		IDerivableContainerSymbol a = table.newDerivableContainerSymbol("a");
+		IDerivableContainerSymbol b = table.newDerivableContainerSymbol("b");
+		
+		a.addSymbol(hideCls);
+		a.addSymbol(hideStruct);
+		a.addSymbol(hideUnion);
 		
 		a.addParent( b );
 		
-		b.addDeclaration(cls);
-		b.addDeclaration(struct);
-		b.addDeclaration(union);
+		b.addSymbol(cls);
+		b.addSymbol(struct);
+		b.addSymbol(union);
 		
-		ParserSymbolTable.Declaration look = a.ElaboratedLookup( ParserSymbolTable.TypeInfo.t_class, "class" );
+		ISymbol look = a.ElaboratedLookup( ParserSymbolTable.TypeInfo.t_class, "class" );
 		assertEquals( look, cls );
 		look = a.ElaboratedLookup( ParserSymbolTable.TypeInfo.t_struct, "struct" );
 		assertEquals( look, struct );
@@ -459,26 +443,26 @@
 	public void testDeclarationType() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+		IContainerSymbol compUnit = table.getCompilationUnit();
 		
 		//pre-condition
-		ParserSymbolTable.Declaration A = table.new Declaration("A");
-		compUnit.addDeclaration(A);
+		IContainerSymbol A = table.newContainerSymbol("A");
+		compUnit.addSymbol(A);
 
-		ParserSymbolTable.Declaration member = table.new Declaration("member");
-		A.addDeclaration(member);
+		ISymbol member = table.newSymbol("member");
+		A.addSymbol(member);
 				
 		//at time of "A a;"
-		ParserSymbolTable.Declaration look = compUnit.Lookup("A");
+		ISymbol look = compUnit.Lookup("A");
 		assertEquals( look, A );
-		ParserSymbolTable.Declaration a = table.new Declaration("a");
-		a.setTypeDeclaration( look );
-		compUnit.addDeclaration( a );
+		ISymbol a = table.newSymbol("a");
+		a.setTypeSymbol( look );
+		compUnit.addSymbol( a );
 		
 		//later "a.member"
 		look = compUnit.Lookup("a");
 		assertEquals( look, a );
-		ParserSymbolTable.Declaration type = look.getTypeDeclaration();
+		IContainerSymbol type = (IContainerSymbol) look.getTypeSymbol();
 		assertEquals( type, A );
 		
 		look = type.Lookup("member");
@@ -502,21 +486,21 @@
 	public void testFunctionHidesClass() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+		IContainerSymbol compUnit = table.getCompilationUnit();
 		
-		ParserSymbolTable.Declaration struct = table.new Declaration( "stat");
+		IDerivableContainerSymbol struct = table.newDerivableContainerSymbol("stat");
 		struct.setType( ParserSymbolTable.TypeInfo.t_struct );
-		compUnit.addDeclaration( struct );
+		compUnit.addSymbol( struct );
 		
-		ParserSymbolTable.Declaration function = table.new Declaration( "stat" );
+		IParameterizedSymbol function = table.newParameterizedSymbol( "stat" );
 		function.setType( ParserSymbolTable.TypeInfo.t_function );
-		compUnit.addDeclaration( function );
+		compUnit.addSymbol( function );
 		
-		ParserSymbolTable.Declaration f = table.new Declaration("f");
+		IParameterizedSymbol f = table.newParameterizedSymbol("f");
 		f.setType( ParserSymbolTable.TypeInfo.t_function );
-		compUnit.addDeclaration( f );
+		compUnit.addSymbol( f );
 				
-		ParserSymbolTable.Declaration look = f.ElaboratedLookup( ParserSymbolTable.TypeInfo.t_struct, "stat" );
+		ISymbol look = f.ElaboratedLookup( ParserSymbolTable.TypeInfo.t_struct, "stat" );
 		assertEquals( look, struct );
 		
 		look = f.Lookup( "stat" );
@@ -557,50 +541,51 @@
 	public void testUsingDirectives_1() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration nsA = table.new Declaration("A");
+		IContainerSymbol nsA = table.newContainerSymbol("A");
 		nsA.setType( ParserSymbolTable.TypeInfo.t_namespace );
-		table.getCompilationUnit().addDeclaration( nsA );
+		table.getCompilationUnit().addSymbol( nsA );
 		
-		ParserSymbolTable.Declaration nsA_i = table.new Declaration("i");
-		nsA.addDeclaration( nsA_i );
+		ISymbol nsA_i = table.newSymbol("i");
+		nsA.addSymbol( nsA_i );
 		
-		ParserSymbolTable.Declaration nsB = table.new Declaration("B");
+		IContainerSymbol nsB = table.newContainerSymbol("B");
 		nsB.setType( ParserSymbolTable.TypeInfo.t_namespace );
-		nsA.addDeclaration( nsB );
+		nsA.addSymbol( nsB );
 		
-		ParserSymbolTable.Declaration nsC = table.new Declaration("C");
+		IContainerSymbol nsC = table.newContainerSymbol("C");
 		nsC.setType( ParserSymbolTable.TypeInfo.t_namespace );
-		nsB.addDeclaration( nsC );
+		nsB.addSymbol( nsC );
 		
-		ParserSymbolTable.Declaration nsC_i = table.new Declaration("i");
-		nsC.addDeclaration( nsC_i );
+		ISymbol nsC_i = table.newSymbol("i");
+		nsC.addSymbol( nsC_i );
 		
-		ParserSymbolTable.Declaration look = nsB.Lookup("C");
-		nsB.addUsingDirective( look );
+		ISymbol look = nsB.Lookup("C");
+		assertEquals( look, nsC );
+		nsB.addUsingDirective( nsC );
 		
-		ParserSymbolTable.Declaration f1 = table.new Declaration("f");
+		IParameterizedSymbol f1 = table.newParameterizedSymbol("f");
 		f1.setType( ParserSymbolTable.TypeInfo.t_function );
 		
-		nsB.addDeclaration( f1 );
+		nsB.addSymbol( f1 );
 		
 		look = f1.Lookup( "i" );
 		assertEquals( look, nsC_i ); //C::i visible and hides A::i
 		
-		ParserSymbolTable.Declaration nsD = table.new Declaration("D");
+		IContainerSymbol nsD = table.newContainerSymbol("D");
 		nsD.setType( ParserSymbolTable.TypeInfo.t_namespace );
-		nsA.addDeclaration( nsD );
+		nsA.addSymbol( nsD );
 		
 		look = nsD.Lookup("B");
 		assertEquals( look, nsB );
-		nsD.addUsingDirective( look );
+		nsD.addUsingDirective( nsB );
 		
 		look = nsD.Lookup("C");
 		assertEquals( look, nsC );
-		nsD.addUsingDirective( look );
+		nsD.addUsingDirective( nsC );
 		
-		ParserSymbolTable.Declaration f2 = table.new Declaration( "f2" );
+		IParameterizedSymbol f2 = table.newParameterizedSymbol( "f2" );
 		f2.setType( ParserSymbolTable.TypeInfo.t_function );
-		nsD.addDeclaration( f2 );
+		nsD.addSymbol( f2 );
 		
 		try
 		{
@@ -613,16 +598,16 @@
 			assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous );
 		}
 		
-		ParserSymbolTable.Declaration f3 = table.new Declaration ("f3");
+		IParameterizedSymbol f3 = table.newParameterizedSymbol("f3");
 		f3.setType( ParserSymbolTable.TypeInfo.t_function );
-		nsA.addDeclaration( f3 );
+		nsA.addSymbol( f3 );
 		
 		look = f3.Lookup("i");
 		assertEquals( look, nsA_i );  //uses A::i
 		
-		ParserSymbolTable.Declaration f4 = table.new Declaration ("f4");
+		IParameterizedSymbol f4 = table.newParameterizedSymbol("f4");
 		f4.setType( ParserSymbolTable.TypeInfo.t_function );
-		table.getCompilationUnit().addDeclaration( f4 );
+		table.getCompilationUnit().addSymbol( f4 );
 		
 		look = f4.Lookup("i");
 		assertEquals( look, null );//neither i is visible here.
@@ -651,31 +636,31 @@
 	{
 		newTable();
 		
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+		IContainerSymbol compUnit = table.getCompilationUnit();
 		
-		ParserSymbolTable.Declaration nsM = table.new Declaration( "M" );
+		IContainerSymbol nsM = table.newContainerSymbol( "M" );
 		nsM.setType( ParserSymbolTable.TypeInfo.t_namespace );
 		
-		compUnit.addDeclaration( nsM );
+		compUnit.addSymbol( nsM );
 		
-		ParserSymbolTable.Declaration nsM_i = table.new Declaration("i");
-		nsM.addDeclaration( nsM_i );
+		ISymbol nsM_i = table.newSymbol("i");
+		nsM.addSymbol( nsM_i );
 				
-		ParserSymbolTable.Declaration nsN = table.new Declaration( "N" );
+		IContainerSymbol nsN = table.newContainerSymbol( "N" );
 		nsN.setType( ParserSymbolTable.TypeInfo.t_namespace );
 		
-		compUnit.addDeclaration( nsN );
+		compUnit.addSymbol( nsN );
 		
-		ParserSymbolTable.Declaration nsN_i = table.new Declaration("i");
-		nsN.addDeclaration( nsN_i );
+		ISymbol nsN_i = table.newSymbol("i");
+		nsN.addSymbol( nsN_i );
 		nsN.addUsingDirective( nsM );
 		
-		ParserSymbolTable.Declaration f = table.new Declaration("f");
-		compUnit.addDeclaration( f );
+		IParameterizedSymbol f = table.newParameterizedSymbol("f");
+		compUnit.addSymbol( f );
 		
 		f.addUsingDirective( nsN );
 		
-		ParserSymbolTable.Declaration look = null;
+		ISymbol look = null;
 		try
 		{
 			look = f.Lookup( "i" );
@@ -688,7 +673,7 @@
 		}
 		
 		look = f.LookupNestedNameSpecifier("N");
-		look = look.QualifiedLookup("i"); //ok
+		look = ((IContainerSymbol) look).QualifiedLookup("i"); //ok
 		assertEquals( look, nsN_i );
 	}
 	
@@ -719,38 +704,38 @@
 	{
 		newTable();
 		
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+		IContainerSymbol compUnit = table.getCompilationUnit();
 		
-		ParserSymbolTable.Declaration nsA = table.new Declaration("A");
+		IContainerSymbol nsA = table.newContainerSymbol("A");
 		nsA.setType( ParserSymbolTable.TypeInfo.t_namespace );
-		compUnit.addDeclaration( nsA );
+		compUnit.addSymbol( nsA );
 		
-		ParserSymbolTable.Declaration a = table.new Declaration("a");
-		nsA.addDeclaration( a );
+		ISymbol a = table.newSymbol("a");
+		nsA.addSymbol( a );
 				
-		ParserSymbolTable.Declaration nsB = table.new Declaration("B");
+		IContainerSymbol nsB = table.newContainerSymbol("B");
 		nsB.setType( ParserSymbolTable.TypeInfo.t_namespace );
-		compUnit.addDeclaration( nsB );
+		compUnit.addSymbol( nsB );
 		nsB.addUsingDirective( nsA );
 		
-		ParserSymbolTable.Declaration nsC = table.new Declaration("C");
+		IContainerSymbol nsC = table.newContainerSymbol("C");
 		nsC.setType( ParserSymbolTable.TypeInfo.t_namespace );
-		compUnit.addDeclaration( nsC );
+		compUnit.addSymbol( nsC );
 		nsC.addUsingDirective( nsA );
 		
-		ParserSymbolTable.Declaration nsBC = table.new Declaration("BC");
+		IContainerSymbol nsBC = table.newContainerSymbol("BC");
 		nsBC.setType( ParserSymbolTable.TypeInfo.t_namespace );
-		compUnit.addDeclaration( nsBC );
+		compUnit.addSymbol( nsBC );
 		nsBC.addUsingDirective( nsB );
 		nsBC.addUsingDirective( nsC );		
 		
-		ParserSymbolTable.Declaration f = table.new Declaration("f");
+		IParameterizedSymbol f = table.newParameterizedSymbol("f");
 		f.setType(ParserSymbolTable.TypeInfo.t_function);
-		compUnit.addDeclaration( f );
+		compUnit.addSymbol( f );
 		
-		ParserSymbolTable.Declaration look = f.LookupNestedNameSpecifier("BC");
+		ISymbol look = f.LookupNestedNameSpecifier("BC");
 		assertEquals( look, nsBC );
-		look = look.QualifiedLookup("a");
+		look = ((IContainerSymbol)look).QualifiedLookup("a");
 		assertEquals( look, a );
 	}
 	
@@ -780,37 +765,37 @@
 	{
 		newTable();
 		
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+		IContainerSymbol compUnit = table.getCompilationUnit();
 		
-		ParserSymbolTable.Declaration nsB = table.new Declaration( "B" );
+		IContainerSymbol nsB = table.newContainerSymbol( "B" );
 		nsB.setType( ParserSymbolTable.TypeInfo.t_namespace );
-		compUnit.addDeclaration( nsB );
+		compUnit.addSymbol( nsB );
 		
-		ParserSymbolTable.Declaration b = table.new Declaration("b");
-		nsB.addDeclaration( b );
+		ISymbol b = table.newSymbol("b");
+		nsB.addSymbol( b );
 		
-		ParserSymbolTable.Declaration nsA = table.new Declaration( "A" );
+		IContainerSymbol nsA = table.newContainerSymbol( "A" );
 		nsA.setType( ParserSymbolTable.TypeInfo.t_namespace );
-		compUnit.addDeclaration( nsA );
+		compUnit.addSymbol( nsA );
 		
 		nsA.addUsingDirective( nsB );
 		
-		ParserSymbolTable.Declaration a = table.new Declaration("a");
-		nsA.addDeclaration( a );
+		ISymbol a = table.newSymbol("a");
+		nsA.addSymbol( a );
 		
 		nsB.addUsingDirective( nsA );
 		
-		ParserSymbolTable.Declaration f = table.new Declaration("f");
-		compUnit.addDeclaration(f);
+		IParameterizedSymbol f = table.newParameterizedSymbol("f");
+		compUnit.addSymbol(f);
 		
-		ParserSymbolTable.Declaration lookA = f.LookupNestedNameSpecifier("A");
-		ParserSymbolTable.Declaration look = lookA.QualifiedLookup("a");
+		IContainerSymbol lookA = f.LookupNestedNameSpecifier("A");
+		ISymbol look = lookA.QualifiedLookup("a");
 		assertEquals( look, a );
 		
 		look = lookA.QualifiedLookup("b");
 		assertEquals( look, b );
 		
-		ParserSymbolTable.Declaration lookB = f.LookupNestedNameSpecifier("B");
+		IContainerSymbol lookB = f.LookupNestedNameSpecifier("B");
 		look = lookB.QualifiedLookup("a");
 		assertEquals( look, a );
 		
@@ -843,25 +828,25 @@
 	{
 		newTable();
 		
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+		IContainerSymbol compUnit = table.getCompilationUnit();
 		
-		ParserSymbolTable.Declaration nsA = table.new Declaration( "A" );
+		IContainerSymbol nsA = table.newContainerSymbol( "A" );
 		nsA.setType( ParserSymbolTable.TypeInfo.t_namespace );
-		compUnit.addDeclaration( nsA );
+		compUnit.addSymbol( nsA );
 			
-		ParserSymbolTable.Declaration nsB = table.new Declaration( "B" );
+		IContainerSymbol nsB = table.newContainerSymbol( "B" );
 		nsB.setType( ParserSymbolTable.TypeInfo.t_namespace );
-		compUnit.addDeclaration( nsB );
+		compUnit.addSymbol( nsB );
 		nsB.addUsingDirective( nsA );
 		
 		nsA.addUsingDirective( nsB );
 		
-		ParserSymbolTable.Declaration f = table.new Declaration("f");
-		compUnit.addDeclaration(f);
+		IParameterizedSymbol f = table.newParameterizedSymbol("f");
+		compUnit.addSymbol(f);
 		f.addUsingDirective(nsA);
 		f.addUsingDirective(nsB);
 		
-		ParserSymbolTable.Declaration look = f.Lookup("i");
+		ISymbol look = f.Lookup("i");
 		assertEquals( look, null );
 	}
 	
@@ -892,49 +877,49 @@
 	public void testNamespaceMemberHiding() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+		IContainerSymbol compUnit = table.getCompilationUnit();
 		
-		ParserSymbolTable.Declaration nsA = table.new Declaration("A");
+		IContainerSymbol nsA = table.newContainerSymbol("A");
 		nsA.setType( ParserSymbolTable.TypeInfo.t_namespace );
 		
-		compUnit.addDeclaration( nsA );
+		compUnit.addSymbol( nsA );
 		
-		ParserSymbolTable.Declaration structX = table.new Declaration("x");
+		IContainerSymbol structX = table.newContainerSymbol("x");
 		structX.setType( ParserSymbolTable.TypeInfo.t_struct );
-		nsA.addDeclaration( structX );
+		nsA.addSymbol( structX );
 		
-		ParserSymbolTable.Declaration intX = table.new Declaration("x");
+		ISymbol intX = table.newSymbol("x");
 		intX.setType( ParserSymbolTable.TypeInfo.t_int );
-		nsA.addDeclaration( intX );
+		nsA.addSymbol( intX );
 		
-		ParserSymbolTable.Declaration intY = table.new Declaration("y");
+		ISymbol intY = table.newSymbol("y");
 		intY.setType( ParserSymbolTable.TypeInfo.t_int );
-		nsA.addDeclaration( intY );
+		nsA.addSymbol( intY );
 
-		ParserSymbolTable.Declaration nsB = table.new Declaration("B");
+		IContainerSymbol nsB = table.newContainerSymbol("B");
 		nsB.setType( ParserSymbolTable.TypeInfo.t_namespace );
 		
-		compUnit.addDeclaration( nsB );
-		ParserSymbolTable.Declaration structY = table.new Declaration("y");
+		compUnit.addSymbol( nsB );
+		IContainerSymbol structY = table.newContainerSymbol("y");
 		structY.setType( ParserSymbolTable.TypeInfo.t_struct );
-		nsB.addDeclaration( structY );
+		nsB.addSymbol( structY );
 		
-		ParserSymbolTable.Declaration nsC = table.new Declaration("C");
+		IContainerSymbol nsC = table.newContainerSymbol("C");
 		nsC.setType( ParserSymbolTable.TypeInfo.t_namespace);
-		compUnit.addDeclaration( nsC );
+		compUnit.addSymbol( nsC );
 		
-		ParserSymbolTable.Declaration look = nsC.Lookup("A");
+		ISymbol look = nsC.Lookup("A");
 		assertEquals( look, nsA );
-		nsC.addUsingDirective( look );
+		nsC.addUsingDirective( nsA );
 		
 		look = nsC.Lookup("B");
 		assertEquals( look, nsB );
-		nsC.addUsingDirective( look );
+		nsC.addUsingDirective( nsB );
 		
 		//lookup C::x
 		look = nsC.LookupNestedNameSpecifier("C");
 		assertEquals( look, nsC );
-		look = look.QualifiedLookup( "x" );
+		look = ((IContainerSymbol)look).QualifiedLookup( "x" );
 		assertEquals( look, intX );
 		
 		//lookup C::y
@@ -942,7 +927,7 @@
 		assertEquals( look, nsC );
 
 		try{
-			look = look.QualifiedLookup( "y" );
+			look = ((IContainerSymbol)look).QualifiedLookup( "y" );
 			assertTrue(false);
 		} catch ( ParserSymbolTableException e ) {
 			assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous );
@@ -966,26 +951,26 @@
 	public void testLookupMemberForDefinition() throws Exception{
 		newTable();
 	
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+		IContainerSymbol compUnit = table.getCompilationUnit();
 		
-		ParserSymbolTable.Declaration nsA = table.new Declaration( "A" );
+		IContainerSymbol nsA = table.newContainerSymbol( "A" );
 		nsA.setType( ParserSymbolTable.TypeInfo.t_namespace );
-		compUnit.addDeclaration( nsA );
+		compUnit.addSymbol( nsA );
 	
-		ParserSymbolTable.Declaration nsB = table.new Declaration( "B" );
+		IContainerSymbol nsB = table.newContainerSymbol( "B" );
 		nsB.setType( ParserSymbolTable.TypeInfo.t_namespace );
-		nsA.addDeclaration( nsB );
+		nsA.addSymbol( nsB );
 	
-		ParserSymbolTable.Declaration f1 = table.new Declaration("f1");
+		IParameterizedSymbol f1 = table.newParameterizedSymbol("f1");
 		f1.setType( ParserSymbolTable.TypeInfo.t_function );
-		nsB.addDeclaration( f1 );
+		nsB.addSymbol( f1 );
 	
 		nsA.addUsingDirective( nsB );
 	
-		ParserSymbolTable.Declaration lookA = compUnit.LookupNestedNameSpecifier( "A" );
+		IContainerSymbol lookA = compUnit.LookupNestedNameSpecifier( "A" );
 		assertEquals( nsA, lookA );
 	
-		ParserSymbolTable.Declaration look = lookA.LookupMemberForDefinition( "f1" );
+		ISymbol look = lookA.LookupMemberForDefinition( "f1" );
 		assertEquals( look, null );
 	
 		//but notice if you wanted to do A::f1 as a function call, it is ok
@@ -1020,45 +1005,45 @@
 	public void testUsingDeclaration() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+		IContainerSymbol compUnit = table.getCompilationUnit();
 		
-		ParserSymbolTable.Declaration B = table.new Declaration("B");
+		IDerivableContainerSymbol B = table.newDerivableContainerSymbol("B");
 		B.setType( ParserSymbolTable.TypeInfo.t_struct );
-		compUnit.addDeclaration( B );
+		compUnit.addSymbol( B );
 		
-		ParserSymbolTable.Declaration f = table.new Declaration("f");
+		IParameterizedSymbol f = table.newParameterizedSymbol("f");
 		f.setType( ParserSymbolTable.TypeInfo.t_function );
-		B.addDeclaration( f );
+		B.addSymbol( f );
 	
-		ParserSymbolTable.Declaration E = table.new Declaration( "E" );
+		IContainerSymbol E = table.newContainerSymbol( "E" );
 		E.setType( ParserSymbolTable.TypeInfo.t_enumeration );
-		B.addDeclaration( E );
+		B.addSymbol( E );
 		
-		ParserSymbolTable.Declaration e = table.new Declaration( "e" );
+		ISymbol e = table.newSymbol( "e" );
 		e.setType( ParserSymbolTable.TypeInfo.t_enumerator );
-		E.addDeclaration( e );
+		E.addSymbol( e );
 		
 		/**
 		 * TBD: Anonymous unions are not yet implemented
 		 */
 		
-		ParserSymbolTable.Declaration C = table.new Declaration( "C" );
+		IDerivableContainerSymbol C = table.newDerivableContainerSymbol( "C" );
 		C.setType( ParserSymbolTable.TypeInfo.t_class );
-		compUnit.addDeclaration( C );
+		compUnit.addSymbol( C );
 		
-		ParserSymbolTable.Declaration g = table.new Declaration( "g" );
+		IParameterizedSymbol g = table.newParameterizedSymbol( "g" );
 		g.setType( ParserSymbolTable.TypeInfo.t_function );
-		C.addDeclaration( g );
+		C.addSymbol( g );
 		
-		ParserSymbolTable.Declaration D = table.new Declaration( "D" );
+		IDerivableContainerSymbol D = table.newDerivableContainerSymbol( "D" );
 		D.setType( ParserSymbolTable.TypeInfo.t_struct );
-		ParserSymbolTable.Declaration look = compUnit.Lookup( "B" );
+		ISymbol look = compUnit.Lookup( "B" );
 		assertEquals( look, B );
-		D.addParent( look );
+		D.addParent( B );
 		
-		compUnit.addDeclaration( D );
+		compUnit.addSymbol( D );
 		
-		ParserSymbolTable.Declaration lookB = D.LookupNestedNameSpecifier("B");
+		IContainerSymbol lookB = D.LookupNestedNameSpecifier("B");
 		assertEquals( lookB, B );
 
 		D.addUsingDeclaration( "f", lookB );
@@ -1071,7 +1056,7 @@
 		assertEquals( look, C );
 		
 		try{
-			D.addUsingDeclaration( "g", look );
+			D.addUsingDeclaration( "g", C );
 			assertTrue( false );
 		}
 		catch ( ParserSymbolTableException exception ){
@@ -1106,36 +1091,36 @@
 	public void testUsingDeclaration_2() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+		IContainerSymbol compUnit = table.getCompilationUnit();
 		
 		ParserSymbolTable.Declaration A = table.new Declaration( "A" );
 		A.setType( ParserSymbolTable.TypeInfo.t_namespace );
-		compUnit.addDeclaration( A );
+		compUnit.addSymbol( A );
 		
 		ParserSymbolTable.Declaration f1 = table.new Declaration( "f" );
 		f1.setType( ParserSymbolTable.TypeInfo.t_function );
 		f1.setReturnType( ParserSymbolTable.TypeInfo.t_void );
 		f1.addParameter( ParserSymbolTable.TypeInfo.t_int, 0, "", false );
-		A.addDeclaration( f1 );
+		A.addSymbol( f1 );
 		
-		ParserSymbolTable.Declaration look = compUnit.LookupNestedNameSpecifier("A");
+		ISymbol look = compUnit.LookupNestedNameSpecifier("A");
 		assertEquals( look, A );
 		
-		ParserSymbolTable.Declaration usingF = compUnit.addUsingDeclaration( "f", look );
+		IParameterizedSymbol usingF = (IParameterizedSymbol) compUnit.addUsingDeclaration( "f", A );
 		
 		look = compUnit.Lookup("A");
 		assertEquals( look, A );
 		
-		ParserSymbolTable.Declaration f2 = table.new Declaration("f");
+		IParameterizedSymbol f2 = table.newParameterizedSymbol("f");
 		f2.setType( ParserSymbolTable.TypeInfo.t_function );
 		f2.setReturnType( ParserSymbolTable.TypeInfo.t_void );
 		f2.addParameter( ParserSymbolTable.TypeInfo.t_char, 0, "", false );
 		
-		look.addDeclaration( f2 );
+		A.addSymbol( f2 );
 		
-		ParserSymbolTable.Declaration foo = table.new Declaration("foo");
+		IParameterizedSymbol foo = table.newParameterizedSymbol("foo");
 		foo.setType( ParserSymbolTable.TypeInfo.t_function );
-		compUnit.addDeclaration( foo );
+		compUnit.addSymbol( foo );
 
 		LinkedList paramList = new LinkedList();
 		ParserSymbolTable.TypeInfo param = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_char, null );
@@ -1143,12 +1128,12 @@
 		
 		look = foo.UnqualifiedFunctionLookup( "f", paramList );
 		assertEquals( look, usingF );
-		assertTrue( look.hasSameParameters( f1 ) );
+		assertTrue( usingF.hasSameParameters( f1 ) );
 		
-		ParserSymbolTable.Declaration bar = table.new Declaration( "bar" );
+		IParameterizedSymbol bar = table.newParameterizedSymbol( "bar" );
 		bar.setType( ParserSymbolTable.TypeInfo.t_function );
 		bar.addParameter( ParserSymbolTable.TypeInfo.t_char, 0, null, false );
-		compUnit.addDeclaration( bar );
+		compUnit.addSymbol( bar );
 		
 		look = bar.LookupNestedNameSpecifier( "A" );
 		assertEquals( look, A );
@@ -1156,7 +1141,7 @@
 		
 		look = bar.UnqualifiedFunctionLookup( "f", paramList );
 		assertTrue( look != null );
-		assertTrue( look.hasSameParameters( f2 ) );
+		assertTrue( ((IParameterizedSymbol) look).hasSameParameters( f2 ) );
 	}
 	
 	/**
@@ -1170,24 +1155,24 @@
 	public void testThisPointer() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration cls = table.new Declaration("class");
+		IContainerSymbol cls = table.newContainerSymbol("class");
 		cls.setType( ParserSymbolTable.TypeInfo.t_class );
 		
-		ParserSymbolTable.Declaration fn = table.new Declaration("function");
+		IParameterizedSymbol fn = table.newParameterizedSymbol("function");
 		fn.setType( ParserSymbolTable.TypeInfo.t_function );
 		fn.setCVQualifier( ParserSymbolTable.TypeInfo.cvConst );
 		
-		table.getCompilationUnit().addDeclaration( cls );
-		cls.addDeclaration( fn );
+		table.getCompilationUnit().addSymbol( cls );
+		cls.addSymbol( fn );
 		
-		ParserSymbolTable.Declaration look = fn.Lookup("this");
+		ISymbol look = fn.Lookup("this");
 		assertTrue( look != null );
 		
 		assertEquals( look.getType(), ParserSymbolTable.TypeInfo.t_type );
-		assertEquals( look.getTypeDeclaration(), cls );
+		assertEquals( look.getTypeSymbol(), cls );
 		assertEquals( look.getPtrOperator(), "*" );
 		assertEquals( look.getCVQualifier(), fn.getCVQualifier() );
-		assertEquals( look.getContainingScope(), fn );
+		assertEquals( look.getContainingSymbol(), fn );
 	}
 	
 	/**
@@ -1201,23 +1186,23 @@
 	public void testEnumerator() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration cls = table.new Declaration("class");
+		IContainerSymbol cls = table.newContainerSymbol("class");
 		cls.setType( ParserSymbolTable.TypeInfo.t_class );
 		
-		ParserSymbolTable.Declaration enumeration = table.new Declaration("enumeration");
+		IContainerSymbol enumeration = table.newContainerSymbol("enumeration");
 		enumeration.setType( ParserSymbolTable.TypeInfo.t_enumeration );
 		
-		table.getCompilationUnit().addDeclaration( cls );
-		cls.addDeclaration( enumeration );
+		table.getCompilationUnit().addSymbol( cls );
+		cls.addSymbol( enumeration );
 		
-		ParserSymbolTable.Declaration enumerator = table.new Declaration( "enumerator" );
+		ISymbol enumerator = table.newSymbol( "enumerator" );
 		enumerator.setType( ParserSymbolTable.TypeInfo.t_enumerator );
-		enumeration.addDeclaration( enumerator );
+		enumeration.addSymbol( enumerator );
 		
-		ParserSymbolTable.Declaration look = cls.Lookup( "enumerator" );
+		ISymbol look = cls.Lookup( "enumerator" );
 		assertEquals( look, enumerator );
-		assertEquals( look.getContainingScope(), cls );
-		assertEquals( look.getTypeDeclaration(), enumeration );
+		assertEquals( look.getContainingSymbol(), cls );
+		assertEquals( look.getTypeSymbol(), enumeration );
 	}
 
 	/**
@@ -1236,42 +1221,42 @@
 	public void testArgumentDependentLookup() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+		IContainerSymbol compUnit = table.getCompilationUnit();
 		
-		ParserSymbolTable.Declaration NS = table.new Declaration("NS");
+		IContainerSymbol NS = table.newContainerSymbol("NS");
 		NS.setType( ParserSymbolTable.TypeInfo.t_namespace );
 		
-		compUnit.addDeclaration( NS );
+		compUnit.addSymbol( NS );
 		
-		ParserSymbolTable.Declaration T = table.new Declaration("T");
+		IDerivableContainerSymbol T = table.newDerivableContainerSymbol("T");
 		T.setType( ParserSymbolTable.TypeInfo.t_class );
 		
-		NS.addDeclaration( T );
+		NS.addSymbol( T );
 		
-		ParserSymbolTable.Declaration f = table.new Declaration("f");
+		IParameterizedSymbol f = table.newParameterizedSymbol("f");
 		f.setType( ParserSymbolTable.TypeInfo.t_function );
 		f.setReturnType( ParserSymbolTable.TypeInfo.t_void );
 		
-		ParserSymbolTable.Declaration look = NS.Lookup( "T" );
+		ISymbol look = NS.Lookup( "T" );
 		assertEquals( look, T );				
 		f.addParameter( look, 0, "", false );
 		
-		NS.addDeclaration( f );	
+		NS.addSymbol( f );	
 				
 		look = compUnit.LookupNestedNameSpecifier( "NS" );
 		assertEquals( look, NS );
-		look = look.QualifiedLookup( "T" );
+		look = NS.QualifiedLookup( "T" );
 		assertEquals( look, T );
 		
-		ParserSymbolTable.Declaration param = table.new Declaration("parm");
+		ISymbol param = table.newSymbol("parm");
 		param.setType( ParserSymbolTable.TypeInfo.t_type );
-		param.setTypeDeclaration( look );
-		compUnit.addDeclaration( param );
+		param.setTypeSymbol( look );
+		compUnit.addSymbol( param );
 		
-		ParserSymbolTable.Declaration main = table.new Declaration("main");
+		IParameterizedSymbol main = table.newParameterizedSymbol("main");
 		main.setType( ParserSymbolTable.TypeInfo.t_function );
 		main.setReturnType( ParserSymbolTable.TypeInfo.t_int );
-		compUnit.addDeclaration( main );
+		compUnit.addSymbol( main );
 
 		LinkedList paramList = new LinkedList();
 		look = main.Lookup( "parm" );
@@ -1309,55 +1294,55 @@
 	public void testArgumentDependentLookup_2() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+		IContainerSymbol compUnit = table.getCompilationUnit();
 		
-		ParserSymbolTable.Declaration NS1 = table.new Declaration( "NS1" );
+		IContainerSymbol NS1 = table.newContainerSymbol( "NS1" );
 		NS1.setType( ParserSymbolTable.TypeInfo.t_namespace );
 		 
-		compUnit.addDeclaration( NS1 );
+		compUnit.addSymbol( NS1 );
 		
 		ParserSymbolTable.Declaration f1 = table.new Declaration( "f" );
 		f1.setType( ParserSymbolTable.TypeInfo.t_function );
 		f1.setReturnType( ParserSymbolTable.TypeInfo.t_void );
 		f1.addParameter( ParserSymbolTable.TypeInfo.t_void, 0, "*", false );
-		NS1.addDeclaration( f1 );
+		NS1.addSymbol( f1 );
 		
-		ParserSymbolTable.Declaration NS2 = table.new Declaration( "NS2" );
+		IContainerSymbol NS2 = table.newContainerSymbol( "NS2" );
 		NS2.setType( ParserSymbolTable.TypeInfo.t_namespace );
 		
-		compUnit.addDeclaration( NS2 );
+		compUnit.addSymbol( NS2 );
 		
-		ParserSymbolTable.Declaration look = NS2.Lookup( "NS1" );
+		ISymbol look = NS2.Lookup( "NS1" );
 		assertEquals( look, NS1 );
-		NS2.addUsingDirective( look );
+		NS2.addUsingDirective( NS1 );
 		
-		ParserSymbolTable.Declaration B = table.new Declaration( "B" );
+		IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B" );
 		B.setType( ParserSymbolTable.TypeInfo.t_class );
-		NS2.addDeclaration( B );
+		NS2.addSymbol( B );
 		
-		ParserSymbolTable.Declaration f2 = table.new Declaration( "f" );
+		IParameterizedSymbol f2 = table.newParameterizedSymbol( "f" );
 		f2.setType( ParserSymbolTable.TypeInfo.t_function );
 		f2.setReturnType( ParserSymbolTable.TypeInfo.t_void );
 		f2.addParameter( ParserSymbolTable.TypeInfo.t_void, 0, "*", false );
-		NS2.addDeclaration( f2 );
+		NS2.addSymbol( f2 );
 		
-		ParserSymbolTable.Declaration A = table.new Declaration( "A" );
+		IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A" );
 		A.setType( ParserSymbolTable.TypeInfo.t_class );
 		look = compUnit.LookupNestedNameSpecifier( "NS2" );
 		assertEquals( look, NS2 );
 		
 		look = NS2.QualifiedLookup( "B" );
 		assertEquals( look, B );
-		A.addParent( look );
+		A.addParent( B );
 		
-		compUnit.addDeclaration( A );
+		compUnit.addSymbol( A );
 		
 		look = compUnit.Lookup( "A" );
 		assertEquals( look, A );
-		ParserSymbolTable.Declaration a = table.new Declaration( "a" );
+		ISymbol a = table.newSymbol( "a" );
 		a.setType( ParserSymbolTable.TypeInfo.t_type );
-		a.setTypeDeclaration( look );
-		compUnit.addDeclaration( a );
+		a.setTypeSymbol( look );
+		compUnit.addSymbol( a );
 		
 		LinkedList paramList = new LinkedList();
 		look = compUnit.Lookup( "a" );
@@ -1392,45 +1377,45 @@
 	public void testFunctionOverloading() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+		IContainerSymbol compUnit = table.getCompilationUnit();
 		
-		ParserSymbolTable.Declaration C = table.new Declaration( "C" );
+		IDerivableContainerSymbol C = table.newDerivableContainerSymbol( "C" );
 		C.setType( ParserSymbolTable.TypeInfo.t_class );
-		compUnit.addDeclaration(C);
+		compUnit.addSymbol(C);
 				
-		ParserSymbolTable.Declaration f1 = table.new Declaration("foo");
+		IParameterizedSymbol f1 = table.newParameterizedSymbol("foo");
 		f1.setType( ParserSymbolTable.TypeInfo.t_function );
 		f1.setReturnType( ParserSymbolTable.TypeInfo.t_void );
 		f1.addParameter( ParserSymbolTable.TypeInfo.t_int, 0, "", false );
-		C.addDeclaration( f1 );
+		C.addSymbol( f1 );
 		
-		ParserSymbolTable.Declaration f2 = table.new Declaration("foo");
+		IParameterizedSymbol f2 = table.newParameterizedSymbol("foo");
 		f2.setType( ParserSymbolTable.TypeInfo.t_function );
 		f2.setReturnType( ParserSymbolTable.TypeInfo.t_void );
 		f2.addParameter( ParserSymbolTable.TypeInfo.t_int, 0, "", false );
 		f2.addParameter( ParserSymbolTable.TypeInfo.t_char, 0, "", false );
-		C.addDeclaration( f2 );
+		C.addSymbol( f2 );
 		
-		ParserSymbolTable.Declaration f3 = table.new Declaration("foo");
+		IParameterizedSymbol f3 = table.newParameterizedSymbol("foo");
 		f3.setType( ParserSymbolTable.TypeInfo.t_function );
 		f3.setReturnType( ParserSymbolTable.TypeInfo.t_void );
 		f3.addParameter( ParserSymbolTable.TypeInfo.t_int, 0, "", false );
 		f3.addParameter( ParserSymbolTable.TypeInfo.t_char, 0, "", false );
 		f3.addParameter( C, 0, "*", false );
-		C.addDeclaration( f3 );
+		C.addSymbol( f3 );
 		
-		ParserSymbolTable.Declaration look = compUnit.Lookup("C");
+		ISymbol look = compUnit.Lookup("C");
 		assertEquals( look, C );
 		
-		ParserSymbolTable.Declaration c = table.new Declaration("c");
+		ISymbol c = table.newSymbol("c");
 		c.setType( ParserSymbolTable.TypeInfo.t_type );
-		c.setTypeDeclaration( look );
+		c.setTypeSymbol( look );
 		c.setPtrOperator( "*" );
-		compUnit.addDeclaration( c );
+		compUnit.addSymbol( c );
 		
 		look = compUnit.Lookup( "c" );
 		assertEquals( look, c );
-		assertEquals( look.getTypeDeclaration(), C );
+		assertEquals( look.getTypeSymbol(), C );
 		
 		LinkedList paramList = new LinkedList();
 		ParserSymbolTable.TypeInfo p1 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_int, null, 0, "", false);
@@ -1465,23 +1450,23 @@
 	public void testFunctionResolution() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+		IContainerSymbol compUnit = table.getCompilationUnit();
 		
-		ParserSymbolTable.Declaration f1 = table.new Declaration("f");
+		IParameterizedSymbol f1 = table.newParameterizedSymbol("f");
 		f1.setType( ParserSymbolTable.TypeInfo.t_function );
 		f1.addParameter( ParserSymbolTable.TypeInfo.t_int, 0, "", false );
-		compUnit.addDeclaration( f1 );
+		compUnit.addSymbol( f1 );
 		
-		ParserSymbolTable.Declaration f2 = table.new Declaration("f");
+		IParameterizedSymbol f2 = table.newParameterizedSymbol("f");
 		f2.setType( ParserSymbolTable.TypeInfo.t_function );
 		f2.addParameter( ParserSymbolTable.TypeInfo.t_char, 0, "", true );
-		compUnit.addDeclaration( f2 );
+		compUnit.addSymbol( f2 );
 		
 		LinkedList paramList = new LinkedList();
 		ParserSymbolTable.TypeInfo p1 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_int, null, 0, "", false );
 		paramList.add( p1 );
 		
-		ParserSymbolTable.Declaration look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
+		ISymbol look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
 		assertEquals( look, f1 );
 		
 		paramList.clear();
@@ -1520,46 +1505,46 @@
 	public void testFunctionResolution_PointersAndBaseClasses() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+		IContainerSymbol compUnit = table.getCompilationUnit();
 		
-		ParserSymbolTable.Declaration A = table.new Declaration( "A" );
+		IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A" );
 		A.setType( ParserSymbolTable.TypeInfo.t_class );
-		compUnit.addDeclaration( A );
+		compUnit.addSymbol( A );
 		
-		ParserSymbolTable.Declaration B = table.new Declaration( "B" );
+		IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B" );
 		B.setType( ParserSymbolTable.TypeInfo.t_class );
 		B.addParent( A );
-		compUnit.addDeclaration( B );
+		compUnit.addSymbol( B );
 		
-		ParserSymbolTable.Declaration C = table.new Declaration( "C" );
+		IDerivableContainerSymbol C = table.newDerivableContainerSymbol( "C" );
 		C.setType( ParserSymbolTable.TypeInfo.t_class );
 		C.addParent( B );
-		compUnit.addDeclaration( C );
+		compUnit.addSymbol( C );
 		
-		ParserSymbolTable.Declaration f1 = table.new Declaration( "f" );
+		IParameterizedSymbol f1 = table.newParameterizedSymbol( "f" );
 		f1.setType( ParserSymbolTable.TypeInfo.t_function );
 		f1.addParameter( A, 0, "*", false );
-		compUnit.addDeclaration( f1 );
+		compUnit.addSymbol( f1 );
 		
-		ParserSymbolTable.Declaration f2 = table.new Declaration( "f" );
+		IParameterizedSymbol f2 = table.newParameterizedSymbol( "f" );
 		f2.setType( ParserSymbolTable.TypeInfo.t_function );
 		f2.addParameter( B, 0, "*", false );
-		compUnit.addDeclaration( f2 );
+		compUnit.addSymbol( f2 );
 		
-		ParserSymbolTable.Declaration a = table.new Declaration( "a" );
+		ISymbol a = table.newSymbol( "a" );
 		a.setType( ParserSymbolTable.TypeInfo.t_type );
-		a.setTypeDeclaration( A );
+		a.setTypeSymbol( A );
 		a.setPtrOperator( "*" );
 		
-		ParserSymbolTable.Declaration c = table.new Declaration( "c" );
+		ISymbol c = table.newSymbol( "c" );
 		c.setType( ParserSymbolTable.TypeInfo.t_type );
-		c.setTypeDeclaration( C );
+		c.setTypeSymbol( C );
 		c.setPtrOperator( "*" );
 		
 		LinkedList paramList = new LinkedList();
 		ParserSymbolTable.TypeInfo p1 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_type, a, 0, null, false );
 		paramList.add( p1 );
-		ParserSymbolTable.Declaration look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
+		ISymbol look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
 		assertEquals( look, f1 );
 		
 		paramList.clear();
@@ -1592,55 +1577,55 @@
 	public void testFunctionResolution_TypedefsAndPointers() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+		IContainerSymbol compUnit = table.getCompilationUnit();
 		
-		ParserSymbolTable.Declaration A = table.new Declaration( "A" );
+		IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A" );
 		A.setType( ParserSymbolTable.TypeInfo.t_class );
-		compUnit.addDeclaration( A );
+		compUnit.addSymbol( A );
 		
-		ParserSymbolTable.Declaration B = table.new Declaration( "B" );
+		ISymbol B = table.newSymbol( "B" );
 		B.setType( ParserSymbolTable.TypeInfo.t_type );
-		B.setTypeDeclaration( A );
+		B.setTypeSymbol( A );
 		B.setPtrOperator( "*" );
-		compUnit.addDeclaration( B );
+		compUnit.addSymbol( B );
 		
-		ParserSymbolTable.Declaration f1 = table.new Declaration( "f" );
+		IParameterizedSymbol f1 = table.newParameterizedSymbol( "f" );
 		f1.setType( ParserSymbolTable.TypeInfo.t_function );
 		f1.addParameter( A, 0, "*", false );
-		compUnit.addDeclaration( f1 );
+		compUnit.addSymbol( f1 );
 		
-		ParserSymbolTable.Declaration f2 = table.new Declaration( "f" );
+		IParameterizedSymbol f2 = table.newParameterizedSymbol( "f" );
 		f2.setType( ParserSymbolTable.TypeInfo.t_function );
 		f2.addParameter( A, 0, null, false );
-		compUnit.addDeclaration( f2 );
+		compUnit.addSymbol( f2 );
 
-		ParserSymbolTable.Declaration a = table.new Declaration( "a" );
+		ISymbol a = table.newSymbol( "a" );
 		a.setType( ParserSymbolTable.TypeInfo.t_type );
-		a.setTypeDeclaration( A );
-		compUnit.addDeclaration( a );
+		a.setTypeSymbol( A );
+		compUnit.addSymbol( a );
 				
-		ParserSymbolTable.Declaration b = table.new Declaration( "b" );
+		ISymbol b = table.newSymbol( "b" );
 		b.setType( ParserSymbolTable.TypeInfo.t_type );
-		b.setTypeDeclaration( B );
-		compUnit.addDeclaration( b );
+		b.setTypeSymbol( B );
+		compUnit.addSymbol( b );
 		
-		ParserSymbolTable.Declaration array = table.new Declaration( "array" );
+		ISymbol array = table.newSymbol( "array" );
 		array.setType( ParserSymbolTable.TypeInfo.t_type );
-		array.setTypeDeclaration( A );
+		array.setTypeSymbol( A );
 		array.setPtrOperator( "[]" );
 				
 		LinkedList paramList = new LinkedList();
 		ParserSymbolTable.TypeInfo p = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_type, a, 0, null, false );
 		paramList.add( p );
 		
-		ParserSymbolTable.Declaration look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
+		ISymbol look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
 		assertEquals( look, f2 );
 		
 		p.setPtrOperator( "&" );
 		look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
 		assertEquals( look, f1 );
 		
-		p.setTypeDeclaration( b );
+		p.setTypeSymbol( b );
 		p.setPtrOperator( null );
 		look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
 		assertEquals( look, f1 );
@@ -1649,7 +1634,7 @@
 		look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
 		assertEquals( look, f2 );
 		
-		p.setTypeDeclaration( array );
+		p.setTypeSymbol( array );
 		p.setPtrOperator( null );
 		look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
 		assertEquals( look, f1 );
@@ -1675,37 +1660,37 @@
 	public void testUserDefinedConversionSequences() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+		IContainerSymbol compUnit = table.getCompilationUnit();
 		
-		ParserSymbolTable.Declaration A = table.new Declaration( "A" );
+		IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A" );
 		A.setType( ParserSymbolTable.TypeInfo.t_class );
-		compUnit.addDeclaration( A );
+		compUnit.addSymbol( A );
 		
-		ParserSymbolTable.Declaration B = table.new Declaration( "B" );
+		IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B" );
 		B.setType( ParserSymbolTable.TypeInfo.t_class );
-		compUnit.addDeclaration( B );
+		compUnit.addSymbol( B );
 		
 		//12.1-1 "Constructors do not have names"
-		ParserSymbolTable.Declaration constructor = table.new Declaration("");
+		IParameterizedSymbol constructor = table.newParameterizedSymbol("");
 		constructor.setType( ParserSymbolTable.TypeInfo.t_function );
 		constructor.addParameter( A, 0, null, false );
-		B.addDeclaration( constructor );
+		B.addSymbol( constructor );
 		
-		ParserSymbolTable.Declaration f = table.new Declaration( "f" );
+		IParameterizedSymbol f = table.newParameterizedSymbol( "f" );
 		f.setType( ParserSymbolTable.TypeInfo.t_function );
 		f.addParameter( B, 0, null, false );
-		compUnit.addDeclaration( f );
+		compUnit.addSymbol( f );
 		
-		ParserSymbolTable.Declaration a = table.new Declaration( "a" );
+		ISymbol a = table.newSymbol( "a" );
 		a.setType( ParserSymbolTable.TypeInfo.t_type );
-		a.setTypeDeclaration( A );
-		compUnit.addDeclaration( a );
+		a.setTypeSymbol( A );
+		compUnit.addSymbol( a );
 		
 		LinkedList paramList = new LinkedList();
 		ParserSymbolTable.TypeInfo p = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_type, a, 0, null, false );
 		paramList.add( p );
 		
-		ParserSymbolTable.Declaration look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
+		ISymbol look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
 		assertEquals( look, f );	
 	}
 	
@@ -1733,33 +1718,33 @@
 	public void testOverloadRanking() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+		IContainerSymbol compUnit = table.getCompilationUnit();
 		
-		ParserSymbolTable.Declaration f1 = table.new Declaration( "f" );
+		IParameterizedSymbol f1 = table.newParameterizedSymbol( "f" );
 		f1.setType( ParserSymbolTable.TypeInfo.t_function );
 		f1.addParameter( ParserSymbolTable.TypeInfo.t_int, ParserSymbolTable.TypeInfo.cvConst, "*", false );
 		f1.addParameter( ParserSymbolTable.TypeInfo.t_int | ParserSymbolTable.TypeInfo.isShort, 0, null, false );
 		
-		compUnit.addDeclaration( f1 );
+		compUnit.addSymbol( f1 );
 		
-		ParserSymbolTable.Declaration f2 = table.new Declaration( "f" );
+		IParameterizedSymbol f2 = table.newParameterizedSymbol( "f" );
 		f2.setType( ParserSymbolTable.TypeInfo.t_function );
 		f2.addParameter( ParserSymbolTable.TypeInfo.t_int, 0, "*", false );
 		f2.addParameter( ParserSymbolTable.TypeInfo.t_int, 0, null, false );
-		compUnit.addDeclaration( f2 );
+		compUnit.addSymbol( f2 );
 		
-		ParserSymbolTable.Declaration i = table.new Declaration( "i" );
+		ISymbol i = table.newSymbol( "i" );
 		i.setType( ParserSymbolTable.TypeInfo.t_int );
-		compUnit.addDeclaration( i );
+		compUnit.addSymbol( i );
 		
-		ParserSymbolTable.Declaration s = table.new Declaration( "s" );
+		ISymbol s = table.newSymbol( "s" );
 		s.setType( ParserSymbolTable.TypeInfo.t_int );
 		s.getTypeInfo().setBit( true, ParserSymbolTable.TypeInfo.isShort );
-		compUnit.addDeclaration( s );
+		compUnit.addSymbol( s );
 		
-		ParserSymbolTable.Declaration main = table.new Declaration( "main" );
+		IParameterizedSymbol main = table.newParameterizedSymbol( "main" );
 		main.setType( ParserSymbolTable.TypeInfo.t_function );
-		compUnit.addDeclaration( main );
+		compUnit.addSymbol( main );
 		
 		LinkedList params = new LinkedList();
 		ParserSymbolTable.TypeInfo p1 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_type, i, 0, "&", false );
@@ -1767,10 +1752,10 @@
 		params.add( p1 );
 		params.add( p2 );
 		
-		ParserSymbolTable.Declaration look = null;
+		ISymbol look = null;
 		
 		try{
-			main = main.UnqualifiedFunctionLookup( "f", params );
+			look = main.UnqualifiedFunctionLookup( "f", params );
 			assertTrue( false );
 		} catch ( ParserSymbolTableException e ){
 			assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous );
@@ -1826,40 +1811,40 @@
 	public void testUserDefinedConversionByOperator() throws Exception{
 		newTable();
 		
-		ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+		IContainerSymbol compUnit = table.getCompilationUnit();
 		
-		ParserSymbolTable.Declaration B = table.new Declaration( "B" );
+		IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B" );
 		B.setType( ParserSymbolTable.TypeInfo.t_class );
 		
-		compUnit.addDeclaration( B );
+		compUnit.addSymbol( B );
 		
-		ParserSymbolTable.Declaration A = table.new Declaration( "A" );
+		IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A" );
 		A.setType( ParserSymbolTable.TypeInfo.t_class );
-		compUnit.addDeclaration( A );
+		compUnit.addSymbol( A );
 		
-		ParserSymbolTable.Declaration constructA = table.new Declaration( "" );
+		IParameterizedSymbol constructA = table.newParameterizedSymbol( "" );
 		constructA.setType( ParserSymbolTable.TypeInfo.t_function );
 		constructA.addParameter( B, 0, "&", false );
-		A.addDeclaration( constructA );
+		A.addSymbol( constructA );
 		
-		ParserSymbolTable.Declaration operator = table.new Declaration( "operator A" );
+		IParameterizedSymbol operator = table.newParameterizedSymbol( "operator A" );
 		operator.setType( ParserSymbolTable.TypeInfo.t_function );
-		B.addDeclaration( operator );
+		B.addSymbol( operator );
 		
-		ParserSymbolTable.Declaration f1 = table.new Declaration( "f" );
+		IParameterizedSymbol f1 = table.newParameterizedSymbol( "f" );
 		f1.setType( ParserSymbolTable.TypeInfo.t_function );
 		f1.addParameter( A, 0, null, false );
-		compUnit.addDeclaration( f1 );
+		compUnit.addSymbol( f1 );
 		
-		ParserSymbolTable.Declaration b = table.new Declaration( "b" );
+		ISymbol b = table.newSymbol( "b" );
 		b.setType( ParserSymbolTable.TypeInfo.t_type );
-		b.setTypeDeclaration( B );
+		b.setTypeSymbol( B );
 		
 		LinkedList params = new LinkedList();
 		ParserSymbolTable.TypeInfo p1 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_type, b, 0, null, false );
 		params.add( p1 );
 		
-		ParserSymbolTable.Declaration look = null;
+		ISymbol look = null;
 		
 		try{
 			look = compUnit.UnqualifiedFunctionLookup( "f", params );
@@ -1868,19 +1853,19 @@
 			assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous ); 
 		}
 		
-		ParserSymbolTable.Declaration C = table.new Declaration("C");
+		IDerivableContainerSymbol C = table.newDerivableContainerSymbol("C");
 		C.setType( ParserSymbolTable.TypeInfo.t_class );
-		compUnit.addDeclaration( C );
+		compUnit.addSymbol( C );
 		
-		ParserSymbolTable.Declaration constructC = table.new Declaration("");
+		IParameterizedSymbol constructC = table.newParameterizedSymbol("");
 		constructC.setType( ParserSymbolTable.TypeInfo.t_function );
 		constructC.addParameter( B, 0, "&", false );
-		C.addDeclaration( constructC );
+		C.addSymbol( constructC );
 
-		ParserSymbolTable.Declaration f2 = table.new Declaration( "f" );
+		IParameterizedSymbol f2 = table.newParameterizedSymbol( "f" );
 		f2.setType( ParserSymbolTable.TypeInfo.t_function );
 		f2.addParameter(  C, 0, null, false );
-		compUnit.addDeclaration( f2 );
+		compUnit.addSymbol( f2 );
 		
 		try{
 			look = compUnit.UnqualifiedFunctionLookup( "f", params );
@@ -1889,10 +1874,10 @@
 			assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous ); 
 		}
 		
-		ParserSymbolTable.Declaration f3 = table.new Declaration( "f" );
+		IParameterizedSymbol f3 = table.newParameterizedSymbol( "f" );
 		f3.setType( ParserSymbolTable.TypeInfo.t_function );
 		f3.addParameter(  B, 0, null, false );
-		compUnit.addDeclaration( f3 );
+		compUnit.addSymbol( f3 );
 		
 		look = compUnit.UnqualifiedFunctionLookup( "f", params );
 		assertEquals( look, f3 );
@@ -1901,16 +1886,16 @@
 	public void testMarkRollback() throws Exception{
 		newTable();
 		
-		Declaration A = table.new Declaration("A");
+		IDerivableContainerSymbol A = table.newDerivableContainerSymbol("A");
 		A.setType( TypeInfo.t_class );
-		table.getCompilationUnit().addDeclaration( A );
+		table.getCompilationUnit().addSymbol( A );
 		
 		Mark mark = table.setMark();
 		
-		Declaration f = table.new Declaration("f");
-		A.addDeclaration( f );
+		ISymbol f = table.newSymbol("f");
+		A.addSymbol( f );
 		
-		Declaration look = A.Lookup("f");
+		ISymbol look = A.Lookup("f");
 		assertEquals( look, f );
 		
 		assertTrue( table.rollBack( mark ) );
@@ -1918,22 +1903,24 @@
 		look = A.Lookup("f");
 		assertEquals( look, null );
 		
-		Declaration B = table.new Declaration("B");
+		IDerivableContainerSymbol B = table.newDerivableContainerSymbol("B");
 		B.setType( TypeInfo.t_class );
 		
 		mark = table.setMark();
-		table.getCompilationUnit().addDeclaration( B );
+		table.getCompilationUnit().addSymbol( B );
 		Mark mark2 = table.setMark();
 		A.addParent( B );
 		Mark mark3 = table.setMark();
-		B.addParameter( TypeInfo.t_class, 0, "", false );
 		
-		assertEquals( B.getParameterList().size(), 1 );
+		IParameterizedSymbol C = table.newParameterizedSymbol("C");
+		C.addParameter( TypeInfo.t_class, 0, "", false );
+		
+		assertEquals( C.getParameterList().size(), 1 );
 		table.rollBack( mark3 );
-		assertEquals( B.getParameterList().size(), 0 );
-		assertEquals( A.getParentScopes().size(), 1 );
+		assertEquals( C.getParameterList().size(), 0 );
+		assertEquals( A.getParents().size(), 1 );
 		table.rollBack( mark2 );
-		assertEquals( A.getParentScopes().size(), 0 );
+		assertEquals( A.getParents().size(), 0 );
 		
 		assertFalse( table.commit( mark2 ) );
 		assertFalse( table.rollBack( mark2 ) );
Index: parser/ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/parser/ChangeLog,v
retrieving revision 1.48.2.2
diff -u -r1.48.2.2 ChangeLog
--- parser/ChangeLog	8 May 2003 20:51:41 -0000	1.48.2.2
+++ parser/ChangeLog	13 May 2003 14:54:48 -0000
@@ -1,3 +1,10 @@
+2003-05-13
+	Moved symbol table to org.eclipse.cdt.internal.core.pst
+	Created interface for symbol table: ISymbol, IContainerSymbol, IDerivableContainerSymbol, 
+	IParameterizedSymbol, and ISpecializedSymbol.  These are all implemented by Declaration
+	The symbol table itself uses this interface instead of using its Declaration directly
+	(with the exception of the undo command framework)
+
 2003-05-08 Andrew Niefer
 	Added a basic command structure to support rollbacks
 
Index: parser/org/eclipse/cdt/internal/core/parser/ISymbol.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ISymbol.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ISymbol.java
--- parser/org/eclipse/cdt/internal/core/parser/ISymbol.java	6 May 2003 23:51:22 -0000	1.1.2.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,21 +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;
-
-/**
- * @author jcamelon
- *
- */
-public interface ISymbol {
-
-	public Object getCallbackExtension(); 
-
-}
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.45.2.3
diff -u -r1.45.2.3 Parser.java
--- parser/org/eclipse/cdt/internal/core/parser/Parser.java	8 May 2003 20:56:33 -0000	1.45.2.3
+++ parser/org/eclipse/cdt/internal/core/parser/Parser.java	13 May 2003 14:54:49 -0000
@@ -16,8 +16,9 @@
 import java.io.StringReader;
 
 import org.eclipse.cdt.internal.core.model.Util;
-import org.eclipse.cdt.internal.core.parser.ParserSymbolTable.Declaration;
-import org.eclipse.cdt.internal.core.parser.ParserSymbolTable.TypeInfo;
+import org.eclipse.cdt.internal.core.pst.*;
+import org.eclipse.cdt.internal.core.pst.ParserSymbolTable.Declaration;
+import org.eclipse.cdt.internal.core.pst.ParserSymbolTable.TypeInfo;
 
 /**
  * This is our first implementation of the IParser interface, serving as a parser for
@@ -169,7 +170,7 @@
 		while (true) {
 			try {
 				checkToken = LA(1);
-				declaration( pst.getCompilationUnit() );
+				declaration( (Declaration) pst.getCompilationUnit() );
 				if( LA(1) == checkToken )
 					errorHandling();
 			} catch (EndOfFile e) {
@@ -338,7 +339,7 @@
 		if( ! quickParse )
 		{
 			try {
-				scope.addDeclaration( linkageSymbol );
+				scope.addSymbol( linkageSymbol );
 			} catch (ParserSymbolTableException e1) {
 				// TODO Auto-generated catch block
 			}
@@ -443,7 +444,7 @@
 			if(!quickParse)
 			{
 				try {
-					scope.addDeclaration( templateSymbol );
+					scope.addSymbol( templateSymbol );
 				} catch (ParserSymbolTableException e1) {
 					// TODO Auto-generated catch block
 					e1.printStackTrace();
@@ -655,7 +656,7 @@
 			 
 			Declaration namespaceSymbol = null; 
 			try {
-				namespaceSymbol = scope.Lookup( identifier );
+				namespaceSymbol = (Declaration) scope.Lookup( identifier );
 			} catch (ParserSymbolTableException e1) {
 				// should not get ambiguity here 
 			}
@@ -669,7 +670,7 @@
 				if( ! quickParse )
 				{
 					try {
-						scope.addDeclaration( namespaceSymbol );
+						scope.addSymbol( namespaceSymbol );
 					} catch (ParserSymbolTableException e2) {
 						// TODO ambiguity?
 					}
@@ -1433,7 +1434,7 @@
 		if( ! quickParse )
 		{
 			try {
-				scope.addDeclaration( declaratorSymbol );
+				scope.addSymbol( declaratorSymbol );
 			} catch (ParserSymbolTableException e1) {
 				try{ callback.declaratorAbort( declaratorSymbol.getCallbackExtension()); } catch( Exception e ) {}
 				throw backtrack;
@@ -1945,7 +1946,7 @@
 			if( !quickParse )
 			{
 				try {
-					scope.addDeclaration( classSymbol );
+					scope.addSymbol( classSymbol );
 				} catch (ParserSymbolTableException e1) {
 				}
 			}
Index: parser/org/eclipse/cdt/internal/core/parser/ParserSymbolTable.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ParserSymbolTable.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ParserSymbolTable.java
--- parser/org/eclipse/cdt/internal/core/parser/ParserSymbolTable.java	8 May 2003 20:56:33 -0000	1.13.2.4
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,2509 +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: 
- * Rational Software - Initial API and implementation
- *
-***********************************************************************/
-
-
-package org.eclipse.cdt.internal.core.parser;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.ListIterator;
-import java.util.Map;
-import java.util.Set;
-//import java.util.Stack;
-
-
-/**
- * @author aniefer
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-
-public class ParserSymbolTable {
-
-	/**
-	 * Constructor for ParserSymbolTable.
-	 */
-	public ParserSymbolTable() {
-		super();
-		_compilationUnit = new Declaration("");
-		_compilationUnit.setType( TypeInfo.t_namespace );
-	}
-
-	public Declaration getCompilationUnit(){
-		return _compilationUnit;
-	}
-
-	/**
-	 * Lookup the name from LookupData starting in the inDeclaration
-	 * @param data
-	 * @param inDeclaration
-	 * @return Declaration
-	 * @throws ParserSymbolTableException
-	 */
-	static private void Lookup( LookupData data, Declaration inDeclaration ) throws ParserSymbolTableException
-	{
-		if( data.type != -1 && data.type < TypeInfo.t_class && data.upperType > TypeInfo.t_union ){
-			throw new ParserSymbolTableException( ParserSymbolTableException.r_BadTypeInfo );
-		}
-		
-		Declaration decl = null;					//the return value
-		LinkedList transitives = new LinkedList();	//list of transitive using directives
-		
-		//if this name define in this scope?
-		LookupInContained( data, inDeclaration );
-		
-		if( !data.ignoreUsingDirectives ){
-			//check nominated namespaces
-			//the transitives list is populated in LookupInNominated, and then 
-			//processed in ProcessDirectives
-			
-			data.visited.clear(); //each namesapce is searched at most once, so keep track
-			
-			LookupInNominated( data, inDeclaration, transitives );
-
-			//if we are doing a qualified lookup, only process using directives if
-			//we haven't found the name yet (and if we aren't ignoring them). 
-			if( !data.qualified || data.foundItems == null ){
-				ProcessDirectives( inDeclaration, data, transitives );
-				
-				if( inDeclaration.getUsingDirectives() != null ){
-					ProcessDirectives( inDeclaration, data, inDeclaration.getUsingDirectives() );
-				}
-							
-				while( data.usingDirectives != null && data.usingDirectives.get( inDeclaration ) != null ){
-					transitives.clear();
-					
-					LookupInNominated( data, inDeclaration, transitives );
-	
-					if( !data.qualified || data.foundItems == null ){
-						ProcessDirectives( inDeclaration, data, transitives );
-					}
-				}
-			}
-		}
-		
-		if( data.foundItems != null || data.stopAt == inDeclaration ){
-			return;
-		}
-			
-		//if we still havn't found it, check any parents we have
-		data.visited.clear();	//each virtual base class is searched at most once	
-		decl = LookupInParents( data, inDeclaration );
-		
-		//there is a resolveAmbiguities inside LookupInParents, which means if we found
-		//something the foundItems set will be non-null, but empty.  So, add the decl into
-		//the foundItems set
-		if( decl != null ){
-			data.foundItems.add( decl );	
-		}
-					
-		//if still not found, check our containing scope.			
-		if( data.foundItems == null && inDeclaration._containingScope != null ){ 
-			Lookup( data, inDeclaration._containingScope );
-		}
-
-		return;
-	}
-	
-	/**
-	 * function LookupInNominated
-	 * @param data
-	 * @param transitiveDirectives
-	 * @return List
-	 * 
-	 * for qualified:
-	 *  3.4.3.2-2 "let S be the set of all declarations of m in X
-	 * and in the transitive closure of all namespaces nominated by using-
-	 * directives in X and its used namespaces, except that using-directives are
-	 * ignored in any namespace, including X, directly containing one or more
-	 * declarations of m."
-	 * 
-	 * for unqualified:
-	 * 7.3.4-2 The using-directive is transitive: if a scope contains a using
-	 * directive that nominates a second namespace that itself contains using-
-	 * directives, the effect is as if the using-directives from the second
-	 * namespace also appeared in the first.
-	 */
-	static private void LookupInNominated( LookupData data, Declaration declaration, LinkedList transitiveDirectives ) throws ParserSymbolTableException{
-		//if the data.usingDirectives is empty, there is nothing to do.
-		if( data.usingDirectives == null ){
-			return;
-		}
-			
-		//local variables
-		LinkedList  directives = null; //using directives association with declaration
-		Iterator    iter = null;
-		Declaration decl = null;
-		
-		boolean foundSomething = false;
-		int size = 0;
-		
-		directives = (LinkedList) data.usingDirectives.remove( declaration );
-		
-		if( directives == null ){
-			return;
-		}
-		
-		iter = directives.iterator();
-		size = directives.size();
-		for( int i = size; i > 0; i-- ){
-			decl = (Declaration) iter.next();
-
-			//namespaces are searched at most once
-			if( !data.visited.contains( decl ) ){
-				data.visited.add( decl );
-				
-				foundSomething = LookupInContained( data, decl );
-													
-				//only consider the transitive using directives if we are an unqualified
-				//lookup, or we didn't find the name in decl
-				if( (!data.qualified || !foundSomething ) && decl.getUsingDirectives() != null ){
-					//name wasn't found, add transitive using directives for later consideration
-					transitiveDirectives.addAll( decl.getUsingDirectives() );
-				}
-			}
-		}
-		
-		return;
-	}
-	
-	/**
-	 * function LookupInContained
-	 * @param data
-	 * @return List
-	 * @throws ParserSymbolTableException
-	 * 
-	 * Look for data.name in our collection _containedDeclarations
-	 */
-	private static boolean LookupInContained( LookupData data, Declaration lookIn ) throws ParserSymbolTableException{
-		boolean foundSomething = false;
-		Declaration temp  = null;
-		Object obj = null;
-	
-		if( data.associated != null ){
-			//we are looking in lookIn, remove it from the associated scopes list
-			data.associated.remove( lookIn );
-		}
-		
-		Map declarations = lookIn.getContainedDeclarations();
-		if( declarations == null )
-			return foundSomething;
-		
-		obj = declarations.get( data.name );
-	
-		if( obj == null ){
-			//not found
-			return foundSomething;
-		}
-		
-	 	//the contained declarations map either to a Declaration object, or to a list
-	 	//of declaration objects.
-		if( obj.getClass() == Declaration.class ){	
-			if( ((Declaration)obj).isType( data.type, data.upperType ) ){
-				if( data.foundItems == null ){
-					data.foundItems = new HashSet();
-				}
-				data.foundItems.add( obj );
-				foundSomething = true;
-			}
-		} else {
-			//we have to filter on type so can't just add the list whole to the fount set
-			LinkedList objList = (LinkedList)obj;
-			Iterator iter  = objList.iterator();
-			int size = objList.size();
-					
-			for( int i = 0; i < size; i++ ){
-				temp = (Declaration) iter.next();
-		
-				if( temp.isType( data.type, data.upperType ) ){
-					if( data.foundItems == null ){
-						data.foundItems = new HashSet();
-					}
-					data.foundItems.add(temp);
-					foundSomething = true;
-				} 
-			}
-		}
-
-		if( foundSomething ){
-			return foundSomething;
-		}
-		
-		HashMap parameters = lookIn.getParameterMap();
-		if( parameters != null ){
-			obj = parameters.get( data.name );
-			if( obj != null && ((Declaration)obj).isType( data.type, data.upperType ) ){
-				if( data.foundItems == null ){
-					data.foundItems = new HashSet();
-				}
-				data.foundItems.add( obj );
-				foundSomething = true;
-			}
-		}
-		
-		return foundSomething;
-	}
-	
-	/**
-	 * 
-	 * @param data
-	 * @param lookIn
-	 * @return Declaration
-	 * @throws ParserSymbolTableException
-	 */
-	private static Declaration LookupInParents( LookupData data, Declaration lookIn ) throws ParserSymbolTableException{
-		LinkedList scopes = lookIn.getParentScopes();
-		boolean foundSomething = false;
-		Declaration temp = null;
-		Declaration decl = null;
-		
-		Iterator iterator = null;
-		Declaration.ParentWrapper wrapper = null;
-		
-		if( scopes == null )
-			return null;
-				
-		//use data to detect circular inheritance
-		if( data.inheritanceChain == null )
-			data.inheritanceChain = new HashSet();
-		
-		data.inheritanceChain.add( lookIn );
-		
-		iterator = scopes.iterator();
-			
-		int size = scopes.size();
-	
-		for( int i = size; i > 0; i-- )
-		{
-			wrapper = (Declaration.ParentWrapper) iterator.next();
-			if( !wrapper.isVirtual || !data.visited.contains( wrapper.parent ) ){
-				if( wrapper.isVirtual ){
-					data.visited.add( wrapper.parent );
-				}
-				
-				//if the inheritanceChain already contains the parent, then that 
-				//is circular inheritance
-				if( ! data.inheritanceChain.contains( wrapper.parent ) ){
-					//is this name define in this scope?
-					LookupInContained( data, wrapper.parent );
-					temp = ResolveAmbiguities( data );
-					if( temp == null ){
-						temp = LookupInParents( data, wrapper.parent );
-					}
-				} else {
-					throw new ParserSymbolTableException( ParserSymbolTableException.r_CircularInheritance );
-				}
-				
-			}	
-			
-			if( temp != null && temp.isType( data.type ) ){
-
-				if( decl == null  ){
-					decl = temp;
-				} else if ( temp != null ) {
-					//it is not ambiguous if temp & decl are the same thing and it is static
-					//or an enumerator
-					TypeInfo type = temp.getTypeInfo();
-					
-					if( decl == temp && ( type.checkBit( TypeInfo.isStatic ) || type.isType( TypeInfo.t_enumerator ) ) ){
-						temp = null;
-					} else {
-						throw( new ParserSymbolTableException( ParserSymbolTableException.r_Ambiguous ) );
-					}
-	
-				}
-			} else {
-				temp = null;	//reset temp for next iteration
-			}
-		}
-	
-		data.inheritanceChain.remove( lookIn );
-
-		return decl;	
-	}
-	
-	/**
-	 * function isValidOverload
-	 * @param origDecl
-	 * @param newDecl
-	 * @return boolean
-	 * 
-	 * 3.3.7 "A class name or enumeration name can be hidden by the name of an
-	 * object, function or enumerator declared in the same scope"
-	 * 
-	 * 3.4-1 "Name lookup may associate more than one declaration with a name if
-	 * it finds the name to be a function name"
-	 */
-	private static boolean isValidOverload( Declaration origDecl, Declaration newDecl ){
-		int origType = origDecl.getType();
-		int newType  = newDecl.getType();
-		
-		if( (origType >= TypeInfo.t_class && origType <= TypeInfo.t_enumeration) && //class name or enumeration ...
-			( newType == TypeInfo.t_type || (newType >= TypeInfo.t_function && newType <= TypeInfo.typeMask) ) ){
-				
-			return true;
-		}
-		//if the origtype is not a class-name or enumeration name, then the only other
-		//allowable thing is if they are both functions.
-		return isValidFunctionOverload( origDecl, newDecl );
-	}
-	
-	private static boolean isValidOverload( LinkedList origList, Declaration newDecl ){
-		if( origList.size() == 1 ){
-			return isValidOverload( (Declaration)origList.getFirst(), newDecl );
-		} else if ( origList.size() > 1 ){
-
-			//the first thing can be a class-name or enumeration name, but the rest
-			//must be functions.  So make sure the newDecl is a function before even
-			//considering the list
-			if( newDecl.getType() != TypeInfo.t_function ){
-				return false;
-			}
-			
-			Iterator iter = origList.iterator();
-			Declaration decl = (Declaration) iter.next();
-			boolean valid = (( decl.getType() >= TypeInfo.t_class && decl.getType() <= TypeInfo.t_enumeration ) ||
-							  isValidFunctionOverload( decl, newDecl ));
-			
-			while( valid && iter.hasNext() ){
-				decl = (Declaration) iter.next();
-				valid = isValidFunctionOverload( decl, newDecl );
-			}
-			
-			return valid;
-		}
-		
-		//empty list, return true
-		return true;
-	}
-	
-	private static boolean isValidFunctionOverload( Declaration origDecl, Declaration newDecl ){
-		if( origDecl.getType() != TypeInfo.t_function || newDecl.getType() != TypeInfo.t_function ){
-			return false;
-		}
-		
-		if( origDecl.hasSameParameters( newDecl ) ){
-			//functions with the same name and same parameter types cannot be overloaded if any of them
-			//is static
-			if( origDecl.getTypeInfo().checkBit( TypeInfo.isStatic ) || newDecl.getTypeInfo().checkBit( TypeInfo.isStatic ) ){
-				return false;
-			}
-			
-			//if none of them are static, then the function can be overloaded if they differ in the type
-			//of their implicit object parameter.
-			if( origDecl.getCVQualifier() != newDecl.getCVQualifier() ){
-				return true;
-			}
-			
-			return false;
-		}
-		
-		return true;
-	}
-	
-	/**
-	 * 
-	 * @param data
-	 * @return Declaration
-	 * @throws ParserSymbolTableException
-	 * 
-	 * Resolve the foundItems set down to one declaration and return that
-	 * declaration.  
-	 * If we successfully resolve, then the data.foundItems list will be
-	 * cleared.  If however, we were not able to completely resolve the set,
-	 * then the data.foundItems set will be left with those items that
-	 * survived the partial resolution and we will return null.  (currently,
-	 * this case applies to when we have overloaded functions and no parameter
-	 * information)
-	 * 
-	 * NOTE: data.parameters == null means there is no parameter information at
-	 * all, when looking for functions with no parameters, an empty list must be
-	 * provided in data.parameters.
-	 */
-	static private Declaration ResolveAmbiguities( LookupData data ) throws ParserSymbolTableException{
-		Declaration decl = null;
-		Declaration obj	= null;
-		Declaration cls = null;
-		
-		if( data.foundItems == null ){
-			return null;
-		}
-		
-		int size = data.foundItems.size(); 
-		Iterator iter = data.foundItems.iterator();
-		
-		boolean needDecl = true;
-		
-		if( size == 0){
-			return null;
-		} else if (size == 1) {
-			decl = (Declaration) iter.next();
-			//if it is a function we need to check its parameters
-			if( !decl.isType( TypeInfo.t_function ) ){
-				data.foundItems.clear();
-				return decl;
-			}
-			needDecl = false;
-		} 
-		
-		LinkedList functionList = null;	
-
-		for( int i = size; i > 0; i-- ){
-			//if we
-			if( needDecl ){
-				decl = (Declaration) iter.next();
-			} else {
-				needDecl = true;
-			}
-			
-			if( decl.isType( TypeInfo.t_function ) ){
-				if( functionList == null){
-					functionList = new LinkedList();
-				}
-				functionList.add( decl );
-			} else {
-				//if this is a class-name, other stuff hides it
-				if( decl.isType( TypeInfo.t_class, TypeInfo.t_enumeration ) ){
-					if( cls == null ) {
-						cls = decl;
-					} else {
-						throw new ParserSymbolTableException( ParserSymbolTableException.r_Ambiguous ); 
-					}
-				} else {
-					//an object, can only have one of these
-					if( obj == null ){
-						obj = decl;	
-					} else {
-						throw new ParserSymbolTableException( ParserSymbolTableException.r_Ambiguous ); 
-					}
-				}
-			}
-			
-			decl = null;
-		}
-	
-		data.foundItems.clear();
-		
-		int numFunctions = ( functionList == null ) ? 0 : functionList.size();
-		
-		boolean ambiguous = false;
-		
-		if( cls != null ){
-			//the class is only hidden by other stuff if they are from the same scope
-			if( obj != null && cls._containingScope != obj._containingScope ){
-				ambiguous = true;	
-			}
-			if( functionList != null ){
-				Iterator fnIter = functionList.iterator();
-				Declaration fn = null;
-				for( int i = numFunctions; i > 0; i-- ){
-					fn = (Declaration) fnIter.next();
-					if( cls._containingScope != fn._containingScope ){
-						ambiguous = true;
-						break;
-					}
-				}
-			}
-		}
-		
-		if( obj != null && !ambiguous ){
-			if( numFunctions > 0 ){
-				ambiguous = true;
-			} else {
-				return obj;
-			}
-		} else if( numFunctions > 0 ) {
-			if( data.parameters == null ){
-				//we have no parameter information, if we only have one function, return
-				//that, otherwise we can't decide between them
-				if( numFunctions == 1){
-					return (Declaration) functionList.getFirst();
-				} else {
-					data.foundItems.addAll( functionList );
-					return null;
-				}
-			} else {
-				return ResolveFunction( data, functionList );
-			}
-		}
-		
-		if( ambiguous ){
-			throw new ParserSymbolTableException( ParserSymbolTableException.r_Ambiguous );
-		} else {
-			return cls;
-		}
-	}
-
-	static private Declaration ResolveFunction( LookupData data, LinkedList functions ) throws ParserSymbolTableException{
-		 
-		ReduceToViable( data, functions );
-		
-		int numSourceParams = ( data.parameters == null ) ? 0 : data.parameters.size();
-		int numFns = functions.size();
-		
-		if( numSourceParams == 0 ){
-			//no parameters
-			//if there is only 1 viable function, return it, if more than one, its ambiguous
-			if( numFns == 0 ){
-				return null;
-			} else if ( numFns == 1 ){
-				return (Declaration)functions.getFirst();
-			} else{
-				throw new ParserSymbolTableException( ParserSymbolTableException.r_Ambiguous );
-			}
-		}
-		
-		Declaration bestFn = null;				//the best function
-		Declaration currFn = null;				//the function currently under consideration
-		Cost [] bestFnCost = null;				//the cost of the best function
-		Cost [] currFnCost = null;				//the cost for the current function
-				
-		Iterator iterFns = functions.iterator();
-		Iterator sourceParams = null;
-		Iterator targetParams = null;
-		
-		int numTargetParams = 0;
-		int numParams = 0;
-		int comparison;
-		Cost cost = null;
-		Cost temp = null;
-		
-		TypeInfo source = null;
-		TypeInfo target = null;
-		 
-		boolean hasWorse = false;
-		boolean hasBetter = false;
-		boolean ambiguous = false;
-		boolean currHasAmbiguousParam = false;
-		boolean bestHasAmbiguousParam = false;
-
-		for( int i = numFns; i > 0; i-- ){
-			currFn = (Declaration) iterFns.next();
-			
-			sourceParams = data.parameters.iterator();
-			targetParams = currFn.getParameterList().iterator();
-			
-			//number of parameters in the current function
-			numTargetParams = currFn.getParameterList().size();
-			
-			//we only need to look at the smaller number of parameters
-			//(a larger number in the Target means default parameters, a larger
-			//number in the source means ellipses.)
-			numParams = ( numTargetParams < numSourceParams ) ? numTargetParams : numSourceParams;
-			
-			if( currFnCost == null ){
-				currFnCost = new Cost [ numParams ];	
-			}
-			
-			comparison = 0;
-			
-			for( int j = 0; j < numParams; j++ ){
-				source = (TypeInfo)sourceParams.next();
-				target = ((Declaration)targetParams.next()).getTypeInfo();
-				if( source.equals( target ) ){
-					cost = new Cost( source, target );
-					cost.rank = 0;	//exact match, no cost
-				} else {
-					cost = checkStandardConversionSequence( source, target );
-					
-					if( cost.rank == -1){
-						temp = checkUserDefinedConversionSequence( source, target );
-						if( temp != null ){
-							cost = temp;
-						}
-					}
-				}
-				
-				currFnCost[ j ] = cost;
-			}
-			
-			
-			hasWorse = false;
-			hasBetter = false;
-			
-			for( int j = 0; j < numParams; j++ ){ 
-				if( currFnCost[ j ].rank < 0 ){
-					hasWorse = true;
-					hasBetter = false;
-					break;
-				}
-				
-				currHasAmbiguousParam = ( currFnCost[ j ].userDefined == 1 );
-				
-				if( bestFnCost != null ){
-					comparison = currFnCost[ j ].compare( bestFnCost[ j ] );
-					hasWorse |= ( comparison < 0 );
-					hasBetter |= ( comparison > 0 );
-				} else {
-					hasBetter = true;
-				}
-			}
-				
-			ambiguous |= ( hasWorse && hasBetter ) || ( !hasWorse && !hasBetter );
-			
-			if( !hasWorse ){
-				if( hasBetter ){
-					ambiguous = false;
-					bestFnCost = currFnCost;
-					bestHasAmbiguousParam = currHasAmbiguousParam;
-					currFnCost = null;
-					bestFn = currFn;
-				}				
-			}
-		}
-
-		if( ambiguous || bestHasAmbiguousParam ){
-			throw new ParserSymbolTableException( ParserSymbolTableException.r_Ambiguous );
-		}
-						
-		return bestFn;
-	}
-	
-	static private void ReduceToViable( LookupData data, LinkedList functions ){
-		int numParameters = ( data.parameters == null ) ? 0 : data.parameters.size();
-		int num;	
-			
-		//Trim the list down to the set of viable functions
-		Declaration function;
-		Iterator iter = functions.iterator();
-		while( iter.hasNext() ){
-			function = (Declaration) iter.next();
-			num = ( function.getParameterList() == null ) ? 0 : function.getParameterList().size();
-		
-			//if there are m arguments in the list, all candidate functions having m parameters
-			//are viable	 
-			if( num == numParameters ){
-				continue;
-			} 
-			//A candidate function having fewer than m parameters is viable only if it has an 
-			//ellipsis in its parameter list.
-			else if( num < numParameters ) {
-				//TBD ellipsis
-				//not enough parameters, remove it
-				iter.remove();		
-			} 
-			//a candidate function having more than m parameters is viable only if the (m+1)-st
-			//parameter has a default argument
-			else {
-				ListIterator listIter = function.getParameterList().listIterator( num );
-				TypeInfo param;
-				for( int i = num; i > ( numParameters - num + 1); i-- ){
-					param = ((Declaration)listIter.previous()).getTypeInfo();
-					if( !param.getHasDefault() ){
-						iter.remove();
-						break;
-					}
-				}
-			}
-		}
-	}
-	
-	/**
-	 * function ProcessDirectives
-	 * @param Declaration decl
-	 * @param LookupData  data
-	 * @param LinkedList  directives
-	 * 
-	 * Go through the directives and for each nominated namespace find the
-	 * closest enclosing declaration for that namespace and decl, then add the
-	 * nominated namespace to the lookup data for consideration when we reach
-	 * the enclosing declaration.
-	 */
-	static private void ProcessDirectives( Declaration decl, LookupData data, LinkedList directives ){
-		Declaration enclosing = null;
-		Declaration temp = null;
-		
-		int size = directives.size();
-		Iterator iter = directives.iterator();
-	
-		for( int i = size; i > 0; i-- ){
-			temp = (Declaration) iter.next();
-		
-			//namespaces are searched at most once
-			if( !data.visited.contains( temp ) ){
-				enclosing = getClosestEnclosingDeclaration( decl, temp );
-						
-				//the data.usingDirectives is a map from enclosing declaration to 
-				//a list of namespaces to consider when we reach that enclosing
-				//declaration
-				LinkedList list = (data.usingDirectives == null ) 
-								? null
-								: (LinkedList) data.usingDirectives.get( enclosing );
-				if ( list == null ){
-					list = new LinkedList();
-					list.add( temp );
-					if( data.usingDirectives == null ){
-						data.usingDirectives = new HashMap();
-					}
-					data.usingDirectives.put( enclosing, list );
-				} else {
-					list.add( temp );
-				}
-			}
-		}
-	}
-	
-	/**
-	 * function getClosestEnclosingDeclaration
-	 * @param decl1
-	 * @param decl2
-	 * @return Declaration
-	 * 
-	 * 7.3.4-1 "During unqualified lookup, the names appear as if they were
-	 * declared in the nearest enclosing namespace which contains both the
-	 * using-directive and the nominated namespace"
-	 * 
-	 * TBD: Consider rewriting this iteratively instead of recursively, for
-	 * performance
-	 */
-	static private Declaration getClosestEnclosingDeclaration( Declaration decl1, Declaration decl2 ){
-		if( decl1 == decl2 ){ 
-			return decl1;
-		}
-				
-		if( decl1.getDepth() == decl2.getDepth() ){
-			return getClosestEnclosingDeclaration( decl1._containingScope, decl2._containingScope );
-		} else if( decl1.getDepth() > decl2.getDepth() ) {
-			return getClosestEnclosingDeclaration( decl1._containingScope, decl2 );
-		} else {
-			return getClosestEnclosingDeclaration( decl1, decl2._containingScope );
-		}
-	}
-	
-	/**
-	 * 
-	 * @param obj
-	 * @param base
-	 * @return int
-	 * figure out if base is a base class of obj, and return the "distance" to
-	 * the base class.
-	 * ie:
-	 *     A -> B -> C
-	 * the distance from A to B is 1 and from A to C is 2. This distance is used
-	 * to rank standard pointer conversions.
-	 * 
-	 * TBD: Consider rewriting iteratively for performance.
-	 */
-	static private int hasBaseClass( Declaration obj, Declaration base ){
-		if( obj == base ){
-			return 0;
-		}
-		
-		if( obj.getParentScopes() != null ){	
-			Declaration decl;
-			Declaration.ParentWrapper wrapper;
-			
-			Iterator iter = obj.getParentScopes().iterator();
-			int size = obj.getParentScopes().size();
-			
-			for( int i = size; i > 0; i-- ){
-				wrapper = (Declaration.ParentWrapper) iter.next();	
-				decl = wrapper.parent;
-				
-				if( decl == base ){
-					return 1;
-				} else {
-					int n = hasBaseClass( decl, base );
-					if( n > 0 ){
-						return n + 1;
-					}
-				}
-				
-			}
-		}
-		
-		return -1;
-	}
-
-	static private void getAssociatedScopes( Declaration decl, HashSet associated ){
-		if( decl == null ){
-			return;
-		}
-		//if T is a class type, its associated classes are the class itself,
-		//and its direct and indirect base classes. its associated Namespaces are the 
-		//namespaces in which its associated classes are defined	
-		if( decl.getType() == TypeInfo.t_class ){
-			associated.add( decl );
-			getBaseClassesAndContainingNamespaces( decl, associated );
-		} 
-		//if T is a union or enumeration type, its associated namespace is the namespace in 
-		//which it is defined. if it is a class member, its associated class is the member's
-		//class
-		else if( decl.getType() == TypeInfo.t_union || decl.getType() == TypeInfo.t_enumeration ){
-			associated.add( decl._containingScope );
-		}
-	}
-	
-	static private void getBaseClassesAndContainingNamespaces( Declaration obj, HashSet classes ){
-		if( obj.getParentScopes() != null ){
-			if( classes == null ){
-				return;
-			}
-			
-			Iterator iter = obj.getParentScopes().iterator();
-			int size = obj.getParentScopes().size();
-			Declaration.ParentWrapper wrapper;
-			Declaration base;
-			
-			for( int i = size; i > 0; i-- ){
-				wrapper = (Declaration.ParentWrapper) iter.next();	
-				base = (Declaration) wrapper.parent;	
-				classes.add( base );
-				if( base._containingScope.getType() == TypeInfo.t_namespace ){
-					classes.add( base._containingScope );
-				}
-				
-				getBaseClassesAndContainingNamespaces( base, classes );
-			}
-		}
-	}
-
-	static private boolean okToAddUsingDeclaration( Declaration obj, Declaration context ){
-		boolean okToAdd = false;
-			
-		//7.3.3-4
-		if( context.isType( TypeInfo.t_class, TypeInfo.t_union ) ){
-			//a member of a base class
-			if( obj.getContainingScope().getType() == context.getType() ){
-				okToAdd = ( hasBaseClass( context, obj.getContainingScope() ) > 0 );		
-			} 
-			//TBD : a member of an _anonymous_ union
-			else if ( obj.getContainingScope().getType() == TypeInfo.t_union ) {
-				Declaration union = obj.getContainingScope();
-				okToAdd = ( hasBaseClass( context, union.getContainingScope() ) > 0 ); 
-			}
-			//an enumerator for an enumeration
-			else if ( obj.getType() == TypeInfo.t_enumerator ){
-				Declaration enumeration = obj.getContainingScope();
-				okToAdd = ( hasBaseClass( context, enumeration.getContainingScope() ) > 0 );
-			}
-		} else {
-			okToAdd = true;
-		}	
-		
-		return okToAdd;
-	}
-
-	static private Cost lvalue_to_rvalue( TypeInfo source, TypeInfo target ) throws ParserSymbolTableException{
-		//lvalues will have type t_type
-		if( source.isType( TypeInfo.t_type ) ){
-			source = getFlatTypeInfo( source );
-		}
-	
-		String sourcePtr = source.getPtrOperator();
-		String targetPtr = target.getPtrOperator();
-		
-		if( sourcePtr != null && sourcePtr.length() > 0 ){
-			char sourcePtrArray [] = sourcePtr.toCharArray();
-			if( sourcePtrArray[ 0 ] == '&' ){
-				source.setPtrOperator( new String(sourcePtrArray, 1, sourcePtr.length() - 1 ) );
-			}
-		}
-		
-		if( targetPtr != null && targetPtr.length() > 0 ){
-			char targetPtrArray [] = targetPtr.toCharArray();
-			if( targetPtrArray[ 0 ] == '&' ){
-				target.setPtrOperator ( new String( targetPtrArray, 1, targetPtr.length() - 1 ) );
-			}
-		}
-		
-		Cost cost = new Cost( source, target );
-	
-		return cost;
-	}
-	
-	static private void qualificationConversion( Cost cost ){
-		if(  cost.source.getCVQualifier() == cost.target.getCVQualifier() || 
-			( cost.target.getCVQualifier() - cost.source.getCVQualifier()) > 1 )
-		{
-			cost.qualification = cost.target.getCVQualifier() + 1;
-			cost.rank = 0;
-		} else {
-			cost.qualification = 0;
-		}
-	}
-		
-	/**
-	 * 
-	 * @param source
-	 * @param target
-	 * @return int
-	 * 
-	 * 4.5-1 char, signed char, unsigned char, short int or unsigned short int
-	 * can be converted to int if int can represent all the values of the source
-	 * type, otherwise they can be converted to unsigned int.
-	 * 4.5-2 wchar_t or an enumeration can be converted to the first of the
-	 * following that can hold it: int, unsigned int, long unsigned long.
-	 * 4.5-4 bool can be promoted to int 
-	 * 4.6 float can be promoted to double
-	 */
-	static private void promotion( Cost cost ){
-		TypeInfo src = cost.source;
-		TypeInfo trg = cost.target;
-		 
-		int mask = TypeInfo.isShort | TypeInfo.isLong | TypeInfo.isUnsigned;
-		
-		if( (src.isType( TypeInfo.t_bool, TypeInfo.t_float ) || src.isType( TypeInfo.t_enumeration )) &&
-			(trg.isType( TypeInfo.t_int ) || trg.isType( TypeInfo.t_double )) )
-		{
-			if( src.getType() == trg.getType() && (( src.getTypeInfo() & mask) == (trg.getTypeInfo() & mask)) ){
-				//same, no promotion needed
-				return;	
-			}
-			
-			if( src.isType( TypeInfo.t_float ) ){ 
-				cost.promotion = trg.isType( TypeInfo.t_double ) ? 1 : 0;
-			} else {
-				cost.promotion = ( trg.isType( TypeInfo.t_int ) && trg.canHold( src ) ) ? 1 : 0;
-			}
-			
-		} else {
-			cost.promotion = 0;
-		}
-		
-		cost.rank = (cost.promotion > 0 ) ? 1 : -1;
-	}
-	
-	/**
-	 * 
-	 * @param source
-	 * @param target
-	 * @return int
-	 * 
-	 */
-	static private void conversion( Cost cost ){
-		TypeInfo src = cost.source;
-		TypeInfo trg = cost.target;
-		
-		int temp;
-		
-		String tempStr = src.getPtrOperator();
-		String srcPtr = ( tempStr == null ) ? new String("") : tempStr;
-		
-		tempStr = trg.getPtrOperator();
-		String trgPtr = ( tempStr == null ) ? new String("") : tempStr;
-		
-		cost.conversion = 0;
-		cost.detail = 0;
-		
-		if( !srcPtr.equals( trgPtr ) ){
-			return;
-		} 
-		if( srcPtr.equals("*") ){
-			Declaration srcDecl = src.isType( TypeInfo.t_type ) ? src.getTypeDeclaration() : null;
-			Declaration trgDecl = trg.isType( TypeInfo.t_type ) ? trg.getTypeDeclaration() : null;
-
-			if( srcDecl == null || (trgDecl == null && !trg.isType( TypeInfo.t_void )) ){
-				return;	
-			}
-			
-			//4.10-2 an rvalue of type "pointer to cv T", where T is an object type can be
-			//converted to an rvalue of type "pointer to cv void"
-			if( trg.isType( TypeInfo.t_void ) ){
-				cost.rank = 2;
-				cost.conversion = 1;
-				cost.detail = 2;
-				return;	
-			}
-			
-			cost.detail = 1;
-			
-			//4.10-3 An rvalue of type "pointer to cv D", where D is a class type can be converted
-			// to an rvalue of type "pointer to cv B", where B is a base class of D.
-			if( srcDecl.isType( TypeInfo.t_class ) && trgDecl.isType( TypeInfo.t_class ) ){
-				temp = hasBaseClass( srcDecl, trgDecl );
-				cost.rank = 2;
-				cost.conversion = ( temp > -1 ) ? temp : 0;
-				cost.detail = 1;
-				return;
-			}
-			
-			//4.11-2 An rvalue of type "pointer to member of B of type cv T", where B is a class type, 
-			//can be converted to an rvalue of type "pointer to member of D of type cv T" where D is a
-			//derived class of B
-			if( srcDecl._containingScope.isType( TypeInfo.t_class ) && trgDecl._containingScope.isType( TypeInfo.t_class ) ){
-				temp = hasBaseClass( trgDecl._containingScope, srcDecl._containingScope );
-				cost.rank = 2;
-				cost.conversion = ( temp > -1 ) ? temp : 0;
-				return;
-			}
-		} else {
-			//4.7 An rvalue of an integer type can be converted to an rvalue of another integer type.  
-			//An rvalue of an enumeration type can be converted to an rvalue of an integer type.
-			if( src.isType( TypeInfo.t_bool, TypeInfo.t_int ) ||
-				src.isType( TypeInfo.t_float, TypeInfo.t_double ) ||
-				src.isType( TypeInfo.t_enumeration ) )
-			{
-				if( trg.isType( TypeInfo.t_bool, TypeInfo.t_int ) ||
-					trg.isType( TypeInfo.t_float, TypeInfo.t_double ) )
-				{
-					cost.rank = 2;
-					cost.conversion = 1;	
-				}
-			}
-		}
-	}
-	
-	static private Cost checkStandardConversionSequence( TypeInfo source, TypeInfo target ) throws ParserSymbolTableException {
-		Cost cost = lvalue_to_rvalue( source, target );
-		
-		if( cost.source.equals( cost.target ) ){
-			cost.rank = 0;
-			return cost;
-		}
-	
-		qualificationConversion( cost );
-		
-		//if we can't convert the qualifications, then we can't do anything
-		if( cost.qualification == 0 ){
-			return cost;
-		}
-		
-		promotion( cost );
-		if( cost.promotion > 0 || cost.rank > -1 ){
-			return cost;
-		}
-		
-		conversion( cost );
-		
-		return cost;	
-	}
-	
-	static private Cost checkUserDefinedConversionSequence( TypeInfo source, TypeInfo target ) throws ParserSymbolTableException {
-		Cost cost = null;
-		Cost constructorCost = null;
-		Cost conversionCost = null;
-
-		Declaration targetDecl = null;
-		Declaration sourceDecl = null;
-		Declaration constructor = null;
-		Declaration conversion = null;
-		
-		//constructors
-		if( target.getType() == TypeInfo.t_type ){
-			targetDecl = target.getTypeDeclaration();
-			if( targetDecl.isType( TypeInfo.t_class, TypeInfo.t_union ) ){
-				LookupData data = new LookupData( "", TypeInfo.t_function );
-				LinkedList params = new LinkedList();
-				params.add( source );
-				data.parameters = params;
-				LookupInContained( data, targetDecl );
-				constructor = ResolveAmbiguities( data );
-			}
-		}
-		
-		//conversion operators
-		if( source.getType() == TypeInfo.t_type ){
-			source = getFlatTypeInfo( source );
-			sourceDecl = source.getTypeDeclaration();
-			
-			if( sourceDecl != null ){
-				String name = target.toString();
-				
-				if( !name.equals("") ){
-					LookupData data = new LookupData( "operator " + name, TypeInfo.t_function );
-					LinkedList params = new LinkedList();
-					data.parameters = params;
-					
-					LookupInContained( data, sourceDecl );
-					conversion = ResolveAmbiguities( data );	
-				}
-			}
-		}
-		
-		if( constructor != null ){
-			constructorCost = checkStandardConversionSequence( new TypeInfo( TypeInfo.t_type, constructor._containingScope ), target );
-		}
-		if( conversion != null ){
-			conversionCost = checkStandardConversionSequence( new TypeInfo( target.getType(), target.getTypeDeclaration() ), target );
-		}
-		
-		//if both are valid, then the conversion is ambiguous
-		if( constructorCost != null && constructorCost.rank != -1 && 
-			conversionCost != null && conversionCost.rank != -1 )
-		{
-			cost = constructorCost;
-			cost.userDefined = 1;
-			cost.rank = 3;
-		} else {
-			if( constructorCost != null && constructorCost.rank != -1 ){
-				cost = constructorCost;
-				cost.userDefined = constructor.hashCode();
-				cost.rank = 3;
-			} else if( conversionCost != null && conversionCost.rank != -1 ){
-				cost = conversionCost;
-				cost.userDefined = conversion.hashCode();
-				cost.rank = 3;
-			} 			
-		}
-		
-		return cost;
-	}
-
-	/**
-	 * 
-	 * @param decl
-	 * @return TypeInfo
-	 * @throws ParserSymbolTableException
-	 * The top level TypeInfo represents modifications to the object and the
-	 * remaining TypeInfo's represent the object.
-	 */
-	static private TypeInfo getFlatTypeInfo( TypeInfo topInfo ){
-		TypeInfo returnInfo = topInfo;
-		TypeInfo info = null;
-		
-		if( topInfo.getType() == TypeInfo.t_type ){
-			returnInfo = new TypeInfo();
-			
-			Declaration typeDecl = topInfo.getTypeDeclaration();
-			
-			info = topInfo.getTypeDeclaration().getTypeInfo();
-			
-			while( info.getType() == TypeInfo.t_type ){
-				typeDecl = info.getTypeDeclaration();
-				
-				returnInfo.addCVQualifier( info.getCVQualifier() );
-				returnInfo.addPtrOperator( info.getPtrOperator() );	
-				
-				info = info.getTypeDeclaration().getTypeInfo();
-			}
-			
-			if( info.isType( TypeInfo.t_class, TypeInfo.t_enumeration ) ){
-				returnInfo.setType( TypeInfo.t_type );
-				returnInfo.setTypeDeclaration( typeDecl );
-			} else {
-				returnInfo.setTypeInfo( info.getTypeInfo() );
-				returnInfo.setTypeDeclaration( null );
-			}
-			
-			String ptrOp = returnInfo.getPtrOperator();
-			returnInfo.setPtrOperator( topInfo.getInvertedPtrOperator() );
-			
-			if( ptrOp != null ){
-				returnInfo.addPtrOperator( ptrOp );
-			}
-			
-			returnInfo.setCVQualifier( info.getCVQualifier() );
-			returnInfo.addCVQualifier( topInfo.getCVQualifier() );
-		}
-		
-		return returnInfo;	
-	}
-
-
-	//private Stack _contextStack = new Stack();
-	private Declaration _compilationUnit;
-	private LinkedList undoList = new LinkedList();
-	private HashSet markSet = new HashSet();
-	
-	private void pushCommand( Command command ){
-		undoList.addFirst( command );
-	}
-	
-	public Mark setMark(){
-		Mark mark = new Mark();
-		undoList.addFirst( mark );
-		markSet.add( mark );
-		return mark;
-	}
-	
-	public boolean rollBack( Mark toMark ){
-		if( markSet.contains( toMark ) ){
-			markSet.remove( toMark );
-			Command command = ( Command )undoList.removeFirst();
-			while( command != toMark ){
-				command.undoIt();
-				command = ( Command ) undoList.removeFirst();
-			}
-			
-			return true;
-		} 
-		
-		return false;
-	}
-	
-	public boolean commit( Mark toMark ){
-		if( markSet.contains( toMark ) ){
-			markSet.remove( toMark );
-			Command command = ( Command )undoList.removeLast();
-			while( command != toMark ){
-				command = (Command) undoList.removeLast();
-			}
-			return true;
-		}
-		
-		return false;
-	}
-	
-	static abstract private class Command{
-		abstract public void undoIt();
-	}
-	
-	static public class Mark extends Command{
-		public void undoIt(){ };
-	}
-	
-	static private class AddDeclarationCommand extends Command{
-		AddDeclarationCommand( Declaration newDecl, Declaration context, boolean removeThis ){
-			_decl = newDecl;
-			_context = context;
-			_removeThis = removeThis;
-		}
-		public void undoIt(){
-			Object obj = _context.getContainedDeclarations().get( _decl.getName() );
-			
-			if( obj instanceof LinkedList ){
-				LinkedList list = (LinkedList)obj;
-				ListIterator iter = list.listIterator();
-				int size = list.size();
-				Declaration item = null;
-				for( int i = 0; i < size; i++ ){
-					item = (Declaration)iter.next();
-					if( item == _decl ){
-						iter.remove();
-						break;
-					}
-				}
-				if( list.size() == 1 ){
-					_context.getContainedDeclarations().remove( _decl.getName() );
-					_context.getContainedDeclarations().put( _decl.getName(), list.getFirst() );
-				}
-			} else if( obj instanceof Declaration ){
-				_context.getContainedDeclarations().remove( _decl.getName() );
-			}
-			if( _removeThis ){
-				_context.getContainedDeclarations().remove( "this" );
-			}
-		}
-		
-		private Declaration _decl;
-		private Declaration _context; 
-		private boolean 	_removeThis;
-	}
-	
-	static private class AddParentCommand extends Command{
-		public AddParentCommand( Declaration container, Declaration.ParentWrapper wrapper ){
-			_decl = container;
-			_wrapper = wrapper;
-		}
-		
-		public void undoIt(){
-			LinkedList parents = _decl.getParentScopes();
-			parents.remove( _wrapper );
-		}
-		
-		private Declaration _decl;
-		private Declaration.ParentWrapper _wrapper;
-	}
-	
-	static private class AddParameterCommand extends Command{
-		public AddParameterCommand( Declaration container, Declaration parameter ){
-			_decl = container;
-			_param = parameter;
-		}
-		
-		public void undoIt(){
-			_decl.getParameterList().remove( _param );
-			
-			String name = _param.getName();
-			if( name != null && !name.equals("") )
-			{	
-				_decl.getParameterMap().remove( name );
-			}
-		}
-		
-		private Declaration _decl;
-		private Declaration _param;
-	}
-	
-	static private class AddUsingDirectiveCommand extends Command{
-		public AddUsingDirectiveCommand( Declaration container, Declaration namespace ){
-			_decl = container;
-			_namespace = namespace;
-		}
-		public void undoIt(){
-			_decl.getUsingDirectives().remove( _namespace );
-		}
-		private Declaration _decl;
-		private Declaration _namespace;
-	}
-	
-	static private class LookupData
-	{
-		
-		public String name;
-		public Map usingDirectives; 
-		public Set visited = new HashSet();	//used to ensure we don't visit things more than once
-		
-		public HashSet inheritanceChain;		//used to detect circular inheritance
-		
-		public LinkedList parameters;			//parameter info for resolving functions
-		public HashSet associated;				//associated namespaces for argument dependant lookup
-		public Declaration stopAt;				//stop looking along the stack once we hit this declaration
-				 
-		public int type = -1;
-		public int upperType = 0;
-		public boolean qualified = false;
-		public boolean ignoreUsingDirectives = false;
-
-		public HashSet foundItems = null;
-		
-		public LookupData( String n, int t ){
-			name = n;
-			type = t;
-		}
-	}
-	
-	static private class Cost
-	{
-		public Cost( TypeInfo s, TypeInfo t ){
-			source = s;
-			target = t;
-		}
-		
-		public TypeInfo source;
-		public TypeInfo target;
-		
-		public int lvalue;
-		public int promotion;
-		public int conversion;
-		public int qualification;
-		public int userDefined;
-		public int rank = -1;
-		public int detail;
-		
-		public int compare( Cost cost ){
-			int result = 0;
-			
-			if( rank != cost.rank ){
-				return cost.rank - rank;
-			}
-			
-			if( userDefined != 0 || cost.userDefined != 0 ){
-				if( userDefined == 0 || cost.userDefined == 0 ){
-					return cost.userDefined - userDefined;
-				} else {
-					if( (userDefined == 1 || cost.userDefined == 1) ||
-						(userDefined != cost.userDefined ) )
-					{
-						return 0;
-					} 
-					// else they are the same constructor/conversion operator and are ranked
-					//on the standard conversion sequence
-				}
-			}
-			
-			if( promotion > 0 || cost.promotion > 0 ){
-				result = cost.promotion - promotion;
-			}
-			if( conversion > 0 || cost.conversion > 0 ){
-				if( detail == cost.detail ){
-					result = cost.conversion - conversion;
-				} else {
-					result = cost.detail - detail;
-				}
-			}
-			
-			if( result == 0 ){
-				result = cost.qualification - qualification;
-			}
-			 
-			return result;
-		}
-	}
-
-	public class Declaration implements Cloneable, ISymbol {
-
-		public Declaration( String name ){
-			super();
-			_name = name;
-			_typeInfo = new TypeInfo();
-		}
-	
-		public Declaration( String name, Object obj ){
-			super();
-			_name   = name;
-			_object = obj;
-			_typeInfo = new TypeInfo();
-		}
-		
-		public Declaration( String name, int typeInfo )
-		{
-			_name =name;
-			_typeInfo = new TypeInfo( typeInfo, this );
-		}
-
-		/**
-		 * clone
-		 * @see java.lang.Object#clone()
-		 * 
-		 * implement clone for the purposes of using declarations.
-		 * int   		_typeInfo;				//by assignment
-		 * String 		_name;					//by assignment
-		 * Object 		_object;				//null this out
-		 * Declaration	_typeDeclaration;		//by assignment
-		 * Declaration	_containingScope;		//by assignment
-		 * LinkedList 	_parentScopes;			//shallow copy
-		 * LinkedList 	_usingDirectives;		//shallow copy
-		 * HashMap		_containedDeclarations;	//shallow copy
-		 * int 			_depth;					//by assignment
-		 */
-		public Object clone(){
-			Declaration copy = null;
-			try{
-				copy = (Declaration)super.clone();
-			}
-			catch ( CloneNotSupportedException e ){
-				//should not happen
-				return null;
-			}
-		
-			copy._object = null;
-			copy._parentScopes          = ( _parentScopes != null ) ? (LinkedList) _parentScopes.clone() : null;
-			copy._usingDirectives       = ( _usingDirectives != null ) ? (LinkedList) _usingDirectives.clone() : null; 
-			copy._containedDeclarations = ( _containedDeclarations != null ) ? (HashMap) _containedDeclarations.clone() : null;
-			copy._parameterList         = ( _parameterList != null ) ? (LinkedList) _parameterList.clone() : null;
-			copy._parameterHash 		= ( _parameterHash != null ) ? (HashMap) _parameterHash.clone() : null;
-		
-			return copy;	
-		}
-	
-		public void setType(int t){
-			_typeInfo.setType( t );	 
-		}
-	
-		public int getType(){ 
-			return _typeInfo.getType(); 
-		}
-	
-		public boolean isType( int type ){
-			return _typeInfo.isType( type, 0 ); 
-		}
-
-		public boolean isType( int type, int upperType ){
-			return _typeInfo.isType( type, upperType );
-		}
-		
-		public Declaration getTypeDeclaration(){	
-			return _typeInfo.getTypeDeclaration(); 
-		}
-	
-		public void setTypeDeclaration( Declaration type ){
-			_typeInfo.setTypeDeclaration( type ); 
-		}
-	
-		public TypeInfo getTypeInfo(){
-			return _typeInfo;
-		}
-	
-		public String getName() { return _name; }
-		public void setName(String name) { _name = name; }
-	
-		public Object getCallbackExtension() { return _object; }
-		public void setCallbackExtension( Object obj ) { _object = obj; }
-	
-		public Declaration	getContainingScope() { return _containingScope; }
-		protected void setContainingScope( Declaration scope ){ 
-			_containingScope = scope;
-			_depth = scope._depth + 1; 
-		}
-	
-		private int getDepth(){
-			return _depth;
-		}
-		
-		public void addParent( Declaration parent ){
-			addParent( parent, false );
-		}
-		public void addParent( Declaration parent, boolean virtual ){
-			if( _parentScopes == null ){
-				_parentScopes = new LinkedList();
-			}
-			
-			ParentWrapper wrapper = new ParentWrapper( parent, virtual );
-			_parentScopes.add( wrapper );
-			
-			Command command = new AddParentCommand( this, wrapper );
-			pushCommand( command );
-		}
-	
-		public Map getContainedDeclarations(){
-			return _containedDeclarations;
-		}
-	
-		public Map createContained(){
-			if( _containedDeclarations == null )
-				_containedDeclarations = new HashMap();
-		
-			return _containedDeclarations;
-		}
-
-		public LinkedList getParentScopes(){
-			return _parentScopes;
-		}
-	
-		public boolean needsDefinition(){
-			return _needsDefinition;
-		}
-		public void setNeedsDefinition( boolean need ) {
-			_needsDefinition = need;
-		}
-	
-		public int getCVQualifier(){
-			return _cvQualifier;
-		}
-	
-		public void setCVQualifier( int cv ){
-			_cvQualifier = cv;
-		}
-	
-		public String getPtrOperator(){
-			return _typeInfo.getPtrOperator();
-		}
-		public void setPtrOperator( String ptrOp ){
-			_typeInfo.setPtrOperator( ptrOp );
-		}
-	
-		public int getReturnType(){
-			return _returnType;
-		}
-	
-		public void setReturnType( int type ){
-			_returnType = type;
-		}
-	
-		public LinkedList getParameterList(){
-			return _parameterList;
-		}
-		public HashMap getParameterMap(){
-			return _parameterHash;
-		}
-		
-		public void addParameter( Declaration param ){
-			if( _parameterList == null )
-				_parameterList = new LinkedList();
-			
-			_parameterList.addLast( param );
-			String name = param.getName();
-			if( name != null && !name.equals("") )
-			{
-				if( _parameterHash == null )
-					_parameterHash = new HashMap();
-
-				if( !_parameterHash.containsKey( name ) )
-					_parameterHash.put( name, param );
-			}
-			
-			Command command = new AddParameterCommand( this, param );
-			pushCommand( command );
-		}
-		
-		public void addParameter( Declaration typeDecl, int cvQual, String ptrOperator, boolean hasDefault ){
-			Declaration param = new Declaration("");
-			
-			TypeInfo info = param.getTypeInfo();
-			info.setType( TypeInfo.t_type );
-			info.setTypeDeclaration( typeDecl );
-			info.setCVQualifier( cvQual );
-			info.setPtrOperator( ptrOperator );
-			info.setHasDefault( hasDefault );
-				
-			addParameter( param );
-		}
-	
-		public void addParameter( int type, int cvQual, String ptrOperator, boolean hasDefault ){
-			Declaration param = new Declaration("");
-					
-			TypeInfo info = param.getTypeInfo();
-			info.setTypeInfo( type );
-			info.setCVQualifier( cvQual );
-			info.setPtrOperator( ptrOperator );
-			info.setHasDefault( hasDefault );
-				
-			addParameter( param );
-		}
-	
-		public boolean hasSameParameters( Declaration function ){
-			if( function.getType() != getType() ){
-				return false;	
-			}
-		
-			int size = getParameterList().size();
-			if( function.getParameterList().size() != size ){
-				return false;
-			}
-		
-			Iterator iter = getParameterList().iterator();
-			Iterator fIter = function.getParameterList().iterator();
-		
-			TypeInfo info = null;
-			TypeInfo fInfo = null;
-		
-			for( int i = size; i > 0; i-- ){
-				info = ((Declaration)iter.next()).getTypeInfo();
-				fInfo = ((Declaration) fIter.next()).getTypeInfo();
-			
-				if( !info.equals( fInfo ) ){
-					return false;
-				}
-			}
-		
-			
-			return true;
-		}
-	
-		public void addDeclaration( Declaration obj ) throws ParserSymbolTableException{
-			Declaration containing = this;
-			
-			//handle enumerators
-			if( obj.getType() == TypeInfo.t_enumerator ){
-				//a using declaration of an enumerator will not be contained in a
-				//enumeration.
-				if( containing.getType() == TypeInfo.t_enumeration ){
-					//Following the closing brace of an enum-specifier, each enumerator has the type of its 
-					//enumeration
-					obj.setTypeDeclaration( containing );
-					//Each enumerator is declared in the scope that immediately contains the enum-specifier	
-					containing = containing.getContainingScope();
-				}
-			}
-		
-			Map declarations = containing.getContainedDeclarations();
-		
-			boolean unnamed = obj.getName().equals( "" );
-		
-			Object origObj = null;
-		
-			obj.setContainingScope( containing );
-
-			if( declarations == null ){
-				declarations = containing.createContained();
-			} else {
-				//does this name exist already?
-				origObj = declarations.get( obj.getName() );
-			}
-		
-			if( origObj != null )
-			{
-				Declaration origDecl = null;
-				LinkedList  origList = null;
-		
-				if( origObj.getClass() == Declaration.class ){
-					origDecl = (Declaration)origObj;
-				} else if( origObj.getClass() == LinkedList.class ){
-					origList = (LinkedList)origObj;
-				} else {
-					throw new ParserSymbolTableException();
-				}
-			
-				if( unnamed || ((origList == null) ? isValidOverload( origDecl, obj ) : isValidOverload( origList, obj ) )){					if( origList == null ){
-						origList = new LinkedList();
-						origList.add( origDecl );
-						origList.add( obj );
-				
-						declarations.remove( obj );
-						declarations.put( obj.getName(), origList );
-					} else	{
-						origList.add( obj );
-						//origList is already in _containedDeclarations
-					}
-				} else {
-					throw new ParserSymbolTableException( ParserSymbolTableException.r_InvalidOverload );
-				}
-			} else {
-				declarations.put( obj.getName(), obj );
-			}
-		
-			//take care of the this pointer
-			TypeInfo type = obj.getTypeInfo();
-			boolean addedThis = false;
-			if( type.isType( TypeInfo.t_function ) && !type.checkBit( TypeInfo.isStatic ) ){
-				addThis( obj );
-				addedThis = true;
-			}
-			
-			Command command = new AddDeclarationCommand( obj, containing, addedThis );
-			pushCommand( command );
-		}
-		
-		/**
-		 * 
-		 * @param obj
-		 * @throws ParserSymbolTableException
-		 * 9.3.2-1 In the body of a nonstatic member function... the type of this of
-		 * a class X is X*.  If the member function is declared const, the type of
-		 * this is const X*, if the member function is declared volatile, the type
-		 * of this is volatile X*....
-		 */
-		private void addThis( Declaration obj ) throws ParserSymbolTableException{
-			TypeInfo type = obj.getTypeInfo();
-			if( !type.isType( TypeInfo.t_function ) || type.checkBit( TypeInfo.isStatic ) ){
-				return;
-			}
-	
-			if( obj.getContainingScope().isType( TypeInfo.t_class, TypeInfo.t_union ) ){
-				//check to see if there is already a this object, since using declarations
-				//of function will have them from the original declaration
-				LookupData data = new LookupData( "this", -1 );
-				LookupInContained( data, obj );
-				//if we didn't find "this" then foundItems will still be null, no need to actually
-				//check its contents 
-				if( data.foundItems == null ){
-					Declaration thisObj = new Declaration("this");
-					thisObj.setType( TypeInfo.t_type );
-					thisObj.setTypeDeclaration( obj.getContainingScope() );
-					thisObj.setCVQualifier( obj.getCVQualifier() );
-					thisObj.setPtrOperator("*");
-			
-					obj.addDeclaration( thisObj );
-				}
-			}		
-		}
-		
-		/**
-		 * 
-		 * @param name
-		 * @return Declaration
-		 * @throws ParserSymbolTableException
-		 * 
-		 * 7.3.1.2-3 If a friend declaration in a non-local class first declares a
-		 * class or function, the friend class or function is a member of the
-		 * innermost enclosing namespace.
-		 * 
-		 * TBD: if/when the parser symbol table starts caring about visibility
-		 * (public/protected/private) we will need to do more to record friendship.
-		 */
-		public Declaration addFriend( String name ) throws ParserSymbolTableException{
-			Declaration friend = LookupForFriendship( name  );
-		
-			if( friend == null ){
-				friend = new Declaration( name );
-				friend.setNeedsDefinition( true );
-			
-				Declaration containing = getContainingScope();
-				//find innermost enclosing namespace
-				while( containing != null && containing.getType() != TypeInfo.t_namespace ){
-					containing = containing.getContainingScope();
-				}
-			
-				Declaration namespace = ( containing == null ) ? ParserSymbolTable.this.getCompilationUnit() : containing;
-				namespace.addDeclaration( friend );
-			}
-			
-			return friend;
-		}
-		
-		/**
-		 * LookupForFriendship
-		 * @param name
-		 * @return Declaration
-		 * 7.3.1.2-3 When looking for a prior declaration of a class or a function
-		 * declared as a friend, scopes outside the innermost enclosing namespace
-		 * scope are not considered.
-		 * 11.4-9 If a friend declaration appears in a local class and the name
-		 * specified is an unqualified name, a prior declaration is looked up
-		 * without considering scopes that are outside the innermost enclosing non-
-		 * class scope.
-		 */
-		private Declaration LookupForFriendship( String name ) throws ParserSymbolTableException{
-			LookupData data = new LookupData( name, -1 );
-		
-			boolean inClass = ( getType() == TypeInfo.t_class);
-		
-			Declaration enclosing = getContainingScope();
-			while( enclosing != null && (inClass ? enclosing.getType() != TypeInfo.t_class
-												  :	enclosing.getType() == TypeInfo.t_namespace) )
-			{                                        		
-				enclosing = enclosing.getContainingScope();
-			}
-
-			data.stopAt = enclosing;
-		
-			ParserSymbolTable.Lookup( data, this );
-			return ParserSymbolTable.ResolveAmbiguities( data ); 
-		}
-		
-		/**
-		 * addUsingDeclaration
-		 * @param obj
-		 * @throws ParserSymbolTableException
-		 * 
-		 * 7.3.3-9  The entity declared by a using-declaration shall be known in the
-		 * context using it according to its definition at the point of the using-
-		 * declaration.  Definitions added to the namespace after the using-
-		 * declaration are not considered when a use of the name is made.
-		 * 
-		 * 7.3.3-4 A using-declaration used as a member-declaration shall refer to a
-		 * member of a base class of the class being defined, shall refer to a
-		 * member of an anonymous union that is a member of a base class of the
-		 * class being defined, or shall refer to an enumerator for an enumeration
-		 * type that is a member of a base class of the class being defined.
-		 */
-		public Declaration addUsingDeclaration( String name ) throws ParserSymbolTableException {
-			return addUsingDeclaration( name, null );
-		}
-
-		public Declaration addUsingDeclaration( String name, Declaration declContext ) throws ParserSymbolTableException{
-			LookupData data = new LookupData( name, -1 );
-	
-			if( declContext != null ){				
-				data.qualified = true;
-				ParserSymbolTable.Lookup( data, declContext );
-			} else {
-				ParserSymbolTable.Lookup( data, this );
-			}
-	
-			//figure out which declaration we are talking about, if it is a set of functions,
-			//then they will be in data.foundItems (since we provided no parameter info);
-			Declaration obj = ParserSymbolTable.ResolveAmbiguities( data );
-	
-			if( data.foundItems == null ){
-				throw new ParserSymbolTableException();				
-			}
-
-			Declaration clone = null;
-
-			//if obj != null, then that is the only object to consider, so size is 1,
-			//otherwise we consider the foundItems set				
-			int size = ( obj == null ) ? data.foundItems.size() : 1;
-			Iterator iter = data.foundItems.iterator();
-			for( int i = size; i > 0; i-- ){
-				obj = ( obj != null && size == 1 ) ? obj : (Declaration) iter.next();
-		
-				if( ParserSymbolTable.okToAddUsingDeclaration( obj, this ) ){
-					clone = (Declaration) obj.clone(); //7.3.3-9
-					addDeclaration( clone );
-				} else {
-					throw new ParserSymbolTableException();
-				}
-			}
-	
-			return ( size == 1 ) ? clone : null;
-		}
-		
-		public void addUsingDirective( Declaration namespace ) throws ParserSymbolTableException{
-			if( namespace.getType() != TypeInfo.t_namespace ){
-				throw new ParserSymbolTableException( ParserSymbolTableException.r_BadTypeInfo );
-			}
-					
-			if( _usingDirectives == null ){
-				_usingDirectives = new LinkedList(); 
-			}
-		
-			_usingDirectives.add( namespace );
-			
-			Command command = new AddUsingDirectiveCommand( this, namespace );
-			pushCommand( command );
-		}
-		
-		public LinkedList getUsingDirectives(){
-			return _usingDirectives;
-		}
-		
-		public Declaration ElaboratedLookup( int type, String name ) throws ParserSymbolTableException{
-			LookupData data = new LookupData( name, type );
-		
-			ParserSymbolTable.Lookup( data, this );
-		
-			return ParserSymbolTable.ResolveAmbiguities( data ); 
-		}
-		
-		public Declaration Lookup( String name ) throws ParserSymbolTableException {
-			LookupData data = new LookupData( name, -1 );
-		
-			ParserSymbolTable.Lookup( data, this );
-		
-			return ParserSymbolTable.ResolveAmbiguities( data ); 
-		}
-		
-		/**
-		 * LookupMemberForDefinition
-		 * @param name
-		 * @return Declaration
-		 * @throws ParserSymbolTableException
-		 * 
-		 * In a definition for a namespace member in which the declarator-id is a
-		 * qualified-id, given that the qualified-id for the namespace member has
-		 * the form "nested-name-specifier unqualified-id", the unqualified-id shall
-		 * name a member of the namespace designated by the nested-name-specifier.
-		 * 
-		 * ie:
-		 * you have this:
-		 * namespace A{    
-		 *    namespace B{       
-		 *       void  f1(int);    
-		 *    }  
-		 *    using  namespace B; 
-		 * }
-		 * 
-		 * if you then do this 
-		 * void A::f1(int) { ... } //ill-formed, f1 is not a member of A
-		 * but, you can do this (Assuming f1 has been defined elsewhere)
-		 * A::f1( 1 );  //ok, finds B::f1
-		 * 
-		 * ie, We need a seperate lookup function for looking up the member names
-		 * for a definition.
-		 */
-		public Declaration LookupMemberForDefinition( String name ) throws ParserSymbolTableException{
-			LookupData data = new LookupData( name, -1 );
-			data.qualified = true;
-	
-			ParserSymbolTable.LookupInContained( data, this );
-		
-			return ParserSymbolTable.ResolveAmbiguities( data );
-		}
-		
-		/**
-		 * Method LookupNestedNameSpecifier.
-		 * @param name
-		 * @return Declaration
-		 * The name of a class or namespace member can be referred to after the ::
-		 * scope resolution operator applied to a nested-name-specifier that
-		 * nominates its class or namespace.  During the lookup for a name preceding
-		 * the ::, object, function and enumerator names are ignored.  If the name
-		 * is not a class-name or namespace-name, the program is ill-formed
-		 */
-		public Declaration LookupNestedNameSpecifier( String name ) throws ParserSymbolTableException {
-			return LookupNestedNameSpecifier( name, this );
-		}
-		private Declaration LookupNestedNameSpecifier(String name, Declaration inDeclaration ) throws ParserSymbolTableException{		
-			Declaration foundDeclaration = null;
-		
-			LookupData data = new LookupData( name, TypeInfo.t_namespace );
-			data.upperType = TypeInfo.t_union;
-		
-			ParserSymbolTable.LookupInContained( data, inDeclaration );
-		
-			if( data.foundItems != null ){
-				foundDeclaration = ParserSymbolTable.ResolveAmbiguities( data );//, data.foundItems );
-			}
-				
-			if( foundDeclaration == null && inDeclaration.getContainingScope() != null ){
-				foundDeclaration = LookupNestedNameSpecifier( name, inDeclaration.getContainingScope() );
-			}
-			
-			return foundDeclaration;
-		}
-		
-		/**
-		 * MemberFunctionLookup
-		 * @param name
-		 * @param parameters
-		 * @return Declaration
-		 * @throws ParserSymbolTableException
-		 * 
-		 * Member lookup really proceeds as an unqualified lookup, but doesn't
-		 * include argument dependant scopes
-		 */
-		public Declaration MemberFunctionLookup( String name, LinkedList parameters ) throws ParserSymbolTableException{
-			LookupData data = new LookupData( name, TypeInfo.t_function );
-			//if parameters == null, thats no parameters, but we need to distinguish that from
-			//no parameter information at all, so make an empty list.
-			data.parameters = ( parameters == null ) ? new LinkedList() : parameters;
-			
-			ParserSymbolTable.Lookup( data, this );
-			return ParserSymbolTable.ResolveAmbiguities( data ); 
-		}
-		
-		public Declaration QualifiedFunctionLookup( String name, LinkedList parameters ) throws ParserSymbolTableException{
-			LookupData data = new LookupData( name, TypeInfo.t_function );
-			data.qualified = true;
-			//if parameters == null, thats no parameters, but we need to distinguish that from
-			//no parameter information at all, so make an empty list.
-			data.parameters = ( parameters == null ) ? new LinkedList() : parameters;
-		
-			ParserSymbolTable.Lookup( data, this );
-		
-			return ParserSymbolTable.ResolveAmbiguities( data ); 
-		}
-		
-		public Declaration QualifiedLookup( String name ) throws ParserSymbolTableException{
-			LookupData data = new LookupData( name, -1 );
-			data.qualified = true;
-			ParserSymbolTable.Lookup( data, this );
-		
-			return ParserSymbolTable.ResolveAmbiguities( data ); 
-		}
-		
-		/**
-		 * UnqualifiedFunctionLookup
-		 * @param name
-		 * @param parameters
-		 * @return Declaration
-		 * @throws ParserSymbolTableException
-		 * 
-		 * 3.4.2-1 When an unqualified name is used as the post-fix expression in a
-		 * function call, other namespaces not consdiered during the usual
-		 * unqualified lookup may be searched.
-		 * 
-		 * 3.4.2-2 For each argument type T in the function call, there is a set of
-		 * zero or more associated namespaces and a set of zero or more associated
-		 * classes to be considered.
-		 * 
-		 * If the ordinary unqualified lookup of the name find the declaration of a
-		 * class member function, the associated namespaces and classes are not
-		 * considered.  Otherwise, the set of declarations found by the lookup of
-		 * the function name is the union of the set of declarations found using
-		 * ordinary unqualified lookup and the set of declarations found in the
-		 * namespaces and classes associated with the argument types.
-		 */
-		public Declaration UnqualifiedFunctionLookup( String name, LinkedList parameters ) throws ParserSymbolTableException{
-			//figure out the set of associated scopes first, so we can remove those that are searched
-			//during the normal lookup to avoid doing them twice
-			HashSet associated = new HashSet();
-		
-			//collect associated namespaces & classes.
-			int size = ( parameters == null ) ? 0 : parameters.size();
-			Iterator iter = ( parameters == null ) ? null : parameters.iterator();
-		
-			TypeInfo param = null;
-			Declaration paramType = null;
-			for( int i = size; i > 0; i-- ){
-				param = (TypeInfo) iter.next();
-				paramType = ParserSymbolTable.getFlatTypeInfo( param ).getTypeDeclaration();
-			
-				ParserSymbolTable.getAssociatedScopes( paramType, associated );
-			
-				//if T is a pointer to a data member of class X, its associated namespaces and classes
-				//are those associated with the member type together with those associated with X
-				if( param.getPtrOperator() != null && 
-				   (param.getPtrOperator().equals("*") || param.getPtrOperator().equals("[]")) &&
-					paramType.getContainingScope().isType( TypeInfo.t_class, TypeInfo.t_union ) )
-				{
-					ParserSymbolTable.getAssociatedScopes( paramType.getContainingScope(), associated );
-				}
-			}
-		
-			LookupData data = new LookupData( name, TypeInfo.t_function );
-			//if parameters == null, thats no parameters, but we need to distinguish that from
-			//no parameter information at all, so make an empty list.
-			data.parameters = ( parameters == null ) ? new LinkedList() : parameters;
-			data.associated = associated;
-		
-			ParserSymbolTable.Lookup( data, this );
-		
-			Declaration found = ResolveAmbiguities( data );
-		
-			//if we haven't found anything, or what we found is not a class member, consider the 
-			//associated scopes
-			if( found == null || found.getContainingScope().getType() != TypeInfo.t_class ){
-				if( found != null ){
-					data.foundItems.add( found );
-				}
-									
-				Declaration decl;
-				Declaration temp;
-
-				//dump the hash to an array and iterate over the array because we
-				//could be removing items from the collection as we go and we don't
-				//want to get ConcurrentModificationExceptions			
-				Object [] scopes = associated.toArray();
-			
-				size = associated.size();
-
-				for( int i = 0; i < size; i++ ){
-					decl  = (Declaration) scopes[ i ];
-					if( associated.contains( decl ) ){
-						data.qualified = true;
-						data.ignoreUsingDirectives = true;
-						ParserSymbolTable.Lookup( data, decl );
-					}
-				}
-			
-				found = ParserSymbolTable.ResolveAmbiguities( data );
-			}
-		
-			return found;
-		}
-			
-		private 	String 		_name;					//our name
-		private		Object 		_object;				//the object associated with us
-		private		boolean		_needsDefinition;		//this name still needs to be defined
-		private		int			_cvQualifier;
-		
-		private		TypeInfo	_typeInfo;				//our type info
-		private		Declaration	_containingScope;		//the scope that contains us
-		private		LinkedList 	_parentScopes;			//inherited scopes (is base classes)
-		private		LinkedList 	_usingDirectives;		//collection of nominated namespaces
-		private		HashMap 	_containedDeclarations;	//declarations contained by us.
-	
-		private 	LinkedList	_parameterList;			//have my cake
-		private 	HashMap		_parameterHash;			//and eat it too
-		
-		private 	int			_returnType;			
-	
-		private		int 		_depth;					//how far down the scope stack we are
-		
-		protected class ParentWrapper
-		{
-			public ParentWrapper( Declaration p, boolean v ){
-				parent    = p;
-				isVirtual = v;
-			}
-		
-			public boolean isVirtual = false;
-			public Declaration parent = null;
-		}
-	}
-	
-	static public class TypeInfo{
-		public TypeInfo(){
-			super();	
-		}
-	
-		public TypeInfo( int type, Declaration decl ){
-			super();
-			_typeInfo = type;
-			_typeDeclaration = decl;	
-		}
-	
-		public TypeInfo( int type, Declaration decl, int cvQualifier, String ptrOp, boolean hasDefault ){
-			super();
-			_typeInfo = type;
-			_typeDeclaration = decl;
-			_cvQualifier = cvQualifier;
-			_ptrOperator = ( ptrOp != null ) ? new String( ptrOp ) : null;
-			_hasDefaultValue = hasDefault;
-		}
-	
-		public TypeInfo( TypeInfo info ){
-			super();
-		
-			_typeInfo = info._typeInfo;
-			_typeDeclaration = info._typeDeclaration;
-			_cvQualifier = info._cvQualifier;
-			_ptrOperator = ( info._ptrOperator == null ) ? null : new String( info._ptrOperator );
-			_hasDefaultValue = info._hasDefaultValue;
-		}
-	
-		public static final int typeMask   = 0x001f;
-		public static final int isAuto     = 0x0020;
-		public static final int isRegister = 0x0040;
-		public static final int isStatic   = 0x0080;
-		public static final int isExtern   = 0x0100;
-		public static final int isMutable  = 0x0200;
-		public static final int isInline   = 0x0400;
-		public static final int isVirtual  = 0x0800;
-		public static final int isExplicit = 0x1000;
-		public static final int isTypedef  = 0x2000;
-		public static final int isFriend   = 0x4000;
-		public static final int isConst    = 0x8000;
-		public static final int isVolatile = 0x10000;
-		public static final int isUnsigned = 0x20000;
-		public static final int isShort    = 0x40000;
-		public static final int isLong     = 0x80000;
-		
-		// Types (maximum type is typeMask
-		// Note that these should be considered ordered and if you change
-		// the order, you should consider the ParserSymbolTable uses
-		public static final int t_undef       =  0; //not specified
-		public static final int t_type        =  1; // Type Specifier
-		public static final int t_namespace   =  2;
-		public static final int t_class       =  3;
-		public static final int t_struct      =  4;
-		public static final int t_union       =  5;
-		public static final int t_enumeration =  6;
-		public static final int t_function    =  7;
-		public static final int t_bool        =  8;
-		public static final int t_char        =  9;
-		public static final int t_wchar_t     = 10;
-		public static final int t_int         = 11;
-		public static final int t_float       = 12;
-		public static final int t_double      = 13;
-		public static final int t_void        = 14;
-		public static final int t_enumerator  = 15;
-		public static final int t_block       = 16;
-		public static final int t_template    = 17;
-		
-		private static final String _image[] = {	"", 
-													"", 
-													"namespace", 
-													"template",
-													"class", 
-													"struct", 
-													"union", 
-													"enum",
-													"",
-													"bool",
-													"char",
-													"wchar_t",
-													"int",
-													"float",
-													"double",
-													"void",
-													""
-												 };
-		//Partial ordering :
-		// none		< const
-		// none     < volatile
-		// none		< const volatile
-		// const	< const volatile
-		// volatile < const volatile
-		public static final int cvConst 			= 2;
-		public static final int cvVolatile 		= 3;
-		public static final int cvConstVolatile 	= 5;
-	
-			// Convenience methods
-		public void setBit(boolean b, int mask){
-			if( b ){
-				_typeInfo = _typeInfo | mask; 
-			} else {
-				_typeInfo = _typeInfo & ~mask; 
-			} 
-		}
-		
-		public boolean checkBit(int mask){
-			return (_typeInfo & mask) != 0;
-		}	
-		
-		public void setType(int t){
-			//sanity check, t must fit in its allocated 5 bits in _typeInfo
-			if( t > typeMask ){
-				return;
-			}
-		
-			_typeInfo = _typeInfo & ~typeMask | t; 
-		}
-		
-		public int getType(){ 
-			return _typeInfo & typeMask; 
-		}
-	
-		public boolean isType( int type ){
-			return isType( type, 0 ); 
-		}
-	
-		public int getTypeInfo(){
-			return _typeInfo;
-		}
-	
-		public void setTypeInfo( int typeInfo ){
-			_typeInfo = typeInfo;
-		}
-	
-		/**
-		 * 
-		 * @param type
-		 * @param upperType
-		 * @return boolean
-		 * 
-		 * type checking, check that this declaration's type is between type and
-		 * upperType (inclusive).  upperType of 0 means no range and our type must
-		 * be type.
-		 */
-		public boolean isType( int type, int upperType ){
-			//type of -1 means we don't care
-			if( type == -1 )
-				return true;
-		
-			//upperType of 0 means no range
-			if( upperType == 0 ){
-				return ( getType() == type );
-			} else {
-				return ( getType() >= type && getType() <= upperType );
-			}
-		}
-		
-		public Declaration getTypeDeclaration(){	
-			return _typeDeclaration; 
-		}
-	
-		public void setTypeDeclaration( Declaration type ){
-			_typeDeclaration = type; 
-		}
-	
-		public int getCVQualifier(){
-			return _cvQualifier;
-		}
-	
-		public void setCVQualifier( int cv ){
-			_cvQualifier = cv;
-		}
-
-		public void addCVQualifier( int cv ){
-			switch( _cvQualifier ){
-				case 0:
-					_cvQualifier = cv;
-					break;
-				
-				case cvConst:
-					if( cv != cvConst ){
-						_cvQualifier = cvConstVolatile;
-					}
-					break;
-			
-				case cvVolatile:
-					if( cv != cvVolatile ){
-						_cvQualifier = cvConstVolatile;
-					}
-					break;
-			
-				case cvConstVolatile:
-					break;	//nothing to do
-			}
-		}
-	
-		public String getPtrOperator(){
-			return _ptrOperator;
-		}
-	
-		public void setPtrOperator( String ptr ){
-			_ptrOperator = ptr;
-		}
-	
-		public void addPtrOperator( String ptr ){
-			if( ptr == null ){
-				return;
-			}
-		
-			char chars[] = ( _ptrOperator == null ) ? ptr.toCharArray() : ( ptr + _ptrOperator ).toCharArray();
-		
-			int nChars = ( _ptrOperator == null ) ? ptr.length() : ptr.length() + _ptrOperator.length();
-		
-			char dest[] = new char [ nChars ];
-			int j = 0;
-		
-			char currChar, nextChar, tempChar;
-		
-			for( int i = 0; i < nChars; i++ ){
-				currChar = chars[ i ];
-				nextChar = ( i + 1 < nChars ) ? chars[ i + 1 ] : 0;
-			
-				switch( currChar ){
-					case '&':{
-						switch( nextChar ){
-							case '[':
-								tempChar = ( i + 2 < nChars ) ? chars[ i + 2 ] : 0;
-								if( tempChar == ']' ){
-									i++;
-									nextChar = '*'; 
-								}
-								//fall through to '*'
-							case '*':
-								i++;
-								break;
-							case '&':
-							default:
-								dest[ j++ ] = currChar;
-								break;
-						}
-						break;
-					}
-					case '[':{
-						if( nextChar == ']' ){
-							i++;
-							currChar = '*';
-							nextChar = ( i + 2 < nChars ) ? chars[ i + 2 ] : 0;
-						}
-						//fall through to '*'
-					}
-					case '*':{
-					
-						if( nextChar == '&' ){
-							i++;
-						} else {
-							dest[ j++ ] = currChar;
-						}
-						break;
-					}
-					default:
-						break;
-
-				}
-			}
-		
-			_ptrOperator = new String( dest, 0, j );
-		}
-	
-		public String getInvertedPtrOperator(){
-			if( _ptrOperator == null ){
-				return null;
-			}
-		
-			char chars[] = _ptrOperator.toCharArray();
-			int nChars = _ptrOperator.length();
-		
-			char dest[] = new char [ nChars ];
-			char currChar;
-		
-			for( int i = 0; i < nChars; i++ ){
-				currChar = chars[ i ];
-				switch( currChar ){
-					case '*' :	dest[ i ] = '&'; 		break;
-					case '&' :	dest[ i ] = '*'; 		break;
-					default: 	dest[ i ] = currChar;	break;
-				}
-			}
-		
-			return new String( dest );
-		}
-	
-		public boolean getHasDefault(){
-			return _hasDefaultValue;
-		}
-
-		public void setHasDefault( boolean def ){
-			_hasDefaultValue = def;
-		}
-
-		/**
-		 * canHold
-		 * @param type
-		 * @return boolean
-		 * return true is the our type can hold all the values of the passed in
-		 * type.
-		 * TBD, for now return true if our type is "larger" (based on ordering of
-		 * the type values)
-		 */
-		public boolean canHold( TypeInfo type ){
-			return getType() >= type.getType();	
-		}
-	
-		public boolean equals( Object t ){
-			if( t == null || !(t instanceof TypeInfo) ){
-				return false;
-			}
-		
-			TypeInfo type = (TypeInfo)t;
-		
-			boolean result = ( _typeInfo == type._typeInfo );
-			result &= ( _typeDeclaration == type._typeDeclaration );
-			result &= ( _cvQualifier == type._cvQualifier );
-		
-			String op1 = ( _ptrOperator != null && _ptrOperator.equals("") ) ? null : _ptrOperator;
-			String op2 = ( type._ptrOperator != null && type._ptrOperator.equals("") ) ? null : type._ptrOperator;
-			result &= (( op1 != null && op2 != null && op1.equals( op2 ) ) || op1 == op2 );
-		
-			return result;
-		}
-	
-		public String toString(){
-			if( isType( t_type ) ){
-				return _typeDeclaration.getName();
-			} else {
-				return _image[ getType() ];
-			}
-		}
-
-		private int 		 _typeInfo = 0;
-		private Declaration _typeDeclaration;	
-		private int		 _cvQualifier = 0;
-	
-		private boolean	_hasDefaultValue = false;
-		private String		_ptrOperator;	
-	}
-}
Index: parser/org/eclipse/cdt/internal/core/parser/ParserSymbolTableException.java
===================================================================
RCS file: parser/org/eclipse/cdt/internal/core/parser/ParserSymbolTableException.java
diff -N parser/org/eclipse/cdt/internal/core/parser/ParserSymbolTableException.java
--- parser/org/eclipse/cdt/internal/core/parser/ParserSymbolTableException.java	7 Apr 2003 21:43:01 -0000	1.5
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,46 +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: 
- * Rational Software - Initial API and implementation
-***********************************************************************/
-
-package org.eclipse.cdt.internal.core.parser;
-
-/**
- * @author aniefer
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- * To enable and disable the creation of type comments go to
- * Window>Preferences>Java>Code Generation.
- */
-public class ParserSymbolTableException extends Exception {
-
-	/**
-	 * Constructor for ParserSymbolTableException.
-	 */
-	public ParserSymbolTableException() {
-		super();
-	}
-
-	/**
-	 * Constructor for ParserSymbolTableException.
-	 * @param int r: reason
-	 */
-	public ParserSymbolTableException( int r ) {
-		reason = r;
-	}
-
-	public static final int r_Unspecified   			= -1;
-	public static final int r_Ambiguous 			=  0;
-	public static final int r_BadTypeInfo   			=  1;
-	public static final int r_CircularInheritance	=  2;
-	public static final int r_InvalidOverload		=  3;
-	
-	public int reason = -1;
-}
\ No newline at end of file

Attachment: pst.zip
Description: Zip archive


Back to the top