diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/CNode.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/CNode.java new file mode 100644 index 00000000000..a3d523d5d68 --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/CNode.java @@ -0,0 +1,56 @@ +package org.eclipse.cdt.internal.ui.compare; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ + +import org.eclipse.cdt.internal.ui.CElementImageProvider; +import org.eclipse.cdt.ui.CUIPlugin; +import org.eclipse.compare.ITypedElement; +import org.eclipse.compare.structuremergeviewer.DocumentRangeNode; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.text.IDocument; +import org.eclipse.swt.graphics.Image; +/** + * + */ + +class CNode extends DocumentRangeNode implements ITypedElement { + + private CNode fParent; + + public CNode(CNode parent, int type, String id, IDocument doc, int start, int length) { + super(type, id, doc, start, length); + fParent= parent; + if (parent != null) { + parent.addChild(this); + } + } + + public CNode(CNode parent, int type, String id, int start, int length) { + this(parent, type, id, parent.getDocument(), start, length); + } + + /** + * @see ITypedInput#getName + */ + public String getName() { + return getId(); + } + + /** + * @see ITypedInput#getType + */ + public String getType() { + return "c2"; //$NON-NLS-1$ + } + + /** + * @see ITypedInput#getImage + */ + public Image getImage() { + ImageDescriptor descriptor = CElementImageProvider.getImageDescriptor(getTypeCode()); + return CUIPlugin.getImageDescriptorRegistry().get(descriptor); + } +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/CParseTreeBuilder.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/CParseTreeBuilder.java new file mode 100644 index 00000000000..4aa787ba13e --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/CParseTreeBuilder.java @@ -0,0 +1,309 @@ +package org.eclipse.cdt.internal.ui.compare; + +/* + * (c) Copyright IBM Corp. 2000, 2001. + * All Rights Reserved. + */ + +import java.util.Stack; + +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.core.parser.IProblem; +import org.eclipse.cdt.core.parser.ast.ASTClassKind; +import org.eclipse.cdt.core.parser.ast.IASTClassSpecifier; +import org.eclipse.cdt.core.parser.ast.IASTCompilationUnit; +import org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier; +import org.eclipse.cdt.core.parser.ast.IASTField; +import org.eclipse.cdt.core.parser.ast.IASTFunction; +import org.eclipse.cdt.core.parser.ast.IASTInclusion; +import org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification; +import org.eclipse.cdt.core.parser.ast.IASTMacro; +import org.eclipse.cdt.core.parser.ast.IASTMethod; +import org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition; +import org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration; +import org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation; +import org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization; +import org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration; +import org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration; +import org.eclipse.cdt.core.parser.ast.IASTUsingDirective; +import org.eclipse.cdt.core.parser.ast.IASTVariable; +import org.eclipse.jface.text.IDocument; + +/** + * + */ +public class CParseTreeBuilder extends SourceElementRequestorAdapter { + + private Stack fStack = new Stack(); + private IDocument fDocument; + + /** + * Syntax Error. + */ + public class ParseError extends Error { + } + + public CParseTreeBuilder(CNode root, IDocument doc) { + fDocument = doc; + fStack.clear(); + fStack.push(root); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier) + */ + public void enterClassSpecifier(IASTClassSpecifier classSpecification) { + String name = classSpecification.getName(); + int start = classSpecification.getStartingOffset(); + if (classSpecification.getClassKind().equals(ASTClassKind.CLASS)) { + push(ICElement.C_CLASS, name, start); + } else if (classSpecification.getClassKind().equals(ASTClassKind.STRUCT)) { + push(ICElement.C_STRUCT, name, start); + } else if (classSpecification.getClassKind().equals(ASTClassKind.UNION)) { + push(ICElement.C_UNION, name, start); + } else if (classSpecification.getClassKind().equals(ASTClassKind.ENUM)) { + push(ICElement.C_ENUMERATION, name, start); + } + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterCompilationUnit(org.eclipse.cdt.core.parser.ast.IASTCompilationUnit) + */ + public void enterCompilationUnit(IASTCompilationUnit compilationUnit) { + push(ICElement.C_UNIT, "Translation Unit", 0); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterFunctionBody(org.eclipse.cdt.core.parser.ast.IASTFunction) + */ + public void enterFunctionBody(IASTFunction function) { + push(ICElement.C_FUNCTION, function.getName(), function.getStartingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterInclusion(org.eclipse.cdt.core.parser.ast.IASTInclusion) + */ + public void enterInclusion(IASTInclusion inclusion) { + push(ICElement.C_INCLUDE, inclusion.getName(), inclusion.getStartingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterLinkageSpecification(org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification) + */ + public void enterLinkageSpecification(IASTLinkageSpecification linkageSpec) { + push(ICElement.C_STORAGE_EXTERN, linkageSpec.getLinkageString(), linkageSpec.getStartingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterMethodBody(org.eclipse.cdt.core.parser.ast.IASTMethod) + */ + public void enterMethodBody(IASTMethod method) { + push(ICElement.C_METHOD, method.getName(), method.getStartingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterNamespaceDefinition(org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition) + */ + public void enterNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition) { + push(ICElement.C_NAMESPACE, namespaceDefinition.getName(), namespaceDefinition.getStartingOffset());; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterTemplateDeclaration(org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration) + */ + public void enterTemplateDeclaration(IASTTemplateDeclaration declaration) { + push(ICElement.C_TEMPLATE_VARIABLE, "export", declaration.getStartingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterTemplateInstantiation(org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation) + */ + public void enterTemplateInstantiation(IASTTemplateInstantiation instantiation) { + push(ICElement.C_TEMPLATE_VARIABLE, "template instanciation", instantiation.getStartingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterTemplateSpecialization(org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization) + */ + public void enterTemplateSpecialization(IASTTemplateSpecialization specialization) { + push(ICElement.C_TEMPLATE_VARIABLE, "template specialization", specialization.getStartingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier) + */ + public void exitClassSpecifier(IASTClassSpecifier classSpecification) { + pop(classSpecification.getEndingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitCompilationUnit(org.eclipse.cdt.core.parser.ast.IASTCompilationUnit) + */ + public void exitCompilationUnit(IASTCompilationUnit translationUnit) { + pop(fDocument.getLength()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitFunctionBody(org.eclipse.cdt.core.parser.ast.IASTFunction) + */ + public void exitFunctionBody(IASTFunction function) { + pop(function.getEndingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitInclusion(org.eclipse.cdt.core.parser.ast.IASTInclusion) + */ + public void exitInclusion(IASTInclusion inclusion) { + pop(inclusion.getEndingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitLinkageSpecification(org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification) + */ + public void exitLinkageSpecification(IASTLinkageSpecification linkageSpec) { + pop(linkageSpec.getEndingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitMethodBody(org.eclipse.cdt.core.parser.ast.IASTMethod) + */ + public void exitMethodBody(IASTMethod method) { + pop(method.getEndingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitNamespaceDefinition(org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition) + */ + public void exitNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition) { + pop(namespaceDefinition.getEndingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitTemplateDeclaration(org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration) + */ + public void exitTemplateDeclaration(IASTTemplateDeclaration declaration) { + pop(declaration.getEndingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitTemplateExplicitInstantiation(org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation) + */ + public void exitTemplateExplicitInstantiation(IASTTemplateInstantiation instantiation) { + pop(instantiation.getEndingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitTemplateSpecialization(org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization) + */ + public void exitTemplateSpecialization(IASTTemplateSpecialization specialization) { + pop(specialization.getEndingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumerationSpecifier(org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier) + */ + public void acceptEnumerationSpecifier(IASTEnumerationSpecifier enumeration) { + push(ICElement.C_ENUMERATION, enumeration.getName(), enumeration.getStartingOffset()); + pop(enumeration.getEndingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptFunctionDeclaration(org.eclipse.cdt.core.parser.ast.IASTFunction) + */ + public void acceptFunctionDeclaration(IASTFunction function) { + push(ICElement.C_FUNCTION_DECLARATION, function.getName(), function.getStartingOffset()); + pop(function.getEndingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptMacro(org.eclipse.cdt.core.parser.ast.IASTMacro) + */ + public void acceptMacro(IASTMacro macro) { + push(ICElement.C_MACRO, macro.getName(), macro.getStartingOffset()); + pop(macro.getEndingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptMethodDeclaration(org.eclipse.cdt.core.parser.ast.IASTMethod) + */ + public void acceptMethodDeclaration(IASTMethod method) { + push(ICElement.C_METHOD_DECLARATION, method.getName(), method.getStartingOffset()); + pop(method.getEndingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptProblem(org.eclipse.cdt.core.parser.IProblem) + */ + public void acceptProblem(IProblem problem) { + int problemId = problem.getID(); + if (problem.isError() && ((problemId & IProblem.Syntax) != 0)) { + throw new ParseError(); + } + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedefDeclaration(org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration) + */ + public void acceptTypedefDeclaration(IASTTypedefDeclaration typedef) { + push(ICElement.C_TYPEDEF, typedef.getName(), typedef.getStartingOffset()); + pop(typedef.getEndingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptUsingDeclaration(org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration) + */ + public void acceptUsingDeclaration(IASTUsingDeclaration usageDeclaration) { + push(ICElement.C_USING, usageDeclaration.usingTypeName(), usageDeclaration.getStartingOffset()); + pop(usageDeclaration.getEndingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptUsingDirective(org.eclipse.cdt.core.parser.ast.IASTUsingDirective) + */ + public void acceptUsingDirective(IASTUsingDirective usageDirective) { + push(ICElement.C_USING, usageDirective.getNamespaceName(), usageDirective.getStartingOffset()); + pop(usageDirective.getEndingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptVariable(org.eclipse.cdt.core.parser.ast.IASTVariable) + */ + public void acceptVariable(IASTVariable variable) { + push(ICElement.C_VARIABLE, variable.getName(), variable.getStartingOffset()); + pop(variable.getEndingOffset()); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptField(org.eclipse.cdt.core.parser.ast.IASTField) + */ + public void acceptField(IASTField field) { + push(ICElement.C_FIELD, field.getName(), field.getStartingOffset()); + pop(field.getEndingOffset()); + } + + private CNode getCurrentContainer() { + return (CNode) fStack.peek(); + } + + /** + * Adds a new JavaNode with the given type and name to the current container. + */ + private void push(int type, String name, int declarationStart) { + fStack.push(new CNode(getCurrentContainer(), type, name, declarationStart, 0)); + } + + /** + * Closes the current Java node by setting its end position + * and pops it off the stack. + */ + private void pop(int declarationEnd) { + CNode current = getCurrentContainer(); + if (current.getTypeCode() == ICElement.C_UNIT) { + current.setAppendPosition(declarationEnd + 1); + } else { + current.setAppendPosition(declarationEnd); + } + current.setLength(declarationEnd - current.getRange().getOffset() + 1); + fStack.pop(); + } +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/CStructureCreator.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/CStructureCreator.java index 27bb5c0d49f..851499cbba4 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/CStructureCreator.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/CStructureCreator.java @@ -4,134 +4,127 @@ package org.eclipse.cdt.internal.ui.compare; * (c) Copyright IBM Corp. 2000, 2001. * All Rights Reserved. */ - + import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; +import java.io.StringReader; -import org.eclipse.swt.graphics.Image; - +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.core.parser.IParser; +import org.eclipse.cdt.core.parser.IScanner; +import org.eclipse.cdt.core.parser.ISourceElementRequestor; +import org.eclipse.cdt.core.parser.ParserFactory; +import org.eclipse.cdt.core.parser.ParserMode; +import org.eclipse.cdt.internal.core.parser.ScannerInfo; +import org.eclipse.cdt.ui.CUIPlugin; import org.eclipse.compare.IEditableContent; import org.eclipse.compare.IStreamContentAccessor; -import org.eclipse.compare.ITypedElement; import org.eclipse.compare.structuremergeviewer.Differencer; -import org.eclipse.compare.structuremergeviewer.DocumentRangeNode; import org.eclipse.compare.structuremergeviewer.IDiffContainer; import org.eclipse.compare.structuremergeviewer.IStructureComparator; import org.eclipse.compare.structuremergeviewer.IStructureCreator; import org.eclipse.core.runtime.CoreException; - import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.Position; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.internal.parser.CStructurizer; -import org.eclipse.cdt.internal.parser.IStructurizerCallback; -import org.eclipse.cdt.internal.ui.CPluginImages; -import org.eclipse.cdt.internal.ui.DocumentInputStream; -import org.eclipse.cdt.ui.CUIPlugin; /** * */ -public class CStructureCreator implements IStructureCreator { +public class CStructureCreator implements IStructureCreator { - private static final String NAME= "CStructureCreator.name"; + private static final String NAME = "CStructureCreator.name"; public CStructureCreator() { } /** * @see IStructureCreator#getTitle - */ + */ public String getName() { return CUIPlugin.getResourceString(NAME); } - + /** * @see IStructureCreator#getStructure - */ + */ public IStructureComparator getStructure(Object input) { - - String s= null; + + String s = null; if (input instanceof IStreamContentAccessor) { try { - s= readString(((IStreamContentAccessor) input).getContents()); - } catch(CoreException ex) { + s = readString(((IStreamContentAccessor) input).getContents()); + } catch (CoreException ex) { } } - - Document doc= new Document(s != null ? s : ""); - - CNode root= new CNode(null, ICElement.C_UNIT, "root", doc, 0, 0); - - DocumentInputStream is= new DocumentInputStream(doc); - IStructurizerCallback callback= new CNodeTreeConstructor(root, doc); + + if (s == null) { + s = new String(); + } + Document doc = new Document(s); + + CNode root = new CNode(null, ICElement.C_UNIT, "root", doc, 0, 0); + + ISourceElementRequestor builder = new CParseTreeBuilder(root, doc); try { - if (CCorePlugin.getDefault().useNewParser()) { - // new parser - ComparatorModelBuilder modelBuilder = new ComparatorModelBuilder(callback, (s != null ? s : "")); - modelBuilder.parse(); - } else { - CStructurizer.getCStructurizer().parse(callback, is); - } - } catch (NodeConstructorError e) { - System.out.println("Parse error: " + e); - return null; - } catch (IOException e) { - return null; + IScanner scanner = + ParserFactory.createScanner(new StringReader(s), "code", new ScannerInfo(), ParserMode.QUICK_PARSE, builder); + IParser parser = ParserFactory.createParser(scanner, builder, ParserMode.QUICK_PARSE); + parser.parse(); + } catch (Exception e) { + // What to do when error ? + // The CParseTreeBuilder will throw CParseTreeBuilder.ParseError + // for acceptProblem. } return root; - } + } /** * @see IStructureCreator#canSave - */ + */ public boolean canSave() { return true; } /** * @see IStructureCreator#locate - */ + */ public IStructureComparator locate(Object path, Object source) { return null; } /** * @see IStructureCreator#canRewriteTree - */ + */ public boolean canRewriteTree() { return false; } /** * @see IStructureCreator#rewriteTree - */ + */ public void rewriteTree(Differencer differencer, IDiffContainer root) { - } + } /** * @see IStructureCreator#save - */ + */ public void save(IStructureComparator structure, Object input) { if (input instanceof IEditableContent && structure instanceof CNode) { - IDocument doc= ((CNode)structure).getDocument(); - IEditableContent bca= (IEditableContent) input; - String c= doc.get(); + IDocument doc = ((CNode) structure).getDocument(); + IEditableContent bca = (IEditableContent) input; + String c = doc.get(); bca.setContent(c.getBytes()); } } - + /** * @see IStructureCreator#getContents */ public String getContents(Object node, boolean ignoreWhitespace) { if (node instanceof IStreamContentAccessor) { - IStreamContentAccessor sca= (IStreamContentAccessor) node; + IStreamContentAccessor sca = (IStreamContentAccessor) node; try { return readString(sca.getContents()); } catch (CoreException ex) { @@ -140,166 +133,24 @@ public class CStructureCreator implements IStructureCreator { return null; } - private static class CNode extends DocumentRangeNode implements ITypedElement { - - private String fImageKey; - private CNode fParent; - private int fCode; - - public CNode(CNode parent, int type, String id, IDocument doc, int start, int length) { - super(type, id, doc, start, length); - fCode = type; - fImageKey= CPluginImages.IMG_OBJS_STRUCT; - fParent= parent; - } - - /** - * Returns the type code of this node. - * The type code is uninterpreted client data which can be set in the constructor. - * - * @return the type code of this node - */ - public int getTypeCode() { - return fCode; - } - - public void setTypeCode(int code) { - fCode = code; - } - - public CNode getParent() { - return fParent; - } - - /** - * @see ITypedInput#getName - */ - public String getName() { - return getId(); - } - - /** - * @see ITypedInput#getType - */ - public String getType() { - return "c2"; - } - - /** - * @see ITypedInput#getImage - */ - public Image getImage() { - if (fImageKey != null) { - return CPluginImages.get(fImageKey); - } - return null; - } - }; - - private static class NodeConstructorError extends Error { - } - - private static class CNodeTreeConstructor implements IStructurizerCallback { - - private CNode fRoot; - private CNode fCurrent; - - private IDocument fDocument; - - public CNodeTreeConstructor(CNode root, IDocument doc) { - fRoot= root; - fCurrent= root; - fDocument= doc; - } - - private CNode getParent(CNode node) { - CNode parent= node.getParent(); - if (parent == null) { - throw new NodeConstructorError(); - } - return parent; - } - - private final int fixLength(int startPos, int endPos) { - if (endPos < startPos) { - return 0; - } else { - return endPos - startPos + 1; - } - } - - - public void includeDecl(String name, int startPos, int endPos, int startLine, int endLine) { - CNode node= new CNode(fRoot, ICElement.C_INCLUDE, name, fDocument, startPos, fixLength(startPos, endPos)); - fRoot.addChild(node); - } - - public void defineDecl(String name, int startPos, int endPos, int startLine, int endLine) { - CNode node= new CNode(fRoot, ICElement.C_MACRO, name, fDocument, startPos, fixLength(startPos, endPos)); - fRoot.addChild(node); - } - - public void functionDeclBegin(String name, int nameStartPos, int nameEndPos, - int declStartPos, int startLine, int type, int modifiers) { - CNode node= new CNode(fCurrent, ICElement.C_FUNCTION, name, fDocument, declStartPos, 0); - fCurrent.addChild(node); - fCurrent= node; - } - - public void functionDeclEnd(int declEndPos, int endLine, boolean prototype) { - if(prototype) { - fCurrent.setTypeCode(ICElement.C_FUNCTION_DECLARATION); - } - Position p= fCurrent.getRange(); - fCurrent.setLength(fixLength(p.getOffset(), declEndPos)); - fCurrent= getParent(fCurrent); - } - - public void fieldDecl(String name, int nameStartPos, int nameEndPos, int declStartPos, - int declEndPos, int startLine, int endLine, int modifiers) { - CNode node= new CNode(fCurrent, ICElement.C_FIELD, name, fDocument, declStartPos, fixLength(declStartPos, declEndPos)); - fCurrent.addChild(node); - } - - public void structDeclBegin(String name, int kind, int nameStartPos, int nameEndPos, - int declStartPos, int startLine, int modifiers) { - CNode node= new CNode(fCurrent, kind, name, fDocument, declStartPos, 0); - fCurrent.addChild(node); - fCurrent= node; - } - - public void structDeclEnd(int declEndPos, int endLine) { - Position p= fCurrent.getRange(); - fCurrent.setLength(fixLength(p.getOffset(), declEndPos)); - fCurrent= getParent(fCurrent); - } - - public void superDecl(String name) { - } - - public void reportError(Throwable throwable) { - throw new NodeConstructorError(); - } - } - /** * Returns null if an error occurred. */ private static String readString(InputStream is) { if (is == null) return null; - BufferedReader reader= null; + BufferedReader reader = null; try { - StringBuffer buffer= new StringBuffer(); - char[] part= new char[2048]; - int read= 0; - reader= new BufferedReader(new InputStreamReader(is)); + StringBuffer buffer = new StringBuffer(); + char[] part = new char[2048]; + int read = 0; + reader = new BufferedReader(new InputStreamReader(is)); - while ((read= reader.read(part)) != -1) + while ((read = reader.read(part)) != -1) buffer.append(part, 0, read); - + return buffer.toString(); - + } catch (IOException ex) { } finally { if (reader != null) { @@ -311,5 +162,5 @@ public class CStructureCreator implements IStructureCreator { } return null; } - + } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/ComparatorModelBuilder.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/ComparatorModelBuilder.java deleted file mode 100644 index de44ff7ee0d..00000000000 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/ComparatorModelBuilder.java +++ /dev/null @@ -1,300 +0,0 @@ -/******************************************************************************* - * - * 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: - * QnX Software Systems - initial implementation base on code from rational/IBM - ******************************************************************************/ - -package org.eclipse.cdt.internal.ui.compare; - -import java.io.StringReader; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.core.parser.IParser; -import org.eclipse.cdt.core.parser.ParserFactory; -import org.eclipse.cdt.core.parser.ParserMode; -import org.eclipse.cdt.internal.core.dom.ClassKey; -import org.eclipse.cdt.internal.core.dom.ClassSpecifier; -import org.eclipse.cdt.internal.core.dom.DOMBuilder; -import org.eclipse.cdt.internal.core.dom.Declaration; -import org.eclipse.cdt.internal.core.dom.Declarator; -import org.eclipse.cdt.internal.core.dom.EnumerationSpecifier; -import org.eclipse.cdt.internal.core.dom.IOffsetable; -import org.eclipse.cdt.internal.core.dom.Inclusion; -import org.eclipse.cdt.internal.core.dom.Macro; -import org.eclipse.cdt.internal.core.dom.NamespaceDefinition; -import org.eclipse.cdt.internal.core.dom.ParameterDeclarationClause; -import org.eclipse.cdt.internal.core.dom.SimpleDeclaration; -import org.eclipse.cdt.internal.core.dom.TemplateDeclaration; -import org.eclipse.cdt.internal.core.dom.TranslationUnit; -import org.eclipse.cdt.internal.core.dom.TypeSpecifier; -import org.eclipse.cdt.internal.core.parser.ScannerInfo; -import org.eclipse.cdt.internal.parser.IStructurizerCallback; - -/** - * @author alain - * TODO: this should be remove when the new parser provides proper callbacks. - * - */ -public class ComparatorModelBuilder { - - IStructurizerCallback callback; - String code; - - /** - */ - public ComparatorModelBuilder(IStructurizerCallback cb, String buffer) { - callback = cb; - code = buffer; - } - - public void parse() { - DOMBuilder domBuilder = new DOMBuilder(); - try { - 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); - } - generateModelElements(domBuilder.getTranslationUnit()); - } - - protected void generateModelElements(TranslationUnit tu) { - Iterator i = tu.iterateOffsetableElements(); - while (i.hasNext()) { - IOffsetable offsetable = (IOffsetable) i.next(); - if (offsetable instanceof Inclusion) { - createInclusion((Inclusion) offsetable); - } else if (offsetable instanceof Macro) { - createMacro((Macro) offsetable); - } else if (offsetable instanceof Declaration) { - generateModelElements((Declaration) offsetable); - } - } - } - - protected void generateModelElements(Declaration declaration) { - // Namespace Definition - if (declaration instanceof NamespaceDefinition) { - NamespaceDefinition nsDef = (NamespaceDefinition) declaration; - createNamespace(nsDef); - List nsDeclarations = nsDef.getDeclarations(); - Iterator nsDecls = nsDeclarations.iterator(); - while (nsDecls.hasNext()) { - Declaration subNsDeclaration = (Declaration) nsDecls.next(); - generateModelElements(subNsDeclaration); - } - } // end Namespace Definition - - // Simple Declaration - if (declaration instanceof SimpleDeclaration) { - SimpleDeclaration simpleDeclaration = (SimpleDeclaration) declaration; - - /*------------------------------------------- - * Checking the type if it is a composite one - *-------------------------------------------*/ - TypeSpecifier typeSpec = simpleDeclaration.getTypeSpecifier(); - // Enumeration - if (typeSpec instanceof EnumerationSpecifier) { - EnumerationSpecifier enumSpecifier = (EnumerationSpecifier) typeSpec; - createEnumeration(enumSpecifier); - } else if (typeSpec instanceof ClassSpecifier) { // Structure - ClassSpecifier classSpecifier = (ClassSpecifier) typeSpec; - createClass(simpleDeclaration, classSpecifier, false); - // create the sub declarations - List declarations = classSpecifier.getDeclarations(); - Iterator j = declarations.iterator(); - while (j.hasNext()) { - Declaration subDeclaration = (Declaration) j.next(); - generateModelElements(subDeclaration); - } // end while j - } - /*----------------------------------------- - * Create declarators of simple declaration - * ----------------------------------------*/ - List declarators = simpleDeclaration.getDeclarators(); - Iterator d = declarators.iterator(); - while (d.hasNext()) { - Declarator declarator = (Declarator) d.next(); - createElement(simpleDeclaration, declarator); - } // end while d - } // end if SimpleDeclaration - - // Template Declaration - if (declaration instanceof TemplateDeclaration) { - TemplateDeclaration templateDeclaration = (TemplateDeclaration) declaration; - SimpleDeclaration simpleDeclaration = (SimpleDeclaration) templateDeclaration.getDeclarations().get(0); - TypeSpecifier typeSpec = simpleDeclaration.getTypeSpecifier(); - if (typeSpec instanceof ClassSpecifier) { - ClassSpecifier classSpecifier = (ClassSpecifier) typeSpec; - createClass(simpleDeclaration, classSpecifier, true); - // create the sub declarations - List declarations = classSpecifier.getDeclarations(); - Iterator j = declarations.iterator(); - while (j.hasNext()) { - Declaration subDeclaration = (Declaration) j.next(); - generateModelElements(subDeclaration); - } // end while j - } - List declarators = simpleDeclaration.getDeclarators(); - Iterator d = declarators.iterator(); - while (d.hasNext()) { - Declarator declarator = (Declarator) d.next(); - createTemplateElement(templateDeclaration, simpleDeclaration, declarator); - } // end while d - - } // end Template Declaration - - } - - private void createElement(SimpleDeclaration simpleDeclaration, Declarator declarator) { - // typedef - if (simpleDeclaration.getDeclSpecifier().isTypedef()) { - createTypeDef(declarator, simpleDeclaration); - } else { - ParameterDeclarationClause pdc = declarator.getParms(); - if (pdc == null) { - createVariableSpecification(simpleDeclaration, declarator); - } else { - createFunctionSpecification(simpleDeclaration, declarator, pdc, false); - } - } - } - - private void createTemplateElement( - TemplateDeclaration templateDeclaration, - SimpleDeclaration simpleDeclaration, - Declarator declarator) { - // TODO: no template in the old parser - ParameterDeclarationClause pdc = declarator.getParms(); - if (pdc != null) { - createFunctionSpecification(simpleDeclaration, declarator, pdc, true); - } - } - - private void createInclusion(Inclusion inclusion) { - callback.includeDecl(inclusion.getName(), inclusion.getStartingOffset(), inclusion.getTotalLength(), 0, 0); - } - - private void createMacro(Macro macro) { - callback.defineDecl(macro.getName(), macro.getStartingOffset(), macro.getTotalLength(), 0, 0); - } - - private void createNamespace(NamespaceDefinition nsDef) { - // TODO: the old parser callback does not know about namespace. - } - - private void createEnumeration(EnumerationSpecifier enumSpecifier) { - callback.structDeclBegin( - enumSpecifier.getName().toString(), - ICElement.C_ENUMERATION, - enumSpecifier.getNameOffset(), - enumSpecifier.getName().length(), - enumSpecifier.getStartingOffset(), - 0, - 0); - callback.structDeclEnd(enumSpecifier.getTotalLength(), 0); - } - - private void createClass(SimpleDeclaration simpleDeclaration, ClassSpecifier classSpecifier, boolean isTemplate) { - // create element - String className = (classSpecifier.getName() == null) ? "" : classSpecifier.getName().toString(); - int kind; - switch (classSpecifier.getClassKey()) { - case ClassKey.t_class : - kind = ICElement.C_CLASS; - break; - case ClassKey.t_struct : - kind = ICElement.C_STRUCT; - break; - default : - kind = ICElement.C_UNION; - break; - } - - // set element position - if (classSpecifier.getName() != null) { - callback.structDeclBegin( - className, - kind, - classSpecifier.getNameOffset(), - classSpecifier.getName().length(), - classSpecifier.getStartingOffset(), - 0, - 0); - } else { - callback.structDeclBegin( - className, - kind, - classSpecifier.getStartingOffset(), - classSpecifier.getClassKeyImage().length(), - classSpecifier.getStartingOffset(), - 0, - 0); - - } - callback.structDeclBegin( - className, - kind, - classSpecifier.getStartingOffset(), - classSpecifier.getClassKeyEndOffset(), - classSpecifier.getStartingOffset(), - 0, - 0); - callback.structDeclEnd(classSpecifier.getTotalLength(), 0); - } - - private void createTypeDef(Declarator declarator, SimpleDeclaration simpleDeclaration) { - // TODO:No typedef in the old callback - String domName = (declarator.getDeclarator() != null) ? declarator.getDeclarator().getName() : declarator.getName(); - String declaratorName = domName.toString(); - callback.fieldDecl( - declaratorName, - declarator.getNameOffset(), - domName.length(), - simpleDeclaration.getStartingOffset(), - simpleDeclaration.getTotalLength(), - 0, - 0, - 0); - } - - private void createVariableSpecification(SimpleDeclaration simpleDeclaration, Declarator declarator) { - String domName = (declarator.getDeclarator() != null) ? declarator.getDeclarator().getName() : declarator.getName(); - String declaratorName = domName.toString(); - callback.fieldDecl( - declaratorName, - declarator.getNameOffset(), - domName.length(), - simpleDeclaration.getStartingOffset(), - simpleDeclaration.getTotalLength(), - 0, - 0, - 0); - } - - private void createFunctionSpecification( - SimpleDeclaration simpleDeclaration, - Declarator declarator, - ParameterDeclarationClause pdc, - boolean isTemplate) { - String domName = (declarator.getDeclarator() != null) ? declarator.getDeclarator().getName() : declarator.getName(); - String declaratorName = domName.toString(); - callback.functionDeclBegin( - declaratorName, - declarator.getNameOffset(), - domName.length(), - simpleDeclaration.getStartingOffset(), - 0, - 0, - 0); - callback.functionDeclEnd(simpleDeclaration.getTotalLength(), 0, simpleDeclaration.isFunctionDefinition()); - } - -} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/SourceElementRequestorAdapter.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/SourceElementRequestorAdapter.java new file mode 100644 index 00000000000..1171195b8fa --- /dev/null +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/compare/SourceElementRequestorAdapter.java @@ -0,0 +1,295 @@ +/******************************************************************************* + * + * 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: + * QnX Software Systems - initial implementation base on code from rational/IBM + ******************************************************************************/ + +package org.eclipse.cdt.internal.ui.compare; + +import org.eclipse.cdt.core.parser.IProblem; +import org.eclipse.cdt.core.parser.ISourceElementRequestor; +import org.eclipse.cdt.core.parser.ast.IASTASMDefinition; +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.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 SourceElementRequestorAdapter implements ISourceElementRequestor { + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptAbstractTypeSpecDeclaration(org.eclipse.cdt.core.parser.ast.IASTAbstractTypeSpecifierDeclaration) + */ + public void acceptAbstractTypeSpecDeclaration(IASTAbstractTypeSpecifierDeclaration abstractDeclaration) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptASMDefinition(org.eclipse.cdt.core.parser.ast.IASTASMDefinition) + */ + public void acceptASMDefinition(IASTASMDefinition asmDefinition) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptClassReference(org.eclipse.cdt.core.parser.ast.IASTClassReference) + */ + public void acceptClassReference(IASTClassReference reference) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptElaboratedForewardDeclaration(org.eclipse.cdt.core.parser.ast.IASTElaboratedTypeSpecifier) + */ + public void acceptElaboratedForewardDeclaration(IASTElaboratedTypeSpecifier elaboratedType) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumerationReference(org.eclipse.cdt.core.parser.ast.IASTEnumerationReference) + */ + public void acceptEnumerationReference(IASTEnumerationReference reference) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptEnumerationSpecifier(org.eclipse.cdt.core.parser.ast.IASTEnumerationSpecifier) + */ + public void acceptEnumerationSpecifier(IASTEnumerationSpecifier enumeration) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptField(org.eclipse.cdt.core.parser.ast.IASTField) + */ + public void acceptField(IASTField field) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptFieldReference(org.eclipse.cdt.core.parser.ast.IASTFieldReference) + */ + public void acceptFieldReference(IASTFieldReference reference) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptFunctionDeclaration(org.eclipse.cdt.core.parser.ast.IASTFunction) + */ + public void acceptFunctionDeclaration(IASTFunction function) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptFunctionReference(org.eclipse.cdt.core.parser.ast.IASTFunctionReference) + */ + public void acceptFunctionReference(IASTFunctionReference reference) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptMacro(org.eclipse.cdt.core.parser.ast.IASTMacro) + */ + public void acceptMacro(IASTMacro macro) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptMethodDeclaration(org.eclipse.cdt.core.parser.ast.IASTMethod) + */ + public void acceptMethodDeclaration(IASTMethod method) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptMethodReference(org.eclipse.cdt.core.parser.ast.IASTMethodReference) + */ + public void acceptMethodReference(IASTMethodReference reference) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptNamespaceReference(org.eclipse.cdt.core.parser.ast.IASTNamespaceReference) + */ + public void acceptNamespaceReference(IASTNamespaceReference reference) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptProblem(org.eclipse.cdt.core.parser.IProblem) + */ + public void acceptProblem(IProblem problem) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedefDeclaration(org.eclipse.cdt.core.parser.ast.IASTTypedefDeclaration) + */ + public void acceptTypedefDeclaration(IASTTypedefDeclaration typedef) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptTypedefReference(org.eclipse.cdt.core.parser.ast.IASTTypedefReference) + */ + public void acceptTypedefReference(IASTTypedefReference reference) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptUsingDeclaration(org.eclipse.cdt.core.parser.ast.IASTUsingDeclaration) + */ + public void acceptUsingDeclaration(IASTUsingDeclaration usageDeclaration) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptUsingDirective(org.eclipse.cdt.core.parser.ast.IASTUsingDirective) + */ + public void acceptUsingDirective(IASTUsingDirective usageDirective) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptVariable(org.eclipse.cdt.core.parser.ast.IASTVariable) + */ + public void acceptVariable(IASTVariable variable) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#acceptVariableReference(org.eclipse.cdt.core.parser.ast.IASTVariableReference) + */ + public void acceptVariableReference(IASTVariableReference reference) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier) + */ + public void enterClassSpecifier(IASTClassSpecifier classSpecification) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterCompilationUnit(org.eclipse.cdt.core.parser.ast.IASTCompilationUnit) + */ + public void enterCompilationUnit(IASTCompilationUnit compilationUnit) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterFunctionBody(org.eclipse.cdt.core.parser.ast.IASTFunction) + */ + public void enterFunctionBody(IASTFunction function) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterInclusion(org.eclipse.cdt.core.parser.ast.IASTInclusion) + */ + public void enterInclusion(IASTInclusion inclusion) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterLinkageSpecification(org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification) + */ + public void enterLinkageSpecification(IASTLinkageSpecification linkageSpec) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterMethodBody(org.eclipse.cdt.core.parser.ast.IASTMethod) + */ + public void enterMethodBody(IASTMethod method) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterNamespaceDefinition(org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition) + */ + public void enterNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterTemplateDeclaration(org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration) + */ + public void enterTemplateDeclaration(IASTTemplateDeclaration declaration) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterTemplateInstantiation(org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation) + */ + public void enterTemplateInstantiation(IASTTemplateInstantiation instantiation) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#enterTemplateSpecialization(org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization) + */ + public void enterTemplateSpecialization(IASTTemplateSpecialization specialization) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitClassSpecifier(org.eclipse.cdt.core.parser.ast.IASTClassSpecifier) + */ + public void exitClassSpecifier(IASTClassSpecifier classSpecification) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitCompilationUnit(org.eclipse.cdt.core.parser.ast.IASTCompilationUnit) + */ + public void exitCompilationUnit(IASTCompilationUnit compilationUnit) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitFunctionBody(org.eclipse.cdt.core.parser.ast.IASTFunction) + */ + public void exitFunctionBody(IASTFunction function) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitInclusion(org.eclipse.cdt.core.parser.ast.IASTInclusion) + */ + public void exitInclusion(IASTInclusion inclusion) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitLinkageSpecification(org.eclipse.cdt.core.parser.ast.IASTLinkageSpecification) + */ + public void exitLinkageSpecification(IASTLinkageSpecification linkageSpec) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitMethodBody(org.eclipse.cdt.core.parser.ast.IASTMethod) + */ + public void exitMethodBody(IASTMethod method) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitNamespaceDefinition(org.eclipse.cdt.core.parser.ast.IASTNamespaceDefinition) + */ + public void exitNamespaceDefinition(IASTNamespaceDefinition namespaceDefinition) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitTemplateDeclaration(org.eclipse.cdt.core.parser.ast.IASTTemplateDeclaration) + */ + public void exitTemplateDeclaration(IASTTemplateDeclaration declaration) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitTemplateExplicitInstantiation(org.eclipse.cdt.core.parser.ast.IASTTemplateInstantiation) + */ + public void exitTemplateExplicitInstantiation(IASTTemplateInstantiation instantiation) { + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.core.parser.ISourceElementRequestor#exitTemplateSpecialization(org.eclipse.cdt.core.parser.ast.IASTTemplateSpecialization) + */ + public void exitTemplateSpecialization(IASTTemplateSpecialization specialization) { + } + +}