mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 01:15:29 +02:00
Fix for 195481: [Editor] Include header not highlighted if no space in between
This commit is contained in:
parent
d4c724562d
commit
4439294790
2 changed files with 19 additions and 9 deletions
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation.
|
||||
* Copyright (c) 2006, 2007 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,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* IBM Corporation - initial API and implementation
|
||||
* Anton Leherbauer (Wind River Systems)
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.ui.tests.text;
|
||||
|
@ -54,7 +55,11 @@ public class CHeaderRuleTest extends TestCase {
|
|||
public void testHeader2() {
|
||||
assertHeader("#include <vector>", "<vector>", 9);
|
||||
}
|
||||
|
||||
|
||||
public void testHeaderNoSpaceBetween() {
|
||||
assertHeader("#include<vector>", "<vector>", 8);
|
||||
}
|
||||
|
||||
public void testHeaderExtraSpacesBetween() {
|
||||
assertHeader("#include <foo.h>", "<foo.h>", 12);
|
||||
}
|
||||
|
@ -62,7 +67,11 @@ public class CHeaderRuleTest extends TestCase {
|
|||
public void testHeaderExtraSpacesBefore() {
|
||||
assertHeader(" #include <foo.h>", "<foo.h>", 11);
|
||||
}
|
||||
|
||||
|
||||
public void testHeaderIncludeNext() {
|
||||
assertHeader("#include_next<vector>", "<vector>", 13);
|
||||
}
|
||||
|
||||
public void testBooleanLogic() {
|
||||
assertNotHeader("if (x < 10 && x > 20) return false;", 6);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2006 IBM Corporation.
|
||||
* Copyright (c) 2006, 2007 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
|
||||
|
@ -114,11 +114,12 @@ public class CHeaderRule implements IRule {
|
|||
current = unread(scanner);
|
||||
lookBehind++;
|
||||
} while (Character.isWhitespace((char) current));
|
||||
scanner.read();
|
||||
--lookBehind;
|
||||
if (searchBackwards(scanner, "include")) { //$NON-NLS-1$
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
scanner.read();
|
||||
--lookBehind;
|
||||
if (current == 'e' && searchBackwards(scanner, "include") || //$NON-NLS-1$
|
||||
current == 't' && searchBackwards(scanner, "include_next")) { //$NON-NLS-1$
|
||||
result = true;
|
||||
}
|
||||
|
||||
seek(scanner, lookBehind);
|
||||
|
|
Loading…
Add table
Reference in a new issue