1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Added further physical/DOM interfaces.

Added the start of the ASTService.
This commit is contained in:
John Camelon 2004-12-08 21:16:54 +00:00
parent 494a85849b
commit 1a2283799d
20 changed files with 443 additions and 1 deletions

View file

@ -0,0 +1,61 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.core.dom;
/**
* @author jcamelon
*
* This class serves as the manager of the AST/DOM mechanisms for the CDT.
* It should be eventually added to CCorePlugin for startup.
*/
public class DOM {
public IASTServiceProvider[] getASTFactories() {
//TODO stub
return null;
}
public IASTServiceProvider getDefaultASTFactory() {
IASTServiceProvider [] factories = getASTFactories();
if( factories != null && factories.length > 0 )
return factories[0];
return null;
}
public IASTServiceProvider getASTFactoryByName(String name) {
IASTServiceProvider [] factories = getASTFactories();
if( factories == null || factories.length == 0 )
return null;
for( int i = 0; i < factories.length; ++i )
if( factories[i] != null && factories[i].getName().equals( name ) )
return factories[i];
return null;
}
public static final int PARSE_SAVED_RESOURCES = 0;
public static final int PARSE_WORKING_COPY_WITH_SAVED_INCLUSIONS = 1;
public static final int PARSE_WORKING_COPY_WHENEVER_POSSIBLE = 2;
public ICodeReaderFactory getCodeReaderFactory( int key )
{
switch( key )
{
case PARSE_SAVED_RESOURCES:
return null; //TODO
case PARSE_WORKING_COPY_WITH_SAVED_INCLUSIONS:
return null; //TODO
case PARSE_WORKING_COPY_WHENEVER_POSSIBLE:
return null; //TODO
}
return null;
}
}

View file

@ -0,0 +1,29 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.core.dom;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
/**
* @author jcamelon
*/
public interface IASTServiceProvider {
public String getName();
public IASTTranslationUnit getTranslationUnit();
public IASTTranslationUnit getTranslationUnit( ICodeReaderFactory fileCreator );
public IASTTranslationUnit getTranslationUnit( ICodeReaderFactory fileCreator, IParserConfiguration configuration );
public String [] getSupportedDialects();
}

View file

@ -0,0 +1,23 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.core.dom;
import org.eclipse.cdt.core.parser.CodeReader;
/**
* @author jcamelon
*/
public interface ICodeReaderFactory {
public int getUniqueIdentifier();
public CodeReader createCodeReaderForTranslationUnit( String path );
public CodeReader createCodeReaderForInclusion( String path );
}

View file

@ -0,0 +1,25 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.core.dom;
import org.eclipse.cdt.core.parser.IScannerInfo;
/**
* @author jcamelon
*/
public interface IParserConfiguration {
/**
*/
public IScannerInfo getScannerInfo();
/**
*/
public String getParserDialectName();
}

View file

@ -15,7 +15,7 @@ package org.eclipse.cdt.core.dom.ast;
*
* @author Doug Schaefer
*/
public interface IASTMacroDefinition extends IASTNode {
public interface IASTMacroDefinition extends IASTPreprocessorStatement {
public static final ASTNodeProperty MACRO_NAME = new ASTNodeProperty( "Macro Name"); //$NON-NLS-1$
public IASTName getName();

View file

@ -0,0 +1,18 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.core.dom.ast;
/**
* @author jcamelon
*/
public interface IASTPreprocessorElseStatement extends IASTPreprocessorStatement {
}

View file

@ -0,0 +1,18 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.core.dom.ast;
/**
* @author jcamelon
*/
public interface IASTPreprocessorElsifStatement extends IASTPreprocessorStatement {
}

View file

@ -0,0 +1,18 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.core.dom.ast;
/**
* @author jcamelon
*/
public interface IASTPreprocessorEndifStatement extends IASTPreprocessorStatement{
}

View file

@ -0,0 +1,19 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.core.dom.ast;
/**
* @author jcamelon
*/
public interface IASTPreprocessorErrorStatement extends
IASTPreprocessorStatement {
}

View file

@ -0,0 +1,18 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.core.dom.ast;
/**
* @author jcamelon
*/
public interface IASTPreprocessorIfStatement extends IASTPreprocessorStatement {
}

View file

@ -0,0 +1,18 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.core.dom.ast;
/**
* @author jcamelon
*/
public interface IASTPreprocessorIfdefStatement extends IASTPreprocessorStatement {
}

View file

@ -0,0 +1,19 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.core.dom.ast;
/**
* @author jcamelon
*/
public interface IASTPreprocessorIncludeStatement extends
IASTPreprocessorStatement {
}

View file

@ -0,0 +1,19 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.core.dom.ast;
/**
* @author jcamelon
*/
public interface IASTPreprocessorPragmaStatement extends
IASTPreprocessorStatement {
}

View file

@ -0,0 +1,18 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.core.dom.ast;
/**
* @author jcamelon
*/
public interface IASTPreprocessorStatement extends IASTNode {
}

View file

@ -0,0 +1,18 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.core.dom.ast;
/**
* @author jcamelon
*/
public interface IASTPreprocessorUndefStatement extends IASTPreprocessorStatement {
}

View file

@ -60,4 +60,8 @@ public interface IASTTranslationUnit extends IASTNode {
public IASTNode getNodeForLocation( IASTNodeLocation location );
public IASTMacroDefinition [] getMacroDefinitions();
public IASTPreprocessorIncludeStatement [] getIncludeDirectives();
public IASTPreprocessorStatement [] getAllPreprocessorStatements();
}

View file

@ -0,0 +1,25 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.internal.core.parser.scanner2;
import org.eclipse.cdt.core.dom.ast.IASTMacroDefinition;
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorStatement;
/**
* @author jcamelon
*/
public interface ILocationResolver {
public IASTMacroDefinition[] getAllMacroDefinitions();
public IASTPreprocessorStatement [] getPreprocessorStatements();
public IASTNodeLocation [] getLocations( int offset, int length );
}

View file

@ -0,0 +1,32 @@
/**********************************************************************
* Copyright (c) 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.internal.core.parser.scanner2;
/**
* @author jcamelon
*/
public interface IScannerPreprocessorLog {
public void startTranslationUnit();
public void endTranslationUnit( int finalOffset );
public void startInclusion( char [] includePath, int offset );
public void endInclusion( char [] includePath, int offset );
public void enterObjectStyleMacroExpansion( char [] name, char [] expansion, int offset );
public void exitObjectStyleMacroExpansion( char [] name, int offset );
public void enterFunctionStyleExpansion( char [] name, char [][] parameters, char [] expansion, int offset );
public void exitFunctionStyleExpansion( char [] name, int offset );
public void defineObjectStyleMacro( ObjectStyleMacro m, int startOffset, int nameOffset, int nameEndOffset, int endOffset );
public void defineFunctionStyleMacro( FunctionStyleMacro m, int startOffset, int nameOffset, int nameEndOffset, int endOffset );
}

View file

@ -11,9 +11,12 @@ package org.eclipse.cdt.internal.core.parser2.c;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTMacroDefinition;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorIncludeStatement;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorStatement;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IScope;
@ -126,4 +129,31 @@ public class CASTTranslationUnit extends CASTNode implements IASTTranslationUnit
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getMacroDefinitions()
*/
public IASTMacroDefinition[] getMacroDefinitions() {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getIncludeDirectives()
*/
public IASTPreprocessorIncludeStatement[] getIncludeDirectives() {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getAllPreprocessorStatements()
*/
public IASTPreprocessorStatement[] getAllPreprocessorStatements() {
// TODO Auto-generated method stub
return null;
}
}

View file

@ -12,9 +12,12 @@ package org.eclipse.cdt.internal.core.parser2.cpp;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTMacroDefinition;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorIncludeStatement;
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorStatement;
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IScope;
@ -125,4 +128,31 @@ public class CPPASTTranslationUnit extends CPPASTNode implements
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getMacroDefinitions()
*/
public IASTMacroDefinition[] getMacroDefinitions() {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getIncludeDirectives()
*/
public IASTPreprocessorIncludeStatement[] getIncludeDirectives() {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.dom.ast.IASTTranslationUnit#getAllPreprocessorStatements()
*/
public IASTPreprocessorStatement[] getAllPreprocessorStatements() {
// TODO Auto-generated method stub
return null;
}
}