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

Fix for Bug 163691 - Incorrect syntax highlight of numbers

This commit is contained in:
Anton Leherbauer 2006-11-08 09:47:45 +00:00
parent e6a0b48500
commit 1aafcab10c
2 changed files with 10 additions and 4 deletions

View file

@ -114,6 +114,13 @@ public class NumberRuleTest extends TestCase {
// assertNoNumber("1e+"); // assertNoNumber("1e+");
} }
public void testBug163691() {
assertNoNumber("+x1");
assertNoNumber("-z0");
assertNoNumber("- 0");
assertNoNumber("+ 9");
}
/** /**
* Validate that given string is recognized as a number. * Validate that given string is recognized as a number.
* @param string * @param string

View file

@ -55,7 +55,6 @@ public class NumberRule implements IRule
} }
if (ch == '0') { if (ch == '0') {
int xCh = scanner.read(); int xCh = scanner.read();
++unreadCount;
if (xCh == 'x' || xCh == 'X') { if (xCh == 'x' || xCh == 'X') {
// hexnumber starting with [+-]?0[xX] // hexnumber starting with [+-]?0[xX]
do { do {
@ -66,9 +65,9 @@ public class NumberRule implements IRule
} }
scanner.unread(); scanner.unread();
// assert ch == '0'; // assert ch == '0';
} else if (!Character.isDigit((char)ch)) { } else if (ch == '.') {
ch = scanner.read(); ch = scanner.read();
++unreadCount; ++unreadCount;
} }
if (Character.isDigit((char)ch)) { if (Character.isDigit((char)ch)) {
// need at least one digit // need at least one digit