mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-28 19:35:36 +02:00
Fix for 177457: Invalid syntax coloring of macros
and 171675: Syntax Coloring & Macro arguments
This commit is contained in:
parent
5e04b06ded
commit
ca89f453d0
7 changed files with 313 additions and 582 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2006 IBM Corporation and others.
|
* Copyright (c) 2000, 2007 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -27,7 +27,7 @@ import org.eclipse.cdt.internal.ui.editor.SemanticHighlightings;
|
||||||
*/
|
*/
|
||||||
public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
|
public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
|
||||||
|
|
||||||
private static final boolean PRINT_POSITIONS= false;
|
private static final boolean PRINT_POSITIONS= true;
|
||||||
|
|
||||||
private static final Class THIS= SemanticHighlightingTest.class;
|
private static final Class THIS= SemanticHighlightingTest.class;
|
||||||
|
|
||||||
|
@ -35,17 +35,6 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
|
||||||
return new SemanticHighlightingTestSetup(new TestSuite(THIS), "/SHTest/src/SHTest.cpp");
|
return new SemanticHighlightingTestSetup(new TestSuite(THIS), "/SHTest/src/SHTest.cpp");
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void testStaticConstFieldHighlighting() throws Exception {
|
|
||||||
// setUpSemanticHighlighting(SemanticHighlightings.STATIC_CONST_FIELD);
|
|
||||||
// Position[] expected= new Position[] {
|
|
||||||
// createPosition(6, 18, 16),
|
|
||||||
// createPosition(35, 37, 16),
|
|
||||||
// };
|
|
||||||
// Position[] actual= getSemanticHighlightingPositions();
|
|
||||||
//// System.out.println(toString(actual));
|
|
||||||
// assertEqualPositions(expected, actual);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public void testStaticFieldHighlighting() throws Exception {
|
public void testStaticFieldHighlighting() throws Exception {
|
||||||
setUpSemanticHighlighting(SemanticHighlightings.STATIC_FIELD);
|
setUpSemanticHighlighting(SemanticHighlightings.STATIC_FIELD);
|
||||||
Position[] actual= getSemanticHighlightingPositions();
|
Position[] actual= getSemanticHighlightingPositions();
|
||||||
|
@ -108,12 +97,9 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
|
||||||
createPosition(63, 8, 10),
|
createPosition(63, 8, 10),
|
||||||
createPosition(77, 4, 13),
|
createPosition(77, 4, 13),
|
||||||
createPosition(104, 4, 26),
|
createPosition(104, 4, 26),
|
||||||
createPosition(104, 20, 10),
|
|
||||||
createPosition(108, 4, 25),
|
createPosition(108, 4, 25),
|
||||||
createPosition(108, 20, 9),
|
|
||||||
createPosition(113, 4, 32),
|
createPosition(113, 4, 32),
|
||||||
createPosition(113, 20, 16),
|
};
|
||||||
};
|
|
||||||
if (PRINT_POSITIONS) System.out.println(toString(actual));
|
if (PRINT_POSITIONS) System.out.println(toString(actual));
|
||||||
assertEqualPositions(expected, actual);
|
assertEqualPositions(expected, actual);
|
||||||
}
|
}
|
||||||
|
@ -129,50 +115,25 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
|
||||||
createPosition(63, 8, 10),
|
createPosition(63, 8, 10),
|
||||||
createPosition(77, 4, 13),
|
createPosition(77, 4, 13),
|
||||||
createPosition(104, 4, 26),
|
createPosition(104, 4, 26),
|
||||||
createPosition(104, 20, 10),
|
|
||||||
createPosition(108, 4, 25),
|
createPosition(108, 4, 25),
|
||||||
createPosition(108, 20, 9),
|
|
||||||
createPosition(113, 4, 32),
|
createPosition(113, 4, 32),
|
||||||
createPosition(113, 20, 16),
|
|
||||||
createPosition(114, 23, 9),
|
createPosition(114, 23, 9),
|
||||||
createPosition(118, 4, 15),
|
createPosition(118, 4, 15),
|
||||||
};
|
};
|
||||||
Position[] actual= getSemanticHighlightingPositions();
|
Position[] actual= getSemanticHighlightingPositions();
|
||||||
if (PRINT_POSITIONS) System.out.println(toString(actual));
|
if (PRINT_POSITIONS) System.out.println(toString(actual));
|
||||||
assertEqualPositions(expected, actual);
|
assertEqualPositions(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void testStaticMethodInvocationHighlighting() throws Exception {
|
public void testStaticMethodInvocationHighlighting() throws Exception {
|
||||||
// setUpSemanticHighlighting(SemanticHighlightings.STATIC_METHOD_INVOCATION);
|
setUpSemanticHighlighting(SemanticHighlightings.STATIC_METHOD_INVOCATION);
|
||||||
// Position[] expected= new Position[] {
|
Position[] expected= new Position[] {
|
||||||
// };
|
createPosition(118, 4, 15),
|
||||||
// Position[] actual= getSemanticHighlightingPositions();
|
};
|
||||||
// System.out.println(toString(actual));
|
Position[] actual= getSemanticHighlightingPositions();
|
||||||
// assertEqualPositions(expected, actual);
|
System.out.println(toString(actual));
|
||||||
// }
|
assertEqualPositions(expected, actual);
|
||||||
|
}
|
||||||
/*
|
|
||||||
*/
|
|
||||||
// public void testVirtualMethodInvocationHighlighting() throws Exception {
|
|
||||||
// setUpSemanticHighlighting(SemanticHighlightings.VIRTUAL_METHOD_INVOCATION);
|
|
||||||
// Position[] expected= new Position[] {
|
|
||||||
// createPosition(11, 2, 14),
|
|
||||||
// };
|
|
||||||
// Position[] actual= getSemanticHighlightingPositions();
|
|
||||||
//// System.out.println(toString(actual));
|
|
||||||
// assertEqualPositions(expected, actual);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// public void testInheritedMethodInvocationHighlighting() throws Exception {
|
|
||||||
// setUpSemanticHighlighting(SemanticHighlightings.INHERITED_METHOD_INVOCATION);
|
|
||||||
// Position[] expected= new Position[] {
|
|
||||||
// createPosition(12, 2, 8),
|
|
||||||
// createPosition(15, 17, 8),
|
|
||||||
// };
|
|
||||||
// Position[] actual= getSemanticHighlightingPositions();
|
|
||||||
//// System.out.println(toString(actual));
|
|
||||||
// assertEqualPositions(expected, actual);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public void testLocalVariableDeclarationHighlighting() throws Exception {
|
public void testLocalVariableDeclarationHighlighting() throws Exception {
|
||||||
setUpSemanticHighlighting(SemanticHighlightings.LOCAL_VARIABLE_DECLARATION);
|
setUpSemanticHighlighting(SemanticHighlightings.LOCAL_VARIABLE_DECLARATION);
|
||||||
|
@ -206,7 +167,6 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
|
||||||
Position[] expected= new Position[] {
|
Position[] expected= new Position[] {
|
||||||
createPosition(11, 20, 1),
|
createPosition(11, 20, 1),
|
||||||
createPosition(28, 35, 3),
|
createPosition(28, 35, 3),
|
||||||
createPosition(29, 8, 19),
|
|
||||||
createPosition(30, 19, 3),
|
createPosition(30, 19, 3),
|
||||||
createPosition(77, 21, 4),
|
createPosition(77, 21, 4),
|
||||||
createPosition(77, 30, 4),
|
createPosition(77, 30, 4),
|
||||||
|
@ -234,16 +194,6 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
|
||||||
assertEqualPositions(expected, actual);
|
assertEqualPositions(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
// public void testTemplateArgumentHighlighting() throws Exception {
|
|
||||||
// setUpSemanticHighlighting(SemanticHighlightings.TEMPLATE_ARGUMENT);
|
|
||||||
// Position[] actual= getSemanticHighlightingPositions();
|
|
||||||
// Position[] expected= new Position[] {
|
|
||||||
// createPosition(41, 8, 6),
|
|
||||||
// };
|
|
||||||
//// System.out.println(toString(actual));
|
|
||||||
// assertEqualPositions(expected, actual);
|
|
||||||
// }
|
|
||||||
|
|
||||||
public void testEnumHighlighting() throws Exception {
|
public void testEnumHighlighting() throws Exception {
|
||||||
setUpSemanticHighlighting(SemanticHighlightings.ENUM);
|
setUpSemanticHighlighting(SemanticHighlightings.ENUM);
|
||||||
Position[] actual= getSemanticHighlightingPositions();
|
Position[] actual= getSemanticHighlightingPositions();
|
||||||
|
@ -282,11 +232,13 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
|
||||||
createPosition(74, 35, 13),
|
createPosition(74, 35, 13),
|
||||||
createPosition(83, 25, 24),
|
createPosition(83, 25, 24),
|
||||||
createPosition(83, 52, 13),
|
createPosition(83, 52, 13),
|
||||||
createPosition(83, 52, 24),
|
|
||||||
createPosition(83, 70, 5),
|
createPosition(83, 70, 5),
|
||||||
createPosition(86, 7, 9),
|
createPosition(86, 7, 9),
|
||||||
createPosition(90, 6, 8),
|
createPosition(90, 6, 8),
|
||||||
createPosition(94, 8, 8),
|
createPosition(94, 8, 8),
|
||||||
|
createPosition(104, 4, 14),
|
||||||
|
createPosition(108, 4, 14),
|
||||||
|
createPosition(113, 4, 14),
|
||||||
createPosition(114, 4, 9),
|
createPosition(114, 4, 9),
|
||||||
createPosition(116, 4, 8),
|
createPosition(116, 4, 8),
|
||||||
};
|
};
|
||||||
|
@ -314,11 +266,9 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
|
||||||
createPosition(11, 5, 10),
|
createPosition(11, 5, 10),
|
||||||
createPosition(12, 12, 16),
|
createPosition(12, 12, 16),
|
||||||
createPosition(19, 16, 10),
|
createPosition(19, 16, 10),
|
||||||
createPosition(29, 8, 19),
|
|
||||||
createPosition(30, 8, 10),
|
createPosition(30, 8, 10),
|
||||||
createPosition(98, 8, 13),
|
createPosition(98, 8, 13),
|
||||||
createPosition(99, 1, 16),
|
createPosition(99, 1, 16),
|
||||||
createPosition(120, 4, 17),
|
|
||||||
};
|
};
|
||||||
if (PRINT_POSITIONS) System.out.println(toString(actual));
|
if (PRINT_POSITIONS) System.out.println(toString(actual));
|
||||||
assertEqualPositions(expected, actual);
|
assertEqualPositions(expected, actual);
|
||||||
|
@ -340,15 +290,26 @@ public class SemanticHighlightingTest extends AbstractSemanticHighlightingTest {
|
||||||
assertEqualPositions(expected, actual);
|
assertEqualPositions(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testMacroSubstitutionHighlighting() throws Exception {
|
public void testMacroDefinitionHighlighting() throws Exception {
|
||||||
setUpSemanticHighlighting(SemanticHighlightings.MACRO_SUBSTITUTION);
|
setUpSemanticHighlighting(SemanticHighlightings.MACRO_DEFINITION);
|
||||||
Position[] actual= getSemanticHighlightingPositions();
|
Position[] actual= getSemanticHighlightingPositions();
|
||||||
Position[] expected= new Position[] {
|
Position[] expected= new Position[] {
|
||||||
createPosition(29, 8, 19),
|
createPosition(0, 8, 3),
|
||||||
|
createPosition(1, 8, 14),
|
||||||
|
};
|
||||||
|
if (PRINT_POSITIONS) System.out.println(toString(actual));
|
||||||
|
assertEqualPositions(expected, actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void testMacroReferencesHighlighting() throws Exception {
|
||||||
|
setUpSemanticHighlighting(SemanticHighlightings.MACRO_REFERENCE);
|
||||||
|
Position[] actual= getSemanticHighlightingPositions();
|
||||||
|
Position[] expected= new Position[] {
|
||||||
|
createPosition(29, 8, 14),
|
||||||
createPosition(104, 0, 3),
|
createPosition(104, 0, 3),
|
||||||
createPosition(108, 0, 3),
|
createPosition(108, 0, 3),
|
||||||
createPosition(113, 0, 3),
|
createPosition(113, 0, 3),
|
||||||
createPosition(120, 4, 17),
|
createPosition(120, 4, 14),
|
||||||
};
|
};
|
||||||
if (PRINT_POSITIONS) System.out.println(toString(actual));
|
if (PRINT_POSITIONS) System.out.println(toString(actual));
|
||||||
assertEqualPositions(expected, actual);
|
assertEqualPositions(expected, actual);
|
||||||
|
|
|
@ -153,8 +153,6 @@ SemanticHighlighting_staticField= Static fields
|
||||||
SemanticHighlighting_staticConstField= Constants
|
SemanticHighlighting_staticConstField= Constants
|
||||||
SemanticHighlighting_methodDeclaration= Method declarations
|
SemanticHighlighting_methodDeclaration= Method declarations
|
||||||
SemanticHighlighting_staticMethodInvocation= Static method invocations
|
SemanticHighlighting_staticMethodInvocation= Static method invocations
|
||||||
SemanticHighlighting_virtualMethodInvocation= Virtual method invocations
|
|
||||||
SemanticHighlighting_inheritedMethodInvocation= Inherited method invocations
|
|
||||||
SemanticHighlighting_localVariableDeclaration= Local variable declarations
|
SemanticHighlighting_localVariableDeclaration= Local variable declarations
|
||||||
SemanticHighlighting_localVariable= Local variable references
|
SemanticHighlighting_localVariable= Local variable references
|
||||||
SemanticHighlighting_globalVariable= Global variables
|
SemanticHighlighting_globalVariable= Global variables
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2006 IBM Corporation and others.
|
* Copyright (c) 2000, 2007 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -84,20 +84,4 @@ public abstract class SemanticHighlighting {
|
||||||
* @return <code>true</code> iff the semantic highlighting consumes the semantic token
|
* @return <code>true</code> iff the semantic highlighting consumes the semantic token
|
||||||
*/
|
*/
|
||||||
public abstract boolean consumes(SemanticToken token);
|
public abstract boolean consumes(SemanticToken token);
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns <code>true</code> iff the semantic highlighting consumes the
|
|
||||||
* semantic token.
|
|
||||||
* <p>
|
|
||||||
* NOTE: Implementors are not allowed to keep a reference on the token or on
|
|
||||||
* any object retrieved from the token.
|
|
||||||
* </p>
|
|
||||||
* @param token the semantic token for a
|
|
||||||
* {@link org.eclipse.cdt.core.dom.ast.IASTLiteralExpression}
|
|
||||||
* @return <code>true</code> iff the semantic highlighting consumes the
|
|
||||||
* semantic token
|
|
||||||
*/
|
|
||||||
public boolean consumesLiteral(SemanticToken token) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2006 IBM Corporation and others.
|
* Copyright (c) 2000, 2007 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -39,6 +39,8 @@ import org.eclipse.cdt.core.dom.ast.IASTMacroExpansion;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
|
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTPreprocessorMacroDefinition;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IASTStatement;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit;
|
||||||
import org.eclipse.cdt.core.model.ICElement;
|
import org.eclipse.cdt.core.model.ICElement;
|
||||||
import org.eclipse.cdt.ui.CUIPlugin;
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
|
@ -62,9 +64,11 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
|
||||||
*/
|
*/
|
||||||
private class PositionCollector extends ASTVisitor {
|
private class PositionCollector extends ASTVisitor {
|
||||||
{
|
{
|
||||||
|
shouldVisitTranslationUnit= true;
|
||||||
shouldVisitNames= true;
|
shouldVisitNames= true;
|
||||||
shouldVisitDeclarations= true;
|
shouldVisitDeclarations= true;
|
||||||
shouldVisitExpressions= true;
|
shouldVisitExpressions= true;
|
||||||
|
shouldVisitStatements= true;
|
||||||
shouldVisitDeclSpecifiers= true;
|
shouldVisitDeclSpecifiers= true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,6 +86,21 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
|
||||||
fPositionTracker= positionTracker;
|
fPositionTracker= positionTracker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTTranslationUnit)
|
||||||
|
*/
|
||||||
|
public int visit(IASTTranslationUnit tu) {
|
||||||
|
// visit macro definitions
|
||||||
|
IASTPreprocessorMacroDefinition[] macroDefs= tu.getMacroDefinitions();
|
||||||
|
for (int i= 0; i < macroDefs.length; i++) {
|
||||||
|
IASTPreprocessorMacroDefinition macroDef= macroDefs[i];
|
||||||
|
if (fFilePath.equals(macroDef.getContainingFilename())) {
|
||||||
|
visit(macroDef.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.visit(tu);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
|
* @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTDeclaration)
|
||||||
*/
|
*/
|
||||||
|
@ -115,29 +134,63 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTStatement)
|
||||||
|
*/
|
||||||
|
public int visit(IASTStatement statement) {
|
||||||
|
if (checkForMacro(statement)) {
|
||||||
|
return PROCESS_SKIP;
|
||||||
|
}
|
||||||
|
return PROCESS_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTName)
|
* @see org.eclipse.cdt.core.dom.ast.ASTVisitor#visit(org.eclipse.cdt.core.dom.ast.IASTName)
|
||||||
*/
|
*/
|
||||||
public int visit(IASTName node) {
|
public int visit(IASTName node) {
|
||||||
visitNode(node);
|
if (visitNode(node)) {
|
||||||
|
return PROCESS_SKIP;
|
||||||
|
}
|
||||||
return PROCESS_CONTINUE;
|
return PROCESS_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkForMacro(IASTNode node) {
|
private boolean checkForMacro(IASTNode node) {
|
||||||
IASTNodeLocation[] nodeLocations= node.getNodeLocations();
|
IASTNodeLocation[] nodeLocations= node.getNodeLocations();
|
||||||
if (nodeLocations.length == 1 && nodeLocations[0] instanceof IASTMacroExpansion) {
|
if (nodeLocations.length == 1 && nodeLocations[0] instanceof IASTMacroExpansion) {
|
||||||
return visitNode(node);
|
IASTNodeLocation useLocation= getMinFileLocation(nodeLocations);
|
||||||
|
if (useLocation != null) {
|
||||||
|
IASTPreprocessorMacroDefinition macroDef= ((IASTMacroExpansion)nodeLocations[0]).getMacroDefinition();
|
||||||
|
IASTNodeLocation defLocation= macroDef.getName().getFileLocation();
|
||||||
|
IASTNode macroNode= node.getTranslationUnit().selectNodeForLocation(fFilePath, useLocation.getNodeOffset(), defLocation.getNodeLength());
|
||||||
|
if (macroNode != null && visitMacro(macroNode, defLocation.getNodeLength())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean visitMacro(IASTNode node, int macroLength) {
|
||||||
|
fToken.update(node);
|
||||||
|
for (int i= 0, n= fJobSemanticHighlightings.length; i < n; ++i) {
|
||||||
|
SemanticHighlighting semanticHighlighting= fJobSemanticHighlightings[i];
|
||||||
|
if (fJobHighlightings[i].isEnabled() && semanticHighlighting.consumes(fToken)) {
|
||||||
|
addMacroLocation(node.getFileLocation(), macroLength, fJobHighlightings[i]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fToken.clear();
|
||||||
|
// always consume this node
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean visitNode(IASTNode node) {
|
private boolean visitNode(IASTNode node) {
|
||||||
boolean consumed= false;
|
boolean consumed= false;
|
||||||
fToken.update(node);
|
fToken.update(node);
|
||||||
for (int i= 0, n= fJobSemanticHighlightings.length; i < n; ++i) {
|
for (int i= 0, n= fJobSemanticHighlightings.length; i < n; ++i) {
|
||||||
SemanticHighlighting semanticHighlighting= fJobSemanticHighlightings[i];
|
SemanticHighlighting semanticHighlighting= fJobSemanticHighlightings[i];
|
||||||
if (fJobHighlightings[i].isEnabled() && semanticHighlighting.consumes(fToken)) {
|
if (fJobHighlightings[i].isEnabled() && semanticHighlighting.consumes(fToken)) {
|
||||||
addNodeLocations(node.getNodeLocations(), fJobHighlightings[i]);
|
addNodeLocation(node.getFileLocation(), fJobHighlightings[i]);
|
||||||
consumed= true;
|
consumed= true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -149,20 +202,15 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
|
||||||
/**
|
/**
|
||||||
* Add the a location range for the given highlighting.
|
* Add the a location range for the given highlighting.
|
||||||
*
|
*
|
||||||
* @param nodeLocations The node locations
|
* @param nodeLocation The node location
|
||||||
* @param highlighting The highlighting
|
* @param highlighting The highlighting
|
||||||
*/
|
*/
|
||||||
private void addNodeLocations(IASTNodeLocation[] nodeLocations, HighlightingStyle highlighting) {
|
private void addNodeLocation(IASTNodeLocation nodeLocation, HighlightingStyle highlighting) {
|
||||||
final IASTFileLocation minLocation= getMinFileLocation(nodeLocations);
|
if (nodeLocation == null) {
|
||||||
if (minLocation == null) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final IASTFileLocation maxLocation= getMaxFileLocation(nodeLocations);
|
int offset= nodeLocation.getNodeOffset();
|
||||||
if (maxLocation == null) {
|
int length= nodeLocation.getNodeLength();
|
||||||
return;
|
|
||||||
}
|
|
||||||
int offset= minLocation.getNodeOffset();
|
|
||||||
int length= maxLocation.getNodeOffset() + maxLocation.getNodeLength() - offset;
|
|
||||||
if (fPositionTracker != null) {
|
if (fPositionTracker != null) {
|
||||||
IRegion actualPos= fPositionTracker.historicToActual(new Region(offset, length));
|
IRegion actualPos= fPositionTracker.historicToActual(new Region(offset, length));
|
||||||
offset= actualPos.getOffset();
|
offset= actualPos.getOffset();
|
||||||
|
@ -173,18 +221,27 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private IASTFileLocation getMaxFileLocation(IASTNodeLocation[] locations) {
|
/**
|
||||||
if (locations == null || locations.length == 0) {
|
* Add the a location range for the given macro highlighting.
|
||||||
return null;
|
*
|
||||||
|
* @param macroUseLocaton The location of the macro occurrence
|
||||||
|
* @param macroLength the length of the macro name
|
||||||
|
* @param highlighting The highlighting
|
||||||
|
*/
|
||||||
|
private void addMacroLocation(IASTNodeLocation macroUseLocation, int macroLength, HighlightingStyle highlighting) {
|
||||||
|
if (macroUseLocation == null) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
final IASTNodeLocation nodeLocation= locations[locations.length-1];
|
int offset= macroUseLocation.getNodeOffset();
|
||||||
if (nodeLocation instanceof IASTFileLocation) {
|
int length= macroLength;
|
||||||
return (IASTFileLocation)nodeLocation;
|
if (fPositionTracker != null) {
|
||||||
} else if (nodeLocation instanceof IASTMacroExpansion) {
|
IRegion actualPos= fPositionTracker.historicToActual(new Region(offset, length));
|
||||||
IASTNodeLocation[] macroLocations= ((IASTMacroExpansion)nodeLocation).getExpansionLocations();
|
offset= actualPos.getOffset();
|
||||||
return getMaxFileLocation(macroLocations);
|
length= actualPos.getLength();
|
||||||
|
}
|
||||||
|
if (offset > -1 && length > 0) {
|
||||||
|
addPosition(offset, length, highlighting);
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private IASTFileLocation getMinFileLocation(IASTNodeLocation[] locations) {
|
private IASTFileLocation getMinFileLocation(IASTNodeLocation[] locations) {
|
||||||
|
@ -298,14 +355,11 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
|
||||||
return;
|
return;
|
||||||
|
|
||||||
PositionCollector collector= new PositionCollector(ast.getFilePath(), positionTracker);
|
PositionCollector collector= new PositionCollector(ast.getFilePath(), positionTracker);
|
||||||
IASTNode[] subtrees= getAffectedSubtrees(ast);
|
|
||||||
if (subtrees.length == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
startReconcilingPositions();
|
startReconcilingPositions();
|
||||||
|
|
||||||
if (!fJobPresenter.isCanceled())
|
if (!fJobPresenter.isCanceled())
|
||||||
reconcilePositions(subtrees, collector);
|
reconcilePositions(ast, collector);
|
||||||
|
|
||||||
TextPresentation textPresentation= null;
|
TextPresentation textPresentation= null;
|
||||||
if (!fJobPresenter.isCanceled())
|
if (!fJobPresenter.isCanceled())
|
||||||
|
@ -325,14 +379,6 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param node Root node
|
|
||||||
* @return Array of subtrees that may be affected by past document changes
|
|
||||||
*/
|
|
||||||
private IASTNode[] getAffectedSubtrees(IASTNode node) {
|
|
||||||
return new IASTNode[] { node };
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start reconciling positions.
|
* Start reconciling positions.
|
||||||
*/
|
*/
|
||||||
|
@ -342,15 +388,13 @@ public class SemanticHighlightingReconciler implements ICReconcilingListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reconcile positions based on the AST subtrees
|
* Reconcile positions based on the AST.
|
||||||
*
|
*
|
||||||
* @param subtrees the AST subtrees
|
* @param ast the AST
|
||||||
|
* @param visitor the AST visitor
|
||||||
*/
|
*/
|
||||||
private void reconcilePositions(IASTNode[] subtrees, ASTVisitor visitor) {
|
private void reconcilePositions(IASTTranslationUnit ast, PositionCollector visitor) {
|
||||||
// FIXME: remove positions not covered by subtrees
|
ast.accept(visitor);
|
||||||
for (int i= 0, n= subtrees.length; i < n; i++) {
|
|
||||||
subtrees[i].accept(visitor);
|
|
||||||
}
|
|
||||||
List oldPositions= fRemovedPositions;
|
List oldPositions= fRemovedPositions;
|
||||||
List newPositions= new ArrayList(fNOfRemovedPositions);
|
List newPositions= new ArrayList(fNOfRemovedPositions);
|
||||||
for (int i= 0, n= oldPositions.size(); i < n; i ++) {
|
for (int i= 0, n= oldPositions.size(); i < n; i ++) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2006 IBM Corporation and others.
|
* Copyright (c) 2000, 2007 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -21,10 +21,8 @@ import org.eclipse.swt.graphics.RGB;
|
||||||
import org.eclipse.cdt.core.dom.ast.DOMException;
|
import org.eclipse.cdt.core.dom.ast.DOMException;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTMacroExpansion;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTName;
|
import org.eclipse.cdt.core.dom.ast.IASTName;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTNodeLocation;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.IASTProblem;
|
import org.eclipse.cdt.core.dom.ast.IASTProblem;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
import org.eclipse.cdt.core.dom.ast.IEnumeration;
|
||||||
|
@ -32,6 +30,7 @@ import org.eclipse.cdt.core.dom.ast.IEnumerator;
|
||||||
import org.eclipse.cdt.core.dom.ast.IField;
|
import org.eclipse.cdt.core.dom.ast.IField;
|
||||||
import org.eclipse.cdt.core.dom.ast.IFunction;
|
import org.eclipse.cdt.core.dom.ast.IFunction;
|
||||||
import org.eclipse.cdt.core.dom.ast.ILabel;
|
import org.eclipse.cdt.core.dom.ast.ILabel;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.IMacroBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IParameter;
|
import org.eclipse.cdt.core.dom.ast.IParameter;
|
||||||
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
import org.eclipse.cdt.core.dom.ast.IProblemBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
|
@ -41,6 +40,7 @@ import org.eclipse.cdt.core.dom.ast.c.ICFunctionScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTCompositeTypeSpecifier;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTFunctionDeclarator;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||||
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPBlockScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPClassType;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPFunctionScope;
|
||||||
|
@ -60,11 +60,6 @@ public class SemanticHighlightings {
|
||||||
|
|
||||||
private static final RGB RGB_BLACK = new RGB(0, 0, 0);
|
private static final RGB RGB_BLACK = new RGB(0, 0, 0);
|
||||||
|
|
||||||
/**
|
|
||||||
* A named preference part that controls the highlighting of static const fields.
|
|
||||||
*/
|
|
||||||
public static final String STATIC_CONST_FIELD="staticConstField"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A named preference part that controls the highlighting of static fields.
|
* A named preference part that controls the highlighting of static fields.
|
||||||
*/
|
*/
|
||||||
|
@ -83,17 +78,7 @@ public class SemanticHighlightings {
|
||||||
/**
|
/**
|
||||||
* A named preference part that controls the highlighting of static method invocations.
|
* A named preference part that controls the highlighting of static method invocations.
|
||||||
*/
|
*/
|
||||||
public static final String STATIC_METHOD_INVOCATION="staticMethodInvocation"; //$NON-NLS-1$
|
public static final String STATIC_METHOD_INVOCATION="staticMethod"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
|
||||||
* A named preference part that controls the highlighting of inherited method invocations.
|
|
||||||
*/
|
|
||||||
public static final String INHERITED_METHOD_INVOCATION="inheritedMethodInvocation"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A named preference part that controls the highlighting of virtual method invocations.
|
|
||||||
*/
|
|
||||||
public static final String VIRTUAL_METHOD_INVOCATION="virtualMethodInvocation"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A named preference part that controls the highlighting of function declarations.
|
* A named preference part that controls the highlighting of function declarations.
|
||||||
|
@ -146,15 +131,9 @@ public class SemanticHighlightings {
|
||||||
public static final String ENUM="enum"; //$NON-NLS-1$
|
public static final String ENUM="enum"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A named preference part that controls the highlighting of template arguments.
|
* A named preference part that controls the highlighting of macro references.
|
||||||
*/
|
*/
|
||||||
public static final String TEMPLATE_ARGUMENT="templateArgument"; //$NON-NLS-1$
|
public static final String MACRO_REFERENCE="macroSubstitution"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
|
||||||
* A named preference part that controls the highlighting of macro substitutions
|
|
||||||
* (=references).
|
|
||||||
*/
|
|
||||||
public static final String MACRO_SUBSTITUTION="macroSubstitution"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A named preference part that controls the highlighting of macro definitions.
|
* A named preference part that controls the highlighting of macro definitions.
|
||||||
|
@ -194,73 +173,6 @@ public class SemanticHighlightings {
|
||||||
*/
|
*/
|
||||||
private static SemanticHighlighting[] fgSemanticHighlightings;
|
private static SemanticHighlighting[] fgSemanticHighlightings;
|
||||||
|
|
||||||
/**
|
|
||||||
* Semantic highlighting for static const fields.
|
|
||||||
*/
|
|
||||||
// private static final class StaticConstFieldHighlighting extends SemanticHighlighting {
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
|
|
||||||
// */
|
|
||||||
// public String getPreferenceKey() {
|
|
||||||
// return STATIC_CONST_FIELD;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor()
|
|
||||||
// */
|
|
||||||
// public RGB getDefaultTextColor() {
|
|
||||||
// return RGB_BLACK;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
|
|
||||||
// */
|
|
||||||
// public boolean isBoldByDefault() {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
|
|
||||||
// */
|
|
||||||
// public boolean isItalicByDefault() {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
|
|
||||||
// */
|
|
||||||
// public boolean isEnabledByDefault() {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
|
|
||||||
// */
|
|
||||||
// public String getDisplayName() {
|
|
||||||
// return CEditorMessages.getString("SemanticHighlighting_staticConstField"); //$NON-NLS-1$
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
|
|
||||||
// */
|
|
||||||
// public boolean consumes(SemanticToken token) {
|
|
||||||
// IBinding binding= token.getBinding();
|
|
||||||
// if (binding instanceof ICPPField && !(binding instanceof IProblemBinding)) {
|
|
||||||
// ICPPField field= (ICPPField)binding;
|
|
||||||
// try {
|
|
||||||
// // TLETODO [semanticHighlighting] need access to const storage class
|
|
||||||
// return field.isStatic() /* && field.isConst() */;
|
|
||||||
// } catch (DOMException exc) {
|
|
||||||
// CUIPlugin.getDefault().log(exc.getStatus());
|
|
||||||
// } catch (Error e) /* PDOMNotImplementedError */ {
|
|
||||||
// // ignore
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Semantic highlighting for static fields.
|
* Semantic highlighting for static fields.
|
||||||
*/
|
*/
|
||||||
|
@ -312,14 +224,21 @@ public class SemanticHighlightings {
|
||||||
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
|
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
|
||||||
*/
|
*/
|
||||||
public boolean consumes(SemanticToken token) {
|
public boolean consumes(SemanticToken token) {
|
||||||
IBinding binding= token.getBinding();
|
IASTNode node= token.getNode();
|
||||||
if (binding instanceof IField && !(binding instanceof IProblemBinding)) {
|
if (node instanceof IASTName) {
|
||||||
try {
|
IASTName name= (IASTName)node;
|
||||||
return ((IField)binding).isStatic();
|
if (name instanceof ICPPASTQualifiedName && name.isReference()) {
|
||||||
} catch (DOMException exc) {
|
return false;
|
||||||
CUIPlugin.getDefault().log(exc);
|
}
|
||||||
} catch (Error e) /* PDOMNotImplementedError */ {
|
IBinding binding= token.getBinding();
|
||||||
// ignore
|
if (binding instanceof IField && !(binding instanceof IProblemBinding)) {
|
||||||
|
try {
|
||||||
|
return ((IField)binding).isStatic();
|
||||||
|
} catch (DOMException exc) {
|
||||||
|
CUIPlugin.getDefault().log(exc);
|
||||||
|
} catch (Error e) /* PDOMNotImplementedError */ {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -377,9 +296,16 @@ public class SemanticHighlightings {
|
||||||
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
|
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
|
||||||
*/
|
*/
|
||||||
public boolean consumes(SemanticToken token) {
|
public boolean consumes(SemanticToken token) {
|
||||||
IBinding binding= token.getBinding();
|
IASTNode node= token.getNode();
|
||||||
if (binding instanceof IField) {
|
if (node instanceof IASTName) {
|
||||||
return true;
|
IASTName name= (IASTName)node;
|
||||||
|
if (name instanceof ICPPASTQualifiedName && name.isReference()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
IBinding binding= token.getBinding();
|
||||||
|
if (binding instanceof IField) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -439,7 +365,7 @@ public class SemanticHighlightings {
|
||||||
IASTNode node= token.getNode();
|
IASTNode node= token.getNode();
|
||||||
if (node instanceof IASTName) {
|
if (node instanceof IASTName) {
|
||||||
IASTName name= (IASTName)node;
|
IASTName name= (IASTName)node;
|
||||||
if (name.isDeclaration() || name.isDefinition()) {
|
if (!name.isReference()) {
|
||||||
IBinding binding= token.getBinding();
|
IBinding binding= token.getBinding();
|
||||||
if (binding instanceof ICPPMethod) {
|
if (binding instanceof ICPPMethod) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -477,198 +403,77 @@ public class SemanticHighlightings {
|
||||||
/**
|
/**
|
||||||
* Semantic highlighting for static method invocations.
|
* Semantic highlighting for static method invocations.
|
||||||
*/
|
*/
|
||||||
// private static final class StaticMethodInvocationHighlighting extends SemanticHighlighting {
|
private static final class StaticMethodInvocationHighlighting extends SemanticHighlighting {
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
|
|
||||||
// */
|
|
||||||
// public String getPreferenceKey() {
|
|
||||||
// return STATIC_METHOD_INVOCATION;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor()
|
|
||||||
// */
|
|
||||||
// public RGB getDefaultTextColor() {
|
|
||||||
// return RGB_BLACK;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
|
|
||||||
// */
|
|
||||||
// public boolean isBoldByDefault() {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
|
|
||||||
// */
|
|
||||||
// public boolean isItalicByDefault() {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
|
|
||||||
// */
|
|
||||||
// public boolean isEnabledByDefault() {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
|
|
||||||
// */
|
|
||||||
// public String getDisplayName() {
|
|
||||||
// return CEditorMessages.getString("SemanticHighlighting_staticMethodInvocation"); //$NON-NLS-1$
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
|
|
||||||
// */
|
|
||||||
// public boolean consumes(SemanticToken token) {
|
|
||||||
// IASTNode node= token.getNode();
|
|
||||||
// if (node instanceof IASTName) {
|
|
||||||
// IASTName name= (IASTName)node;
|
|
||||||
// if (name.isReference()) {
|
|
||||||
// IBinding binding= token.getBinding();
|
|
||||||
// if (binding instanceof ICPPMethod) {
|
|
||||||
// try {
|
|
||||||
// return ((ICPPMethod)binding).isStatic();
|
|
||||||
// } catch (DOMException exc) {
|
|
||||||
// CUIPlugin.getDefault().log(exc.getStatus());
|
|
||||||
// } catch (Error e) /* PDOMNotImplementedError */ {
|
|
||||||
// // ignore
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Semantic highlighting for virtual method invocations.
|
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
|
||||||
*/
|
*/
|
||||||
// private static final class VirtualMethodInvocationHighlighting extends SemanticHighlighting {
|
public String getPreferenceKey() {
|
||||||
//
|
return STATIC_METHOD_INVOCATION;
|
||||||
// /*
|
}
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
|
|
||||||
// */
|
|
||||||
// public String getPreferenceKey() {
|
|
||||||
// return VIRTUAL_METHOD_INVOCATION;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor()
|
|
||||||
// */
|
|
||||||
// public RGB getDefaultTextColor() {
|
|
||||||
// return RGB_BLACK;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
|
|
||||||
// */
|
|
||||||
// public boolean isBoldByDefault() {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
|
|
||||||
// */
|
|
||||||
// public boolean isItalicByDefault() {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
|
|
||||||
// */
|
|
||||||
// public boolean isEnabledByDefault() {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
|
|
||||||
// */
|
|
||||||
// public String getDisplayName() {
|
|
||||||
// return CEditorMessages.getString("SemanticHighlighting_virtualMethodInvocation"); //$NON-NLS-1$
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
|
|
||||||
// */
|
|
||||||
// public boolean consumes(SemanticToken token) {
|
|
||||||
// IASTName node= token.getNode();
|
|
||||||
// if (node.isReference()) {
|
|
||||||
// IBinding binding= token.getBinding();
|
|
||||||
// if (binding instanceof ICPPMethod) {
|
|
||||||
// try {
|
|
||||||
// // TLETODO [semanticHighlighting] need proper check for virtual method
|
|
||||||
// return ((ICPPMethod)binding).isVirtual();
|
|
||||||
// } catch (DOMException exc) {
|
|
||||||
// CUIPlugin.getDefault().log(exc.getStatus());
|
|
||||||
// } catch (Error e) /* PDOMNotImplementedError */ {
|
|
||||||
// // ignore
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/*
|
||||||
* Semantic highlighting for inherited method invocations.
|
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor()
|
||||||
*/
|
*/
|
||||||
// private static final class InheritedMethodInvocationHighlighting extends SemanticHighlighting {
|
public RGB getDefaultTextColor() {
|
||||||
//
|
return RGB_BLACK;
|
||||||
// /*
|
}
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
|
|
||||||
// */
|
/*
|
||||||
// public String getPreferenceKey() {
|
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
|
||||||
// return INHERITED_METHOD_INVOCATION;
|
*/
|
||||||
// }
|
public boolean isBoldByDefault() {
|
||||||
//
|
return false;
|
||||||
// /*
|
}
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor()
|
|
||||||
// */
|
/*
|
||||||
// public RGB getDefaultTextColor() {
|
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
|
||||||
// return RGB_BLACK;
|
*/
|
||||||
// }
|
public boolean isItalicByDefault() {
|
||||||
//
|
return true;
|
||||||
// /*
|
}
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
|
|
||||||
// */
|
/*
|
||||||
// public boolean isBoldByDefault() {
|
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
|
||||||
// return false;
|
*/
|
||||||
// }
|
public boolean isEnabledByDefault() {
|
||||||
//
|
return true;
|
||||||
// /*
|
}
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
|
|
||||||
// */
|
/*
|
||||||
// public boolean isItalicByDefault() {
|
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
|
||||||
// return false;
|
*/
|
||||||
// }
|
public String getDisplayName() {
|
||||||
//
|
return CEditorMessages.getString("SemanticHighlighting_staticMethodInvocation"); //$NON-NLS-1$
|
||||||
// /*
|
}
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
|
|
||||||
// */
|
/*
|
||||||
// public boolean isEnabledByDefault() {
|
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
|
||||||
// return false;
|
*/
|
||||||
// }
|
public boolean consumes(SemanticToken token) {
|
||||||
//
|
IASTNode node= token.getNode();
|
||||||
// /*
|
if (node instanceof IASTName) {
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
|
IASTName name= (IASTName)node;
|
||||||
// */
|
if (name instanceof ICPPASTQualifiedName) {
|
||||||
// public String getDisplayName() {
|
return false;
|
||||||
// return CEditorMessages.getString("SemanticHighlighting_inheritedMethodInvocation"); //$NON-NLS-1$
|
}
|
||||||
// }
|
if (!name.isReference()) {
|
||||||
//
|
return false;
|
||||||
// /*
|
}
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
|
IBinding binding= token.getBinding();
|
||||||
// */
|
if (binding instanceof ICPPMethod) {
|
||||||
// public boolean consumes(SemanticToken token) {
|
try {
|
||||||
// // TLETODO [semanticHighlighting] inherited method invocation
|
return ((ICPPMethod)binding).isStatic();
|
||||||
// return false;
|
} catch (DOMException exc) {
|
||||||
// }
|
CUIPlugin.getDefault().log(exc);
|
||||||
// }
|
} catch (Error e) /* PDOMNotImplementedError */ {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Semantic highlighting for methods.
|
* Semantic highlighting for methods.
|
||||||
|
@ -723,6 +528,10 @@ public class SemanticHighlightings {
|
||||||
public boolean consumes(SemanticToken token) {
|
public boolean consumes(SemanticToken token) {
|
||||||
IASTNode node= token.getNode();
|
IASTNode node= token.getNode();
|
||||||
if (node instanceof IASTName) {
|
if (node instanceof IASTName) {
|
||||||
|
IASTName name= (IASTName)node;
|
||||||
|
if (name instanceof ICPPASTQualifiedName && name.isReference()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
IBinding binding= token.getBinding();
|
IBinding binding= token.getBinding();
|
||||||
if (binding instanceof ICPPMethod) {
|
if (binding instanceof ICPPMethod) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -1296,22 +1105,13 @@ public class SemanticHighlightings {
|
||||||
*/
|
*/
|
||||||
public boolean consumes(SemanticToken token) {
|
public boolean consumes(SemanticToken token) {
|
||||||
IASTNode node= token.getNode();
|
IASTNode node= token.getNode();
|
||||||
|
if (node instanceof ICPPASTQualifiedName || node instanceof ICPPASTTemplateId) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (node instanceof IASTName) {
|
if (node instanceof IASTName) {
|
||||||
IBinding binding= token.getBinding();
|
IBinding binding= token.getBinding();
|
||||||
if (binding instanceof ICPPClassType) {
|
if (binding instanceof ICPPClassType) {
|
||||||
IASTName name= (IASTName)node;
|
return true;
|
||||||
if (name.isReference()) {
|
|
||||||
if (node.getParent() instanceof ICPPASTQualifiedName) {
|
|
||||||
ICPPASTQualifiedName qName= (ICPPASTQualifiedName)node.getParent();
|
|
||||||
if (qName.getLastName() == name) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -1369,83 +1169,27 @@ public class SemanticHighlightings {
|
||||||
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
|
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
|
||||||
*/
|
*/
|
||||||
public boolean consumes(SemanticToken token) {
|
public boolean consumes(SemanticToken token) {
|
||||||
IBinding binding= token.getBinding();
|
IASTNode node= token.getNode();
|
||||||
if (binding instanceof IEnumeration) {
|
if (node instanceof IASTName) {
|
||||||
return true;
|
IBinding binding= token.getBinding();
|
||||||
|
if (binding instanceof IEnumeration) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Semantic highlighting for template arguments.
|
* Semantic highlighting for macro references.
|
||||||
*/
|
*/
|
||||||
// private static final class TemplateArgumentHighlighting extends SemanticHighlighting {
|
private static final class MacroReferenceHighlighting extends SemanticHighlighting {
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
|
|
||||||
// */
|
|
||||||
// public String getPreferenceKey() {
|
|
||||||
// return TEMPLATE_ARGUMENT;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor()
|
|
||||||
// */
|
|
||||||
// public RGB getDefaultTextColor() {
|
|
||||||
// return new RGB(13, 100, 0);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
|
|
||||||
// */
|
|
||||||
// public boolean isBoldByDefault() {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
|
|
||||||
// */
|
|
||||||
// public boolean isItalicByDefault() {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
|
|
||||||
// */
|
|
||||||
// public boolean isEnabledByDefault() {
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
|
|
||||||
// */
|
|
||||||
// public String getDisplayName() {
|
|
||||||
// return CEditorMessages.getString("SemanticHighlighting_templateArguments"); //$NON-NLS-1$
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /*
|
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
|
|
||||||
// */
|
|
||||||
// public boolean consumes(SemanticToken token) {
|
|
||||||
// IBinding binding= token.getBinding();
|
|
||||||
// if (binding instanceof ICPPTemplateParameter) {
|
|
||||||
// return true;
|
|
||||||
// }
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Semantic highlighting for macro substitutions (references).
|
|
||||||
*/
|
|
||||||
private static final class MacroSubstitutionHighlighting extends SemanticHighlighting {
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
|
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
|
||||||
*/
|
*/
|
||||||
public String getPreferenceKey() {
|
public String getPreferenceKey() {
|
||||||
return MACRO_SUBSTITUTION;
|
return MACRO_REFERENCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1487,10 +1231,12 @@ public class SemanticHighlightings {
|
||||||
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
|
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
|
||||||
*/
|
*/
|
||||||
public boolean consumes(SemanticToken token) {
|
public boolean consumes(SemanticToken token) {
|
||||||
IASTNode node= token.getNode();
|
IBinding binding= token.getBinding();
|
||||||
IASTNodeLocation[] nodeLocations= node.getNodeLocations();
|
if (binding instanceof IMacroBinding) {
|
||||||
if (nodeLocations.length == 1 && nodeLocations[0] instanceof IASTMacroExpansion) {
|
IASTName name= (IASTName)token.getNode();
|
||||||
return true;
|
if (name.isReference()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1499,61 +1245,64 @@ public class SemanticHighlightings {
|
||||||
/**
|
/**
|
||||||
* Semantic highlighting for macro definitions.
|
* Semantic highlighting for macro definitions.
|
||||||
*/
|
*/
|
||||||
// private static final class MacroDefinitionHighlighting extends SemanticHighlighting {
|
private static final class MacroDefinitionHighlighting extends SemanticHighlighting {
|
||||||
//
|
|
||||||
// /*
|
/*
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
|
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getPreferenceKey()
|
||||||
// */
|
*/
|
||||||
// public String getPreferenceKey() {
|
public String getPreferenceKey() {
|
||||||
// return MACRO_DEFINITION;
|
return MACRO_DEFINITION;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// /*
|
/*
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor()
|
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextColor()
|
||||||
// */
|
*/
|
||||||
// public RGB getDefaultTextColor() {
|
public RGB getDefaultTextColor() {
|
||||||
// return RGB_BLACK;
|
return RGB_BLACK;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// /*
|
/*
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
|
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDefaultTextStyleBold()
|
||||||
// */
|
*/
|
||||||
// public boolean isBoldByDefault() {
|
public boolean isBoldByDefault() {
|
||||||
// return false;
|
return false;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// /*
|
/*
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
|
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isItalicByDefault()
|
||||||
// */
|
*/
|
||||||
// public boolean isItalicByDefault() {
|
public boolean isItalicByDefault() {
|
||||||
// return false;
|
return false;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// /*
|
/*
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
|
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#isEnabledByDefault()
|
||||||
// */
|
*/
|
||||||
// public boolean isEnabledByDefault() {
|
public boolean isEnabledByDefault() {
|
||||||
// return false;
|
return false;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// /*
|
/*
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
|
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#getDisplayName()
|
||||||
// */
|
*/
|
||||||
// public String getDisplayName() {
|
public String getDisplayName() {
|
||||||
// return CEditorMessages.getString("SemanticHighlighting_macroDefinition"); //$NON-NLS-1$
|
return CEditorMessages.getString("SemanticHighlighting_macroDefintion"); //$NON-NLS-1$
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// /*
|
/*
|
||||||
// * @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
|
* @see org.eclipse.cdt.internal.ui.editor.SemanticHighlighting#consumes(org.eclipse.cdt.internal.ui.editor.SemanticToken)
|
||||||
// */
|
*/
|
||||||
// public boolean consumes(SemanticToken token) {
|
public boolean consumes(SemanticToken token) {
|
||||||
// IASTNode node= token.getNode();
|
IBinding binding= token.getBinding();
|
||||||
// if (node instanceof IASTName && node.getParent() instanceof IASTPreprocessorMacroDefinition) {
|
if (binding instanceof IMacroBinding) {
|
||||||
// return true;
|
IASTName name= (IASTName)token.getNode();
|
||||||
// }
|
if (!name.isReference()) {
|
||||||
// return false;
|
return true;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Semantic highlighting for typedefs.
|
* Semantic highlighting for typedefs.
|
||||||
|
@ -1927,31 +1676,21 @@ public class SemanticHighlightings {
|
||||||
public static SemanticHighlighting[] getSemanticHighlightings() {
|
public static SemanticHighlighting[] getSemanticHighlightings() {
|
||||||
if (fgSemanticHighlightings == null)
|
if (fgSemanticHighlightings == null)
|
||||||
fgSemanticHighlightings= new SemanticHighlighting[] {
|
fgSemanticHighlightings= new SemanticHighlighting[] {
|
||||||
new MacroSubstitutionHighlighting(), // before all others!
|
new MacroReferenceHighlighting(), // before all others!
|
||||||
new ProblemHighlighting(),
|
new ProblemHighlighting(),
|
||||||
new ClassHighlighting(),
|
new ClassHighlighting(),
|
||||||
// new StaticConstFieldHighlighting(),
|
|
||||||
new StaticFieldHighlighting(),
|
new StaticFieldHighlighting(),
|
||||||
new FieldHighlighting(), // after all other fields
|
new FieldHighlighting(), // after all other fields
|
||||||
new MethodDeclarationHighlighting(),
|
new MethodDeclarationHighlighting(),
|
||||||
// TLETODO [semanticHighlighting] Static method invocations
|
new StaticMethodInvocationHighlighting(),
|
||||||
// new StaticMethodInvocationHighlighting(),
|
|
||||||
// TLETODO [semanticHighlighting] Virtual method invocations
|
|
||||||
// new VirtualMethodInvocationHighlighting(),
|
|
||||||
// TLETODO [semanticHighlighting] Inherited method invocations
|
|
||||||
// new InheritedMethodInvocationHighlighting(),
|
|
||||||
new ParameterVariableHighlighting(), // before local variables
|
new ParameterVariableHighlighting(), // before local variables
|
||||||
new LocalVariableDeclarationHighlighting(),
|
new LocalVariableDeclarationHighlighting(),
|
||||||
new LocalVariableHighlighting(),
|
new LocalVariableHighlighting(),
|
||||||
new GlobalVariableHighlighting(),
|
new GlobalVariableHighlighting(),
|
||||||
// TLETODO [semanticHighlighting] Template parameter highlighting
|
|
||||||
new TemplateParameterHighlighting(), // before template arguments!
|
new TemplateParameterHighlighting(), // before template arguments!
|
||||||
new MethodHighlighting(), // before types to get ctors
|
new MethodHighlighting(), // before types to get ctors
|
||||||
// TLETODO [semanticHighlighting] Template argument highlighting
|
|
||||||
// new TemplateArgumentHighlighting(), // before other types
|
|
||||||
new EnumHighlighting(),
|
new EnumHighlighting(),
|
||||||
// TLETODO [semanticHighlighting] Macro definition highlighting
|
new MacroDefinitionHighlighting(),
|
||||||
// new MacroDefinitionHighlighting(),
|
|
||||||
new FunctionDeclarationHighlighting(),
|
new FunctionDeclarationHighlighting(),
|
||||||
new FunctionHighlighting(),
|
new FunctionHighlighting(),
|
||||||
new TypedefHighlighting(),
|
new TypedefHighlighting(),
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2006 IBM Corporation and others.
|
* Copyright (c) 2000, 2007 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -851,6 +851,7 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
||||||
*/
|
*/
|
||||||
private SemanticHighlightingManager.HighlightedRange[][] createPreviewerRanges() {
|
private SemanticHighlightingManager.HighlightedRange[][] createPreviewerRanges() {
|
||||||
return new SemanticHighlightingManager.HighlightedRange[][] {
|
return new SemanticHighlightingManager.HighlightedRange[][] {
|
||||||
|
{ createHighlightedRange( 2, 8, 5, SemanticHighlightings.MACRO_DEFINITION) },
|
||||||
{ createHighlightedRange( 3, 16, 3, SemanticHighlightings.NAMESPACE) },
|
{ createHighlightedRange( 3, 16, 3, SemanticHighlightings.NAMESPACE) },
|
||||||
{ createHighlightedRange( 5, 21, 4, SemanticHighlightings.TYPEDEF) },
|
{ createHighlightedRange( 5, 21, 4, SemanticHighlightings.TYPEDEF) },
|
||||||
{ createHighlightedRange( 6, 11, 6, SemanticHighlightings.FUNCTION_DECLARATION), createHighlightedRange( 6, 11, 6, SemanticHighlightings.FUNCTION) },
|
{ createHighlightedRange( 6, 11, 6, SemanticHighlightings.FUNCTION_DECLARATION), createHighlightedRange( 6, 11, 6, SemanticHighlightings.FUNCTION) },
|
||||||
|
@ -877,9 +878,11 @@ class CEditorColoringConfigurationBlock extends AbstractConfigurationBlock {
|
||||||
{ createHighlightedRange(18, 0, 5, SemanticHighlightings.LABEL) },
|
{ createHighlightedRange(18, 0, 5, SemanticHighlightings.LABEL) },
|
||||||
{ createHighlightedRange(18, 7, 6, SemanticHighlightings.FUNCTION) },
|
{ createHighlightedRange(18, 7, 6, SemanticHighlightings.FUNCTION) },
|
||||||
{ createHighlightedRange(18, 14, 5, SemanticHighlightings.LOCAL_VARIABLE) },
|
{ createHighlightedRange(18, 14, 5, SemanticHighlightings.LOCAL_VARIABLE) },
|
||||||
{ createHighlightedRange(18, 21, 11, SemanticHighlightings.MACRO_SUBSTITUTION) },
|
{ createHighlightedRange(18, 21, 5, SemanticHighlightings.MACRO_REFERENCE) },
|
||||||
{ createHighlightedRange(19, 4, 7, SemanticHighlightings.METHOD) },
|
{ createHighlightedRange(19, 4, 7, SemanticHighlightings.METHOD) },
|
||||||
{ createHighlightedRange(20, 4, 7, SemanticHighlightings.PROBLEM) },
|
{ createHighlightedRange(20, 4, 12, SemanticHighlightings.STATIC_METHOD_INVOCATION), createHighlightedRange(20, 4, 12, SemanticHighlightings.METHOD) },
|
||||||
|
{ createHighlightedRange(21, 4, 7, SemanticHighlightings.PROBLEM) },
|
||||||
|
{ createHighlightedRange(23, 14, 12, SemanticHighlightings.METHOD_DECLARATION), createHighlightedRange(23, 14, 12, SemanticHighlightings.METHOD) },
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,8 @@ public:
|
||||||
int local= (int)n;
|
int local= (int)n;
|
||||||
label: myfunc(local, MACRO('\0'));
|
label: myfunc(local, MACRO('\0'));
|
||||||
vmethod();
|
vmethod();
|
||||||
|
staticMethod();
|
||||||
problem();
|
problem();
|
||||||
}
|
}
|
||||||
|
static void staticMethod();
|
||||||
};
|
};
|
Loading…
Add table
Reference in a new issue