1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-31 21:05:37 +02:00

CORE & UI

Added ISourceElementCallbackDelegate interface for AST constructs to allow the Parser to delegate callback's to the nodes themselves.  
	Got rid of ParserMode.STRUCTURAL_PARSE for the time being. 
	Removed org.eclipse.cdt.internal.core.parser.ast.full. 
	Created org.eclipse.cdt.internal.core.parser.ast.complete. 
	Updated ParserFactory.createScanner() to force the user to provide a callback and a ParserMode.
	Introduced ASTSemanticException for COMPLETE_PARSE mode. 
	Fleshed out preliminary IASTReference interfaces and added callbacks to ISourceElementRequestor.
	Removed acceptElaboratedTypeSpecifier() from ISourceElementRequestor.

TESTS
	Updated ParserSymbolTableTests to remove dependencies on parser.ast.full classes.
	Updated Parser test suites for updates to ParserFactory.
This commit is contained in:
John Camelon 2003-07-18 16:39:26 +00:00
parent e042f101ba
commit 8aa2e6f9b9
97 changed files with 1601 additions and 1486 deletions

View file

@ -1,3 +1,7 @@
2003-07-18 John Camelon
Updated ParserSymbolTableTests to remove dependencies on parser.ast.full classes.
Updated Parser test suites for updates to ParserFactory.
2003-07-18 John Camelon
Wrote new tests in QuickParseASTQualifiedNameTest.java and added it to ParserTestSuite's suite.

View file

@ -56,7 +56,7 @@ public class AutomatedTest extends AutomatedFramework {
FileInputStream stream = new FileInputStream( file );
String filePath = file.getCanonicalPath();
parser = ParserFactory.createParser( ParserFactory.createScanner( new InputStreamReader (stream), filePath, new ScannerInfo(), ParserMode.QUICK_PARSE ), nullCallback, ParserMode.QUICK_PARSE);
parser = ParserFactory.createParser( ParserFactory.createScanner( new InputStreamReader (stream), filePath, new ScannerInfo(), ParserMode.QUICK_PARSE, nullCallback ), nullCallback, ParserMode.QUICK_PARSE);
parser.setCppNature( ((String)natures.get( filePath )).equalsIgnoreCase("cpp") );
mapping = ParserFactory.createLineOffsetReconciler( new InputStreamReader( stream ) );

View file

@ -45,7 +45,7 @@ public class BaseASTTest extends TestCase
{
ParserMode mode = quick ? ParserMode.QUICK_PARSE : ParserMode.COMPLETE_PARSE;
quickParseCallback = ParserFactory.createQuickParseCallback();
parser = ParserFactory.createParser( ParserFactory.createScanner( new StringReader( code ), "code", new ScannerInfo(), mode), quickParseCallback, mode );
parser = ParserFactory.createParser( ParserFactory.createScanner( new StringReader( code ), "code", new ScannerInfo(), mode, quickParseCallback), quickParseCallback, mode );
if( ! parser.parse() && throwExceptionOnError )
throw new ParserException("Parse failure");
return quickParseCallback.getCompilationUnit();

View file

@ -19,7 +19,9 @@ import org.eclipse.cdt.core.parser.EndOfFile;
import org.eclipse.cdt.core.parser.IScanner;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.ParserFactory;
import org.eclipse.cdt.core.parser.ParserMode;
import org.eclipse.cdt.core.parser.ScannerException;
import org.eclipse.cdt.internal.core.parser.NullSourceElementRequestor;
import org.eclipse.cdt.internal.core.parser.ScannerInfo;
/**
@ -35,9 +37,15 @@ public class BaseScannerTest extends TestCase {
super(x);
}
protected void initializeScanner( String input, ParserMode mode )
{
scanner= ParserFactory.createScanner( new StringReader(input),"TEXT", new ScannerInfo(), mode, callback );
}
protected void initializeScanner(String input)
{
scanner= ParserFactory.createScanner( new StringReader(input),"TEXT", new ScannerInfo(), null );
initializeScanner( input, ParserMode.COMPLETE_PARSE );
}
public int fullyTokenize() throws Exception
@ -194,6 +202,8 @@ public class BaseScannerTest extends TestCase {
+ "as we sent in bad preprocessor input to the scanner";
public static final boolean verbose = false;
protected NullSourceElementRequestor callback = new NullSourceElementRequestor();
}

View file

@ -25,7 +25,8 @@ public class ExprEvalTest extends TestCase {
public void runTest(String code, int expectedValue) throws Exception {
IParser parser = ParserFactory.createParser(ParserFactory.createScanner( new StringReader( code ), null, new ScannerInfo(), null ), new NullSourceElementRequestor(), ParserMode.QUICK_PARSE);
final NullSourceElementRequestor nullCallback = new NullSourceElementRequestor();
IParser parser = ParserFactory.createParser(ParserFactory.createScanner( new StringReader( code ), null, new ScannerInfo(), null, nullCallback ), nullCallback, ParserMode.QUICK_PARSE);
IASTExpression expression = parser.expression();
assertEquals(expectedValue, expression.evaluateExpression());
}

View file

@ -239,7 +239,7 @@ public class FractionalAutomatedTest extends AutomatedFramework {
try{
result = null;
IParser parser = ParserFactory.createParser(
ParserFactory.createScanner( new StringReader( code ), null, new ScannerInfo(), ParserMode.QUICK_PARSE ), nullCallback, ParserMode.QUICK_PARSE);
ParserFactory.createScanner( new StringReader( code ), null, new ScannerInfo(), ParserMode.QUICK_PARSE, nullCallback ), nullCallback, ParserMode.QUICK_PARSE);
parser.setCppNature( cppNature );
parser.parse();
} catch ( Exception e ){

View file

@ -54,7 +54,7 @@ public class LineNumberTest extends TestCase {
public void testDOMLineNos() throws Exception
{
DOMBuilder domBuilder = new DOMBuilder();
IParser parser = ParserFactory.createParser( ParserFactory.createScanner( new InputStreamReader( fileIn ), null, new ScannerInfo(), ParserMode.QUICK_PARSE ), domBuilder, ParserMode.QUICK_PARSE );
IParser parser = ParserFactory.createParser( ParserFactory.createScanner( new InputStreamReader( fileIn ), null, new ScannerInfo(), ParserMode.QUICK_PARSE, domBuilder ), domBuilder, ParserMode.QUICK_PARSE );
//parser.mapLineNumbers(true);
if( ! parser.parse() ) fail( "Parse of file failed");

View file

@ -18,9 +18,9 @@ import java.util.Map;
import junit.framework.TestCase;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
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.ast.complete.SymbolExtension;
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
import org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension;
import org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol;
import org.eclipse.cdt.internal.core.parser.pst.IParameterizedSymbol;
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
@ -107,14 +107,15 @@ public class ParserSymbolTableTest extends TestCase {
IContainerSymbol x = table.new Declaration("x");
IASTFCompilationUnit obj = new ASTCompilationUnit( x );
x.setASTNode( obj );
ISymbolASTExtension extension = new SymbolExtension( null, null ); // cheating!
x.setASTNode( extension );
table.getCompilationUnit().addSymbol( x );
ISymbol look = table.getCompilationUnit().Lookup( "x" );
assertEquals( look.getASTNode(), obj );
assertEquals( look.getASTNode(), extension );
}
/**

View file

@ -15,10 +15,12 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.cdt.core.parser.EndOfFile;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.ParserFactory;
import org.eclipse.cdt.core.parser.ParserMode;
import org.eclipse.cdt.core.parser.ScannerException;
import org.eclipse.cdt.internal.core.parser.NullSourceElementRequestor;
import org.eclipse.cdt.internal.core.parser.ScannerInfo;
/**
@ -28,9 +30,12 @@ import org.eclipse.cdt.internal.core.parser.ScannerInfo;
public class PreprocessorConditionalTest extends BaseScannerTest
{
protected void initializeScanner(String input, Map definitions )
private ISourceElementRequestor nullSourceElementRequestor = new NullSourceElementRequestor();
protected void initializeScanner(String input, Map definitions )
{
scanner= ParserFactory.createScanner( new StringReader(input),"TEXT", new ScannerInfo( definitions, null), ParserMode.COMPLETE_PARSE );
scanner= ParserFactory.createScanner( new StringReader(input),"TEXT", new ScannerInfo( definitions, null), ParserMode.COMPLETE_PARSE, nullSourceElementRequestor );
}

View file

@ -31,7 +31,7 @@ import org.eclipse.cdt.internal.core.parser.ScannerInfo;
*/
public class PreprocessorTest extends TestCase {
public static class Callback extends NullSourceElementRequestor implements ISourceElementRequestor
public static class Callback extends NullSourceElementRequestor
{
private List enteredInc = new ArrayList(), exitedInc = new ArrayList();
@ -73,8 +73,7 @@ public class PreprocessorTest extends TestCase {
public IPreprocessor setupPreprocessor( String text, List includePaths, Map defns, ISourceElementRequestor rq )
{
IPreprocessor p = ParserFactory.createPreprocessor( new StringReader( text ), "test", new ScannerInfo(), ParserMode.COMPLETE_PARSE );
p.setRequestor( rq );
IPreprocessor p = ParserFactory.createPreprocessor( new StringReader( text ), "test", new ScannerInfo(), ParserMode.COMPLETE_PARSE, rq );
return p;
}
}

View file

@ -851,8 +851,7 @@ public class ScannerTestCase extends BaseScannerTest
{
try
{
initializeScanner( "#if X + 5 < 7\n int found = 1;\n#endif" );
scanner.setMode( ParserMode.QUICK_PARSE );
initializeScanner( "#if X + 5 < 7\n int found = 1;\n#endif", ParserMode.QUICK_PARSE );
validateToken( IToken.t_int );
validateIdentifier( "found" );
validateToken( IToken.tASSIGN );
@ -869,7 +868,6 @@ public class ScannerTestCase extends BaseScannerTest
try
{
initializeScanner( "#if 0\n int error = 666;\n#endif" );
scanner.setMode( ParserMode.COMPLETE_PARSE );
validateEOF();
}
catch( ScannerException se )

View file

@ -271,7 +271,7 @@ public class TortureTest extends FractionalAutomatedTest {
try {
DOMBuilder domBuilder = new DOMBuilder();
parser = ParserFactory.createParser(
ParserFactory.createScanner( new StringReader( code ), null, new ScannerInfo(), ParserMode.QUICK_PARSE ), nullCallback, ParserMode.QUICK_PARSE);
ParserFactory.createScanner( new StringReader( code ), null, new ScannerInfo(), ParserMode.QUICK_PARSE, nullCallback ), nullCallback, ParserMode.QUICK_PARSE);
parser.setCppNature(cppNature);
mapping = ParserFactory.createLineOffsetReconciler( new StringReader( code ) );

View file

@ -13,16 +13,21 @@ import org.eclipse.cdt.core.parser.ast.IASTClassReference;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationReference;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
import org.eclipse.cdt.core.parser.ast.IASTExpression;
import org.eclipse.cdt.core.parser.ast.IASTField;
import org.eclipse.cdt.core.parser.ast.IASTFieldReference;
import org.eclipse.cdt.core.parser.ast.IASTFunction;
import org.eclipse.cdt.core.parser.ast.IASTFunctionReference;
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
import org.eclipse.cdt.core.parser.ast.IASTMacro;
import org.eclipse.cdt.core.parser.ast.IASTMethod;
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
@ -31,9 +36,11 @@ import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTTypedefReference;
import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.core.parser.ast.IASTVariable;
import org.eclipse.cdt.core.parser.ast.IASTVariableReference;
import org.eclipse.cdt.internal.core.parser.ast.IASTArrayModifier;
/**
* This is the parser callback that creates objects in the DOM.
@ -607,7 +614,7 @@ public class DOMBuilder implements ISourceElementRequestor
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedef(org.eclipse.cdt.core.parser.ast.IASTTypedef)
*/
public void acceptTypedef(IASTTypedefDeclaration typedef)
public void acceptTypedefDeclaration(IASTTypedefDeclaration typedef)
{
// TODO Auto-generated method stub
}
@ -731,7 +738,7 @@ public class DOMBuilder implements ISourceElementRequestor
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterTemplateExplicitInstantiation(org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation)
*/
public void enterTemplateExplicitInstantiation(IASTTemplateInstantiation instantiation)
public void enterTemplateInstantiation(IASTTemplateInstantiation instantiation)
{
// TODO Auto-generated method stub
}
@ -876,28 +883,7 @@ public class DOMBuilder implements ISourceElementRequestor
{
// ignore
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptElaboratedTypeSpecifier(org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier)
*/
public void acceptElaboratedTypeSpecifier(IASTElaboratedTypeSpecifier elaboratedTypeSpec)
{
int kind = ClassKey.t_struct;
if( elaboratedTypeSpec.getClassKind() == ASTClassKind.CLASS )
kind = ClassKey.t_class;
else if( elaboratedTypeSpec.getClassKind() == ASTClassKind.STRUCT )
kind = ClassKey.t_struct;
else if( elaboratedTypeSpec.getClassKind() == ASTClassKind.UNION )
kind = ClassKey.t_union;
else if( elaboratedTypeSpec.getClassKind() == ASTClassKind.ENUM )
kind = ClassKey.t_enum;
SimpleDeclaration declaration = getTypeSpecOwner( getCurrentDOMScope(), elaboratedTypeSpec.getElementStartingOffset() );
ElaboratedTypeSpecifier elab = null;
elab = new ElaboratedTypeSpecifier( kind, declaration );
declaration.setTypeSpecifier( elab );
((ElaboratedTypeSpecifier)elab).setName( elaboratedTypeSpec.getName() );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptAbstractTypeSpecDeclaration(org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration)
*/
@ -922,4 +908,60 @@ public class DOMBuilder implements ISourceElementRequestor
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedefReference(org.eclipse.cdt.core.parser.ast.IASTTypedefReference)
*/
public void acceptTypedefReference(IASTTypedefReference reference)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptNamespaceReference(org.eclipse.cdt.core.parser.ast.IASTNamespaceReference)
*/
public void acceptNamespaceReference(IASTNamespaceReference reference)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumerationReference(org.eclipse.cdt.core.parser.ast.IASTEnumerationReference)
*/
public void acceptEnumerationReference(IASTEnumerationReference reference)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptVariableReference(org.eclipse.cdt.core.parser.ast.IASTVariableReference)
*/
public void acceptVariableReference(IASTVariableReference reference)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptFunctionReference(org.eclipse.cdt.core.parser.ast.IASTFunctionReference)
*/
public void acceptFunctionReference(IASTFunctionReference reference)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptFieldReference(org.eclipse.cdt.core.parser.ast.IASTFieldReference)
*/
public void acceptFieldReference(IASTFieldReference reference)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptMethodReference(org.eclipse.cdt.core.parser.ast.IASTMethodReference)
*/
public void acceptMethodReference(IASTMethodReference reference)
{
// TODO Auto-generated method stub
}
}

View file

@ -59,7 +59,7 @@ public class SourceIndexer extends AbstractIndexer {
// Create a new Parser
SourceIndexerRequestor requestor = new SourceIndexerRequestor(this, document);
IParser parser = ParserFactory.createParser(
ParserFactory.createScanner( new StringReader( document.getStringContent() ), document.getName(), new ScannerInfo(), ParserMode.QUICK_PARSE ),
ParserFactory.createScanner( new StringReader( document.getStringContent() ), document.getName(), new ScannerInfo(), ParserMode.QUICK_PARSE, requestor ),
requestor, ParserMode.QUICK_PARSE);
try{
parser.parse();

View file

@ -24,24 +24,30 @@ import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTClassReference;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationReference;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTField;
import org.eclipse.cdt.core.parser.ast.IASTFieldReference;
import org.eclipse.cdt.core.parser.ast.IASTFunction;
import org.eclipse.cdt.core.parser.ast.IASTFunctionReference;
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
import org.eclipse.cdt.core.parser.ast.IASTMacro;
import org.eclipse.cdt.core.parser.ast.IASTMethod;
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTTypedefReference;
import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.core.parser.ast.IASTVariable;
import org.eclipse.cdt.core.parser.ast.IASTVariableReference;
import org.eclipse.cdt.internal.core.index.IDocument;
/**
@ -124,7 +130,7 @@ public class SourceIndexerRequestor implements ISourceElementRequestor, IIndexCo
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedef(org.eclipse.cdt.core.parser.ast.IASTTypedef)
*/
public void acceptTypedef(IASTTypedefDeclaration typedef) {
public void acceptTypedefDeclaration(IASTTypedefDeclaration typedef) {
// TODO Auto-generated method stub
//System.out.println("acceptTypedef");
}
@ -219,7 +225,7 @@ public class SourceIndexerRequestor implements ISourceElementRequestor, IIndexCo
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterTemplateExplicitInstantiation(org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation)
*/
public void enterTemplateExplicitInstantiation(IASTTemplateInstantiation instantiation) {
public void enterTemplateInstantiation(IASTTemplateInstantiation instantiation) {
// TODO Auto-generated method stub
//System.out.println("enterTemplateExplicitInstantiation");
}
@ -1045,13 +1051,7 @@ public class SourceIndexerRequestor implements ISourceElementRequestor, IIndexCo
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptElaboratedTypeSpecifier(org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier)
*/
public void acceptElaboratedTypeSpecifier(IASTElaboratedTypeSpecifier elaboratedTypeSpec) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptAbstractTypeSpecDeclaration(org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration)
*/
@ -1076,6 +1076,62 @@ public class SourceIndexerRequestor implements ISourceElementRequestor, IIndexCo
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedefReference(org.eclipse.cdt.core.parser.ast.IASTTypedefReference)
*/
public void acceptTypedefReference(IASTTypedefReference reference)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptNamespaceReference(org.eclipse.cdt.core.parser.ast.IASTNamespaceReference)
*/
public void acceptNamespaceReference(IASTNamespaceReference reference)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumerationReference(org.eclipse.cdt.core.parser.ast.IASTEnumerationReference)
*/
public void acceptEnumerationReference(IASTEnumerationReference reference)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptVariableReference(org.eclipse.cdt.core.parser.ast.IASTVariableReference)
*/
public void acceptVariableReference(IASTVariableReference reference)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptFunctionReference(org.eclipse.cdt.core.parser.ast.IASTFunctionReference)
*/
public void acceptFunctionReference(IASTFunctionReference reference)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptFieldReference(org.eclipse.cdt.core.parser.ast.IASTFieldReference)
*/
public void acceptFieldReference(IASTFieldReference reference)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptMethodReference(org.eclipse.cdt.core.parser.ast.IASTMethodReference)
*/
public void acceptMethodReference(IASTMethodReference reference)
{
// TODO Auto-generated method stub
}
//TODO: Get rid of these IParserCallbacks once the parser cleans up

View file

@ -94,8 +94,8 @@ public class CModelBuilder {
translationUnit.getBuffer().getContents()
),
null, new ScannerInfo(), ParserMode.QUICK_PARSE,
problemReporter,
unitResult
domBuilder,
problemReporter, unitResult
),
domBuilder,
ParserMode.QUICK_PARSE,

View file

@ -1,3 +1,13 @@
2003-07-18 John Camelon
Added ISourceElementCallbackDelegate interface for AST constructs to allow the Parser to delegate callback's to the nodes themselves.
Got rid of ParserMode.STRUCTURAL_PARSE for the time being.
Removed org.eclipse.cdt.internal.core.parser.ast.full.
Created org.eclipse.cdt.internal.core.parser.ast.complete.
Updated ParserFactory.createScanner() to force the user to provide a callback and a ParserMode.
Introduced ASTSemanticException for COMPLETE_PARSE mode.
Fleshed out preliminary IASTReference interfaces and added callbacks to ISourceElementRequestor.
Removed acceptElaboratedTypeSpecifier() from ISourceElementRequestor.
2003-07-18 John Camelon
Removed DeclaratorDuple as it was obsolete.
Fixed offsets in quickParse's IASTTypedefDeclaration implementation.

View file

@ -65,6 +65,4 @@ public interface IParser {
public int getLastErrorOffset();
public void setRequestor( ISourceElementRequestor r );
}

View file

@ -21,7 +21,7 @@ package org.eclipse.cdt.core.parser;
* as constants on this interface. </li>
* </ul>
*/
public interface IProblem {
public interface IProblem extends ISourceElementCallbackDelegate {
/**
* Answer back the original arguments recorded into the problem.

View file

@ -19,15 +19,12 @@ public interface IScanner {
public String[] getIncludePaths();
public void addIncludePath(String includePath);
public void overwriteIncludePath( String [] newIncludePaths );
public void setRequestor( ISourceElementRequestor r );
public IToken nextToken() throws ScannerException, EndOfFile;
public IToken nextToken( boolean next ) throws ScannerException, EndOfFile;
public void setCppNature( boolean value );
public void setMode(ParserMode mode);
public int getCount();
public int getDepth();

View file

@ -8,13 +8,15 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.full;
package org.eclipse.cdt.core.parser;
/**
* @author jcamelon
*
*/
public interface IASTFLinkageSpecification
extends org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification, IASTFScope {
public interface ISourceElementCallbackDelegate
{
public void acceptElement( ISourceElementRequestor requestor );
public void enterScope( ISourceElementRequestor requestor );
public void exitScope( ISourceElementRequestor requestor );
}

View file

@ -15,24 +15,30 @@ import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTClassReference;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationReference;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTField;
import org.eclipse.cdt.core.parser.ast.IASTFieldReference;
import org.eclipse.cdt.core.parser.ast.IASTFunction;
import org.eclipse.cdt.core.parser.ast.IASTFunctionReference;
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
import org.eclipse.cdt.core.parser.ast.IASTMacro;
import org.eclipse.cdt.core.parser.ast.IASTMethod;
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTTypedefReference;
import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.core.parser.ast.IASTVariable;
import org.eclipse.cdt.core.parser.ast.IASTVariableReference;
/**
* @author jcamelon
@ -48,7 +54,7 @@ public interface ISourceElementRequestor {
public void acceptUsingDirective( IASTUsingDirective usageDirective );
public void acceptUsingDeclaration( IASTUsingDeclaration usageDeclaration );
public void acceptASMDefinition( IASTASMDefinition asmDefinition );
public void acceptTypedef( IASTTypedefDeclaration typedef );
public void acceptTypedefDeclaration( IASTTypedefDeclaration typedef );
public void acceptEnumerationSpecifier( IASTEnumerationSpecifier enumeration );
public void acceptAbstractTypeSpecDeclaration( IASTAbstractTypeSpecifierDeclaration abstractDeclaration );
@ -63,7 +69,7 @@ public interface ISourceElementRequestor {
public void enterTemplateDeclaration( IASTTemplateDeclaration declaration );
public void enterTemplateSpecialization( IASTTemplateSpecialization specialization );
public void enterTemplateExplicitInstantiation( IASTTemplateInstantiation instantiation );
public void enterTemplateInstantiation( IASTTemplateInstantiation instantiation );
public void acceptMethodDeclaration( IASTMethod method );
public void enterMethodBody( IASTMethod method );
@ -71,6 +77,13 @@ public interface ISourceElementRequestor {
public void acceptField( IASTField field );
public void acceptClassReference( IASTClassReference reference );
public void acceptTypedefReference( IASTTypedefReference reference );
public void acceptNamespaceReference( IASTNamespaceReference reference );
public void acceptEnumerationReference( IASTEnumerationReference reference );
public void acceptVariableReference( IASTVariableReference reference );
public void acceptFunctionReference( IASTFunctionReference reference );
public void acceptFieldReference( IASTFieldReference reference );
public void acceptMethodReference( IASTMethodReference reference );
public void exitTemplateDeclaration( IASTTemplateDeclaration declaration );
public void exitTemplateSpecialization( IASTTemplateSpecialization specialization );
@ -82,8 +95,6 @@ public interface ISourceElementRequestor {
public void exitInclusion( IASTInclusion inclusion );
public void exitCompilationUnit( IASTCompilationUnit compilationUnit );
public void acceptElaboratedTypeSpecifier(IASTElaboratedTypeSpecifier elaboratedTypeSpec);
/**
* @param function
*/

View file

@ -23,7 +23,7 @@ import org.eclipse.cdt.internal.core.parser.QuickParseCallback;
import org.eclipse.cdt.internal.core.parser.Scanner;
import org.eclipse.cdt.internal.core.parser.TranslationOptions;
import org.eclipse.cdt.internal.core.parser.TranslationResult;
import org.eclipse.cdt.internal.core.parser.ast.full.FullParseASTFactory;
import org.eclipse.cdt.internal.core.parser.ast.complete.CompleteParseASTFactory;
import org.eclipse.cdt.internal.core.parser.ast.quick.QuickParseASTFactory;
import org.eclipse.cdt.internal.core.parser.problem.DefaultProblemFactory;
import org.eclipse.cdt.internal.core.parser.problem.ProblemReporter;
@ -40,7 +40,7 @@ public class ParserFactory {
if( mode == ParserMode.QUICK_PARSE )
return new QuickParseASTFactory();
else
return new FullParseASTFactory();
return new CompleteParseASTFactory();
}
public static IParser createParser( IScanner scanner, ISourceElementRequestor callback, ParserMode mode )
@ -55,29 +55,29 @@ public class ParserFactory {
return new Parser( scanner, ourCallback, ourMode, problemReporter, unitResult );
}
public static IScanner createScanner( Reader input, String fileName, IScannerInfo config, ParserMode mode )
public static IScanner createScanner( Reader input, String fileName, IScannerInfo config, ParserMode mode, ISourceElementRequestor requestor )
{
return createScanner(input, fileName, config, mode, null, null);
return createScanner(input, fileName, config, mode, requestor, null, null);
}
public static IScanner createScanner( Reader input, String fileName, IScannerInfo config, ParserMode mode, IProblemReporter problemReporter, ITranslationResult unitResult )
public static IScanner createScanner( Reader input, String fileName, IScannerInfo config, ParserMode mode, ISourceElementRequestor requestor, IProblemReporter problemReporter, ITranslationResult unitResult )
{
ParserMode ourMode = ( (mode == null )? ParserMode.COMPLETE_PARSE : mode );
IScanner s = new Scanner( input, fileName, config, problemReporter, unitResult );
s.setMode( ourMode );
ParserMode ourMode = ( (mode == null )? ParserMode.COMPLETE_PARSE : mode );
ISourceElementRequestor ourRequestor = (( requestor == null) ? new NullSourceElementRequestor() : requestor );
IScanner s = new Scanner( input, fileName, config, problemReporter, unitResult, ourRequestor, ourMode );
return s;
}
public static IPreprocessor createPreprocessor( Reader input, String fileName, IScannerInfo info, ParserMode mode )
public static IPreprocessor createPreprocessor( Reader input, String fileName, IScannerInfo info, ParserMode mode, ISourceElementRequestor requestor )
{
return createPreprocessor(input, fileName, info, mode, null, null);
return createPreprocessor(input, fileName, info, mode, requestor, null, null);
}
public static IPreprocessor createPreprocessor( Reader input, String fileName, IScannerInfo info, ParserMode mode, IProblemReporter problemReporter, ITranslationResult unitResult )
public static IPreprocessor createPreprocessor( Reader input, String fileName, IScannerInfo info, ParserMode mode, ISourceElementRequestor requestor, IProblemReporter problemReporter, ITranslationResult unitResult )
{
ParserMode ourMode = ( (mode == null )? ParserMode.COMPLETE_PARSE : mode );
IPreprocessor s = new Preprocessor( input, fileName, info, problemReporter, unitResult );
s.setMode( ourMode );
ISourceElementRequestor ourRequestor = (( requestor == null) ? new NullSourceElementRequestor() : requestor );
IPreprocessor s = new Preprocessor( input, fileName, info, ourRequestor, problemReporter, unitResult, ourMode );
return s;
}

View file

@ -19,11 +19,8 @@ public class ParserMode extends Enum {
// follow inclusions, parse function/method bodies
public static final ParserMode COMPLETE_PARSE = new ParserMode( 1 );
// follow inclusions, do not parse function/method bodies
public static final ParserMode STRUCTURAL_PARSE = new ParserMode( 2 );
// do not follow inclusions, do not parse function/method bodies
public static final ParserMode QUICK_PARSE = new ParserMode( 3 );
public static final ParserMode QUICK_PARSE = new ParserMode( 2 );
protected ParserMode( int value )
{

View file

@ -0,0 +1,41 @@
/**********************************************************************
* 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.ast;
import org.eclipse.cdt.core.parser.IProblem;
/**
* @author jcamelon
*
*/
public class ASTSemanticException extends Exception
{
private final IProblem theProblem;
/**
*
*/
public ASTSemanticException( IProblem reason )
{
super();
theProblem = reason;
}
/**
* @return
*/
public IProblem getTheProblem()
{
return theProblem;
}
}

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.core.parser.ast;
/**
* @author jcamelon
*

View file

@ -14,8 +14,7 @@ package org.eclipse.cdt.core.parser.ast;
* @author jcamelon
*
*/
public interface IASTClassReference
public interface IASTClassReference extends IASTReference
{
public IASTClassSpecifier getClassSpecifier();
public int getOffset();
}

View file

@ -13,12 +13,13 @@ package org.eclipse.cdt.core.parser.ast;
import java.util.Iterator;
import org.eclipse.cdt.core.parser.Enum;
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
/**
* @author jcamelon
*
*/
public interface IASTClassSpecifier extends IASTTypeSpecifier, IASTScope, IASTOffsetableNamedElement, IASTScopedTypeSpecifier {
public interface IASTClassSpecifier extends IASTTypeSpecifier, IASTScope, IASTOffsetableNamedElement, IASTScopedTypeSpecifier, ISourceElementCallbackDelegate {
public class ClassNameType extends Enum {

View file

@ -10,10 +10,12 @@
***********************************************************************/
package org.eclipse.cdt.core.parser.ast;
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
/**
* @author jcamelon
*
*/
public interface IASTCompilationUnit extends IASTScope {
public interface IASTCompilationUnit extends IASTScope, ISourceElementCallbackDelegate {
}

View file

@ -10,11 +10,13 @@
***********************************************************************/
package org.eclipse.cdt.core.parser.ast;
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
/**
* @author jcamelon
*
*/
public interface IASTDeclaration extends IASTScopedElement {
public interface IASTDeclaration extends IASTScopedElement, ISourceElementCallbackDelegate {
}

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.core.parser.ast;
/**
* @author jcamelon
*

View file

@ -8,16 +8,12 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.full;
package org.eclipse.cdt.core.parser.ast;
/**
* @author jcamelon
*
*/
public interface IASTFCompilationUnit
extends
org.eclipse.cdt.core.parser.ast.IASTCompilationUnit,
IASTFScope {
public interface IASTEnumerationReference extends IASTReference
{
}

View file

@ -12,11 +12,13 @@ package org.eclipse.cdt.core.parser.ast;
import java.util.Iterator;
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
/**
* @author jcamelon
*
*/
public interface IASTEnumerationSpecifier extends IASTScopedTypeSpecifier, IASTOffsetableNamedElement {
public interface IASTEnumerationSpecifier extends ISourceElementCallbackDelegate, IASTScopedTypeSpecifier, IASTOffsetableNamedElement {
public void addEnumerator( IASTEnumerator enumerator );
public Iterator getEnumerators();

View file

@ -11,11 +11,11 @@
package org.eclipse.cdt.core.parser.ast;
import java.util.List;
import org.eclipse.cdt.core.parser.Backtrack;
import org.eclipse.cdt.core.parser.ITokenDuple;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType;
import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor;
import org.eclipse.cdt.internal.core.parser.ast.IASTArrayModifier;
import org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension;
/**
* @author jcamelon
*
@ -37,7 +37,7 @@ public interface IASTFactory
public IASTUsingDirective createUsingDirective(
IASTScope scope,
ITokenDuple duple, int startingOffset, int endingOffset)
throws Backtrack;
throws ASTSemanticException;
public IASTUsingDeclaration createUsingDeclaration(
IASTScope scope,
boolean isTypeName,
@ -215,4 +215,6 @@ public interface IASTFactory
boolean isExplicit,
boolean isPureVirtual,
ASTAccessVisibility visibility, ASTPointerOperator pointerOperator);
public ISymbolASTExtension createSymbolTableDeclarationExtension( IASTDeclaration declaration, IASTDeclaration definition ) throws ASTNotImplementedException;
}

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.core.parser.ast;
/**
* @author jcamelon
*

View file

@ -8,14 +8,12 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.full;
package org.eclipse.cdt.core.parser.ast;
/**
* @author jcamelon
*
*/
public interface IASTFASMDefinition
extends org.eclipse.cdt.core.parser.ast.IASTASMDefinition, IPSTSymbolExtension {
public interface IASTFieldReference extends IASTReference
{
}

View file

@ -8,15 +8,12 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.full;
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
package org.eclipse.cdt.core.parser.ast;
/**
* @author jcamelon
*
*/
public interface IPSTSymbolExtension {
ISymbol getSymbol();
public interface IASTFunctionReference extends IASTReference
{
}

View file

@ -10,12 +10,14 @@
***********************************************************************/
package org.eclipse.cdt.core.parser.ast;
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
/**
* @author jcamelon
*
*/
public interface IASTInclusion extends IASTOffsetableNamedElement {
public interface IASTInclusion extends IASTOffsetableNamedElement, ISourceElementCallbackDelegate {
public String getName();

View file

@ -10,11 +10,12 @@
***********************************************************************/
package org.eclipse.cdt.core.parser.ast;
/**
* @author jcamelon
*
*/
public interface IASTLinkageSpecification extends IASTScope, IASTDeclaration, IASTOffsetableElement {
public interface IASTLinkageSpecification extends IASTScope, IASTDeclaration, IASTOffsetableElement {
public String getLinkageString();
}

View file

@ -10,11 +10,13 @@
***********************************************************************/
package org.eclipse.cdt.core.parser.ast;
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
/**
* @author jcamelon
*
*/
public interface IASTMacro extends IASTOffsetableNamedElement {
public interface IASTMacro extends IASTOffsetableNamedElement, ISourceElementCallbackDelegate {
public String getName();

View file

@ -10,11 +10,12 @@
***********************************************************************/
package org.eclipse.cdt.core.parser.ast;
/**
* @author jcamelon
*
*/
public interface IASTMethod extends IASTFunction, IASTMember {
public interface IASTMethod extends IASTFunction, IASTMember {
public boolean isVirtual();
public boolean isExplicit();

View file

@ -0,0 +1,19 @@
/**********************************************************************
* 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.ast;
/**
* @author jcamelon
*
*/
public interface IASTMethodReference extends IASTReference
{
}

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.core.parser.ast;
/**
* @author jcamelon
*

View file

@ -0,0 +1,19 @@
/**********************************************************************
* 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.ast;
/**
* @author jcamelon
*
*/
public interface IASTNamespaceReference extends IASTReference
{
}

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.core.parser.ast;
/**
* @author jcamelon
*

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.core.parser.ast;
/**
* @author jcamelon
*

View file

@ -8,16 +8,19 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.full;
package org.eclipse.cdt.core.parser.ast;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
import org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate;
/**
* @author jcamelon
*
*/
public interface IPSTContainerExtension extends IPSTSymbolExtension, IASTScope {
public interface IASTReference extends ISourceElementCallbackDelegate
{
public IContainerSymbol getContainerSymbol();
public int getOffset();
public String getName();
public IASTScopedElement getReferencedElement();
}

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.core.parser.ast;
/**
* @author jcamelon
*

View file

@ -0,0 +1,19 @@
/**********************************************************************
* 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.ast;
/**
* @author jcamelon
*
*/
public interface IASTTypedefReference extends IASTReference
{
}

View file

@ -10,11 +10,12 @@
***********************************************************************/
package org.eclipse.cdt.core.parser.ast;
/**
* @author jcamelon
*
*/
public interface IASTVariable extends IASTDeclaration, IASTOffsetableNamedElement, IASTQualifiedNameElement {
public interface IASTVariable extends IASTDeclaration, IASTOffsetableNamedElement, IASTQualifiedNameElement {
public boolean isAuto();
public boolean isRegister();

View file

@ -0,0 +1,19 @@
/**********************************************************************
* 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.ast;
/**
* @author jcamelon
*
*/
public interface IASTVariableReference extends IASTReference
{
}

View file

@ -64,8 +64,7 @@ public class ContextStack {
{
if( !inclusions.add( context.getFilename() ) )
throw new ScannerException( "Inclusion " + context.getFilename() + " already encountered." );
if( requestor != null )
requestor.enterInclusion( context.getExtension() );
context.getExtension().enterScope( requestor );
} else if( context.getKind() == IScannerContext.MACROEXPANSION )
{
@ -90,8 +89,7 @@ public class ContextStack {
if( currentContext.getKind() == IScannerContext.INCLUSION )
{
inclusions.remove( currentContext.getFilename() );
if( requestor != null )
requestor.exitInclusion( currentContext.getExtension() );
currentContext.getExtension().exitScope( requestor );
} else if( currentContext.getKind() == IScannerContext.MACROEXPANSION )
{
defines.remove( currentContext.getFilename() );

View file

@ -7,24 +7,30 @@ import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTClassReference;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationReference;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTField;
import org.eclipse.cdt.core.parser.ast.IASTFieldReference;
import org.eclipse.cdt.core.parser.ast.IASTFunction;
import org.eclipse.cdt.core.parser.ast.IASTFunctionReference;
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
import org.eclipse.cdt.core.parser.ast.IASTMacro;
import org.eclipse.cdt.core.parser.ast.IASTMethod;
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTTypedefReference;
import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.core.parser.ast.IASTVariable;
import org.eclipse.cdt.core.parser.ast.IASTVariableReference;
public class NullSourceElementRequestor implements ISourceElementRequestor
@ -96,7 +102,7 @@ public class NullSourceElementRequestor implements ISourceElementRequestor
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedef(org.eclipse.cdt.core.parser.ast.IASTTypedef)
*/
public void acceptTypedef(IASTTypedefDeclaration typedef)
public void acceptTypedefDeclaration(IASTTypedefDeclaration typedef)
{
// TODO Auto-generated method stub
@ -195,7 +201,7 @@ public class NullSourceElementRequestor implements ISourceElementRequestor
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterTemplateExplicitInstantiation(org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation)
*/
public void enterTemplateExplicitInstantiation(IASTTemplateInstantiation instantiation)
public void enterTemplateInstantiation(IASTTemplateInstantiation instantiation)
{
// TODO Auto-generated method stub
@ -318,15 +324,6 @@ public class NullSourceElementRequestor implements ISourceElementRequestor
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptElaboratedTypeSpecifier(org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier)
*/
public void acceptElaboratedTypeSpecifier(IASTElaboratedTypeSpecifier elaboratedTypeSpec)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptAbstractTypeSpecDeclaration(org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration)
*/
@ -352,5 +349,68 @@ public class NullSourceElementRequestor implements ISourceElementRequestor
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedefReference(org.eclipse.cdt.core.parser.ast.IASTTypedefReference)
*/
public void acceptTypedefReference(IASTTypedefReference reference)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptNamespaceReference(org.eclipse.cdt.core.parser.ast.IASTNamespaceReference)
*/
public void acceptNamespaceReference(IASTNamespaceReference reference)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumerationReference(org.eclipse.cdt.core.parser.ast.IASTEnumerationReference)
*/
public void acceptEnumerationReference(IASTEnumerationReference reference)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptVariableReference(org.eclipse.cdt.core.parser.ast.IASTVariableReference)
*/
public void acceptVariableReference(IASTVariableReference reference)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptFunctionReference(org.eclipse.cdt.core.parser.ast.IASTFunctionReference)
*/
public void acceptFunctionReference(IASTFunctionReference reference)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptFieldReference(org.eclipse.cdt.core.parser.ast.IASTFieldReference)
*/
public void acceptFieldReference(IASTFieldReference reference)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptMethodReference(org.eclipse.cdt.core.parser.ast.IASTMethodReference)
*/
public void acceptMethodReference(IASTMethodReference reference)
{
// TODO Auto-generated method stub
}
}

View file

@ -28,6 +28,7 @@ import org.eclipse.cdt.core.parser.ScannerException;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.core.parser.ast.ASTClassKind;
import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
import org.eclipse.cdt.core.parser.ast.ASTSemanticException;
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
@ -36,15 +37,10 @@ import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTExpression;
import org.eclipse.cdt.core.parser.ast.IASTFactory;
import org.eclipse.cdt.core.parser.ast.IASTField;
import org.eclipse.cdt.core.parser.ast.IASTFunction;
import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
import org.eclipse.cdt.core.parser.ast.IASTMethod;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
import org.eclipse.cdt.core.parser.ast.IASTOffsetableElement;
import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTTemplate;
@ -52,10 +48,8 @@ import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
import org.eclipse.cdt.core.parser.ast.IASTTemplateParameter;
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.core.parser.ast.IASTVariable;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType;
import org.eclipse.cdt.core.parser.ast.IASTExpression.Kind;
import org.eclipse.cdt.internal.core.model.Util;
@ -115,11 +109,9 @@ public class Parser implements IParser
this.scanner = scanner;
this.problemReporter = problemReporter;
this.unitResult = unitResult;
if (callback instanceof ISourceElementRequestor)
setRequestor((ISourceElementRequestor)callback);
requestor = callback;
this.mode = mode;
astFactory = ParserFactory.createASTFactory(mode);
scanner.setMode(mode);
scanner.setASTFactory(astFactory);
}
// counter that keeps track of the number of times Parser.parse() is called
@ -157,8 +149,8 @@ public class Parser implements IParser
{
IASTCompilationUnit compilationUnit =
astFactory.createCompilationUnit();
requestor.enterCompilationUnit(compilationUnit);
compilationUnit.enterScope( requestor );
IToken lastBacktrack = null;
IToken checkToken;
while (true)
@ -203,7 +195,7 @@ public class Parser implements IParser
// we've done the best we can
}
}
requestor.exitCompilationUnit(compilationUnit);
compilationUnit.exitScope( requestor );
}
/**
* This function is called whenever we encounter and error that we cannot backtrack out of and we
@ -262,9 +254,18 @@ public class Parser implements IParser
if (LT(1) == IToken.tSEMI)
{
IToken last = consume(IToken.tSEMI);
IASTUsingDirective astUD =
astFactory.createUsingDirective(scope, duple, firstToken.getOffset(), last.getEndOffset());
requestor.acceptUsingDirective(astUD);
IASTUsingDirective astUD = null;
try
{
astUD = astFactory.createUsingDirective(scope, duple, firstToken.getOffset(), last.getEndOffset());
}
catch (ASTSemanticException e)
{
//TODO add in IProblem stuff here
failParse();
}
astUD.acceptElement(requestor);
return;
}
else
@ -295,7 +296,7 @@ public class Parser implements IParser
IToken last = consume(IToken.tSEMI);
IASTUsingDeclaration declaration =
astFactory.createUsingDeclaration(scope, typeName, name, firstToken.getOffset(), last.getEndOffset());
requestor.acceptUsingDeclaration(declaration);
declaration.acceptElement( requestor );
}
else
{
@ -326,7 +327,8 @@ public class Parser implements IParser
consume(IToken.tLBRACE);
IASTLinkageSpecification linkage =
astFactory.createLinkageSpecification(scope, spec.getImage(), firstToken.getOffset());
requestor.enterLinkageSpecification(linkage);
linkage.enterScope( requestor );
linkageDeclarationLoop : while (LT(1) != IToken.tRBRACE)
{
IToken checkToken = LA(1);
@ -353,15 +355,15 @@ public class Parser implements IParser
// consume the }
IToken lastToken = consume();
linkage.setEndingOffset(lastToken.getEndOffset());
requestor.exitLinkageSpecification(linkage);
linkage.exitScope( requestor );
}
else // single declaration
{
IASTLinkageSpecification linkage =
astFactory.createLinkageSpecification(scope, spec.getImage(), firstToken.getOffset());
requestor.enterLinkageSpecification(linkage);
linkage.enterScope( requestor );
declaration(linkage, null);
requestor.exitLinkageSpecification(linkage);
linkage.exitScope( requestor );
}
}
/**
@ -396,10 +398,10 @@ public class Parser implements IParser
astFactory.createTemplateInstantiation(
scope,
firstToken.getOffset());
requestor.enterTemplateExplicitInstantiation(templateInstantiation);
templateInstantiation.enterScope( requestor );
declaration(scope, templateInstantiation);
templateInstantiation.setEndingOffset(lastToken.getEndOffset());
requestor.exitTemplateExplicitInstantiation(templateInstantiation);
templateInstantiation.exitScope( requestor );
return;
}
@ -415,11 +417,11 @@ public class Parser implements IParser
astFactory.createTemplateSpecialization(
scope,
firstToken.getOffset());
requestor.enterTemplateSpecialization(templateSpecialization);
templateSpecialization.enterScope(requestor);
declaration(scope, templateSpecialization);
templateSpecialization.setEndingOffset(
lastToken.getEndOffset());
requestor.exitTemplateSpecialization(templateSpecialization);
templateSpecialization.exitScope(requestor);
return;
}
}
@ -429,10 +431,9 @@ public class Parser implements IParser
List parms = templateParameterList();
consume(IToken.tGT);
IASTTemplateDeclaration templateDecl = astFactory.createTemplateDeclaration( scope, parms, exported, firstToken.getOffset() );
requestor.enterTemplateDeclaration( templateDecl );
templateDecl.enterScope( requestor );
declaration(scope, templateDecl );
templateDecl.setEndingOffset( lastToken.getEndOffset() );
requestor.exitTemplateDeclaration( templateDecl );
templateDecl.exitScope( requestor );
}
catch (Backtrack bt)
@ -617,8 +618,7 @@ public class Parser implements IParser
last.getEndOffset());
// if we made it this far, then we have all we need
// do the callback
requestor.acceptASMDefinition(asmDefinition);
asmDefinition.acceptElement(requestor);
return;
case IToken.t_namespace :
namespaceDefinition(scope);
@ -690,7 +690,7 @@ public class Parser implements IParser
(identifier == null ? "" : identifier.getImage()),
first.getOffset(),
(identifier == null ? 0 : identifier.getOffset()));
requestor.enterNamespaceDefinition(namespaceDefinition);
namespaceDefinition.enterScope( requestor );
namepsaceDeclarationLoop : while (LT(1) != IToken.tRBRACE)
{
IToken checkToken = LA(1);
@ -719,7 +719,7 @@ public class Parser implements IParser
namespaceDefinition.setEndingOffset(
last.getOffset() + last.getLength());
requestor.exitNamespaceDefinition(namespaceDefinition);
namespaceDefinition.exitScope( requestor );
}
else
{
@ -830,56 +830,30 @@ public class Parser implements IParser
IASTDeclaration declaration = (IASTDeclaration)i.next();
((IASTOffsetableElement)declaration).setEndingOffset(
lastToken.getEndOffset());
if (declaration instanceof IASTField)
requestor.acceptField((IASTField)declaration);
else if (declaration instanceof IASTVariable)
requestor.acceptVariable((IASTVariable)declaration);
else if (declaration instanceof IASTMethod)
requestor.acceptMethodDeclaration(
(IASTMethod)declaration);
else if (declaration instanceof IASTFunction)
requestor.acceptFunctionDeclaration(
(IASTFunction)declaration);
else if (declaration instanceof IASTTypedefDeclaration)
requestor.acceptTypedef((IASTTypedefDeclaration)declaration);
else if (declaration instanceof IASTPointerToFunction )
requestor.acceptPointerToFunction( (IASTPointerToFunction)declaration );
else if (declaration instanceof IASTPointerToMethod )
requestor.acceptPointerToMethod( (IASTPointerToMethod)declaration );
else
{
failParse();
throw backtrack; //TODO Should be an IProblem
}
declaration.acceptElement( requestor );
}
}
else
{
IASTDeclaration declaration = (IASTDeclaration)i.next();
if (declaration instanceof IASTMethod)
requestor.enterMethodBody((IASTMethod)declaration);
else if (declaration instanceof IASTFunction)
requestor.enterFunctionBody((IASTFunction)declaration);
else
{
if (hasFunctionBody && l.size() != 1)
{
failParse();
throw backtrack; //TODO Should be an IProblem
}
}
declaration.enterScope( requestor );
handleFunctionBody(declarator);
if (declaration instanceof IASTMethod)
requestor.exitMethodBody((IASTMethod)declaration);
else if (declaration instanceof IASTFunction)
requestor.exitFunctionBody((IASTFunction)declaration);
declaration.exitScope( requestor );
}
}
else
requestor.acceptAbstractTypeSpecDeclaration( astFactory.createTypeSpecDeclaration(
sdw.getScope(), sdw.getTypeSpecifier(), ownerTemplate, sdw.getStartingOffset(), lastToken.getEndOffset()) );
{
astFactory
.createTypeSpecDeclaration(
sdw.getScope(),
sdw.getTypeSpecifier(),
ownerTemplate,
sdw.getStartingOffset(),
lastToken.getEndOffset())
.acceptElement(requestor);
}
}
protected void handleFunctionBody(Declarator d) throws Backtrack, EndOfFile
@ -1458,8 +1432,6 @@ public class Parser implements IParser
t.getOffset(),
d.getLastToken().getEndOffset());
sdw.setTypeSpecifier(elaboratedTypeSpec);
requestor.acceptElaboratedTypeSpecifier(elaboratedTypeSpec);
}
/**
* Consumes template parameters.
@ -2185,7 +2157,7 @@ public class Parser implements IParser
}
IToken t = consume(IToken.tRBRACE);
enumeration.setEndingOffset(t.getEndOffset());
requestor.acceptEnumerationSpecifier(enumeration);
enumeration.acceptElement( requestor );
sdw.setTypeSpecifier(enumeration);
}
else
@ -2263,7 +2235,7 @@ public class Parser implements IParser
if (LT(1) == IToken.tLBRACE)
{
consume(IToken.tLBRACE);
requestor.enterClassSpecifier(astClassSpecifier);
astClassSpecifier.enterScope( requestor );
memberDeclarationLoop : while (LT(1) != IToken.tRBRACE)
{
IToken checkToken = LA(1);
@ -2306,7 +2278,7 @@ public class Parser implements IParser
// consume the }
IToken lastToken = consume(IToken.tRBRACE);
astClassSpecifier.setEndingOffset(lastToken.getEndOffset());
requestor.exitClassSpecifier(astClassSpecifier);
astClassSpecifier.exitScope( requestor );
}
}
/**
@ -4068,13 +4040,5 @@ public class Parser implements IParser
{
return firstErrorOffset;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.IParser#setRequestor(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void setRequestor(ISourceElementRequestor r)
{
requestor = r;
if (scanner != null)
scanner.setRequestor(r);
}
}

View file

@ -16,7 +16,9 @@ import org.eclipse.cdt.core.parser.EndOfFile;
import org.eclipse.cdt.core.parser.IPreprocessor;
import org.eclipse.cdt.core.parser.IProblemReporter;
import org.eclipse.cdt.core.parser.IScannerInfo;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ITranslationResult;
import org.eclipse.cdt.core.parser.ParserMode;
import org.eclipse.cdt.core.parser.ScannerException;
@ -31,8 +33,8 @@ public class Preprocessor extends Scanner implements IPreprocessor {
* @param filename
* @param defns
*/
public Preprocessor(Reader reader, String filename, IScannerInfo info, IProblemReporter problemReporter, ITranslationResult unitResult) {
super(reader, filename, info, problemReporter, unitResult);
public Preprocessor(Reader reader, String filename, IScannerInfo info, ISourceElementRequestor requestor, IProblemReporter problemReporter, ITranslationResult unitResult, ParserMode mode) {
super(reader, filename, info, problemReporter, unitResult, requestor, mode );
}
public void process()

View file

@ -42,7 +42,6 @@ import org.eclipse.cdt.core.parser.ast.ExpressionEvaluationException;
import org.eclipse.cdt.core.parser.ast.IASTExpression;
import org.eclipse.cdt.core.parser.ast.IASTFactory;
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
import org.eclipse.cdt.core.parser.ast.IASTMacro;
/**
@ -52,7 +51,11 @@ import org.eclipse.cdt.core.parser.ast.IASTMacro;
public class Scanner implements IScanner {
public Scanner(Reader reader, String filename, IScannerInfo info, IProblemReporter problemReporter, ITranslationResult unitResult) {
public Scanner(Reader reader, String filename, IScannerInfo info, IProblemReporter problemReporter, ITranslationResult unitResult, ISourceElementRequestor requestor, ParserMode parserMode ) {
this.requestor = requestor;
this.mode = parserMode;
astFactory = ParserFactory.createASTFactory( mode );
try {
//this is a hack to get around a sudden EOF experience
contextStack.push(
@ -381,11 +384,8 @@ public class Scanner implements IScanner {
tokenizingMacroReplacementList = mr;
}
private ParserMode mode = ParserMode.COMPLETE_PARSE;
private final ParserMode mode;
public void setMode(ParserMode mode) {
this.mode = mode;
}
private int getChar() throws ScannerException
{
@ -1656,13 +1656,14 @@ public class Scanner implements IScanner {
}
else
{
final NullSourceElementRequestor nullCallback = new NullSourceElementRequestor();
IScanner trial =
ParserFactory.createScanner(
new StringReader(expression + ";"),
EXPRESSION,
new ScannerInfo( definitions, originalConfig.getIncludePaths()),
ParserMode.QUICK_PARSE );
IParser parser = ParserFactory.createParser(trial, new NullSourceElementRequestor(), ParserMode.QUICK_PARSE );
ParserMode.QUICK_PARSE, nullCallback );
IParser parser = ParserFactory.createParser(trial, nullCallback, ParserMode.QUICK_PARSE );
try {
IASTExpression exp = parser.expression();
@ -1812,9 +1813,9 @@ public class Scanner implements IScanner {
if( requestor != null )
{
IASTInclusion i = astFactory.createInclusion( f, "", !useIncludePath, beginningOffset,
contextStack.getCurrentContext().getOffset(), offset );
requestor.enterInclusion(i);
requestor.exitInclusion(i);
contextStack.getCurrentContext().getOffset(), offset );
i.enterScope( requestor );
i.exitScope( requestor );
}
}
else
@ -1894,7 +1895,7 @@ public class Scanner implements IScanner {
if( ! replacementString.equals( "" ) )
{
IScanner helperScanner = ParserFactory.createScanner( new StringReader(replacementString), null, new ScannerInfo( ), mode, problemReporter, translationResult );
IScanner helperScanner = ParserFactory.createScanner( new StringReader(replacementString), null, new ScannerInfo( ), mode, new NullSourceElementRequestor(), problemReporter, translationResult );
helperScanner.setTokenizingMacroReplacementList( true );
IToken t = helperScanner.nextToken(false);
@ -1976,16 +1977,12 @@ public class Scanner implements IScanner {
throw new ScannerException(BAD_PP + contextStack.getCurrentContext().getOffset());
}
if( requestor != null )
{
IASTMacro m = astFactory.createMacro( key, beginning, contextStack.getCurrentContext().getOffset(), offset );
requestor.acceptMacro(m);
}
astFactory.createMacro( key, beginning, contextStack.getCurrentContext().getOffset(), offset ).acceptElement( requestor );
}
protected Vector getMacroParameters (String params, boolean forStringizing) throws ScannerException {
IScanner tokenizer = ParserFactory.createScanner(new StringReader(params), TEXT, new ScannerInfo( definitions, originalConfig.getIncludePaths() ), mode, problemReporter, translationResult );
IScanner tokenizer = ParserFactory.createScanner(new StringReader(params), TEXT, new ScannerInfo( definitions, originalConfig.getIncludePaths() ), mode, new NullSourceElementRequestor(), problemReporter, translationResult );
Vector parameterValues = new Vector();
Token t = null;
String str = new String();
@ -2204,16 +2201,8 @@ public class Scanner implements IScanner {
public void setCppNature(boolean value) {
cppNature = value;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.IScanner#setRequestor(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void setRequestor(ISourceElementRequestor r) {
requestor = r;
}
private ISourceElementRequestor requestor = null;
private final ISourceElementRequestor requestor;
private IASTFactory astFactory = null;
/* (non-Javadoc)

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
/**
@ -94,4 +95,29 @@ public class ASTInclusion implements IASTInclusion {
nameOffset = o;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
requestor.enterInclusion(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
requestor.exitInclusion(this);
}
}

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTMacro;
/**
@ -68,5 +69,24 @@ public class ASTMacro implements IASTMacro {
public int getElementNameOffset() {
return nameOffset;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
requestor.acceptMacro( this );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
}
}

View file

@ -0,0 +1,524 @@
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.complete;
import java.util.List;
import org.eclipse.cdt.core.parser.ITokenDuple;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.core.parser.ast.ASTClassKind;
import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
import org.eclipse.cdt.core.parser.ast.ASTSemanticException;
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
import org.eclipse.cdt.core.parser.ast.IASTExpression;
import org.eclipse.cdt.core.parser.ast.IASTFactory;
import org.eclipse.cdt.core.parser.ast.IASTField;
import org.eclipse.cdt.core.parser.ast.IASTFunction;
import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
import org.eclipse.cdt.core.parser.ast.IASTMethod;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTTemplate;
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
import org.eclipse.cdt.core.parser.ast.IASTTemplateParameter;
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.core.parser.ast.IASTVariable;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType;
import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor;
import org.eclipse.cdt.core.parser.ast.IASTExpression.Kind;
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type;
import org.eclipse.cdt.core.parser.ast.IASTTemplateParameter.ParamKind;
import org.eclipse.cdt.internal.core.parser.ast.BaseASTFactory;
import org.eclipse.cdt.internal.core.parser.ast.IASTArrayModifier;
import org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension;
/**
* @author jcamelon
*
*/
public class CompleteParseASTFactory extends BaseASTFactory implements IASTFactory
{
/**
*
*/
public CompleteParseASTFactory()
{
super();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createUsingDirective(org.eclipse.cdt.core.parser.ast.IASTScope, org.eclipse.cdt.core.parser.ITokenDuple, int, int)
*/
public IASTUsingDirective createUsingDirective(
IASTScope scope,
ITokenDuple duple,
int startingOffset,
int endingOffset)
throws ASTSemanticException
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createUsingDeclaration(org.eclipse.cdt.core.parser.ast.IASTScope, boolean, org.eclipse.cdt.core.parser.ITokenDuple, int, int)
*/
public IASTUsingDeclaration createUsingDeclaration(
IASTScope scope,
boolean isTypeName,
ITokenDuple name,
int startingOffset,
int endingOffset)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createASMDefinition(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, int, int)
*/
public IASTASMDefinition createASMDefinition(
IASTScope scope,
String assembly,
int first,
int last)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNamespaceDefinition(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, int, int)
*/
public IASTNamespaceDefinition createNamespaceDefinition(
IASTScope scope,
String identifier,
int startingOffset,
int nameOffset)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createCompilationUnit()
*/
public IASTCompilationUnit createCompilationUnit()
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createLinkageSpecification(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, int)
*/
public IASTLinkageSpecification createLinkageSpecification(
IASTScope scope,
String spec,
int startingOffset)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, org.eclipse.cdt.core.parser.ast.ASTClassKind, org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility, org.eclipse.cdt.core.parser.ast.IASTTemplate, int, int)
*/
public IASTClassSpecifier createClassSpecifier(
IASTScope scope,
String name,
ASTClassKind kind,
ClassNameType type,
ASTAccessVisibility access,
IASTTemplate ownerTemplateDeclaration,
int startingOffset,
int nameOffset)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#addBaseSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility, java.lang.String)
*/
public void addBaseSpecifier(
IASTClassSpecifier astClassSpec,
boolean isVirtual,
ASTAccessVisibility visibility,
String string)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createElaboratedTypeSpecifier(org.eclipse.cdt.core.parser.ast.ASTClassKind, java.lang.String, int, int)
*/
public IASTElaboratedTypeSpecifier createElaboratedTypeSpecifier(
ASTClassKind elaboratedClassKind,
String typeName,
int startingOffset,
int endOffset)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createEnumerationSpecifier(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, int, int)
*/
public IASTEnumerationSpecifier createEnumerationSpecifier(
IASTScope scope,
String name,
int startingOffset,
int nameOffset)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#addEnumerator(org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier, java.lang.String, int, int, org.eclipse.cdt.core.parser.ast.IASTExpression)
*/
public void addEnumerator(
IASTEnumerationSpecifier enumeration,
String string,
int startingOffset,
int endingOffset,
IASTExpression initialValue)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createExpression(org.eclipse.cdt.core.parser.ast.IASTExpression.Kind, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTExpression, java.lang.String, java.lang.String, java.lang.String, org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor)
*/
public IASTExpression createExpression(
Kind kind,
IASTExpression lhs,
IASTExpression rhs,
IASTExpression thirdExpression,
String id,
String typeId,
String literal,
IASTNewExpressionDescriptor newDescriptor)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNewDescriptor()
*/
public IASTNewExpressionDescriptor createNewDescriptor()
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createInitializerClause(org.eclipse.cdt.core.parser.ast.IASTInitializerClause.Kind, org.eclipse.cdt.core.parser.ast.IASTExpression, java.util.List)
*/
public IASTInitializerClause createInitializerClause(
org.eclipse.cdt.core.parser.ast.IASTInitializerClause.Kind kind,
IASTExpression assignmentExpression,
List initializerClauses)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createExceptionSpecification(java.util.List)
*/
public IASTExceptionSpecification createExceptionSpecification(List typeIds)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createArrayModifier(org.eclipse.cdt.core.parser.ast.IASTExpression)
*/
public IASTArrayModifier createArrayModifier(IASTExpression exp)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createConstructorMemberInitializer(org.eclipse.cdt.core.parser.ITokenDuple, org.eclipse.cdt.core.parser.ast.IASTExpression)
*/
public IASTConstructorMemberInitializer createConstructorMemberInitializer(
ITokenDuple duple,
IASTExpression expressionList)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createSimpleTypeSpecifier(org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type, org.eclipse.cdt.core.parser.ITokenDuple, boolean, boolean, boolean, boolean, boolean)
*/
public IASTSimpleTypeSpecifier createSimpleTypeSpecifier(
Type kind,
ITokenDuple typeName,
boolean isShort,
boolean isLong,
boolean isSigned,
boolean isUnsigned,
boolean isTypename)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createFunction(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, java.util.List, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.IASTTemplate)
*/
public IASTFunction createFunction(
IASTScope scope,
String name,
List parameters,
IASTAbstractDeclaration returnType,
IASTExceptionSpecification exception,
boolean isInline,
boolean isFriend,
boolean isStatic,
int startOffset,
int nameOffset,
IASTTemplate ownerTemplate)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createAbstractDeclaration(boolean, org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier, java.util.List, java.util.List)
*/
public IASTAbstractDeclaration createAbstractDeclaration(
boolean isConst,
IASTTypeSpecifier typeSpecifier,
List pointerOperators,
List arrayModifiers)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createMethod(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, java.util.List, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.IASTTemplate, boolean, boolean, boolean, boolean, boolean, boolean, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility)
*/
public IASTMethod createMethod(
IASTScope scope,
String name,
List parameters,
IASTAbstractDeclaration returnType,
IASTExceptionSpecification exception,
boolean isInline,
boolean isFriend,
boolean isStatic,
int startOffset,
int nameOffset,
IASTTemplate ownerTemplate,
boolean isConst,
boolean isVolatile,
boolean isConstructor,
boolean isDestructor,
boolean isVirtual,
boolean isExplicit,
boolean isPureVirtual,
ASTAccessVisibility visibility)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createVariable(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, boolean, org.eclipse.cdt.core.parser.ast.IASTInitializerClause, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, boolean, boolean, boolean, boolean, int, int)
*/
public IASTVariable createVariable(
IASTScope scope,
String name,
boolean isAuto,
IASTInitializerClause initializerClause,
IASTExpression bitfieldExpression,
IASTAbstractDeclaration abstractDeclaration,
boolean isMutable,
boolean isExtern,
boolean isRegister,
boolean isStatic,
int startingOffset,
int nameOffset)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createField(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, boolean, org.eclipse.cdt.core.parser.ast.IASTInitializerClause, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, boolean, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility)
*/
public IASTField createField(
IASTScope scope,
String name,
boolean isAuto,
IASTInitializerClause initializerClause,
IASTExpression bitfieldExpression,
IASTAbstractDeclaration abstractDeclaration,
boolean isMutable,
boolean isExtern,
boolean isRegister,
boolean isStatic,
int startingOffset,
int nameOffset,
ASTAccessVisibility visibility)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createParameterDeclaration(boolean, org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier, java.util.List, java.util.List, java.lang.String, org.eclipse.cdt.core.parser.ast.IASTInitializerClause)
*/
public IASTParameterDeclaration createParameterDeclaration(
boolean isConst,
IASTTypeSpecifier getTypeSpecifier,
List pointerOperators,
List arrayModifiers,
String parameterName,
IASTInitializerClause initializerClause)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTemplateDeclaration(org.eclipse.cdt.core.parser.ast.IASTScope, java.util.List, boolean, int)
*/
public IASTTemplateDeclaration createTemplateDeclaration(
IASTScope scope,
List templateParameters,
boolean exported,
int startingOffset)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTemplateParameter(org.eclipse.cdt.core.parser.ast.IASTTemplateParameter.ParamKind, java.lang.String, java.lang.String, org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration, java.util.List)
*/
public IASTTemplateParameter createTemplateParameter(
ParamKind kind,
String identifier,
String defaultValue,
IASTParameterDeclaration parameter,
List parms)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTemplateInstantiation(org.eclipse.cdt.core.parser.ast.IASTScope, int)
*/
public IASTTemplateInstantiation createTemplateInstantiation(
IASTScope scope,
int startingOffset)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTemplateSpecialization(org.eclipse.cdt.core.parser.ast.IASTScope, int)
*/
public IASTTemplateSpecialization createTemplateSpecialization(
IASTScope scope,
int startingOffset)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTypedef(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, int, int)
*/
public IASTTypedefDeclaration createTypedef(
IASTScope scope,
String name,
IASTAbstractDeclaration mapping,
int startingOffset,
int nameOffset)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTypeSpecDeclaration(org.eclipse.cdt.core.parser.ast.IASTScope, org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier, org.eclipse.cdt.core.parser.ast.IASTTemplate, int, int)
*/
public IASTAbstractTypeSpecifierDeclaration createTypeSpecDeclaration(
IASTScope scope,
IASTTypeSpecifier typeSpecifier,
IASTTemplate template,
int startingOffset,
int endingOffset)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createPointerToFunction(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, java.util.List, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.IASTTemplate, org.eclipse.cdt.core.parser.ast.ASTPointerOperator)
*/
public IASTPointerToFunction createPointerToFunction(
IASTScope scope,
String name,
List parameters,
IASTAbstractDeclaration returnType,
IASTExceptionSpecification exception,
boolean isInline,
boolean isFriend,
boolean isStatic,
int startOffset,
int nameOffset,
IASTTemplate ownerTemplate,
ASTPointerOperator pointerOperator)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createPointerToMethod(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, java.util.List, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.IASTTemplate, boolean, boolean, boolean, boolean, boolean, boolean, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility, org.eclipse.cdt.core.parser.ast.ASTPointerOperator)
*/
public IASTPointerToMethod createPointerToMethod(
IASTScope scope,
String name,
List parameters,
IASTAbstractDeclaration returnType,
IASTExceptionSpecification exception,
boolean isInline,
boolean isFriend,
boolean isStatic,
int startOffset,
int nameOffset,
IASTTemplate ownerTemplate,
boolean isConst,
boolean isVolatile,
boolean isConstructor,
boolean isDestructor,
boolean isVirtual,
boolean isExplicit,
boolean isPureVirtual,
ASTAccessVisibility visibility,
ASTPointerOperator pointerOperator)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createSymbolTableDeclarationExtension(org.eclipse.cdt.core.parser.ast.IASTDeclaration, org.eclipse.cdt.core.parser.ast.IASTDeclaration)
*/
public ISymbolASTExtension createSymbolTableDeclarationExtension(IASTDeclaration declaration, IASTDeclaration definition) throws ASTNotImplementedException
{
return new SymbolExtension( declaration, definition );
}
}

View file

@ -0,0 +1,82 @@
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.complete;
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
import org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension;
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
/**
* @author jcamelon
*
*/
public class SymbolExtension implements ISymbolASTExtension
{
private ISymbol symbol;
private final IASTDeclaration declaration;
private IASTDeclaration definition;
/**
*
*/
public SymbolExtension( IASTDeclaration declaration, IASTDeclaration definition )
{
this.declaration = declaration;
this.definition = definition;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.pst.IDeclarationExtension#getDeclaration()
*/
public IASTDeclaration getDeclaration()
{
return declaration;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.pst.IDeclarationExtension#getDefinition()
*/
public IASTDeclaration getDefinition()
{
return definition;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.pst.IDeclarationExtension#setDefinition(org.eclipse.cdt.core.parser.ast.IASTDeclaration)
*/
public void setDefinition(IASTDeclaration definition)
{
this.definition = definition;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.pst.IDeclarationExtension#hasBeenDefined()
*/
public boolean hasBeenDefined()
{
return ( definition != null );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.pst.IDeclarationExtension#getSymbol()
*/
public ISymbol getSymbol()
{
return symbol;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.pst.IDeclarationExtension#setSymbol(org.eclipse.cdt.internal.core.parser.pst.ISymbol)
*/
public void setSymbol(ISymbol s)
{
symbol = s;
}
}

View file

@ -1,78 +0,0 @@
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.full;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
/**
* @author jcamelon
*
*/
public class ASTASMDefinition implements IASTFASMDefinition {
private final String body;
public ASTASMDefinition( ISymbol s, String body )
{
this.symbol = s;
this.body = body;
}
private int startingOffset, endingOffset;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTASMDefinition#getBody()
*/
public String getBody() {
return body;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#setStartingOffset(int)
*/
public void setStartingOffset(int o) {
startingOffset = o;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#setEndingOffset(int)
*/
public void setEndingOffset(int o) {
endingOffset = o;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementStartingOffset()
*/
public int getElementStartingOffset() {
return startingOffset;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IOffsetableElement#getElementEndingOffset()
*/
public int getElementEndingOffset() {
return endingOffset;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.ast.ISymbolTableExtension#getSymbol()
*/
private final ISymbol symbol;
public ISymbol getSymbol() {
return symbol;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTDeclaration#getOwnerScope()
*/
public IASTScope getOwnerScope() {
return (IPSTContainerExtension)symbol.getContainingSymbol().getASTNode();
}
}

View file

@ -1,64 +0,0 @@
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.full;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
/**
* @author jcamelon
*
*/
public class ASTBaseSpecifier implements IASTBaseSpecifier {
private final IASTClassSpecifier baseClass;
private final boolean isVirtual;
private final ASTAccessVisibility visibility;
public ASTBaseSpecifier( IASTClassSpecifier classSpec, ASTAccessVisibility a, boolean virtual )
{
isVirtual = virtual;
baseClass = classSpec;
visibility = a;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier#getAccess()
*/
public ASTAccessVisibility getAccess() {
return visibility;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier#isVirtual()
*/
public boolean isVirtual() {
return isVirtual;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier#getParent()
*/
public String getParentClassName() {
return baseClass.getName();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier#getParentClassSpecifier()
*/
public IASTClassSpecifier getParentClassSpecifier() throws ASTNotImplementedException
{
return baseClass;
}
}

View file

@ -1,174 +0,0 @@
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.full;
import java.util.Iterator;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.core.parser.ast.ASTClassKind;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTTemplate;
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
import org.eclipse.cdt.internal.core.parser.pst.IDerivableContainerSymbol;
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable;
/**
* @author jcamelon
*
*/
public class ASTClassSpecifier implements IASTFClassSpecifier, IPSTSymbolExtension {
private final IDerivableContainerSymbol symbol;
private final ASTClassKind classKind;
private final ClassNameType type;
private final String name;
public ASTClassSpecifier( IDerivableContainerSymbol symbol, String name, ClassNameType type, ASTClassKind kind )
{
this.name = name;
this.symbol = symbol;
this.classKind = kind;
this.type = type;
symbol.setASTNode( this );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTScope#getDeclarations()
*/
public Iterator getDeclarations() {
return new ScopeIterator( symbol.getContainedSymbols());
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getClassNameType()
*/
public ClassNameType getClassNameType() {
return type;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getClassKind()
*/
public ASTClassKind getClassKind() {
return classKind;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getBaseClauses()
*/
public Iterator getBaseClauses() {
return new BaseIterator( symbol.getParents() );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getName()
*/
public String getName() {
return name;
}
private int nameOffset = 0, startingOffset = 0, endingOffset = 0;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
*/
public int getElementNameOffset() {
return nameOffset;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
*/
public void setElementNameOffset(int o) {
nameOffset = o;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTTemplatedDeclaration#getOwnerTemplateDeclaration()
*/
public IASTTemplate getOwnerTemplateDeclaration() {
if( getSymbol().getContainingSymbol().getType() == ParserSymbolTable.TypeInfo.t_template )
return (IASTTemplateDeclaration)getSymbol().getContainingSymbol().getASTNode();
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
*/
public void setStartingOffset(int o) {
startingOffset = o;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
*/
public void setEndingOffset(int o) {
endingOffset = o;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
*/
public int getElementStartingOffset() {
return startingOffset;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
*/
public int getElementEndingOffset() {
return endingOffset;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.ast.IPSTSymbolExtension#getSymbol()
*/
public ISymbol getSymbol() {
return symbol;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getCurrentVisiblity()
*/
public ASTAccessVisibility getCurrentVisibilityMode() {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#getFullyQualifiedName()
*/
public String[] getFullyQualifiedName()
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTClassSpecifier#setCurrentVisibility(org.eclipse.cdt.core.parser.ast.ASTAccessVisibility)
*/
public void setCurrentVisibility(ASTAccessVisibility visibility)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTScopedElement#getOwnerScope()
*/
public IASTScope getOwnerScope()
{
return null;
}
}

View file

@ -1,50 +0,0 @@
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.full;
import java.util.Iterator;
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
/**
* @author jcamelon
*
*/
public class ASTCompilationUnit implements IASTFCompilationUnit {
public ASTCompilationUnit( IContainerSymbol symbol )
{
this.symbol = symbol;
symbol.setASTNode( this );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IScope#getDeclarations()
*/
public Iterator getDeclarations() {
return new ScopeIterator( symbol.getContainedSymbols() );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.ast.ISymbolTableExtension#getSymbol()
*/
public IContainerSymbol getContainerSymbol() {
return symbol;
}
private final IContainerSymbol symbol;
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.ast.IPSTSymbolExtension#getSymbol()
*/
public ISymbol getSymbol() {
return symbol;
}
}

View file

@ -1,100 +0,0 @@
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.full;
import java.util.Iterator;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.internal.core.parser.ast.Offsets;
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
/**
* @author jcamelon
*
*/
public class ASTLinkageSpecification implements IASTFLinkageSpecification {
public ASTLinkageSpecification( IContainerSymbol symbol, String linkage, int startingOffset )
{
this.symbol = symbol;
symbol.setASTNode( this );
this.linkage = linkage;
setStartingOffset(startingOffset);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTScope#getDeclarations()
*/
public Iterator getDeclarations() {
return new ScopeIterator( symbol.getContainedSymbols() );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.ast.IPSTSymbolExtension#getSymbol()
*/
public IContainerSymbol getContainerSymbol() {
return symbol;
}
private final IContainerSymbol symbol;
private final String linkage;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification#getLinkageString()
*/
public String getLinkageString() {
return linkage;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.ast.IPSTSymbolExtension#getSymbol()
*/
public ISymbol getSymbol() {
return symbol;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTDeclaration#getOwnerScope()
*/
public IASTScope getOwnerScope() {
return (IPSTContainerExtension)symbol.getContainingSymbol().getASTNode();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
*/
public void setStartingOffset(int o)
{
offsets.setStartingOffset(o);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
*/
public void setEndingOffset(int o)
{
offsets.setEndingOffset(o);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
*/
public int getElementStartingOffset()
{
return offsets.getElementStartingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
*/
public int getElementEndingOffset()
{
return offsets.getElementEndingOffset();
}
private Offsets offsets = new Offsets();
}

View file

@ -1,121 +0,0 @@
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.full;
import java.util.Iterator;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
/**
* @author jcamelon
*
*/
public class ASTNamespaceDefinition implements IASTFNamespaceDefinition {
public ASTNamespaceDefinition( IContainerSymbol symbol, String name )
{
this.symbol = symbol;
this.name = name;
}
private final String name;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition#getName()
*/
public String getName() {
return name;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTScope#getDeclarations()
*/
public Iterator getDeclarations() {
return new ScopeIterator( symbol.getContainedSymbols() );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.ast.IPSTSymbolExtension#getSymbol()
*/
public ISymbol getSymbol() {
return symbol;
}
private final IContainerSymbol symbol;
private int nameOffset = 0, startingOffset = 0, endingOffset = 0;
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#getElementNameOffset()
*/
public int getElementNameOffset() {
return nameOffset;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement#setNameOffset(int)
*/
public void setElementNameOffset(int o) {
nameOffset = o;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
*/
public void setStartingOffset(int o) {
startingOffset = o;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
*/
public void setEndingOffset(int o) {
endingOffset = o;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
*/
public int getElementStartingOffset() {
return startingOffset;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
*/
public int getElementEndingOffset() {
return endingOffset;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.ast.IPSTContainerExtension#getContainerSymbol()
*/
public IContainerSymbol getContainerSymbol() {
return symbol;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTDeclaration#getOwnerScope()
*/
public IASTScope getOwnerScope() {
return (IPSTContainerExtension)symbol.getContainingSymbol().getASTNode();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTQualifiedNameElement#getFullyQualifiedName()
*/
public String[] getFullyQualifiedName()
{
// TODO Auto-generated method stub
return null;
}
}

View file

@ -1,74 +0,0 @@
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.full;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.internal.core.parser.ast.Offsets;
/**
* @author jcamelon
*
*/
public class ASTUsingDirective implements IASTUsingDirective {
private final String namespaceName;
private Offsets offsets = new Offsets();
public ASTUsingDirective( String namespace, int startingOffset, int endingOffset )
{
namespaceName = namespace;
offsets.setStartingOffset(startingOffset);
offsets.setEndingOffset( endingOffset );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTUsingDirective#getNamespaceName()
*/
public String getNamespaceName() {
return namespaceName;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTDeclaration#getOwnerScope()
*/
public IASTScope getOwnerScope() {
return null; //TODO
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setStartingOffset(int)
*/
public void setStartingOffset(int o)
{
offsets.setStartingOffset(o);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#setEndingOffset(int)
*/
public void setEndingOffset(int o)
{
offsets.setEndingOffset(o);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementStartingOffset()
*/
public int getElementStartingOffset()
{
return offsets.getElementStartingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTOffsetableElement#getElementEndingOffset()
*/
public int getElementEndingOffset()
{
return offsets.getElementEndingOffset();
}
}

View file

@ -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.internal.core.parser.ast.full;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable;
/**
* @author jcamelon
*
*/
public class BaseIterator implements Iterator {
private final Iterator rawIter;
public BaseIterator( List bases )
{
rawIter = bases.iterator();
}
/* (non-Javadoc)
* @see java.util.Iterator#hasNext()
*/
public boolean hasNext() {
return rawIter.hasNext();
}
/* (non-Javadoc)
* @see java.util.Iterator#next()
*/
public Object next() {
ParserSymbolTable.Declaration.ParentWrapper wrapper = (ParserSymbolTable.Declaration.ParentWrapper)rawIter.next();
return new ASTBaseSpecifier( (IASTFClassSpecifier)wrapper.getParent().getASTNode(), wrapper.getAccess(), wrapper.isVirtual());
}
/* (non-Javadoc)
* @see java.util.Iterator#remove()
*/
public void remove() {
throw new UnsupportedOperationException();
}
}

View file

@ -1,411 +0,0 @@
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.full;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.core.parser.Backtrack;
import org.eclipse.cdt.core.parser.IToken;
import org.eclipse.cdt.core.parser.ITokenDuple;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.core.parser.ast.ASTClassKind;
import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
import org.eclipse.cdt.core.parser.ast.IASTExpression;
import org.eclipse.cdt.core.parser.ast.IASTFactory;
import org.eclipse.cdt.core.parser.ast.IASTField;
import org.eclipse.cdt.core.parser.ast.IASTFunction;
import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
import org.eclipse.cdt.core.parser.ast.IASTMethod;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
import org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTTemplate;
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
import org.eclipse.cdt.core.parser.ast.IASTTemplateParameter;
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
import org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.core.parser.ast.IASTVariable;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier.ClassNameType;
import org.eclipse.cdt.core.parser.ast.IASTExpression.IASTNewExpressionDescriptor;
import org.eclipse.cdt.core.parser.ast.IASTExpression.Kind;
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type;
import org.eclipse.cdt.internal.core.parser.ast.BaseASTFactory;
import org.eclipse.cdt.internal.core.parser.ast.IASTArrayModifier;
import org.eclipse.cdt.internal.core.parser.pst.IContainerSymbol;
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;
/**
* @author jcamelon
*
*/
public class FullParseASTFactory extends BaseASTFactory implements IASTFactory {
private ParserSymbolTable pst = new ParserSymbolTable(); // symbol table
public IASTUsingDirective createUsingDirective(
IASTScope scope,
ITokenDuple duple, int startingOffset, int endingOffset)
throws Backtrack {
Iterator iter = duple.iterator();
IToken t1 = (IToken)iter.next();
IContainerSymbol symbol = null;
if( t1.getType() == IToken.tCOLONCOLON )
symbol = pst.getCompilationUnit();
else
{
try
{
symbol = (IContainerSymbol)((IASTFScope)scope).getContainerSymbol().Lookup( t1.getImage() );
}
catch( ParserSymbolTableException pste )
{
handlePSTException( pste );
}
}
while( iter.hasNext() )
{
IToken t = (IToken)iter.next();
if( t.getType() == IToken.tCOLONCOLON ) continue;
try
{
symbol = symbol.LookupNestedNameSpecifier( t.getImage() );
}
catch( ParserSymbolTableException pste )
{
handlePSTException( pste );
}
}
try {
((IASTFScope)scope).getContainerSymbol().addUsingDirective( symbol );
} catch (ParserSymbolTableException pste) {
handlePSTException( pste );
}
IASTUsingDirective astUD = new ASTUsingDirective( duple.toString(), startingOffset, endingOffset );
return astUD;
}
public IASTASMDefinition createASMDefinition(
IASTScope scope,
String assembly,
int first,
int last) {
IContainerSymbol containerSymbol = (IContainerSymbol)((IASTFScope)scope).getSymbol();
ISymbol asmSymbol = pst.newSymbol( "", ParserSymbolTable.TypeInfo.t_asm );
IASTFASMDefinition asmDefinition = new ASTASMDefinition( asmSymbol, assembly );
asmSymbol.setASTNode( asmDefinition );
try {
containerSymbol.addSymbol(asmSymbol);
} catch (ParserSymbolTableException e1) {
//?
}
asmDefinition.setStartingOffset( first );
asmDefinition.setEndingOffset( last );
return asmDefinition;
}
public IASTNamespaceDefinition createNamespaceDefinition(
IASTScope scope,
String identifier,
int first, int nameOffset ) {
IContainerSymbol namespaceSymbol = null;
pst.newContainerSymbol( identifier, ParserSymbolTable.TypeInfo.t_namespace );
IASTFNamespaceDefinition namespaceDefinition = new ASTNamespaceDefinition( namespaceSymbol, identifier );
namespaceDefinition.setStartingOffset( first );
if( identifier != "" )
namespaceDefinition.setElementNameOffset( nameOffset );
return namespaceDefinition;
}
public IASTCompilationUnit createCompilationUnit() {
IASTFCompilationUnit compilationUnit = new ASTCompilationUnit( pst.getCompilationUnit() );
return compilationUnit;
}
public IASTLinkageSpecification createLinkageSpecification(IASTScope scope, String spec, int startingOffset) {
IContainerSymbol symbol = pst.newContainerSymbol("", ParserSymbolTable.TypeInfo.t_linkage );
IASTFLinkageSpecification linkage = new ASTLinkageSpecification( symbol, spec, startingOffset);
return linkage;
}
/**
* @param pste
*/
private void handlePSTException(ParserSymbolTableException pste) throws Backtrack {
throw new Backtrack();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createUsingDeclaration(org.eclipse.cdt.core.parser.ast.IASTScope, boolean, org.eclipse.cdt.internal.core.parser.TokenDuple)
*/
public IASTUsingDeclaration createUsingDeclaration(IASTScope scope, boolean isTypeName, ITokenDuple name, int startingOffset, int endingOffset) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, org.eclipse.cdt.core.parser.ast.ClassKind, org.eclipse.cdt.core.parser.ast.ClassNameType, org.eclipse.cdt.core.parser.ast.AccessVisibility, org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration)
*/
public IASTClassSpecifier createClassSpecifier(IASTScope scope, String name, ASTClassKind kind, ClassNameType type, ASTAccessVisibility access, IASTTemplate ownerTemplateDeclaration, int startingOffset, int nameOffset) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#addBaseSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier, boolean, org.eclipse.cdt.core.parser.ast.AccessVisibility, java.lang.String)
*/
public void addBaseSpecifier(IASTClassSpecifier astClassSpec, boolean isVirtual, ASTAccessVisibility visibility, String string) {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createElaboratedTypeSpecifier(org.eclipse.cdt.core.parser.ast.ClassKind, java.lang.String, int, int)
*/
public IASTElaboratedTypeSpecifier createElaboratedTypeSpecifier(ASTClassKind elaboratedClassKind, String typeName, int startingOffset, int endOffset )
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createEnumerationSpecifier(java.lang.String, int)
*/
public IASTEnumerationSpecifier createEnumerationSpecifier(IASTScope scope, String name, int startingOffset, int nameOffset)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#addEnumerator(org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier, java.lang.String, int, int)
*/
public void addEnumerator(IASTEnumerationSpecifier enumeration, String string, int startingOffset, int endingOffset, IASTExpression initialValue)
{
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createExpression(org.eclipse.cdt.core.parser.ast.IASTExpression.ExpressionKind, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTExpression, java.lang.String, java.lang.String, java.lang.String)
*/
public IASTExpression createExpression(Kind kind, IASTExpression lhs, IASTExpression rhs, IASTExpression thirdExpression, String id, String typeId, String literal, IASTNewExpressionDescriptor newDescriptor) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createNewDescriptor()
*/
public IASTNewExpressionDescriptor createNewDescriptor() {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createIASTInitializerClause()
*/
public IASTInitializerClause createInitializerClause(IASTInitializerClause.Kind kind, IASTExpression assignmentExpression, List initializerClauses) {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createExceptionSpecification(java.util.List)
*/
public IASTExceptionSpecification createExceptionSpecification(List typeIds)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createArrayModifier(org.eclipse.cdt.core.parser.ast.IASTExpression)
*/
public IASTArrayModifier createArrayModifier(IASTExpression exp)
{
// TODO
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createConstructorMemberInitializer(org.eclipse.cdt.core.parser.ITokenDuple, org.eclipse.cdt.core.parser.ast.IASTExpression)
*/
public IASTConstructorMemberInitializer createConstructorMemberInitializer(ITokenDuple duple, IASTExpression expressionList )
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createSimpleTypeSpecifier(org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.SimpleType, org.eclipse.cdt.core.parser.ITokenDuple, boolean, boolean, boolean, boolean)
*/
public IASTSimpleTypeSpecifier createSimpleTypeSpecifier(Type kind, ITokenDuple typeName, boolean isShort, boolean isLong, boolean isSigned, boolean isUnsigned, boolean isTypename)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createFunction(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, java.util.List, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration)
*/
public IASTFunction createFunction(IASTScope scope, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplate ownerTemplate)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createAbstractDeclaration(boolean, org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier, java.util.List, java.util.List)
*/
public IASTAbstractDeclaration createAbstractDeclaration(boolean isConst, IASTTypeSpecifier typeSpecifier, List pointerOperators, List arrayModifiers)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createMethod(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, java.util.List, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration, boolean, boolean, boolean, boolean, boolean, boolean, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility)
*/
public IASTMethod createMethod(IASTScope scope, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplate ownerTemplate, boolean isConst, boolean isVolatile, boolean isConstructor, boolean isDestructor, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, ASTAccessVisibility visibility)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createVariable(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, boolean, org.eclipse.cdt.core.parser.ast.IASTInitializerClause, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, boolean, boolean, boolean, boolean)
*/
public IASTVariable createVariable(IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createField(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, boolean, org.eclipse.cdt.core.parser.ast.IASTInitializerClause, org.eclipse.cdt.core.parser.ast.IASTExpression, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, boolean, boolean, boolean, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility)
*/
public IASTField createField(IASTScope scope, String name, boolean isAuto, IASTInitializerClause initializerClause, IASTExpression bitfieldExpression, IASTAbstractDeclaration abstractDeclaration, boolean isMutable, boolean isExtern, boolean isRegister, boolean isStatic, int startingOffset, int nameOffset, ASTAccessVisibility visibility)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createParameterDeclaration(boolean, org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier, java.util.List, java.util.List, java.lang.String, org.eclipse.cdt.core.parser.ast.IASTInitializerClause)
*/
public IASTParameterDeclaration createParameterDeclaration(boolean isConst, IASTTypeSpecifier getTypeSpecifier, List pointerOperators, List arrayModifiers, String parameterName, IASTInitializerClause initializerClause)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTemplateDeclaration(java.util.List)
*/
public IASTTemplateDeclaration createTemplateDeclaration(IASTScope scope, List templateParameters, boolean exported, int startingOffset)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTemplateParameter(org.eclipse.cdt.core.parser.ast.IASTTemplateParameter.ParameterKind, org.eclipse.cdt.core.parser.IToken, java.lang.String, org.eclipse.cdt.core.parser.ast.IASTParameterDeclaration)
*/
public IASTTemplateParameter createTemplateParameter(IASTTemplateParameter.ParamKind kind, String identifier, String defaultValue, IASTParameterDeclaration parameter, List parms)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTemplateInstantiation()
*/
public IASTTemplateInstantiation createTemplateInstantiation(IASTScope scope, int startingOffset)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTemplateSpecialization()
*/
public IASTTemplateSpecialization createTemplateSpecialization(IASTScope scope, int startingOffset)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTypedef(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration)
*/
public IASTTypedefDeclaration createTypedef(IASTScope scope, String name, IASTAbstractDeclaration mapping, int startingOffset, int nameOffset)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createTypeSpecDeclaration(org.eclipse.cdt.core.parser.ast.IASTScope, boolean, org.eclipse.cdt.core.parser.ast.IASTTypeSpecifier, java.util.List, java.util.List)
*/
public IASTAbstractTypeSpecifierDeclaration createTypeSpecDeclaration(IASTScope scope, IASTTypeSpecifier typeSpecifier, IASTTemplate template, int startingOffset, int endingOffset)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createPointerToFunction(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, java.util.List, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.IASTTemplate)
*/
public IASTPointerToFunction createPointerToFunction(IASTScope scope, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplate ownerTemplate, ASTPointerOperator pointerOperator)
{
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createPointerToMethod(org.eclipse.cdt.core.parser.ast.IASTScope, java.lang.String, java.util.List, org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration, org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification, boolean, boolean, boolean, int, int, org.eclipse.cdt.core.parser.ast.IASTTemplate, boolean, boolean, boolean, boolean, boolean, boolean, boolean, org.eclipse.cdt.core.parser.ast.ASTAccessVisibility)
*/
public IASTPointerToMethod createPointerToMethod(IASTScope scope, String name, List parameters, IASTAbstractDeclaration returnType, IASTExceptionSpecification exception, boolean isInline, boolean isFriend, boolean isStatic, int startOffset, int nameOffset, IASTTemplate ownerTemplate, boolean isConst, boolean isVolatile, boolean isConstructor, boolean isDestructor, boolean isVirtual, boolean isExplicit, boolean isPureVirtual, ASTAccessVisibility visibility, ASTPointerOperator pointerOperator)
{
// TODO Auto-generated method stub
return null;
}
}

View file

@ -1,20 +0,0 @@
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.full;
/**
* @author jcamelon
*
*/
public interface IASTFNamespaceDefinition
extends IASTFScope, org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition {
}

View file

@ -1,55 +0,0 @@
/**********************************************************************
* Copyright (c) 2002,2003 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.full;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.cdt.internal.core.parser.pst.ISymbol;
/**
* @author jcamelon
*
*/
public class ScopeIterator implements Iterator {
private final Map sourceMap;
private final Iterator keyIter;
public ScopeIterator( Map in )
{
sourceMap = in;
keyIter = in.keySet().iterator();
}
/* (non-Javadoc)
* @see java.util.Iterator#hasNext()
*/
public boolean hasNext() {
return keyIter.hasNext();
}
/* (non-Javadoc)
* @see java.util.Iterator#next()
*/
public Object next() {
ISymbol symbol = (ISymbol)sourceMap.get( keyIter.next() );
return symbol.getASTNode();
}
/* (non-Javadoc)
* @see java.util.Iterator#remove()
*/
public void remove() {
throw new UnsupportedOperationException();
}
}

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.quick;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.internal.core.parser.ast.Offsets;
@ -67,4 +68,26 @@ public class ASTASMDefinition
return offsets.getElementEndingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
requestor.acceptASMDefinition(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
}
}

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.quick;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTTemplate;
@ -85,5 +86,26 @@ public class ASTAbstractTypeSpecifierDeclaration
return offsets.getElementEndingOffset();
}
private Offsets offsets = new Offsets();
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
requestor.acceptAbstractTypeSpecDeclaration(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
}
}

View file

@ -13,6 +13,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.core.parser.ast.ASTClassKind;
import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
@ -160,5 +161,25 @@ public class ASTClassSpecifier extends ASTScopedTypeSpecifier implements IASTQCl
{
this.access = visibility;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
requestor.enterClassSpecifier(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
requestor.exitClassSpecifier(this);
}
}

View file

@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
@ -37,4 +38,26 @@ public class ASTCompilationUnit implements IASTCompilationUnit, IASTQScope {
declarations.add( declaration );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
requestor.enterCompilationUnit(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
requestor.exitCompilationUnit(this);
}
}

View file

@ -17,7 +17,7 @@ import org.eclipse.cdt.core.parser.ast.IASTScope;
* @author jcamelon
*
*/
public class ASTDeclaration implements IASTDeclaration {
public abstract class ASTDeclaration implements IASTDeclaration {
private final IASTScope scope;
public ASTDeclaration( IASTScope scope )

View file

@ -15,6 +15,7 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement;
@ -107,4 +108,23 @@ public class ASTEnumerationSpecifier extends ASTScopedTypeSpecifier
{
enumerators.add(enumerator);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
requestor.acceptEnumerationSpecifier(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
}
}

View file

@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTExceptionSpecification;
import org.eclipse.cdt.core.parser.ast.IASTFunction;
@ -173,4 +174,27 @@ public class ASTFunction extends ASTDeclaration implements IASTFunction
{
return qualifiedName.getFullyQualifiedName();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
requestor.acceptFunctionDeclaration(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
requestor.enterFunctionBody( this );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
requestor.exitFunctionBody( this );
}
}

View file

@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
import org.eclipse.cdt.core.parser.ast.IASTScope;
@ -88,4 +89,27 @@ public class ASTLinkageSpecification
}
private Offsets offsets = new Offsets();
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
requestor.enterLinkageSpecification(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
requestor.exitLinkageSpecification(this);
}
}

View file

@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
import org.eclipse.cdt.core.parser.ast.IASTScope;
@ -105,4 +106,24 @@ public class ASTNamespaceDefinition extends ASTDeclaration implements IASTNamesp
{
return qualifiedNameElement.getFullyQualifiedName();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
requestor.enterNamespaceDefinition(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
requestor.exitNamespaceDefinition(this);
}
}

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.core.parser.ast.quick;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
@ -98,4 +99,27 @@ public class ASTTemplateDeclaration extends ASTDeclaration implements IASTTempla
{
return isExported;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
requestor.enterTemplateDeclaration(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
requestor.exitTemplateDeclaration(this);
}
}

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.quick;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
@ -80,4 +81,28 @@ public class ASTTemplateInstantiation extends ASTDeclaration implements IASTTemp
{
return offsets.getElementEndingOffset();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
requestor.enterTemplateInstantiation(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
requestor.exitTemplateExplicitInstantiation(this);
}
}

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.quick;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
@ -75,4 +76,27 @@ public class ASTTemplateSpecialization extends ASTDeclaration implements IASTTem
{
ownedDeclaration = declaration;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
requestor.enterTemplateSpecialization(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
requestor.exitTemplateSpecialization(this);
}
}

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.quick;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
@ -103,5 +104,24 @@ public class ASTTypedefDeclaration extends ASTDeclaration implements IASTTypedef
{
return qualifiedName.getFullyQualifiedName();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
requestor.acceptTypedefDeclaration(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
}
}

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.quick;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
import org.eclipse.cdt.internal.core.parser.ast.Offsets;
@ -76,4 +77,23 @@ public class ASTUsingDeclaration
return offsets.getElementEndingOffset();
}
private Offsets offsets = new Offsets();
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
requestor.acceptUsingDeclaration(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
}
}

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.quick;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.internal.core.parser.ast.Offsets;
@ -68,4 +69,23 @@ public class ASTUsingDirective
return offsets.getElementEndingOffset();
}
private Offsets offsets = new Offsets();
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
requestor.acceptUsingDirective(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
}
}

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.quick;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTExpression;
import org.eclipse.cdt.core.parser.ast.IASTInitializerClause;
@ -172,6 +173,25 @@ public class ASTVariable extends ASTDeclaration implements IASTVariable
{
return qualifiedName.getFullyQualifiedName();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#accept(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
requestor.acceptVariable(this);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enter(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exit(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
}
}

View file

@ -12,11 +12,12 @@ package org.eclipse.cdt.internal.core.parser.ast.quick;
import java.util.List;
import org.eclipse.cdt.core.parser.Backtrack;
import org.eclipse.cdt.core.parser.ITokenDuple;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.core.parser.ast.ASTClassKind;
import org.eclipse.cdt.core.parser.ast.ASTNotImplementedException;
import org.eclipse.cdt.core.parser.ast.ASTPointerOperator;
import org.eclipse.cdt.core.parser.ast.ASTSemanticException;
import org.eclipse.cdt.core.parser.ast.IASTASMDefinition;
import org.eclipse.cdt.core.parser.ast.IASTAbstractDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration;
@ -24,6 +25,7 @@ import org.eclipse.cdt.core.parser.ast.IASTBaseSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
import org.eclipse.cdt.core.parser.ast.IASTConstructorMemberInitializer;
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
@ -57,6 +59,7 @@ import org.eclipse.cdt.core.parser.ast.IASTExpression.Kind;
import org.eclipse.cdt.core.parser.ast.IASTSimpleTypeSpecifier.Type;
import org.eclipse.cdt.internal.core.parser.ast.BaseASTFactory;
import org.eclipse.cdt.internal.core.parser.ast.IASTArrayModifier;
import org.eclipse.cdt.internal.core.parser.pst.ISymbolASTExtension;
/**
* @author jcamelon
@ -67,7 +70,7 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
/* (non-Javadoc)
* @see org.eclipse.cdt.internal.core.parser.ast.IASTFactory#createUsingDirective(org.eclipse.cdt.internal.core.parser.ast.IASTScope, org.eclipse.cdt.internal.core.parser.TokenDuple)
*/
public IASTUsingDirective createUsingDirective(IASTScope scope, ITokenDuple duple, int startingOffset, int endingOffset) throws Backtrack {
public IASTUsingDirective createUsingDirective(IASTScope scope, ITokenDuple duple, int startingOffset, int endingOffset) throws ASTSemanticException {
return new ASTUsingDirective( scope, duple.toString(), startingOffset, endingOffset );
}
@ -319,5 +322,13 @@ public class QuickParseASTFactory extends BaseASTFactory implements IASTFactory
return new ASTPointerToMethod(scope, name, parameters, returnType, exception, isInline, isFriend, isStatic, startOffset, nameOffset, ownerTemplate, isConst, isVolatile, isConstructor, isDestructor, isVirtual, isExplicit, isPureVirtual, visibility, pointerOperator);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ast.IASTFactory#createSymbolTableDeclarationExtension(org.eclipse.cdt.core.parser.ast.IASTDeclaration, org.eclipse.cdt.core.parser.ast.IASTDeclaration)
*/
public ISymbolASTExtension createSymbolTableDeclarationExtension(IASTDeclaration declaration, IASTDeclaration definition) throws ASTNotImplementedException
{
throw new ASTNotImplementedException();
}
}

View file

@ -12,6 +12,7 @@ package org.eclipse.cdt.internal.core.parser.problem;
//import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.core.parser.IProblem;
import org.eclipse.cdt.core.parser.ISourceElementRequestor;
public class DefaultProblem implements IProblem {
@ -246,4 +247,26 @@ public class DefaultProblem implements IProblem {
}
return s;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#acceptElement(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void acceptElement(ISourceElementRequestor requestor)
{
requestor.acceptProblem( this );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#enterScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void enterScope(ISourceElementRequestor requestor)
{
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.parser.ISourceElementCallbackDelegate#exitScope(org.eclipse.cdt.core.parser.ISourceElementRequestor)
*/
public void exitScope(ISourceElementRequestor requestor)
{
}
}

View file

@ -13,7 +13,6 @@ package org.eclipse.cdt.internal.core.parser.pst;
import java.util.HashMap;
import java.util.LinkedList;
import org.eclipse.cdt.internal.core.parser.ast.full.IPSTSymbolExtension;
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.TemplateInstance;
import org.eclipse.cdt.internal.core.parser.pst.ParserSymbolTable.TypeInfo;
/**
@ -26,8 +25,8 @@ public interface ISymbol {
public Object clone();
public IPSTSymbolExtension getASTNode();
public void setASTNode( IPSTSymbolExtension obj );
public ISymbolASTExtension getASTNode();
public void setASTNode( ISymbolASTExtension obj );
public String getName();

View file

@ -8,15 +8,18 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.full;
package org.eclipse.cdt.internal.core.parser.pst;
import org.eclipse.cdt.core.parser.ast.IASTScope;
import org.eclipse.cdt.core.parser.ast.IASTDeclaration;
/**
* @author jcamelon
*
*/
public interface IASTFClassSpecifier
extends IASTScope, org.eclipse.cdt.core.parser.ast.IASTClassSpecifier {
public interface ISymbolASTExtension extends ISymbolOwner
{
public IASTDeclaration getDeclaration();
public IASTDeclaration getDefinition();
public void setDefinition( IASTDeclaration definition );
public boolean hasBeenDefined();
}

View file

@ -8,13 +8,15 @@
* Contributors:
* IBM Rational Software - Initial API and implementation
***********************************************************************/
package org.eclipse.cdt.internal.core.parser.ast.full;
package org.eclipse.cdt.internal.core.parser.pst;
/**
* @author jcamelon
*
*/
public interface IASTFScope
extends org.eclipse.cdt.core.parser.ast.IASTScope, IPSTContainerExtension {
public interface ISymbolOwner
{
public ISymbol getSymbol();
public void setSymbol( ISymbol s );
}

View file

@ -23,7 +23,6 @@ import java.util.Map;
import java.util.Set;
import org.eclipse.cdt.core.parser.ast.ASTAccessVisibility;
import org.eclipse.cdt.internal.core.parser.ast.full.IPSTSymbolExtension;
/**
* @author aniefer
@ -2035,7 +2034,7 @@ public class ParserSymbolTable {
_typeInfo = new TypeInfo();
}
public BasicSymbol( String name, IPSTSymbolExtension obj ){
public BasicSymbol( String name, ISymbolASTExtension obj ){
super();
_name = name;
_object = obj;
@ -2068,8 +2067,8 @@ public class ParserSymbolTable {
public String getName() { return _name; }
public void setName(String name) { _name = name; }
public IPSTSymbolExtension getASTNode() { return _object; }
public void setASTNode( IPSTSymbolExtension obj ) { _object = obj; }
public ISymbolASTExtension getASTNode() { return _object; }
public void setASTNode( ISymbolASTExtension obj ) { _object = obj; }
public IContainerSymbol getContainingSymbol() { return _containingScope; }
public void setContainingSymbol( IContainerSymbol scope ){
@ -2165,7 +2164,7 @@ public class ParserSymbolTable {
return null;
}
private String _name; //our name
private IPSTSymbolExtension _object; //the object associated with us
private ISymbolASTExtension _object; //the object associated with us
private TypeInfo _typeInfo; //our type info
private Declaration _containingScope; //the scope that contains us
private int _depth; //how far down the scope stack we are
@ -2300,7 +2299,7 @@ public class ParserSymbolTable {
super( name );
}
public Declaration( String name, IPSTSymbolExtension obj ){
public Declaration( String name, ISymbolASTExtension obj ){
super( name, obj );
}

View file

@ -97,7 +97,7 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte
* @return
*/
private static CSearchPattern createNamespacePattern(String patternString, LimitTo limitTo, int matchMode, boolean caseSensitive) {
IScanner scanner = ParserFactory.createScanner( new StringReader( patternString ), "TEXT", new ScannerInfo(), ParserMode.QUICK_PARSE );
IScanner scanner = ParserFactory.createScanner( new StringReader( patternString ), "TEXT", new ScannerInfo(), ParserMode.QUICK_PARSE, null );
LinkedList list = scanForNames( scanner, null );
char [] name = (char []) list.removeLast();
@ -138,7 +138,7 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte
* @return
*/
private static CSearchPattern createFieldPattern(String patternString, LimitTo limitTo, int matchMode, boolean caseSensitive) {
IScanner scanner = ParserFactory.createScanner( new StringReader( patternString ), "TEXT", new ScannerInfo(), ParserMode.QUICK_PARSE );
IScanner scanner = ParserFactory.createScanner( new StringReader( patternString ), "TEXT", new ScannerInfo(), ParserMode.QUICK_PARSE, null );
LinkedList list = scanForNames( scanner, null );
char [] name = (char []) list.removeLast();
@ -167,7 +167,7 @@ public abstract class CSearchPattern implements ICSearchConstants, ICSearchPatte
* @return
*/
private static CSearchPattern createClassPattern(String patternString, SearchFor searchFor, LimitTo limitTo, int matchMode, boolean caseSensitive) {
IScanner scanner = ParserFactory.createScanner( new StringReader( patternString ), "TEXT", new ScannerInfo(), ParserMode.QUICK_PARSE );
IScanner scanner = ParserFactory.createScanner( new StringReader( patternString ), "TEXT", new ScannerInfo(), ParserMode.QUICK_PARSE, null );
IToken token = null;
ASTClassKind kind = null;

View file

@ -34,15 +34,20 @@ import org.eclipse.cdt.core.parser.ast.IASTClassReference;
import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit;
import org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationReference;
import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier;
import org.eclipse.cdt.core.parser.ast.IASTEnumerator;
import org.eclipse.cdt.core.parser.ast.IASTField;
import org.eclipse.cdt.core.parser.ast.IASTFieldReference;
import org.eclipse.cdt.core.parser.ast.IASTFunction;
import org.eclipse.cdt.core.parser.ast.IASTFunctionReference;
import org.eclipse.cdt.core.parser.ast.IASTInclusion;
import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification;
import org.eclipse.cdt.core.parser.ast.IASTMacro;
import org.eclipse.cdt.core.parser.ast.IASTMethod;
import org.eclipse.cdt.core.parser.ast.IASTMethodReference;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition;
import org.eclipse.cdt.core.parser.ast.IASTNamespaceReference;
import org.eclipse.cdt.core.parser.ast.IASTOffsetableNamedElement;
import org.eclipse.cdt.core.parser.ast.IASTPointerToFunction;
import org.eclipse.cdt.core.parser.ast.IASTPointerToMethod;
@ -51,9 +56,11 @@ import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation;
import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization;
import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTTypedefReference;
import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration;
import org.eclipse.cdt.core.parser.ast.IASTUsingDirective;
import org.eclipse.cdt.core.parser.ast.IASTVariable;
import org.eclipse.cdt.core.parser.ast.IASTVariableReference;
import org.eclipse.cdt.core.search.ICSearchConstants;
import org.eclipse.cdt.core.search.ICSearchPattern;
import org.eclipse.cdt.core.search.ICSearchResultCollector;
@ -98,7 +105,7 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants
public void acceptUsingDirective(IASTUsingDirective usageDirective) { }
public void acceptUsingDeclaration(IASTUsingDeclaration usageDeclaration) { }
public void acceptASMDefinition(IASTASMDefinition asmDefinition) { }
public void acceptTypedef(IASTTypedefDeclaration typedef) { }
public void acceptTypedefDeclaration(IASTTypedefDeclaration typedef) { }
public void acceptEnumerator(IASTEnumerator enumerator) { }
public void acceptAbstractTypeSpecDeclaration(IASTAbstractTypeSpecifierDeclaration abstractDeclaration) {}
public void acceptPointerToFunction(IASTPointerToFunction function) {}
@ -119,7 +126,14 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants
}
public void acceptClassReference(IASTClassReference reference) { }
public void acceptElaboratedTypeSpecifier(IASTElaboratedTypeSpecifier elaboratedTypeSpec){ }
public void acceptTypedefReference( IASTTypedefReference reference ){ }
public void acceptNamespaceReference( IASTNamespaceReference reference ){ }
public void acceptEnumerationReference( IASTEnumerationReference reference ){ }
public void acceptVariableReference( IASTVariableReference reference ){ }
public void acceptFunctionReference( IASTFunctionReference reference ){ }
public void acceptFieldReference( IASTFieldReference reference ){ }
public void acceptMethodReference( IASTMethodReference reference ) { }
public void acceptMethodDeclaration(IASTMethod method) { }
public void acceptField(IASTField field) { }
@ -147,7 +161,7 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants
public void enterLinkageSpecification(IASTLinkageSpecification linkageSpec) { }
public void enterTemplateDeclaration(IASTTemplateDeclaration declaration) { }
public void enterTemplateSpecialization(IASTTemplateSpecialization specialization) { }
public void enterTemplateExplicitInstantiation(IASTTemplateInstantiation instantiation) { }
public void enterTemplateInstantiation(IASTTemplateInstantiation instantiation) { }
public void enterMethodBody(IASTMethod method) {
pushScope( method );
@ -297,9 +311,8 @@ public class MatchLocator implements ISourceElementRequestor, ICSearchConstants
}
}
IScanner scanner = ParserFactory.createScanner( reader, pathString, new ScannerInfo(), ParserMode.QUICK_PARSE );
IParser parser = ParserFactory.createParser( scanner, null, ParserMode.QUICK_PARSE );
parser.setRequestor( this );
IScanner scanner = ParserFactory.createScanner( reader, pathString, new ScannerInfo(), ParserMode.QUICK_PARSE, this );
IParser parser = ParserFactory.createParser( scanner, this, ParserMode.QUICK_PARSE );
parser.parse();
}

View file

@ -1,3 +1,7 @@
2003-07-18 John Camelon
In the core, I updated ParserFactory.createScanner() to force the user to provide a callback and a ParserMode.
==> I had to update ComparatorModelBuilder.
2003-07-17 John Camelon
Partially converted DOM to ISourceElementRequestor (requires refactoring of CModelBuilder & StuctureComparator modules in near future).

View file

@ -57,7 +57,7 @@ public class ComparatorModelBuilder {
public void parse() {
DOMBuilder domBuilder = new DOMBuilder();
try {
IParser parser = ParserFactory.createParser(ParserFactory.createScanner( new StringReader( code ), null, new ScannerInfo(), ParserMode.QUICK_PARSE ), domBuilder, ParserMode.QUICK_PARSE);
IParser parser = ParserFactory.createParser(ParserFactory.createScanner( new StringReader( code ), "junk", new ScannerInfo(), ParserMode.QUICK_PARSE, domBuilder ), domBuilder, ParserMode.QUICK_PARSE);
parser.parse();
} catch (Exception e) {
callback.reportError(e);