Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTVisitor.java110
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/CASTVisitor.java33
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/ICASTVisitor.java33
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/CPPASTVisitor.java85
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTVisitor.java57
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayDesignator.java20
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayRangeDesignator.java20
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFieldDesignator.java20
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBaseSpecifier.java22
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceDefinition.java21
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeTemplateParameter.java28
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplatedTypeTemplateParameter.java29
-rw-r--r--core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMAST.java11
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java42
14 files changed, 316 insertions, 215 deletions
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTVisitor.java
index 5ede1617801..b4608b97e22 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTVisitor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/ASTVisitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,67 +8,113 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
-
-/*
- * Created on Mar 8, 2005
- */
package org.eclipse.cdt.core.dom.ast;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
+import org.eclipse.cdt.core.dom.ast.c.ICASTVisitor;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisitor;
/**
- * Visitor allows traversal of AST. <br>
+ * Abstract base class for all visitors to traverse ast nodes. <br>
* visit() methods implement a top-down traversal, and <br>
- * leave() methods implement a bottom-up traversal.
- *
+ * leave() methods implement a bottom-up traversal. <br>
+ *
+ * To visit c- or c++-specific nodes you need to implement {@link ICASTVisitor}
+ * and/or {@link ICPPASTVisitor} in addition to deriving from this class.
*/
public abstract class ASTVisitor {
-
/**
- * These values should be overriden in the implementation subclass.
+ * Set this flag to visit names.
*/
public boolean shouldVisitNames = false;
-
+ /**
+ * Set this flag to visit declarations.
+ */
public boolean shouldVisitDeclarations = false;
-
+ /**
+ * Set this flag to visit initializers.
+ */
public boolean shouldVisitInitializers = false;
-
+ /**
+ * Set this flag to visit parameter declarations.
+ */
public boolean shouldVisitParameterDeclarations = false;
-
+ /**
+ * Set this flag to visit declarators.
+ */
public boolean shouldVisitDeclarators = false;
-
+ /**
+ * Set this flag to visit declaration specifiers.
+ */
public boolean shouldVisitDeclSpecifiers = false;
-
+ /**
+ * Set this flag to visit expressions.
+ */
public boolean shouldVisitExpressions = false;
-
+ /**
+ * Set this flag to visit statements.
+ */
public boolean shouldVisitStatements = false;
-
+ /**
+ * Set this flag to visit typeids.
+ */
public boolean shouldVisitTypeIds = false;
-
+ /**
+ * Set this flag to visit enumerators.
+ */
public boolean shouldVisitEnumerators = false;
-
+ /**
+ * Set this flag to visit translation units.
+ */
public boolean shouldVisitTranslationUnit = false;
-
+ /**
+ * Set this flag to visit problem nodes.
+ */
public boolean shouldVisitProblems = false;
- public boolean shouldVisitComments = false;
+ /**
+ * Set this flag to visit designators of initializers.
+ * Your visitor needs to implement {@link ICASTVisitor} to make this work.
+ */
+ public boolean shouldVisitDesignators = false;
/**
- * @return continue to continue visiting, abort to stop, skip to not descend
- * into this node.
+ * Set this flag to visit base specifiers off composite types.
+ * Your visitor needs to implement {@link ICPPASTVisitor} to make this work.
+ */
+ public boolean shouldVisitBaseSpecifiers = false;
+
+ /**
+ * Set this flag to visit to visit namespaces.
+ * Your visitor needs to implement {@link ICPPASTVisitor} to make this work.
+ */
+ public boolean shouldVisitNamespaces = false;
+
+ /**
+ * Set this flag to visit template parameters.
+ * Your visitor needs to implement {@link ICPPASTVisitor} to make this work.
+ */
+ public boolean shouldVisitTemplateParameters = false;
+
+
+ /**
+ * Skip the traversal of children of this node, don't call leave on this node.
*/
public final static int PROCESS_SKIP = 1;
+ /**
+ * Abort the entire traversal.
+ */
public final static int PROCESS_ABORT = 2;
- public final static int PROCESS_CONTINUE = 3;
-
/**
- *
- * visit methods
- *
+ * Continue with traversing the children of this node.
*/
+ public final static int PROCESS_CONTINUE = 3;
+
+ // visit methods
public int visit(IASTTranslationUnit tu) {
return PROCESS_CONTINUE;
}
@@ -120,10 +166,8 @@ public abstract class ASTVisitor {
public int visit( IASTComment comment){
return PROCESS_CONTINUE;
}
-
- /**
- * leave methods - implement a bottom-up traversal
- */
+
+ // leave methods
public int leave(IASTTranslationUnit tu) {
return PROCESS_CONTINUE;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/CASTVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/CASTVisitor.java
index d9f843b7542..e3a4ddd6f8f 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/CASTVisitor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/CASTVisitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -8,43 +8,26 @@
* Contributors:
* IBM Corporation - initial API and implementation
* Yuan Zhang / Beth Tibbitts (IBM Research)
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
-
-/*
- * Created on Mar 8, 2005
- */
package org.eclipse.cdt.core.dom.ast.c;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
/**
* This subclass of ASTVisitor that allows for better control in traversing C.
- *
- * @ref ASTVisitor
- * @author jcamelon
*/
-public abstract class CASTVisitor extends ASTVisitor {
- /**
- * Override this value in your subclass if you do wish to visit designators.
- */
- public boolean shouldVisitDesignators = false;
+public abstract class CASTVisitor extends ASTVisitor implements ICASTVisitor {
- /**
- * Function to override if you wish to visit designators in your
- * implementation. This does a top-down traversal.
- *
- * @param designator
- * @return
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.c.ICASTVisitor#visit(org.eclipse.cdt.core.dom.ast.c.ICASTDesignator)
*/
public int visit(ICASTDesignator designator) {
return PROCESS_CONTINUE;
}
-
- /**
- * Function to override if you wish to visit designators in your
- * implementation: this does a bottom-up traversal.
- * @param designator
- * @return
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.c.ICASTVisitor#leave(org.eclipse.cdt.core.dom.ast.c.ICASTDesignator)
*/
public int leave(ICASTDesignator designator) {
return PROCESS_CONTINUE;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/ICASTVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/ICASTVisitor.java
new file mode 100644
index 00000000000..47a334c0d1b
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/c/ICASTVisitor.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Markus Schorn - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.core.dom.ast.c;
+
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
+
+
+/**
+ * Interface for visitors to visit c-specific nodes.
+ * @since 5.0
+ */
+public interface ICASTVisitor {
+
+ /**
+ * Visits a designator.
+ * @return {@link ASTVisitor#PROCESS_CONTINUE}, {@link ASTVisitor#PROCESS_SKIP} or {@link ASTVisitor#PROCESS_ABORT}
+ */
+ int visit(ICASTDesignator designator);
+
+ /**
+ * Visits a designator.
+ * @return {@link ASTVisitor#PROCESS_CONTINUE} or {@link ASTVisitor#PROCESS_ABORT}
+ */
+ int leave(ICASTDesignator designator);
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/CPPASTVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/CPPASTVisitor.java
index 58caee02671..95939af9ce2 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/CPPASTVisitor.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/CPPASTVisitor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,11 +7,8 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
-
-/*
- * Created on Mar 8, 2005
- */
package org.eclipse.cdt.core.dom.ast.cpp;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
@@ -21,86 +18,48 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBas
* C++ specific visitor class.
* <br>The visit() methods implement a top-down traversal of the AST,
* and the leave() methods implement a bottom-up traversal.
- *
- * @author jcamelon
*/
-public abstract class CPPASTVisitor extends ASTVisitor {
+public abstract class CPPASTVisitor extends ASTVisitor implements ICPPASTVisitor {
- /**
- * Overide this value if you wish to visit base specifiers off composite
- * types.
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisitor#visit(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier)
*/
- public boolean shouldVisitBaseSpecifiers = false;
-
- /**
- * Overide this value if you wish to visit namespaces.
- */
- public boolean shouldVisitNamespaces = false;
-
- /**
- * Overide this value if you wish to visit template parameters.
- */
- public boolean shouldVisitTemplateParameters = false;
-
- /**
- * Visit BaseSpecifiers.
- *
- * @param specifier
- * @return
- */
- public int visit(ICPPASTBaseSpecifier specifier) {
+ public int visit(ICPPASTBaseSpecifier baseSpecifier) {
return PROCESS_CONTINUE;
}
- /**
- * Visit namespace definitions.
- *
- * @param namespace
- * @return
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisitor#visit(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition)
*/
- public int visit(ICPPASTNamespaceDefinition namespace) {
+ public int visit(ICPPASTNamespaceDefinition namespaceDefinition) {
return PROCESS_CONTINUE;
}
- /**
- * Visit template parameter.
- *
- * @param parameter
- * @return
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisitor#visit(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter)
*/
- public int visit(ICPPASTTemplateParameter parameter) {
+ public int visit(ICPPASTTemplateParameter templateParameter) {
return PROCESS_CONTINUE;
}
- /**
- * Visit BaseSpecifiers.
- * Bottom-up traversal.
- *
- * @param specifier
- * @return
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisitor#leave(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier)
*/
- public int leave(ICPPASTBaseSpecifier specifier) {
+ public int leave(ICPPASTBaseSpecifier baseSpecifier) {
return PROCESS_CONTINUE;
}
- /**
- * Visit namespace definitions.
- * Bottom-up traversal.
- *
- * @param namespace
- * @return
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisitor#leave(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition)
*/
- public int leave(ICPPASTNamespaceDefinition namespace) {
+ public int leave(ICPPASTNamespaceDefinition namespaceDefinition) {
return PROCESS_CONTINUE;
}
- /**
- * Visit template parameter.
- * Bottom-up traversal.
- *
- * @param parameter
- * @return
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisitor#leave(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter)
*/
- public int leave(ICPPASTTemplateParameter parameter) {
+ public int leave(ICPPASTTemplateParameter templateParameter) {
return PROCESS_CONTINUE;
}
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTVisitor.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTVisitor.java
new file mode 100644
index 00000000000..6f2231905ce
--- /dev/null
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPASTVisitor.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Wind River Systems, Inc. and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Markus Schorn - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.cdt.core.dom.ast.cpp;
+
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
+
+/**
+ * Interface for visitors to visit c-specific nodes.
+ * @since 5.0
+ */
+public interface ICPPASTVisitor {
+
+ /**
+ * Visits a base class specifier of a composite type.
+ * @return {@link ASTVisitor#PROCESS_CONTINUE}, {@link ASTVisitor#PROCESS_SKIP} or {@link ASTVisitor#PROCESS_ABORT}
+ */
+ int visit(ICPPASTBaseSpecifier baseSpecifier);
+
+ /**
+ * Visits a base class specifier of a composite type.
+ * @return {@link ASTVisitor#PROCESS_CONTINUE} or {@link ASTVisitor#PROCESS_ABORT}
+ */
+ int leave(ICPPASTBaseSpecifier baseSpecifier);
+
+ /**
+ * Visits a namespace definition.
+ * @return {@link ASTVisitor#PROCESS_CONTINUE}, {@link ASTVisitor#PROCESS_SKIP} or {@link ASTVisitor#PROCESS_ABORT}
+ */
+ int visit(ICPPASTNamespaceDefinition namespaceDefinition);
+
+ /**
+ * Visits a namespace definition.
+ * @return {@link ASTVisitor#PROCESS_CONTINUE} or {@link ASTVisitor#PROCESS_ABORT}
+ */
+ int leave(ICPPASTNamespaceDefinition namespaceDefinition);
+
+ /**
+ * Visits a template parameter.
+ * @return {@link ASTVisitor#PROCESS_CONTINUE}, {@link ASTVisitor#PROCESS_SKIP} or {@link ASTVisitor#PROCESS_ABORT}
+ */
+ int visit(ICPPASTTemplateParameter templateParameter);
+
+ /**
+ * Visits a template parameter.
+ * @return {@link ASTVisitor#PROCESS_CONTINUE} or {@link ASTVisitor#PROCESS_ABORT}
+ */
+ int leave(ICPPASTTemplateParameter templateParameter);
+}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayDesignator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayDesignator.java
index dfd882b4478..67be1636741 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayDesignator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayDesignator.java
@@ -1,21 +1,22 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM Rational Software - Initial API and implementation
- * Yuan Zhang / Beth Tibbitts (IBM Research)
+ * IBM Rational Software - Initial API and implementation
+ * Yuan Zhang / Beth Tibbitts (IBM Research)
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTNode;
-import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
import org.eclipse.cdt.core.dom.ast.c.ICASTArrayDesignator;
+import org.eclipse.cdt.core.dom.ast.c.ICASTVisitor;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
/**
@@ -47,9 +48,10 @@ public class CASTArrayDesignator extends CASTNode implements
}
}
- public boolean accept( ASTVisitor action ){
- if( action instanceof CASTVisitor && ((CASTVisitor)action).shouldVisitDesignators ){
- switch( ((CASTVisitor)action).visit( this ) ){
+ @Override
+ public boolean accept( ASTVisitor action ){
+ if (action.shouldVisitDesignators && action instanceof ICASTVisitor) {
+ switch( ((ICASTVisitor)action).visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
@@ -57,8 +59,8 @@ public class CASTArrayDesignator extends CASTNode implements
}
if( exp != null ) if( !exp.accept( action ) ) return false;
- if( action instanceof CASTVisitor && ((CASTVisitor)action).shouldVisitDesignators ){
- switch( ((CASTVisitor)action).leave( this ) ){
+ if (action.shouldVisitDesignators && action instanceof ICASTVisitor) {
+ switch( ((ICASTVisitor)action).leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayRangeDesignator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayRangeDesignator.java
index ebbc6c677d5..e0281ca4bc8 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayRangeDesignator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTArrayRangeDesignator.java
@@ -1,20 +1,21 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM Rational Software - Initial API and implementation
- * Yuan Zhang / Beth Tibbitts (IBM Research)
+ * IBM Rational Software - Initial API and implementation
+ * Yuan Zhang / Beth Tibbitts (IBM Research)
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTNode;
-import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
+import org.eclipse.cdt.core.dom.ast.c.ICASTVisitor;
import org.eclipse.cdt.core.dom.ast.gnu.c.IGCCASTArrayRangeDesignator;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
@@ -58,9 +59,10 @@ public class CASTArrayRangeDesignator extends CASTNode implements
}
}
- public boolean accept( ASTVisitor action ){
- if( action instanceof CASTVisitor && ((CASTVisitor)action).shouldVisitDesignators ){
- switch( ((CASTVisitor)action).visit( this ) ){
+ @Override
+ public boolean accept( ASTVisitor action ){
+ if (action.shouldVisitDesignators && action instanceof ICASTVisitor) {
+ switch( ((ICASTVisitor)action).visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
@@ -69,8 +71,8 @@ public class CASTArrayRangeDesignator extends CASTNode implements
if( floor != null ) if( !floor.accept( action ) ) return false;
if( ceiling != null ) if( !ceiling.accept( action ) ) return false;
- if( action instanceof CASTVisitor && ((CASTVisitor)action).shouldVisitDesignators ){
- switch( ((CASTVisitor)action).leave( this ) ){
+ if (action.shouldVisitDesignators && action instanceof ICASTVisitor) {
+ switch( ((ICASTVisitor)action).leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFieldDesignator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFieldDesignator.java
index 29a806208f5..6d16de821dc 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFieldDesignator.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/c/CASTFieldDesignator.java
@@ -1,20 +1,21 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM Rational Software - Initial API and implementation
- * Yuan Zhang / Beth Tibbitts (IBM Research)
+ * IBM Rational Software - Initial API and implementation
+ * Yuan Zhang / Beth Tibbitts (IBM Research)
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.c;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTName;
-import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
import org.eclipse.cdt.core.dom.ast.c.ICASTFieldDesignator;
+import org.eclipse.cdt.core.dom.ast.c.ICASTVisitor;
/**
* @author jcamelon
@@ -44,17 +45,18 @@ public class CASTFieldDesignator extends CASTNode implements
}
}
- public boolean accept( ASTVisitor action ){
- if( action instanceof CASTVisitor && ((CASTVisitor)action).shouldVisitDesignators ){
- switch( ((CASTVisitor)action).visit( this ) ){
+ @Override
+ public boolean accept( ASTVisitor action ){
+ if (action.shouldVisitDesignators && action instanceof ICASTVisitor) {
+ switch( ((ICASTVisitor)action).visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
}
}
if( name != null ) if( !name.accept( action ) ) return false;
- if( action instanceof CASTVisitor && ((CASTVisitor)action).shouldVisitDesignators ){
- switch( ((CASTVisitor)action).leave( this ) ){
+ if (action.shouldVisitDesignators && action instanceof ICASTVisitor) {
+ switch( ((ICASTVisitor)action).leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBaseSpecifier.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBaseSpecifier.java
index e00e4d3c508..15380a0bb45 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBaseSpecifier.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTBaseSpecifier.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM - Initial API and implementation
- * Bryan Wilkinson (QNX)
+ * IBM - Initial API and implementation
+ * Bryan Wilkinson (QNX)
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@@ -19,7 +20,7 @@ import org.eclipse.cdt.core.dom.ast.DOMException;
import org.eclipse.cdt.core.dom.ast.IASTCompletionContext;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IBinding;
-import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisitor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier.ICPPASTBaseSpecifier;
@@ -71,10 +72,10 @@ public class CPPASTBaseSpecifier extends CPPASTNode implements
}
}
- public boolean accept(ASTVisitor action) {
- if (action instanceof CPPASTVisitor &&
- ((CPPASTVisitor)action).shouldVisitBaseSpecifiers) {
- switch (((CPPASTVisitor)action).visit(this)) {
+ @Override
+ public boolean accept(ASTVisitor action) {
+ if (action.shouldVisitBaseSpecifiers && action instanceof ICPPASTVisitor) {
+ switch (((ICPPASTVisitor)action).visit(this)) {
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
@@ -83,9 +84,8 @@ public class CPPASTBaseSpecifier extends CPPASTNode implements
if (!name.accept(action)) return false;
- if (action instanceof CPPASTVisitor &&
- ((CPPASTVisitor)action).shouldVisitBaseSpecifiers) {
- switch (((CPPASTVisitor)action).leave(this)) {
+ if (action.shouldVisitBaseSpecifiers && action instanceof ICPPASTVisitor) {
+ switch (((ICPPASTVisitor)action).leave(this)) {
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceDefinition.java
index 69e7deffa86..1e2ade04400 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceDefinition.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTNamespaceDefinition.java
@@ -1,13 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM - Initial API and implementation
- * Markus Schorn (Wind River Systems)
+ * IBM - Initial API and implementation
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@@ -17,8 +17,8 @@ import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
import org.eclipse.cdt.core.dom.ast.IScope;
-import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisitor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
@@ -73,10 +73,10 @@ public class CPPASTNamespaceDefinition extends CPPASTNode implements
}
}
- public boolean accept( ASTVisitor action ){
- if( action instanceof CPPASTVisitor &&
- ((CPPASTVisitor)action).shouldVisitNamespaces ){
- switch( ((CPPASTVisitor)action).visit( this ) ){
+ @Override
+ public boolean accept( ASTVisitor action ){
+ if (action.shouldVisitNamespaces && action instanceof ICPPASTVisitor) {
+ switch( ((ICPPASTVisitor)action).visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
@@ -88,9 +88,8 @@ public class CPPASTNamespaceDefinition extends CPPASTNode implements
for ( int i = 0; i < decls.length; i++ )
if( !decls[i].accept( action ) ) return false;
- if( action instanceof CPPASTVisitor &&
- ((CPPASTVisitor)action).shouldVisitNamespaces ){
- switch( ((CPPASTVisitor)action).leave( this ) ){
+ if (action.shouldVisitNamespaces && action instanceof ICPPASTVisitor) {
+ switch( ((ICPPASTVisitor)action).leave( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeTemplateParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeTemplateParameter.java
index a2546480161..6078940eaf3 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeTemplateParameter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTSimpleTypeTemplateParameter.java
@@ -1,20 +1,21 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM - Initial API and implementation
+ * IBM - Initial API and implementation
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTTypeId;
-import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTSimpleTypeTemplateParameter;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisitor;
/**
* @author jcamelon
@@ -68,10 +69,10 @@ public class CPPASTSimpleTypeTemplateParameter extends CPPASTNode implements
}
}
- public boolean accept( ASTVisitor action ){
- if( action instanceof CPPASTVisitor &&
- ((CPPASTVisitor)action).shouldVisitTemplateParameters ){
- switch( ((CPPASTVisitor)action).visit( this ) ){
+ @Override
+ public boolean accept( ASTVisitor action ){
+ if (action.shouldVisitTemplateParameters && action instanceof ICPPASTVisitor) {
+ switch( ((ICPPASTVisitor)action).visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
@@ -81,14 +82,13 @@ public class CPPASTSimpleTypeTemplateParameter extends CPPASTNode implements
if( name != null ) if( !name.accept( action ) ) return false;
if( typeId != null ) if( !typeId.accept( action ) ) return false;
- if( action instanceof CPPASTVisitor &&
- ((CPPASTVisitor)action).shouldVisitTemplateParameters ){
- switch( ((CPPASTVisitor)action).leave( this ) ){
- case ASTVisitor.PROCESS_ABORT : return false;
- case ASTVisitor.PROCESS_SKIP : return true;
- default : break;
- }
+ if (action.shouldVisitTemplateParameters && action instanceof ICPPASTVisitor) {
+ switch( ((ICPPASTVisitor)action).leave( this ) ){
+ case ASTVisitor.PROCESS_ABORT : return false;
+ case ASTVisitor.PROCESS_SKIP : return true;
+ default : break;
}
+ }
return true;
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplatedTypeTemplateParameter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplatedTypeTemplateParameter.java
index aed92d31ade..44d5f304f1b 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplatedTypeTemplateParameter.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPASTTemplatedTypeTemplateParameter.java
@@ -1,13 +1,13 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM - Initial API and implementation
- * Markus Schorn (Wind River Systems)
+ * IBM - Initial API and implementation
+ * Markus Schorn (Wind River Systems)
*******************************************************************************/
package org.eclipse.cdt.internal.core.dom.parser.cpp;
@@ -15,9 +15,9 @@ import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTExpression;
import org.eclipse.cdt.core.dom.ast.IASTName;
import org.eclipse.cdt.core.dom.ast.IASTNode;
-import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplatedTypeTemplateParameter;
+import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTVisitor;
import org.eclipse.cdt.core.parser.util.ArrayUtil;
import org.eclipse.cdt.internal.core.dom.parser.IASTAmbiguityParent;
@@ -79,10 +79,10 @@ public class CPPASTTemplatedTypeTemplateParameter extends CPPASTNode implements
}
}
- public boolean accept( ASTVisitor action ){
- if( action instanceof CPPASTVisitor &&
- ((CPPASTVisitor)action).shouldVisitTemplateParameters ){
- switch( ((CPPASTVisitor)action).visit( this ) ){
+ @Override
+ public boolean accept( ASTVisitor action ){
+ if (action.shouldVisitTemplateParameters && action instanceof ICPPASTVisitor) {
+ switch( ((ICPPASTVisitor)action).visit( this ) ){
case ASTVisitor.PROCESS_ABORT : return false;
case ASTVisitor.PROCESS_SKIP : return true;
default : break;
@@ -96,14 +96,13 @@ public class CPPASTTemplatedTypeTemplateParameter extends CPPASTNode implements
if( name != null ) if( !name.accept( action ) ) return false;
if( defaultValue != null ) if( !defaultValue.accept( action ) ) return false;
- if( action instanceof CPPASTVisitor &&
- ((CPPASTVisitor)action).shouldVisitTemplateParameters ){
- switch( ((CPPASTVisitor)action).leave( this ) ){
- case ASTVisitor.PROCESS_ABORT : return false;
- case ASTVisitor.PROCESS_SKIP : return true;
- default : break;
- }
+ if (action.shouldVisitTemplateParameters && action instanceof ICPPASTVisitor) {
+ switch( ((ICPPASTVisitor)action).leave( this ) ){
+ case ASTVisitor.PROCESS_ABORT : return false;
+ case ASTVisitor.PROCESS_SKIP : return true;
+ default : break;
}
+ }
return true;
}
diff --git a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMAST.java b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMAST.java
index 6b590e5035d..ece0d7673b7 100644
--- a/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMAST.java
+++ b/core/org.eclipse.cdt.ui.tests/src/org/eclipse/cdt/ui/tests/DOMAST/DOMAST.java
@@ -1,12 +1,12 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
+ * Copyright (c) 2005, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
- * IBM Rational Software - Initial API and implementation
+ * IBM Rational Software - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.ui.tests.DOMAST;
@@ -64,6 +64,7 @@ import org.eclipse.ui.views.properties.PropertySheet;
import org.eclipse.cdt.core.dom.ast.ASTSignatureUtil;
import org.eclipse.cdt.core.dom.ast.ASTTypeUtil;
+import org.eclipse.cdt.core.dom.ast.ASTVisitor;
import org.eclipse.cdt.core.dom.ast.IASTArrayModifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
import org.eclipse.cdt.core.dom.ast.IASTDeclaration;
@@ -87,9 +88,7 @@ import org.eclipse.cdt.core.dom.ast.IFunction;
import org.eclipse.cdt.core.dom.ast.IType;
import org.eclipse.cdt.core.dom.ast.IVariable;
import org.eclipse.cdt.core.dom.ast.IASTEnumerationSpecifier.IASTEnumerator;
-import org.eclipse.cdt.core.dom.ast.c.CASTVisitor;
import org.eclipse.cdt.core.dom.ast.c.ICASTDesignator;
-import org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConstructorChainInitializer;
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter;
import org.eclipse.cdt.core.model.CModelException;
@@ -373,11 +372,11 @@ public class DOMAST extends ViewPart {
start=System.currentTimeMillis();
if (aTu instanceof CPPASTTranslationUnit ) {
action = new CPPPopulateASTViewAction(aTu, monitor);
- aTu.accept( (CPPASTVisitor) action);
+ aTu.accept( (ASTVisitor) action);
}
else if (aTu instanceof CASTTranslationUnit){
action = new CPopulateASTViewAction(aTu, monitor);
- aTu.accept( (CASTVisitor) action);
+ aTu.accept( (ASTVisitor) action);
}
monitor.worked(30);
System.out.println(DOM_AST_VIEW_DONE + GENERATING_INITIAL_TREE + COLON_SPACE + (System.currentTimeMillis()- start) );
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java
index 148eccc53e0..651d06982a2 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/SemanticHighlightingReconciler.java
@@ -90,7 +90,6 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
shouldVisitEnumerators= true;
shouldVisitTranslationUnit= false;
shouldVisitProblems= true;
- shouldVisitComments= false;
shouldVisitBaseSpecifiers= true;
shouldVisitNamespaces= true;
shouldVisitTemplateParameters= true;
@@ -108,48 +107,63 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
}
return PROCESS_CONTINUE;
}
+ @Override
public int visit(ICPPASTBaseSpecifier specifier) {
return processNode(specifier);
}
+ @Override
public int visit(ICPPASTNamespaceDefinition namespace) {
return processNode(namespace);
}
+ @Override
public int visit(ICPPASTTemplateParameter parameter) {
return processNode(parameter);
}
+ @Override
public int visit(IASTDeclaration declaration) {
return processNode(declaration);
}
+ @Override
public int visit(IASTDeclarator declarator) {
return processNode(declarator);
}
+ @Override
public int visit(IASTDeclSpecifier declSpec) {
return processNode(declSpec);
}
+ @Override
public int visit(IASTEnumerator enumerator) {
return processNode(enumerator);
}
+ @Override
public int visit(IASTExpression expression) {
return processNode(expression);
}
+ @Override
public int visit(IASTInitializer initializer) {
return processNode(initializer);
}
+ @Override
public int visit(IASTName name) {
return processNode(name);
}
+ @Override
public int visit(IASTParameterDeclaration parameterDeclaration) {
return processNode(parameterDeclaration);
}
+ @Override
public int visit(IASTProblem problem) {
return processNode(problem);
}
+ @Override
public int visit(IASTStatement statement) {
return processNode(statement);
}
+ @Override
public int visit(IASTTranslationUnit tu) {
return processNode(tu);
}
+ @Override
public int visit(IASTTypeId typeId) {
return processNode(typeId);
}
@@ -190,6 +204,7 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
/*
* @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTTranslationUnit)
*/
+ @Override
public int visit(IASTTranslationUnit tu) {
fFilePath= tu.getFilePath();
@@ -215,6 +230,7 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
/*
* @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
*/
+ @Override
public int visit(IASTDeclaration declaration) {
if (!declaration.isPartOfTranslationUnitFile()) {
return PROCESS_SKIP;
@@ -228,6 +244,7 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
/*
* @see org.eclipse.cdt.core.dom.ast.ASTVisitor#leave(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
*/
+ @Override
public int leave(IASTDeclaration declaration) {
if (!shouldVisitCatchHandlers && declaration instanceof IASTFunctionDefinition) {
shouldVisitCatchHandlers= true;
@@ -244,6 +261,7 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
/*
* @see org.eclipse.cdt.core.dom.ast.cpp.CPPASTVisitor#visit(org.eclipse.cdt.core.dom.ast.cpp.ICPPASTNamespaceDefinition)
*/
+ @Override
public int visit(ICPPASTNamespaceDefinition namespace) {
if (!namespace.isPartOfTranslationUnitFile()) {
return PROCESS_SKIP;
@@ -257,6 +275,7 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
/*
* @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier)
*/
+ @Override
public int visit(IASTDeclSpecifier declSpec) {
if (checkForMacro(declSpec)) {
return PROCESS_SKIP;
@@ -267,6 +286,7 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
/*
* @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTDeclarator)
*/
+ @Override
public int visit(IASTDeclarator declarator) {
if (checkForMacro(declarator)) {
return PROCESS_SKIP;
@@ -280,6 +300,7 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
/*
* @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTExpression)
*/
+ @Override
public int visit(IASTExpression expression) {
if (checkForMacro(expression)) {
return PROCESS_SKIP;
@@ -290,6 +311,7 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
/*
* @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTStatement)
*/
+ @Override
public int visit(IASTStatement statement) {
if (!shouldVisitCatchHandlers && statement instanceof ICPPASTCatchHandler) {
return PROCESS_SKIP;
@@ -303,6 +325,7 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
/*
* @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTName)
*/
+ @Override
public int visit(IASTName name) {
if (checkForMacro(name)) {
return PROCESS_SKIP;
@@ -481,9 +504,9 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
private HighlightingStyle[] fHighlightings;
/** Background job's added highlighted positions */
- private List fAddedPositions= new ArrayList();
+ private List<Position> fAddedPositions= new ArrayList<Position>();
/** Background job's removed highlighted positions */
- private List fRemovedPositions= new ArrayList();
+ private List<Object> fRemovedPositions= new ArrayList<Object>();
/** Number of removed positions */
private int fNOfRemovedPositions;
@@ -578,8 +601,8 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
*/
private void reconcilePositions(IASTTranslationUnit ast, PositionCollector visitor) {
ast.accept(visitor);
- List oldPositions= fRemovedPositions;
- List newPositions= new ArrayList(fNOfRemovedPositions);
+ List<Object> oldPositions= fRemovedPositions;
+ List<Object> newPositions= new ArrayList<Object>(fNOfRemovedPositions);
for (int i= 0, n= oldPositions.size(); i < n; i ++) {
Object current= oldPositions.get(i);
if (current != null)
@@ -587,10 +610,8 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
}
fRemovedPositions= newPositions;
// positions need to be sorted by ascending offset
- Collections.sort(fAddedPositions, new Comparator() {
- public int compare(Object o1, Object o2) {
- final Position p1= (Position)o1;
- final Position p2= (Position)o2;
+ Collections.sort(fAddedPositions, new Comparator<Position>() {
+ public int compare(final Position p1, final Position p2) {
return p1.getOffset() - p2.getOffset();
}});
}
@@ -602,7 +623,7 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
* @param addedPositions the added positions
* @param removedPositions the removed positions
*/
- private void updatePresentation(TextPresentation textPresentation, List addedPositions, List removedPositions) {
+ private void updatePresentation(TextPresentation textPresentation, List<Position> addedPositions, List<Object> removedPositions) {
Runnable runnable= fJobPresenter.createUpdateRunnable(textPresentation, addedPositions, removedPositions);
if (runnable == null)
return;
@@ -687,6 +708,7 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
if (element != null) {
fJob= new Job(CEditorMessages.getString("SemanticHighlighting_job")) { //$NON-NLS-1$
+ @Override
protected IStatus run(final IProgressMonitor monitor) {
if (oldJob != null) {
try {

Back to the top