Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Camelon2003-06-13 15:01:26 +0000
committerJohn Camelon2003-06-13 15:01:26 +0000
commit89913324d499cca1f62ff955f15afd14071ba8c2 (patch)
treed23dba1ec4c0a1f8efc8a9f45e03948e912df65f /core/org.eclipse.cdt.ui.tests
parentc2348df6081957a219d3d05a52726bd6dc66becc (diff)
downloadorg.eclipse.cdt-89913324d499cca1f62ff955f15afd14071ba8c2.tar.gz
org.eclipse.cdt-89913324d499cca1f62ff955f15afd14071ba8c2.tar.xz
org.eclipse.cdt-89913324d499cca1f62ff955f15afd14071ba8c2.zip
Merge Parser_SymbolTable branch into HEAD.
Diffstat (limited to 'core/org.eclipse.cdt.ui.tests')
-rw-r--r--core/org.eclipse.cdt.ui.tests/ChangeLog35
-rw-r--r--core/org.eclipse.cdt.ui.tests/failures/org/eclipse/cdt/core/model/failedTests/CModelElementsFailedTests.java2
-rw-r--r--core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/AutomatedTest.java2
-rw-r--r--core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/BaseDOMTest.java7
-rw-r--r--core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/CrossReferenceTests.java52
-rw-r--r--core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/DOMTests.java12
-rw-r--r--core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ExprEvalTest.java2
-rw-r--r--core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/LineNumberTest.java5
-rw-r--r--core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java1415
-rw-r--r--core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserTestSuite.java3
-rw-r--r--core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/TortureTest.java10
11 files changed, 980 insertions, 565 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/ChangeLog b/core/org.eclipse.cdt.ui.tests/ChangeLog
index 124edec304..3597ef5e9e 100644
--- a/core/org.eclipse.cdt.ui.tests/ChangeLog
+++ b/core/org.eclipse.cdt.ui.tests/ChangeLog
@@ -1,3 +1,12 @@
+2003-06-13 John Camelon
+ Merged ParserSymbolTable branch back into HEAD.
+
+2003-06-12 John Camelon
+ Get rest of JUnit tests working, will merge back to HEAD branch.
+
+2003-06-12 John Camelon
+ Introduction of ASTFactory strategy, some restructuring of packages and interfaces.
+
2003-06-11 Victor Mozgin
Old Java TestCase.txt and TestCase2.txt for partioning testing have been replaced with C/C++ files.
Modified AutomatedIntegrationSuite.java so it doesn't produce JUnit warning anymore.
@@ -11,9 +20,15 @@
Added TortureTest to test CDT C++ parser with GCC testsuites.
GCC testsuites are not included.
+2003-06-10 John Camelon
+ Futher pursuit of the golden hammer, symbol table integration.
+
2003-06-10 Brent Nicolle
Added some Interface tests of (IInclude, IMacro, IStructure).
Made sure all the Test Suites have names in the JUnit hierarchy.
+
+2003-06-09 John Camelon
+ First step in replacing IParserCallback with ISourceElementRequestor.
2003-06-09 Victor Mozgin
Moved testBug36769() from ACEFailedTest.java to DOMTests.java.
@@ -38,6 +53,26 @@
Moved testBug23478A() & testBug23478B() from failed tests to TranslationUnitTests.java.
Removed TranslationUnitFailedTests.java as it was empty.
+2003-05-29 Andrew Niefer
+ Modified tests to support eType & PtrOp changes in core
+ Added ParserSymbolTableTest::testTemplateParameterAsParent
+ Added ParserSymbolTableTest::testTemplateInstanceAsParent
+ Added ParserSymbolTableTest::testTemplateParameterDefaults
+ Added ParserSymbolTableTest::testTemplateParameterAsFunctionArgument
+ started ParserSymbolTableTest::incompletetestTemplateSpecialization
+
+2003-05-26 John Camelon
+ Rollback PST/Parser integration.
+
+2003-05-13 Andrew Niefer
+ Modified ParserSymbolTableTest to use new interface
+
+2003-05-08 Andrew Niefer
+ Added ParserSymbolTableTest::testMarkRollback
+
+2003-05-06 John Camelon
+ Further integration of SymbolTable into Parser, some refactoring.
+
2003-05-05 John Camelon/Andrew Niefer
Added CrossReferenceTests to ParserTestSuite to test symbol-table/DOM interworking.
diff --git a/core/org.eclipse.cdt.ui.tests/failures/org/eclipse/cdt/core/model/failedTests/CModelElementsFailedTests.java b/core/org.eclipse.cdt.ui.tests/failures/org/eclipse/cdt/core/model/failedTests/CModelElementsFailedTests.java
index 224881a83a..16242b197b 100644
--- a/core/org.eclipse.cdt.ui.tests/failures/org/eclipse/cdt/core/model/failedTests/CModelElementsFailedTests.java
+++ b/core/org.eclipse.cdt.ui.tests/failures/org/eclipse/cdt/core/model/failedTests/CModelElementsFailedTests.java
@@ -21,12 +21,12 @@ import junit.framework.TestSuite;
import org.eclipse.cdt.core.CCProjectNature;
import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.internal.core.model.TranslationUnit;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.core.model.ICProject;
import org.eclipse.cdt.core.model.INamespace;
import org.eclipse.cdt.core.model.IStructure;
import org.eclipse.cdt.internal.core.model.CElement;
+import org.eclipse.cdt.internal.core.model.TranslationUnit;
import org.eclipse.cdt.testplugin.CProjectHelper;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
diff --git a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/AutomatedTest.java b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/AutomatedTest.java
index cbf247ef7b..030dc584af 100644
--- a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/AutomatedTest.java
+++ b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/AutomatedTest.java
@@ -20,7 +20,7 @@ import java.util.StringTokenizer;
import junit.framework.AssertionFailedError;
import junit.framework.Test;
-import org.eclipse.cdt.internal.core.parser.IParser;
+import org.eclipse.cdt.core.parser.IParser;
import org.eclipse.cdt.internal.core.parser.Parser;
import org.eclipse.core.runtime.Path;
diff --git a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/BaseDOMTest.java b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/BaseDOMTest.java
index ed04853cad..715e37106d 100644
--- a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/BaseDOMTest.java
+++ b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/BaseDOMTest.java
@@ -12,10 +12,9 @@ package org.eclipse.cdt.core.parser.tests;
import junit.framework.TestCase;
+import org.eclipse.cdt.core.parser.IParser;
import org.eclipse.cdt.internal.core.dom.DOMBuilder;
-import org.eclipse.cdt.internal.core.dom.DOMFactory;
import org.eclipse.cdt.internal.core.dom.TranslationUnit;
-import org.eclipse.cdt.internal.core.parser.IParser;
import org.eclipse.cdt.internal.core.parser.Parser;
import org.eclipse.cdt.internal.core.parser.ParserException;
@@ -32,11 +31,11 @@ public class BaseDOMTest extends TestCase {
public TranslationUnit parse( String code ) throws Exception
{
- return parse( code, false, true );
+ return parse( code, true, true );
}
public TranslationUnit parse(String code, boolean quickParse, boolean throwOnError ) throws Exception {
- DOMBuilder domBuilder = DOMFactory.createDOMBuilder(false);
+ DOMBuilder domBuilder = new DOMBuilder();
IParser parser = new Parser(code, domBuilder, quickParse );
if( ! parser.parse() )
if( throwOnError ) throw new ParserException( "Parse failure" );
diff --git a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/CrossReferenceTests.java b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/CrossReferenceTests.java
deleted file mode 100644
index dc46398b9e..0000000000
--- a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/CrossReferenceTests.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**********************************************************************
- * Copyright (c) 2002,2003 Rational Software Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Rational Software - Initial API and implementation
-***********************************************************************/
-package org.eclipse.cdt.core.parser.tests;
-
-import java.io.StringWriter;
-import java.io.Writer;
-
-import org.eclipse.cdt.internal.core.dom.NamespaceDefinition;
-import org.eclipse.cdt.internal.core.dom.SimpleDeclaration;
-import org.eclipse.cdt.internal.core.dom.TranslationUnit;
-
-/**
- * @author jcamelon
- *
- */
-public class CrossReferenceTests extends BaseDOMTest {
-
- public CrossReferenceTests( String arg )
- {
- super( arg );
- }
-
-
- public void testMultipleNamespaceDefinition() throws Exception
- {
- Writer code = new StringWriter();
- code.write( "namespace A { int a; }\n" );
- code.write( "namespace A { int k; }\n" );
- TranslationUnit tu = parse( code.toString() );
- assertEquals( tu.getDeclarations().size(), 1 );
- assertEquals( ((NamespaceDefinition)tu.getDeclarations().get(0)).getDeclarations().size(), 2 );
- }
-
- public void testElaboratedTypeReference() throws Exception
- {
- Writer code = new StringWriter();
- code.write( "class A { int x; }; \n");
- code.write( "class A myA;");
- TranslationUnit tu = parse( code.toString() );
- assertEquals( tu.getDeclarations().size(), 2 );
- SimpleDeclaration first = (SimpleDeclaration)tu.getDeclarations().get(0);
- SimpleDeclaration second = (SimpleDeclaration)tu.getDeclarations().get(1);
- }
-}
diff --git a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/DOMTests.java b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/DOMTests.java
index 27937038b1..f8c5fd6fc2 100644
--- a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/DOMTests.java
+++ b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/DOMTests.java
@@ -27,7 +27,6 @@ import org.eclipse.cdt.internal.core.dom.Expression;
import org.eclipse.cdt.internal.core.dom.Inclusion;
import org.eclipse.cdt.internal.core.dom.LinkageSpecification;
import org.eclipse.cdt.internal.core.dom.Macro;
-import org.eclipse.cdt.internal.core.dom.Name;
import org.eclipse.cdt.internal.core.dom.NamespaceDefinition;
import org.eclipse.cdt.internal.core.dom.ParameterDeclaration;
import org.eclipse.cdt.internal.core.dom.ParameterDeclarationClause;
@@ -39,6 +38,7 @@ import org.eclipse.cdt.internal.core.dom.TemplateParameterList;
import org.eclipse.cdt.internal.core.dom.TranslationUnit;
import org.eclipse.cdt.internal.core.dom.UsingDeclaration;
import org.eclipse.cdt.internal.core.dom.UsingDirective;
+import org.eclipse.cdt.internal.core.parser.Name;
import org.eclipse.cdt.internal.core.parser.ParserException;
import org.eclipse.cdt.internal.core.parser.Token;
@@ -66,7 +66,7 @@ public class DOMTests extends BaseDOMTest {
if( i == 0 )
assertEquals( namespace.getName().toString(), "KingJohn" );
else
- assertNull( namespace.getName() );
+ assertEquals( namespace.getName(), "" );
List namespaceDeclarations = namespace.getDeclarations();
assertEquals( namespaceDeclarations.size(), 1 );
SimpleDeclaration simpleDec = (SimpleDeclaration)namespaceDeclarations.get(0);
@@ -222,16 +222,16 @@ public class DOMTests extends BaseDOMTest {
assertEquals( second.getNamespaceName().toString(), "C" );
third = (UsingDeclaration) declarations.get(2);
- assertEquals( third.getMappedName().toString(), "B::f" );
+ assertEquals( third.getMappedName(), "B::f" );
assertFalse( third.isTypename() );
fourth = (UsingDeclaration) declarations.get(3);
- assertEquals( fourth.getMappedName().toString(), "::f" );
+ assertEquals( fourth.getMappedName(), "::f" );
assertFalse( fourth.isTypename() );
fifth = (UsingDeclaration) declarations.get(4);
assertTrue( fifth.isTypename() );
- assertEquals( fifth.getMappedName().toString(), "crap::de::crap" );
+ assertEquals( fifth.getMappedName(), "crap::de::crap" );
}
public void testDeclSpecifier() throws Exception
@@ -899,7 +899,7 @@ public class DOMTests extends BaseDOMTest {
public void testConstructorChain() throws Exception
{
- TranslationUnit tu = parse( "TrafficLight_Actor::TrafficLight_Actor( RTController * rtg_rts, RTActorRef * rtg_ref ) : RTActor( rtg_rts, rtg_ref ), myId( 0 ) {}" );
+ TranslationUnit tu = parse( "TrafficLight_Actor::TrafficLight_Actor( RTController * rtg_rts, RTActorRef * rtg_ref ) : RTActor( rtg_rts, rtg_ref ), myId( 0 ) {}", true, true);
List tuDeclarations = tu.getDeclarations();
assertEquals( tuDeclarations.size(), 1 );
SimpleDeclaration decl1 = (SimpleDeclaration)tuDeclarations.get(0);
diff --git a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ExprEvalTest.java b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ExprEvalTest.java
index d08115a8d0..19a192d510 100644
--- a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ExprEvalTest.java
+++ b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ExprEvalTest.java
@@ -4,8 +4,8 @@ import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
+import org.eclipse.cdt.core.parser.IParser;
import org.eclipse.cdt.internal.core.parser.ExpressionEvaluator;
-import org.eclipse.cdt.internal.core.parser.IParser;
import org.eclipse.cdt.internal.core.parser.Parser;
public class ExprEvalTest extends TestCase {
diff --git a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/LineNumberTest.java b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/LineNumberTest.java
index 98e24f3d26..af95172e01 100644
--- a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/LineNumberTest.java
+++ b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/LineNumberTest.java
@@ -19,15 +19,14 @@ import java.util.List;
import junit.framework.TestCase;
+import org.eclipse.cdt.core.parser.IParser;
import org.eclipse.cdt.internal.core.dom.ClassSpecifier;
import org.eclipse.cdt.internal.core.dom.DOMBuilder;
-import org.eclipse.cdt.internal.core.dom.DOMFactory;
import org.eclipse.cdt.internal.core.dom.EnumerationSpecifier;
import org.eclipse.cdt.internal.core.dom.IOffsetable;
import org.eclipse.cdt.internal.core.dom.NamespaceDefinition;
import org.eclipse.cdt.internal.core.dom.SimpleDeclaration;
import org.eclipse.cdt.internal.core.dom.TemplateDeclaration;
-import org.eclipse.cdt.internal.core.parser.IParser;
import org.eclipse.cdt.internal.core.parser.Parser;
import org.eclipse.cdt.internal.core.parser.Scanner;
import org.eclipse.cdt.internal.core.parser.Token;
@@ -92,7 +91,7 @@ public class LineNumberTest extends TestCase {
public void testDOMLineNos() throws Exception
{
- DOMBuilder domBuilder = DOMFactory.createDOMBuilder( true );
+ DOMBuilder domBuilder = new DOMBuilder();
IParser parser = new Parser( fileIn, domBuilder, true );
parser.mapLineNumbers(true);
if( ! parser.parse() ) fail( "Parse of file failed");
diff --git a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java
index 3fa9fb37db..edad17dd94 100644
--- a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java
+++ b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserSymbolTableTest.java
@@ -17,8 +17,22 @@ import java.util.Map;
import junit.framework.TestCase;
-import org.eclipse.cdt.internal.core.parser.ParserSymbolTable;
-import org.eclipse.cdt.internal.core.parser.ParserSymbolTableException;
+import org.eclipse.cdt.core.parser.ast.AccessVisibility;
+import org.eclipse.cdt.internal.core.parser.ast.full.ASTCompilationUnit;
+import org.eclipse.cdt.internal.core.parser.ast.full.IASTFCompilationUnit;
+import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
+import org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol;
+import org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol;
+import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
+import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable;
+import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTableException;
+import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.Declaration;
+import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.Mark;
+import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.TemplateInstance;
+import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.TypeInfo;
+import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.TypeInfo.PtrOp;
+
+
/**
* @author aniefer
@@ -51,15 +65,15 @@ public class ParserSymbolTableTest extends TestCase {
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 );
@@ -74,10 +88,10 @@ public class ParserSymbolTableTest extends TestCase {
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 );
}
@@ -85,43 +99,23 @@ public class ParserSymbolTableTest extends TestCase {
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");
+ IContainerSymbol x = table.new Declaration("x");
- Object obj = new Object();
- x.setObject( obj );
+ IASTFCompilationUnit obj = new ASTCompilationUnit( x );
+ x.setASTNode( obj );
- table.getCompilationUnit().addDeclaration( x );
+ table.getCompilationUnit().addSymbol( x );
- ParserSymbolTable.Declaration look = table.getCompilationUnit().Lookup( "x" );
+ ISymbol look = table.getCompilationUnit().Lookup( "x" );
- assertEquals( look.getObject(), obj );
+ assertEquals( look.getASTNode(), obj );
}
/**
@@ -133,18 +127,18 @@ public class ParserSymbolTableTest extends TestCase {
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 );
@@ -161,14 +155,14 @@ public class ParserSymbolTableTest extends TestCase {
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 );
}
@@ -182,20 +176,20 @@ public class ParserSymbolTableTest extends TestCase {
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 );
}
@@ -211,14 +205,14 @@ public class ParserSymbolTableTest extends TestCase {
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" );
@@ -237,17 +231,17 @@ public class ParserSymbolTableTest extends TestCase {
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 );
@@ -269,29 +263,29 @@ public class ParserSymbolTableTest extends TestCase {
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");
- a.addParent( c, true );
+ IDerivableContainerSymbol a = table.newDerivableContainerSymbol("A");
+ a.addParent( c, true, AccessVisibility.v_public );
- ParserSymbolTable.Declaration b = table.new Declaration("B");
- b.addParent( c, true );
+ IDerivableContainerSymbol b = table.newDerivableContainerSymbol("B");
+ b.addParent( c, true, AccessVisibility.v_public );
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 );
}
@@ -310,15 +304,17 @@ public class ParserSymbolTableTest extends TestCase {
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 );
+ compUnit.addSymbol( d );
+
try{
cls.Lookup( "x" );
assertTrue( false );
@@ -344,34 +340,34 @@ public class ParserSymbolTableTest extends TestCase {
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" );
+ IDerivableContainerSymbol a = table.newDerivableContainerSymbol("a" );
+ IDerivableContainerSymbol b = table.newDerivableContainerSymbol( "b" );
+ IDerivableContainerSymbol c = table.newDerivableContainerSymbol( "c" );
+ IDerivableContainerSymbol d = table.newDerivableContainerSymbol( "d" );
- ParserSymbolTable.Declaration compUnit = table.getCompilationUnit();
+ IContainerSymbol compUnit = table.getCompilationUnit();
- compUnit.addDeclaration( a );
- compUnit.addDeclaration( b );
- compUnit.addDeclaration( c );
- compUnit.addDeclaration( d );
+ 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 );
@@ -411,33 +407,36 @@ public class ParserSymbolTableTest extends TestCase {
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");
+ IDerivableContainerSymbol hideCls = table.newDerivableContainerSymbol( "class" );
+ IDerivableContainerSymbol hideStruct = table.newDerivableContainerSymbol("struct");
+ IContainerSymbol hideUnion = table.newContainerSymbol("union");
- ParserSymbolTable.Declaration a = table.new Declaration("a");
- ParserSymbolTable.Declaration b = table.new Declaration("b");
+ IDerivableContainerSymbol a = table.newDerivableContainerSymbol("a");
+ IDerivableContainerSymbol b = table.newDerivableContainerSymbol("b");
- a.addDeclaration(hideCls);
- a.addDeclaration(hideStruct);
- a.addDeclaration(hideUnion);
+ 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" );
+ table.getCompilationUnit().addSymbol( a );
+ table.getCompilationUnit().addSymbol( b );
+
+ ISymbol look = a.ElaboratedLookup( ParserSymbolTable.TypeInfo.t_class, "class" );
assertEquals( look, cls );
look = a.ElaboratedLookup( ParserSymbolTable.TypeInfo.t_struct, "struct" );
assertEquals( look, struct );
@@ -456,26 +455,26 @@ public class ParserSymbolTableTest extends TestCase {
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");
@@ -499,21 +498,21 @@ public class ParserSymbolTableTest extends TestCase {
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" );
@@ -554,50 +553,51 @@ public class ParserSymbolTableTest extends TestCase {
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
{
@@ -610,16 +610,16 @@ public class ParserSymbolTableTest extends TestCase {
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.
@@ -648,31 +648,31 @@ public class ParserSymbolTableTest extends TestCase {
{
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" );
@@ -685,7 +685,7 @@ public class ParserSymbolTableTest extends TestCase {
}
look = f.LookupNestedNameSpecifier("N");
- look = look.QualifiedLookup("i"); //ok
+ look = ((IContainerSymbol) look).QualifiedLookup("i"); //ok
assertEquals( look, nsN_i );
}
@@ -716,38 +716,38 @@ public class ParserSymbolTableTest extends TestCase {
{
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 );
}
@@ -777,37 +777,37 @@ public class ParserSymbolTableTest extends TestCase {
{
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 );
@@ -840,25 +840,25 @@ public class ParserSymbolTableTest extends TestCase {
{
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 );
}
@@ -889,49 +889,49 @@ public class ParserSymbolTableTest extends TestCase {
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
@@ -939,7 +939,7 @@ public class ParserSymbolTableTest extends TestCase {
assertEquals( look, nsC );
try{
- look = look.QualifiedLookup( "y" );
+ look = ((IContainerSymbol)look).QualifiedLookup( "y" );
assertTrue(false);
} catch ( ParserSymbolTableException e ) {
assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous );
@@ -963,26 +963,26 @@ public class ParserSymbolTableTest extends TestCase {
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
@@ -1017,45 +1017,45 @@ public class ParserSymbolTableTest extends TestCase {
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 );
@@ -1068,7 +1068,7 @@ public class ParserSymbolTableTest extends TestCase {
assertEquals( look, C );
try{
- D.addUsingDeclaration( "g", look );
+ D.addUsingDeclaration( "g", C );
assertTrue( false );
}
catch ( ParserSymbolTableException exception ){
@@ -1103,49 +1103,49 @@ public class ParserSymbolTableTest extends TestCase {
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 );
+ f1.setReturnType( table.newSymbol( "", TypeInfo.t_void ) );
+ f1.addParameter( ParserSymbolTable.TypeInfo.t_int, 0, null, false );
+ 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 );
+ f2.setReturnType( table.newSymbol( "", TypeInfo.t_void ) );
+ f2.addParameter( ParserSymbolTable.TypeInfo.t_char, 0, null, 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 );
+ ParserSymbolTable.TypeInfo param = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_char, 0, null );
paramList.add( param );
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 );
@@ -1153,7 +1153,7 @@ public class ParserSymbolTableTest extends TestCase {
look = bar.UnqualifiedFunctionLookup( "f", paramList );
assertTrue( look != null );
- assertTrue( look.hasSameParameters( f2 ) );
+ assertTrue( ((IParameterizedSymbol) look).hasSameParameters( f2 ) );
}
/**
@@ -1167,24 +1167,25 @@ public class ParserSymbolTableTest extends TestCase {
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 );
+ fn.getTypeInfo().addPtrOperator( new PtrOp( PtrOp.t_undef, true, false ) );
+ //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.getPtrOperator(), "*" );
- assertEquals( look.getCVQualifier(), fn.getCVQualifier() );
- assertEquals( look.getContainingScope(), fn );
+ assertEquals( look.getTypeSymbol(), cls );
+ assertEquals( ((PtrOp)look.getPtrOperators().getFirst()).getType(), TypeInfo.PtrOp.t_pointer );
+ assertTrue( ((PtrOp)look.getPtrOperators().getFirst()).isConst() );
+ assertEquals( look.getContainingSymbol(), fn );
}
/**
@@ -1198,23 +1199,23 @@ public class ParserSymbolTableTest extends TestCase {
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 );
}
/**
@@ -1233,47 +1234,47 @@ public class ParserSymbolTableTest extends TestCase {
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 );
+ f.setReturnType( table.newSymbol( "", TypeInfo.t_void ) );
- ParserSymbolTable.Declaration look = NS.Lookup( "T" );
+ ISymbol look = NS.Lookup( "T" );
assertEquals( look, T );
- f.addParameter( look, 0, "", false );
+ f.addParameter( look, null, 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 );
+ main.setReturnType( table.newSymbol( "", TypeInfo.t_int ) );
+ compUnit.addSymbol( main );
LinkedList paramList = new LinkedList();
look = main.Lookup( "parm" );
assertEquals( look, param );
- ParserSymbolTable.TypeInfo p = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_type, look, 0, null, false );
+ ParserSymbolTable.TypeInfo p = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_type, 0, look );
paramList.add( p );
look = main.UnqualifiedFunctionLookup( "f", paramList );
@@ -1306,60 +1307,60 @@ public class ParserSymbolTableTest extends TestCase {
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 );
+ f1.setReturnType( table.newSymbol( "", TypeInfo.t_void ) );
+ f1.addParameter( ParserSymbolTable.TypeInfo.t_void, 0, new PtrOp( PtrOp.t_pointer ), false );
+ 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 );
+ f2.setReturnType( table.newSymbol( "", TypeInfo.t_void ) );
+ f2.addParameter( ParserSymbolTable.TypeInfo.t_void, 0, new PtrOp( PtrOp.t_pointer ), false );
+ 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" );
assertEquals( look, a );
- ParserSymbolTable.TypeInfo param = new ParserSymbolTable.TypeInfo( look.getType(), look, 0, "&", false );
+ ParserSymbolTable.TypeInfo param = new ParserSymbolTable.TypeInfo( look.getType(), 0, look, new PtrOp( PtrOp.t_reference ), false );
paramList.add( param );
look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
@@ -1389,50 +1390,51 @@ public class ParserSymbolTableTest extends TestCase {
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 );
+ f1.setReturnType( table.newSymbol( "", TypeInfo.t_void ) );
+ f1.addParameter( ParserSymbolTable.TypeInfo.t_int, 0, null, false );
+ 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 );
+ f2.setReturnType( table.newSymbol( "", TypeInfo.t_void ) );
+ f2.addParameter( ParserSymbolTable.TypeInfo.t_int, 0, null, false );
+ f2.addParameter( ParserSymbolTable.TypeInfo.t_char, 0, null, false );
+ 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 );
+ f3.setReturnType( table.newSymbol( "", TypeInfo.t_void ) );
+ f3.addParameter( ParserSymbolTable.TypeInfo.t_int, 0, null, false );
+ f3.addParameter( ParserSymbolTable.TypeInfo.t_char, 0, null, false );
+ f3.addParameter( C, new PtrOp( PtrOp.t_pointer ), false );
+ 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.setPtrOperator( "*" );
- compUnit.addDeclaration( c );
+ c.setTypeSymbol( look );
+ c.addPtrOperator( new PtrOp( PtrOp.t_pointer, false, false ) );
+ 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);
- ParserSymbolTable.TypeInfo p2 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_char, null, 0, "", false);
- ParserSymbolTable.TypeInfo p3 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_type, c, 0, "", false);
+
+ ParserSymbolTable.TypeInfo p1 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_int, 0, null );
+ ParserSymbolTable.TypeInfo p2 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_char, 0, null );
+ ParserSymbolTable.TypeInfo p3 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_type, 0, c );
paramList.add( p1 );
look = C.MemberFunctionLookup( "foo", paramList );
@@ -1462,33 +1464,33 @@ public class ParserSymbolTableTest extends TestCase {
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 );
+ f1.addParameter( ParserSymbolTable.TypeInfo.t_int, 0, null, false );
+ 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 );
+ f2.addParameter( ParserSymbolTable.TypeInfo.t_char, 0, null, true );
+ compUnit.addSymbol( f2 );
LinkedList paramList = new LinkedList();
- ParserSymbolTable.TypeInfo p1 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_int, null, 0, "", false );
+ ParserSymbolTable.TypeInfo p1 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_int, 0, null );
paramList.add( p1 );
- ParserSymbolTable.Declaration look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
+ ISymbol look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
assertEquals( look, f1 );
paramList.clear();
- ParserSymbolTable.TypeInfo p2 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_char, null, 0, "", false );
+ ParserSymbolTable.TypeInfo p2 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_char, 0, null );
paramList.add( p2 );
look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
assertEquals( look, f2 );
paramList.clear();
- ParserSymbolTable.TypeInfo p3 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_bool, null, 0, "", false );
+ ParserSymbolTable.TypeInfo p3 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_bool, 0, null );
paramList.add( p3 );
look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
assertEquals( look, f1 );
@@ -1517,50 +1519,50 @@ public class ParserSymbolTableTest extends TestCase {
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 );
+ f1.addParameter( A, new PtrOp( PtrOp.t_pointer ), false );
+ 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 );
+ f2.addParameter( B, new PtrOp( PtrOp.t_pointer ), false );
+ 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.setPtrOperator( "*" );
+ a.setTypeSymbol( A );
+ a.addPtrOperator( new PtrOp( PtrOp.t_pointer, false, false ) );
- ParserSymbolTable.Declaration c = table.new Declaration( "c" );
+ ISymbol c = table.newSymbol( "c" );
c.setType( ParserSymbolTable.TypeInfo.t_type );
- c.setTypeDeclaration( C );
- c.setPtrOperator( "*" );
+ c.setTypeSymbol( C );
+ c.addPtrOperator( new PtrOp( PtrOp.t_pointer, false, false ) );
LinkedList paramList = new LinkedList();
- ParserSymbolTable.TypeInfo p1 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_type, a, 0, null, false );
+ ParserSymbolTable.TypeInfo p1 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_type, 0, a );
paramList.add( p1 );
- ParserSymbolTable.Declaration look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
+ ISymbol look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
assertEquals( look, f1 );
paramList.clear();
- ParserSymbolTable.TypeInfo p2 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_type, c, 0, "", false );
+ ParserSymbolTable.TypeInfo p2 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_type, 0, c );
paramList.add( p2 );
look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
assertEquals( look, f2 );
@@ -1589,65 +1591,65 @@ public class ParserSymbolTableTest extends TestCase {
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.setPtrOperator( "*" );
- compUnit.addDeclaration( B );
+ B.setTypeSymbol( A );
+ B.addPtrOperator( new PtrOp( PtrOp.t_pointer, false, false ) );
+ 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 );
+ f1.addParameter( A, new PtrOp( PtrOp.t_pointer ), false );
+ 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 );
+ f2.addParameter( A, null, false );
+ 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.setPtrOperator( "[]" );
+ array.setTypeSymbol( A );
+ array.addPtrOperator( new PtrOp( PtrOp.t_array, false, false ) );
LinkedList paramList = new LinkedList();
- ParserSymbolTable.TypeInfo p = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_type, a, 0, null, false );
+ ParserSymbolTable.TypeInfo p = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_type, 0, a );
paramList.add( p );
- ParserSymbolTable.Declaration look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
+ ISymbol look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
assertEquals( look, f2 );
- p.setPtrOperator( "&" );
+ p.addPtrOperator( new PtrOp( PtrOp.t_reference, false, false ) );
look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
assertEquals( look, f1 );
- p.setTypeDeclaration( b );
- p.setPtrOperator( null );
+ p.setTypeSymbol( b );
+ p.getPtrOperators().clear();
look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
assertEquals( look, f1 );
- p.setPtrOperator( "*" );
+ p.addPtrOperator( new PtrOp( PtrOp.t_pointer, false, false ) );
look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
assertEquals( look, f2 );
- p.setTypeDeclaration( array );
- p.setPtrOperator( null );
+ p.setTypeSymbol( array );
+ p.getPtrOperators().clear();
look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
assertEquals( look, f1 );
@@ -1672,37 +1674,37 @@ public class ParserSymbolTableTest extends TestCase {
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 );
+ constructor.addParameter( A, null, false );
+ 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 );
+ f.addParameter( B, null, false );
+ 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 );
+ ParserSymbolTable.TypeInfo p = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_type, 0, a );
paramList.add( p );
- ParserSymbolTable.Declaration look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
+ ISymbol look = compUnit.UnqualifiedFunctionLookup( "f", paramList );
assertEquals( look, f );
}
@@ -1730,65 +1732,65 @@ public class ParserSymbolTableTest extends TestCase {
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 );
+ f1.addParameter( ParserSymbolTable.TypeInfo.t_int, 0, new PtrOp( PtrOp.t_pointer, true, false ), false );
+ f1.addParameter( ParserSymbolTable.TypeInfo.t_int, ParserSymbolTable.TypeInfo.isShort, 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, new PtrOp( PtrOp.t_pointer ), 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 );
- ParserSymbolTable.TypeInfo p2 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_type, s, 0, null, false );
+ ParserSymbolTable.TypeInfo p1 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_type, 0, i, new PtrOp( PtrOp.t_reference ), false );
+ ParserSymbolTable.TypeInfo p2 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_type, 0, s );
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 );
}
params.clear();
- ParserSymbolTable.TypeInfo p3 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_int | ParserSymbolTable.TypeInfo.isLong, null, 0, null, false );
+ ParserSymbolTable.TypeInfo p3 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_int, ParserSymbolTable.TypeInfo.isLong, null );
params.add( p1 );
params.add( p3 );
look = main.UnqualifiedFunctionLookup( "f", params );
assertEquals( look, f2 );
params.clear();
- ParserSymbolTable.TypeInfo p4 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_char, null, 0, null, false );
+ ParserSymbolTable.TypeInfo p4 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_char, 0, null );
params.add( p1 );
params.add( p4 );
look = main.UnqualifiedFunctionLookup( "f", params );
assertEquals( look, f2 );
params.clear();
- p1.setCVQualifier( ParserSymbolTable.TypeInfo.cvConst );
+ ((PtrOp)p1.getPtrOperators().getFirst()).setConst( true );
params.add( p1 );
params.add( p3 );
look = main.UnqualifiedFunctionLookup( "f", params );
@@ -1823,40 +1825,40 @@ public class ParserSymbolTableTest extends TestCase {
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 );
+ constructA.addParameter( B, new PtrOp( PtrOp.t_reference ), false );
+ 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 );
+ f1.addParameter( A, null, false );
+ 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 );
+ ParserSymbolTable.TypeInfo p1 = new ParserSymbolTable.TypeInfo( ParserSymbolTable.TypeInfo.t_type, 0, b );
params.add( p1 );
- ParserSymbolTable.Declaration look = null;
+ ISymbol look = null;
try{
look = compUnit.UnqualifiedFunctionLookup( "f", params );
@@ -1865,19 +1867,19 @@ public class ParserSymbolTableTest extends TestCase {
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 );
+ constructC.addParameter( B, new PtrOp( PtrOp.t_reference ), false );
+ 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 );
+ f2.addParameter( C, null, false );
+ compUnit.addSymbol( f2 );
try{
look = compUnit.UnqualifiedFunctionLookup( "f", params );
@@ -1886,13 +1888,448 @@ public class ParserSymbolTableTest extends TestCase {
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 );
+ f3.addParameter( B, null, false );
+ compUnit.addSymbol( f3 );
look = compUnit.UnqualifiedFunctionLookup( "f", params );
assertEquals( look, f3 );
}
+
+ public void testMarkRollback() throws Exception{
+ newTable();
+
+ IDerivableContainerSymbol A = table.newDerivableContainerSymbol("A");
+ A.setType( TypeInfo.t_class );
+ table.getCompilationUnit().addSymbol( A );
+
+ Mark mark = table.setMark();
+
+ ISymbol f = table.newSymbol("f");
+ A.addSymbol( f );
+
+ ISymbol look = A.Lookup("f");
+ assertEquals( look, f );
+
+ assertTrue( table.rollBack( mark ) );
+
+ look = A.Lookup("f");
+ assertEquals( look, null );
+
+ IDerivableContainerSymbol B = table.newDerivableContainerSymbol("B");
+ B.setType( TypeInfo.t_class );
+
+ mark = table.setMark();
+ table.getCompilationUnit().addSymbol( B );
+ Mark mark2 = table.setMark();
+ A.addParent( B );
+ Mark mark3 = table.setMark();
+
+ IParameterizedSymbol C = table.newParameterizedSymbol("C");
+ C.addParameter( TypeInfo.t_class, 0, null, false );
+
+ assertEquals( C.getParameterList().size(), 1 );
+ table.rollBack( mark3 );
+ assertEquals( C.getParameterList().size(), 0 );
+ assertEquals( A.getParents().size(), 1 );
+ table.rollBack( mark2 );
+ assertEquals( A.getParents().size(), 0 );
+
+ assertFalse( table.commit( mark2 ) );
+ assertFalse( table.rollBack( mark2 ) );
+
+ B.setType( TypeInfo.t_namespace );
+
+ mark = table.setMark();
+ A.addUsingDirective( B );
+ assertEquals( A.getUsingDirectives().size(), 1 );
+ table.rollBack( mark );
+ assertEquals( A.getUsingDirectives().size(), 0 );
+ }
+
+ /**
+ *
+ * @throws Exception
+ *
+ * template < class T > class A : public T {};
+ *
+ * class B
+ * {
+ * int i;
+ * }
+ *
+ * A<B> a;
+ * a.i; //finds B::i;
+ */
+ public void testTemplateParameterAsParent() throws Exception{
+ newTable();
+
+ IParameterizedSymbol template = table.newParameterizedSymbol( "A", TypeInfo.t_template );
+ ISymbol param = table.newSymbol( "T", TypeInfo.t_undef );
+ template.addParameter( param );
+
+ IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A", TypeInfo.t_class );
+ template.addSymbol( A );
+ A.addParent( param );
+
+ table.getCompilationUnit().addSymbol( template );
+
+ IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B", TypeInfo.t_class );
+ ISymbol i = table.newSymbol( "i", TypeInfo.t_int );
+ B.addSymbol( i );
+
+ TypeInfo type = new TypeInfo( TypeInfo.t_class, 0, B );
+ LinkedList args = new LinkedList();
+ args.add( type );
+
+ ParserSymbolTable.TemplateInstance instance = table.getCompilationUnit().TemplateLookup( "A", args );
+ assertEquals( instance.getInstantiatedSymbol(), A );
+
+ ISymbol a = table.newSymbol( "a", TypeInfo.t_type );
+ a.setTypeSymbol( instance );
+
+ table.getCompilationUnit().addSymbol( a );
+
+ ISymbol look = table.getCompilationUnit().Lookup( "a" );
+
+ assertEquals( look, a );
+
+ ISymbol symbol = a.getTypeSymbol();
+ assertEquals( symbol, instance );
+
+ look = ((IContainerSymbol)instance.getInstantiatedSymbol()).Lookup( "i" );
+ assertEquals( look, i );
+ }
+
+ /**
+ *
+ * @throws Exception
+ *
+ * template < class T > class A { T t; }
+ * class B : public A< int > { }
+ *
+ * B b;
+ * b.t; //finds A::t, will be type int
+ */
+ public void testTemplateInstanceAsParent() throws Exception{
+ newTable();
+
+ IParameterizedSymbol template = table.newParameterizedSymbol( "A", TypeInfo.t_template );
+ ISymbol param = table.newSymbol( "T", TypeInfo.t_undef );
+ template.addParameter( param );
+
+ IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A", TypeInfo.t_class );
+ ISymbol t = table.newSymbol( "t", TypeInfo.t_type );
+
+ ISymbol look = template.Lookup( "T" );
+ assertEquals( look, param );
+
+ t.setTypeSymbol( param );
+
+ template.addSymbol( A );
+ A.addSymbol( t );
+ table.getCompilationUnit().addSymbol( template );
+
+ IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B", TypeInfo.t_class );
+
+ TypeInfo type = new TypeInfo( TypeInfo.t_int, 0 , null );
+ LinkedList args = new LinkedList();
+ args.add( type );
+
+ look = table.getCompilationUnit().TemplateLookup( "A", args );
+ assertTrue( look instanceof ParserSymbolTable.TemplateInstance );
+
+ B.addParent( look );
+ table.getCompilationUnit().addSymbol( B );
+
+ ISymbol b = table.newSymbol( "b", TypeInfo.t_type );
+ b.setTypeSymbol( B );
+ table.getCompilationUnit().addSymbol( b );
+
+ look = table.getCompilationUnit().Lookup( "b" );
+ assertEquals( look, b );
+
+ look = ((IDerivableContainerSymbol) b.getTypeSymbol()).Lookup( "t" );
+ assertTrue( look instanceof TemplateInstance );
+
+ TemplateInstance instance = (TemplateInstance) look;
+ assertEquals( instance.getInstantiatedSymbol(), t );
+ assertTrue( instance.isType( TypeInfo.t_int ) );
+
+ }
+
+ /**
+ * The scope of a template-parameter extends from its point of declaration
+ * until the end of its template. In particular, a template parameter can be used
+ * in the declaration of a subsequent template-parameter and its default arguments.
+ * @throws Exception
+ *
+ * template< class T, class U = T > class X
+ * {
+ * T t;
+ * U u;
+ * };
+ *
+ * X< char > x;
+ * x.t;
+ * x.u;
+ */
+ public void testTemplateParameterDefaults() throws Exception{
+ newTable();
+
+ IParameterizedSymbol template = table.newParameterizedSymbol( "X", TypeInfo.t_template );
+
+ ISymbol paramT = table.newSymbol( "T", TypeInfo.t_undef );
+ template.addParameter( paramT );
+
+ ISymbol look = template.Lookup( "T" );
+ assertEquals( look, paramT );
+ ISymbol paramU = table.newSymbol( "U", TypeInfo.t_undef );
+ paramU.getTypeInfo().setDefault( new TypeInfo( TypeInfo.t_type, 0, look ) );
+ template.addParameter( paramU );
+
+ IDerivableContainerSymbol X = table.newDerivableContainerSymbol( "X", TypeInfo.t_class );
+ template.addSymbol( X );
+
+ look = X.Lookup( "T" );
+ assertEquals( look, paramT );
+ ISymbol t = table.newSymbol( "t", TypeInfo.t_type );
+ t.setTypeSymbol( look );
+ X.addSymbol( t );
+
+ look = X.Lookup( "U" );
+ assertEquals( look, paramU );
+ ISymbol u = table.newSymbol( "u", TypeInfo.t_type );
+ u.setTypeSymbol( look );
+ X.addSymbol( u );
+
+ table.getCompilationUnit().addSymbol( template );
+
+ TypeInfo type = new TypeInfo( TypeInfo.t_char, 0, null );
+ LinkedList args = new LinkedList();
+ args.add( type );
+ look = table.getCompilationUnit().TemplateLookup( "X", args );
+ assertTrue( look instanceof TemplateInstance );
+
+ TemplateInstance instance = (TemplateInstance) look;
+ look = ((IDerivableContainerSymbol) instance.getInstantiatedSymbol()).Lookup( "t" );
+
+ assertTrue( look instanceof TemplateInstance );
+ assertTrue( ((TemplateInstance) look).isType( TypeInfo.t_char ) );
+
+ look = ((IDerivableContainerSymbol) instance.getInstantiatedSymbol()).Lookup( "u" );
+ assertTrue( look instanceof TemplateInstance );
+ assertTrue( ((TemplateInstance) look).isType( TypeInfo.t_char ) );
+ }
+
+ /**
+ *
+ * @throws Exception
+ * template < class T > class A {
+ * T t;
+ * };
+ * class B {};
+ * void f( char c ) {}
+ * void f( A<B> b ) { ... }
+ * void f( int i ) {}
+ *
+ * A<B> a;
+ * f( a ); //calls f( A<B> )
+ *
+ */
+ public void testTemplateParameterAsFunctionArgument() throws Exception{
+ newTable();
+
+ IParameterizedSymbol template = table.newParameterizedSymbol( "A", TypeInfo.t_template );
+ ISymbol paramT = table.newSymbol( "T", TypeInfo.t_undef );
+ template.addParameter( paramT );
+
+ IDerivableContainerSymbol A = table.newDerivableContainerSymbol( "A", TypeInfo.t_class );
+ template.addSymbol( A );
+
+ ISymbol t = table.newSymbol( "t", TypeInfo.t_type );
+ t.setTypeSymbol( paramT );
+ A.addSymbol( t );
+
+ table.getCompilationUnit().addSymbol( template );
+
+ IDerivableContainerSymbol B = table.newDerivableContainerSymbol( "B", TypeInfo.t_class );
+ table.getCompilationUnit().addSymbol( B );
+
+ IParameterizedSymbol temp = (IParameterizedSymbol) table.getCompilationUnit().Lookup( "A" );
+ assertEquals( temp, template );
+
+ LinkedList args = new LinkedList();
+ TypeInfo arg = new TypeInfo( TypeInfo.t_type, 0, B );
+ args.add( arg );
+
+ IParameterizedSymbol f1 = table.newParameterizedSymbol( "f", TypeInfo.t_function );
+ f1.addParameter( TypeInfo.t_char, 0, null, false );
+ table.getCompilationUnit().addSymbol( f1 );
+
+ IParameterizedSymbol f2 = table.newParameterizedSymbol( "f", TypeInfo.t_function );
+ f2.addParameter( temp.instantiate( args ), null, false );
+ table.getCompilationUnit().addSymbol( f2 );
+
+ IParameterizedSymbol f3 = table.newParameterizedSymbol( "f", TypeInfo.t_function );
+ f3.addParameter( TypeInfo.t_int, 0, null, false );
+ table.getCompilationUnit().addSymbol( f3 );
+
+ ISymbol a = table.newSymbol( "a", TypeInfo.t_type );
+ a.setTypeSymbol( temp.instantiate( args ) );
+ table.getCompilationUnit().addSymbol( a );
+
+ LinkedList params = new LinkedList();
+ params.add( new TypeInfo( TypeInfo.t_type, 0, a ) );
+
+ ISymbol look = table.getCompilationUnit().UnqualifiedFunctionLookup( "f", params );
+ assertEquals( look, f2 );
+
+ }
+
+ /**
+ *
+ * template < class T1, class T2, int I > class A {} //#1
+ * template < class T, int I > class A < T, T*, I > {} //#2
+ * template < class T1, class T2, int I > class A < T1*, T2, I > {} //#3
+ * template < class T > class A < int, T*, 5 > {} //#4
+ * template < class T1, class T2, int I > class A < T1, T2*, I > {} //#5
+ *
+ * A <int, int, 1> a1; //uses #1
+ * A <int, int*, 1> a2; //uses #2, T is int, I is 1
+ * A <int, char*, 5> a3; //uses #4, T is char
+ * A <int, char*, 1> a4; //uses #5, T is int, T2 is char, I is1
+ * A <int*, int*, 2> a5; //ambiguous, matches #3 & #5.
+ *
+ * @throws Exception
+ */
+ public void incompletetestTemplateSpecialization() throws Exception{
+ newTable();
+
+ IDerivableContainerSymbol cls1 = table.newDerivableContainerSymbol( "A", TypeInfo.t_class );
+ IDerivableContainerSymbol cls2 = table.newDerivableContainerSymbol( "A", TypeInfo.t_class );
+ IDerivableContainerSymbol cls3 = table.newDerivableContainerSymbol( "A", TypeInfo.t_class );
+ IDerivableContainerSymbol cls4 = table.newDerivableContainerSymbol( "A", TypeInfo.t_class );
+ IDerivableContainerSymbol cls5 = table.newDerivableContainerSymbol( "A", TypeInfo.t_class );
+
+ IParameterizedSymbol template1 = table.newParameterizedSymbol( "A", TypeInfo.t_template );
+ ISymbol T1p1 = table.newSymbol( "T1", TypeInfo.t_undef );
+ ISymbol T1p2 = table.newSymbol( "T2", TypeInfo.t_undef );
+ ISymbol T1p3 = table.newSymbol( "I", TypeInfo.t_int );
+ template1.addParameter( T1p1 );
+ template1.addParameter( T1p2 );
+ template1.addParameter( T1p3 );
+ template1.addSymbol( cls1 );
+ table.getCompilationUnit().addSymbol( template1 );
+
+ IParameterizedSymbol template2 = table.newParameterizedSymbol( "A", TypeInfo.t_template );
+ ISymbol T2p1 = table.newSymbol( "T", TypeInfo.t_undef );
+ ISymbol T2p2 = table.newSymbol( "I", TypeInfo.t_int );
+ template2.addParameter( T2p1 );
+ template2.addParameter( T2p2 );
+ ISymbol T2a1 = table.newSymbol( "T", TypeInfo.t_undef );
+ ISymbol T2a2 = table.newSymbol( "T", TypeInfo.t_undef );
+ T2a2.addPtrOperator( new PtrOp( PtrOp.t_pointer ) );
+ ISymbol T2a3 = table.newSymbol( "I", TypeInfo.t_int );
+ template2.addArgument( T2a1 );
+ template2.addArgument( T2a2 );
+ template2.addArgument( T2a3 );
+ template2.addSymbol( cls2 );
+ template1.addSpecialization( template2 );
+
+ IParameterizedSymbol template3 = table.newParameterizedSymbol( "A", TypeInfo.t_template );
+ ISymbol T3p1 = table.newSymbol( "T1", TypeInfo.t_undef );
+ ISymbol T3p2 = table.newSymbol( "T2", TypeInfo.t_undef );
+ ISymbol T3p3 = table.newSymbol( "I", TypeInfo.t_int );
+ template3.addParameter( T3p1 );
+ template3.addParameter( T3p2 );
+ template3.addParameter( T3p3 );
+ ISymbol T3a1 = table.newSymbol( "T1", TypeInfo.t_undef );
+ T3a1.addPtrOperator( new PtrOp( PtrOp.t_pointer ) );
+ ISymbol T3a2 = table.newSymbol( "T2", TypeInfo.t_undef );
+ ISymbol T3a3 = table.newSymbol( "I", TypeInfo.t_int );
+ template3.addArgument( T3a1 );
+ template3.addArgument( T3a2 );
+ template3.addArgument( T3a3 );
+ template3.addSymbol( cls3 );
+ template1.addSpecialization( template3 );
+
+ IParameterizedSymbol template4 = table.newParameterizedSymbol( "A", TypeInfo.t_template );
+ ISymbol T4p1 = table.newSymbol( "T", TypeInfo.t_undef );
+ template4.addParameter( T4p1 );
+
+ ISymbol T4a1 = table.newSymbol( "", TypeInfo.t_int );
+ ISymbol T4a2 = table.newSymbol( "T", TypeInfo.t_undef );
+ T4a2.addPtrOperator( new PtrOp( PtrOp.t_pointer ) );
+ ISymbol T4a3 = table.newSymbol( "", TypeInfo.t_int );
+ T4a3.getTypeInfo().setDefault( new Integer(5) );
+ template4.addArgument( T4a1 );
+ template4.addArgument( T4a2 );
+ template4.addArgument( T4a3 );
+ template4.addSymbol( cls4 );
+ template1.addSpecialization( template4 );
+
+ IParameterizedSymbol template5 = table.newParameterizedSymbol( "A", TypeInfo.t_template );
+ ISymbol T5p1 = table.newSymbol( "T1", TypeInfo.t_undef );
+ ISymbol T5p2 = table.newSymbol( "T2", TypeInfo.t_undef );
+ ISymbol T5p3 = table.newSymbol( "I", TypeInfo.t_int );
+ template5.addParameter( T5p1 );
+ template5.addParameter( T5p2 );
+ template5.addParameter( T5p3 );
+ ISymbol T5a1 = table.newSymbol( "T1", TypeInfo.t_undef );
+ ISymbol T5a2 = table.newSymbol( "T2", TypeInfo.t_undef );
+ T5a1.addPtrOperator( new PtrOp( PtrOp.t_pointer ) );
+ ISymbol T5a3 = table.newSymbol( "I", TypeInfo.t_int );
+ template5.addArgument( T5a1 );
+ template5.addArgument( T5a2 );
+ template5.addArgument( T5a3 );
+ template5.addSymbol( cls5 );
+ template1.addSpecialization( template5 );
+
+ IParameterizedSymbol a = (IParameterizedSymbol) table.getCompilationUnit().Lookup( "A" );
+
+ LinkedList args = new LinkedList();
+
+ args.add( new TypeInfo( TypeInfo.t_int, 0, null ) );
+ args.add( new TypeInfo( TypeInfo.t_int, 0, null ) );
+ args.add( new TypeInfo( TypeInfo.t_int, 0, null, null, new Integer(1) ) );
+
+ TemplateInstance a1 = a.instantiate( args );
+ assertEquals( a1.getInstantiatedSymbol(), cls1 );
+
+ args.clear();
+ args.add( new TypeInfo( TypeInfo.t_int, 0, null ) );
+ args.add( new TypeInfo( TypeInfo.t_int, 0, null, new PtrOp( PtrOp.t_pointer ), false ) );
+ args.add( new TypeInfo( TypeInfo.t_int, 0, null, null, new Integer(1) ) );
+
+ TemplateInstance a2 = a.instantiate( args );
+ assertEquals( a2.getInstantiatedSymbol(), cls2 );
+
+ args.clear();
+ args.add( new TypeInfo( TypeInfo.t_int, 0, null ) );
+ args.add( new TypeInfo( TypeInfo.t_char, 0, null, new PtrOp( PtrOp.t_pointer ), false ) );
+ args.add( new TypeInfo( TypeInfo.t_int, 0, null, null, new Integer(5) ) );
+ TemplateInstance a3 = a.instantiate( args );
+ assertEquals( a3.getInstantiatedSymbol(), cls4 );
+
+ args.clear();
+ args.add( new TypeInfo( TypeInfo.t_int, 0, null ) );
+ args.add( new TypeInfo( TypeInfo.t_char, 0, null, new PtrOp( PtrOp.t_pointer ), false ) );
+ args.add( new TypeInfo( TypeInfo.t_int, 0, null, null, new Integer(1) ) );
+ TemplateInstance a4 = a.instantiate( args );
+ assertEquals( a4.getInstantiatedSymbol(), cls5 );
+
+ args.clear();
+ args.add( new TypeInfo( TypeInfo.t_int, 0, null, new PtrOp( PtrOp.t_pointer ), false ) );
+ args.add( new TypeInfo( TypeInfo.t_int, 0, null, new PtrOp( PtrOp.t_pointer ), false ) );
+ args.add( new TypeInfo( TypeInfo.t_int, 0, null, null, new Integer(2) ) );
+
+ try{
+ TemplateInstance a5 = a.instantiate( args );
+ } catch ( ParserSymbolTableException e ){
+ assertEquals( e.reason, ParserSymbolTableException.r_Ambiguous );
+ }
+ }
}
diff --git a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserTestSuite.java b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserTestSuite.java
index 8d931f71ac..25a733fbdf 100644
--- a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserTestSuite.java
+++ b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/ParserTestSuite.java
@@ -15,6 +15,7 @@ import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.cdt.core.model.tests.CModelElementsTests;
+import org.eclipse.cdt.core.parser.failedTests.*;
/**
* @author jcamelon
@@ -30,9 +31,7 @@ public class ParserTestSuite extends TestCase {
suite.addTestSuite(ExprEvalTest.class);
suite.addTestSuite(DOMTests.class);
suite.addTestSuite(ParserSymbolTableTest.class);
- suite.addTestSuite(LineNumberTest.class);
suite.addTestSuite(CModelElementsTests.class);
- suite.addTestSuite(CrossReferenceTests.class);
return suite;
}
diff --git a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/TortureTest.java b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/TortureTest.java
index 5f51384f3b..d6376b5c5e 100644
--- a/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/TortureTest.java
+++ b/core/org.eclipse.cdt.ui.tests/parser/org/eclipse/cdt/core/parser/tests/TortureTest.java
@@ -18,15 +18,13 @@ import java.io.StringWriter;
import java.util.NoSuchElementException;
import java.util.StringTokenizer;
+import junit.framework.AssertionFailedError;
import junit.framework.Test;
-import org.eclipse.core.runtime.Path;
-
+import org.eclipse.cdt.core.parser.IParser;
import org.eclipse.cdt.internal.core.dom.DOMBuilder;
-import org.eclipse.cdt.internal.core.dom.DOMFactory;
-import org.eclipse.cdt.internal.core.parser.IParser;
import org.eclipse.cdt.internal.core.parser.Parser;
-import junit.framework.AssertionFailedError;
+import org.eclipse.core.runtime.Path;
/**
@@ -201,7 +199,7 @@ public class TortureTest extends FractionalAutomatedTest {
public void run(){
try {
- DOMBuilder domBuilder = DOMFactory.createDOMBuilder(true);
+ DOMBuilder domBuilder = new DOMBuilder();
parser = new Parser(code.toString(), domBuilder, quickParse);
parser.setCppNature(cppNature);

Back to the top