View | Details | Raw Unified | Return to bug 356746
Collapse All | Expand All

(-)codeassist/org/eclipse/jdt/internal/codeassist/SelectionEngine.java (-4 / +4 lines)
Lines 531-543 Link Here
531
							}
531
							}
532
						}
532
						}
533
533
534
						if ((c1 = ScannerHelper.getNumericValue(source[pos++])) > 15
534
						if ((c1 = ScannerHelper.getHexadecimalValue(source[pos++])) > 15
535
							|| c1 < 0
535
							|| c1 < 0
536
							|| (c2 = ScannerHelper.getNumericValue(source[pos++])) > 15
536
							|| (c2 = ScannerHelper.getHexadecimalValue(source[pos++])) > 15
537
							|| c2 < 0
537
							|| c2 < 0
538
							|| (c3 = ScannerHelper.getNumericValue(source[pos++])) > 15
538
							|| (c3 = ScannerHelper.getHexadecimalValue(source[pos++])) > 15
539
							|| c3 < 0
539
							|| c3 < 0
540
							|| (c4 = ScannerHelper.getNumericValue(source[pos++])) > 15
540
							|| (c4 = ScannerHelper.getHexadecimalValue(source[pos++])) > 15
541
							|| c4 < 0) {
541
							|| c4 < 0) {
542
							return false;
542
							return false;
543
						} else {
543
						} else {
(-)codeassist/org/eclipse/jdt/internal/codeassist/complete/CompletionScanner.java (-12 / +12 lines)
Lines 552-564 Link Here
552
									while (this.source[this.currentPosition] == 'u') {
552
									while (this.source[this.currentPosition] == 'u') {
553
										this.currentPosition++;
553
										this.currentPosition++;
554
									}
554
									}
555
									if ((c1 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
555
									if ((c1 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
556
										|| c1 < 0
556
										|| c1 < 0
557
										|| (c2 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
557
										|| (c2 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
558
										|| c2 < 0
558
										|| c2 < 0
559
										|| (c3 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
559
										|| (c3 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
560
										|| c3 < 0
560
										|| c3 < 0
561
										|| (c4 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
561
										|| (c4 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
562
										|| c4 < 0) {
562
										|| c4 < 0) {
563
										throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
563
										throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
564
									} else {
564
									} else {
Lines 585-597 Link Here
585
										while (this.source[this.currentPosition] == 'u') {
585
										while (this.source[this.currentPosition] == 'u') {
586
											this.currentPosition++;
586
											this.currentPosition++;
587
										}
587
										}
588
										if ((c1 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
588
										if ((c1 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
589
											|| c1 < 0
589
											|| c1 < 0
590
											|| (c2 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
590
											|| (c2 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
591
											|| c2 < 0
591
											|| c2 < 0
592
											|| (c3 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
592
											|| (c3 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
593
											|| c3 < 0
593
											|| c3 < 0
594
											|| (c4 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
594
											|| (c4 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
595
											|| c4 < 0) {
595
											|| c4 < 0) {
596
											throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
596
											throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
597
										} else {
597
										} else {
Lines 623-635 Link Here
623
										}
623
										}
624
										//-------------unicode traitement ------------
624
										//-------------unicode traitement ------------
625
										int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
625
										int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
626
										if ((c1 = ScannerHelper.getNumericValue(this.source[index++])) > 15
626
										if ((c1 = ScannerHelper.getHexadecimalValue(this.source[index++])) > 15
627
											|| c1 < 0
627
											|| c1 < 0
628
											|| (c2 = ScannerHelper.getNumericValue(this.source[index++])) > 15
628
											|| (c2 = ScannerHelper.getHexadecimalValue(this.source[index++])) > 15
629
											|| c2 < 0
629
											|| c2 < 0
630
											|| (c3 = ScannerHelper.getNumericValue(this.source[index++])) > 15
630
											|| (c3 = ScannerHelper.getHexadecimalValue(this.source[index++])) > 15
631
											|| c3 < 0
631
											|| c3 < 0
632
											|| (c4 = ScannerHelper.getNumericValue(this.source[index++])) > 15
632
											|| (c4 = ScannerHelper.getHexadecimalValue(this.source[index++])) > 15
633
											|| c4 < 0) {
633
											|| c4 < 0) {
634
											this.currentPosition = index;
634
											this.currentPosition = index;
635
											throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
635
											throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
(-)compiler/org/eclipse/jdt/internal/compiler/parser/AbstractCommentParser.java (-6 / +8 lines)
Lines 1354-1362 Link Here
1354
			idx++;
1354
			idx++;
1355
			while (this.source[idx] == 'u')
1355
			while (this.source[idx] == 'u')
1356
				idx++;
1356
				idx++;
1357
			if (!(((c1 = ScannerHelper.getNumericValue(this.source[idx++])) > 15 || c1 < 0)
1357
			if (!(((c1 = ScannerHelper.getHexadecimalValue(this.source[idx++])) > 15 || c1 < 0)
1358
					|| ((c2 = ScannerHelper.getNumericValue(this.source[idx++])) > 15 || c2 < 0)
1358
					|| ((c2 = ScannerHelper.getHexadecimalValue(this.source[idx++])) > 15 || c2 < 0)
1359
					|| ((c3 = ScannerHelper.getNumericValue(this.source[idx++])) > 15 || c3 < 0) || ((c4 = ScannerHelper.getNumericValue(this.source[idx++])) > 15 || c4 < 0))) {
1359
					|| ((c3 = ScannerHelper.getHexadecimalValue(this.source[idx++])) > 15 || c3 < 0)
1360
					|| ((c4 = ScannerHelper.getHexadecimalValue(this.source[idx++])) > 15 || c4 < 0))) {
1360
				c = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
1361
				c = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
1361
			}
1362
			}
1362
		}
1363
		}
Lines 1473-1481 Link Here
1473
			this.index++;
1474
			this.index++;
1474
			while (this.source[this.index] == 'u')
1475
			while (this.source[this.index] == 'u')
1475
				this.index++;
1476
				this.index++;
1476
			if (!(((c1 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c1 < 0)
1477
			if (!(((c1 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c1 < 0)
1477
					|| ((c2 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c2 < 0)
1478
					|| ((c2 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c2 < 0)
1478
					|| ((c3 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c3 < 0) || ((c4 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c4 < 0))) {
1479
					|| ((c3 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c3 < 0)
1480
					|| ((c4 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c4 < 0))) {
1479
				c = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
1481
				c = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
1480
			} else {
1482
			} else {
1481
				// TODO (frederic) currently reset to previous position, perhaps signal a syntax error would be more appropriate
1483
				// TODO (frederic) currently reset to previous position, perhaps signal a syntax error would be more appropriate
(-)compiler/org/eclipse/jdt/internal/compiler/parser/JavadocParser.java (-3 / +4 lines)
Lines 385-393 Link Here
385
			this.index++;
385
			this.index++;
386
			while (this.source[this.index] == 'u')
386
			while (this.source[this.index] == 'u')
387
				this.index++;
387
				this.index++;
388
			if (!(((c1 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c1 < 0)
388
			if (!(((c1 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c1 < 0)
389
					|| ((c2 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c2 < 0)
389
					|| ((c2 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c2 < 0)
390
					|| ((c3 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c3 < 0) || ((c4 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c4 < 0))) {
390
					|| ((c3 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c3 < 0)
391
					|| ((c4 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c4 < 0))) {
391
				first = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
392
				first = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
392
			} else {
393
			} else {
393
				this.index = pos;
394
				this.index = pos;
(-)compiler/org/eclipse/jdt/internal/compiler/parser/Parser.java (-8 / +8 lines)
Lines 2993-3005 Link Here
2993
				pos--;
2993
				pos--;
2994
			}
2994
			}
2995
			if (source[pos] == '\\' &&
2995
			if (source[pos] == '\\' &&
2996
					!((c1 = ScannerHelper.getNumericValue(source[this.endStatementPosition - 3])) > 15
2996
					!((c1 = ScannerHelper.getHexadecimalValue(source[this.endStatementPosition - 3])) > 15
2997
						|| c1 < 0
2997
						|| c1 < 0
2998
						|| (c2 = ScannerHelper.getNumericValue(source[this.endStatementPosition - 2])) > 15
2998
						|| (c2 = ScannerHelper.getHexadecimalValue(source[this.endStatementPosition - 2])) > 15
2999
						|| c2 < 0
2999
						|| c2 < 0
3000
						|| (c3 = ScannerHelper.getNumericValue(source[this.endStatementPosition - 1])) > 15
3000
						|| (c3 = ScannerHelper.getHexadecimalValue(source[this.endStatementPosition - 1])) > 15
3001
						|| c3 < 0
3001
						|| c3 < 0
3002
						|| (c4 = ScannerHelper.getNumericValue(source[this.endStatementPosition])) > 15
3002
						|| (c4 = ScannerHelper.getHexadecimalValue(source[this.endStatementPosition])) > 15
3003
						|| c4 < 0) &&
3003
						|| c4 < 0) &&
3004
					((char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4)) == ';'){
3004
					((char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4)) == ';'){
3005
				// we have a Unicode for the ';' (/u003B)
3005
				// we have a Unicode for the ';' (/u003B)
Lines 8852-8862 Link Here
8852
				int c1, c2, c3, c4;
8852
				int c1, c2, c3, c4;
8853
				index[0]++;
8853
				index[0]++;
8854
				while (comment[index[0]] == 'u') index[0]++;
8854
				while (comment[index[0]] == 'u') index[0]++;
8855
				if (!(((c1 = ScannerHelper.getNumericValue(comment[index[0]++])) > 15
8855
				if (!(((c1 = ScannerHelper.getHexadecimalValue(comment[index[0]++])) > 15
8856
					|| c1 < 0)
8856
					|| c1 < 0)
8857
					|| ((c2 = ScannerHelper.getNumericValue(comment[index[0]++])) > 15 || c2 < 0)
8857
					|| ((c2 = ScannerHelper.getHexadecimalValue(comment[index[0]++])) > 15 || c2 < 0)
8858
					|| ((c3 = ScannerHelper.getNumericValue(comment[index[0]++])) > 15 || c3 < 0)
8858
					|| ((c3 = ScannerHelper.getHexadecimalValue(comment[index[0]++])) > 15 || c3 < 0)
8859
					|| ((c4 = ScannerHelper.getNumericValue(comment[index[0]++])) > 15 || c4 < 0))) {
8859
					|| ((c4 = ScannerHelper.getHexadecimalValue(comment[index[0]++])) > 15 || c4 < 0))) {
8860
						nextCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
8860
						nextCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
8861
				}
8861
				}
8862
				break;
8862
				break;
(-)compiler/org/eclipse/jdt/internal/compiler/parser/Scanner.java (-7 / +7 lines)
Lines 1819-1831 Link Here
1819
		this.currentPosition += (this.eofPosition - this.currentPosition);
1819
		this.currentPosition += (this.eofPosition - this.currentPosition);
1820
		throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
1820
		throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
1821
	}
1821
	}
1822
	if ((c1 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
1822
	if ((c1 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
1823
    		|| c1 < 0
1823
    		|| c1 < 0
1824
    		|| (c2 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
1824
    		|| (c2 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
1825
    		|| c2 < 0
1825
    		|| c2 < 0
1826
    		|| (c3 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
1826
    		|| (c3 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
1827
    		|| c3 < 0
1827
    		|| c3 < 0
1828
    		|| (c4 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
1828
    		|| (c4 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
1829
    		|| c4 < 0){
1829
    		|| c4 < 0){
1830
		throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
1830
		throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
1831
	}
1831
	}
Lines 2725-2742 Link Here
2725
			// OctalDigit OctalDigit
2725
			// OctalDigit OctalDigit
2726
			// ZeroToThree OctalDigit OctalDigit
2726
			// ZeroToThree OctalDigit OctalDigit
2727
2727
2728
			int number = ScannerHelper.getNumericValue(this.currentCharacter);
2728
			int number = ScannerHelper.getHexadecimalValue(this.currentCharacter);
2729
			if (number >= 0 && number <= 7) {
2729
			if (number >= 0 && number <= 7) {
2730
				boolean zeroToThreeNot = number > 3;
2730
				boolean zeroToThreeNot = number > 3;
2731
				if (ScannerHelper.isDigit(this.currentCharacter = this.source[this.currentPosition++])) {
2731
				if (ScannerHelper.isDigit(this.currentCharacter = this.source[this.currentPosition++])) {
2732
					int digit = ScannerHelper.getNumericValue(this.currentCharacter);
2732
					int digit = ScannerHelper.getHexadecimalValue(this.currentCharacter);
2733
					if (digit >= 0 && digit <= 7) {
2733
					if (digit >= 0 && digit <= 7) {
2734
						number = (number * 8) + digit;
2734
						number = (number * 8) + digit;
2735
						if (ScannerHelper.isDigit(this.currentCharacter = this.source[this.currentPosition++])) {
2735
						if (ScannerHelper.isDigit(this.currentCharacter = this.source[this.currentPosition++])) {
2736
							if (zeroToThreeNot) {// has read \NotZeroToThree OctalDigit Digit --> ignore last character
2736
							if (zeroToThreeNot) {// has read \NotZeroToThree OctalDigit Digit --> ignore last character
2737
								this.currentPosition--;
2737
								this.currentPosition--;
2738
							} else {
2738
							} else {
2739
								digit = ScannerHelper.getNumericValue(this.currentCharacter);
2739
								digit = ScannerHelper.getHexadecimalValue(this.currentCharacter);
2740
								if (digit >= 0 && digit <= 7){ // has read \ZeroToThree OctalDigit OctalDigit
2740
								if (digit >= 0 && digit <= 7){ // has read \ZeroToThree OctalDigit OctalDigit
2741
									number = (number * 8) + digit;
2741
									number = (number * 8) + digit;
2742
								} else {// has read \ZeroToThree OctalDigit NonOctalDigit --> ignore last character
2742
								} else {// has read \ZeroToThree OctalDigit NonOctalDigit --> ignore last character
(-)compiler/org/eclipse/jdt/internal/compiler/parser/ScannerHelper.java (+44 lines)
Lines 475-480 Link Here
475
	}
475
	}
476
	return Character.getNumericValue(c);
476
	return Character.getNumericValue(c);
477
}
477
}
478
public static int getHexadecimalValue(char c) {
479
	switch(c) {
480
		case '0' :
481
			return 0;
482
		case '1' :
483
			return 1;
484
		case '2' :
485
			return 2;
486
		case '3' :
487
			return 3;
488
		case '4' :
489
			return 4;
490
		case '5' :
491
			return 5;
492
		case '6' :
493
			return 6;
494
		case '7' :
495
			return 7;
496
		case '8' :
497
			return 8;
498
		case '9' :
499
			return 9;
500
		case 'A' :
501
		case 'a' :
502
			return 10;
503
		case 'B' :
504
		case 'b' :
505
			return 11;
506
		case 'C' :
507
		case 'c' :
508
			return 12;
509
		case 'D' :
510
		case 'd' :
511
			return 13;
512
		case 'E' :
513
		case 'e' :
514
			return 14;
515
		case 'F' :
516
		case 'f' :
517
			return 15;
518
		default:
519
			return -1;
520
	}
521
}
478
public static char toUpperCase(char c) {
522
public static char toUpperCase(char c) {
479
	if (c < MAX_OBVIOUS) {
523
	if (c < MAX_OBVIOUS) {
480
		if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & ScannerHelper.C_UPPER_LETTER) != 0) {
524
		if ((ScannerHelper.OBVIOUS_IDENT_CHAR_NATURES[c] & ScannerHelper.C_UPPER_LETTER) != 0) {
(-)model/org/eclipse/jdt/internal/compiler/SourceJavadocParser.java (-5 / +5 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 93-102 Link Here
93
		this.index++;
93
		this.index++;
94
		while (this.source[this.index] == 'u')
94
		while (this.source[this.index] == 'u')
95
			this.index++;
95
			this.index++;
96
		if (!(((c1 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c1 < 0)
96
		if (!(((c1 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c1 < 0)
97
				|| ((c2 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c2 < 0)
97
				|| ((c2 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c2 < 0)
98
				|| ((c3 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c3 < 0)
98
				|| ((c3 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c3 < 0)
99
				|| ((c4 = ScannerHelper.getNumericValue(this.source[this.index++])) > 15 || c4 < 0))) {
99
				|| ((c4 = ScannerHelper.getHexadecimalValue(this.source[this.index++])) > 15 || c4 < 0))) {
100
			first = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
100
			first = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
101
		} else {
101
		} else {
102
			this.index = pos;
102
			this.index = pos;
(-)model/org/eclipse/jdt/internal/core/util/PublicScanner.java (-7 / +7 lines)
Lines 1817-1829 Link Here
1817
		this.currentPosition += (this.eofPosition - this.currentPosition);
1817
		this.currentPosition += (this.eofPosition - this.currentPosition);
1818
		throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
1818
		throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
1819
	}
1819
	}
1820
	if ((c1 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
1820
	if ((c1 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
1821
    		|| c1 < 0
1821
    		|| c1 < 0
1822
    		|| (c2 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
1822
    		|| (c2 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
1823
    		|| c2 < 0
1823
    		|| c2 < 0
1824
    		|| (c3 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
1824
    		|| (c3 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
1825
    		|| c3 < 0
1825
    		|| c3 < 0
1826
    		|| (c4 = ScannerHelper.getNumericValue(this.source[this.currentPosition++])) > 15
1826
    		|| (c4 = ScannerHelper.getHexadecimalValue(this.source[this.currentPosition++])) > 15
1827
    		|| c4 < 0){
1827
    		|| c4 < 0){
1828
		throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
1828
		throw new InvalidInputException(INVALID_UNICODE_ESCAPE);
1829
	}
1829
	}
Lines 2723-2740 Link Here
2723
			// OctalDigit OctalDigit
2723
			// OctalDigit OctalDigit
2724
			// ZeroToThree OctalDigit OctalDigit
2724
			// ZeroToThree OctalDigit OctalDigit
2725
2725
2726
			int number = ScannerHelper.getNumericValue(this.currentCharacter);
2726
			int number = ScannerHelper.getHexadecimalValue(this.currentCharacter);
2727
			if (number >= 0 && number <= 7) {
2727
			if (number >= 0 && number <= 7) {
2728
				boolean zeroToThreeNot = number > 3;
2728
				boolean zeroToThreeNot = number > 3;
2729
				if (ScannerHelper.isDigit(this.currentCharacter = this.source[this.currentPosition++])) {
2729
				if (ScannerHelper.isDigit(this.currentCharacter = this.source[this.currentPosition++])) {
2730
					int digit = ScannerHelper.getNumericValue(this.currentCharacter);
2730
					int digit = ScannerHelper.getHexadecimalValue(this.currentCharacter);
2731
					if (digit >= 0 && digit <= 7) {
2731
					if (digit >= 0 && digit <= 7) {
2732
						number = (number * 8) + digit;
2732
						number = (number * 8) + digit;
2733
						if (ScannerHelper.isDigit(this.currentCharacter = this.source[this.currentPosition++])) {
2733
						if (ScannerHelper.isDigit(this.currentCharacter = this.source[this.currentPosition++])) {
2734
							if (zeroToThreeNot) {// has read \NotZeroToThree OctalDigit Digit --> ignore last character
2734
							if (zeroToThreeNot) {// has read \NotZeroToThree OctalDigit Digit --> ignore last character
2735
								this.currentPosition--;
2735
								this.currentPosition--;
2736
							} else {
2736
							} else {
2737
								digit = ScannerHelper.getNumericValue(this.currentCharacter);
2737
								digit = ScannerHelper.getHexadecimalValue(this.currentCharacter);
2738
								if (digit >= 0 && digit <= 7){ // has read \ZeroToThree OctalDigit OctalDigit
2738
								if (digit >= 0 && digit <= 7){ // has read \ZeroToThree OctalDigit OctalDigit
2739
									number = (number * 8) + digit;
2739
									number = (number * 8) + digit;
2740
								} else {// has read \ZeroToThree OctalDigit NonOctalDigit --> ignore last character
2740
								} else {// has read \ZeroToThree OctalDigit NonOctalDigit --> ignore last character
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverterJavadocTest.java (-10 / +8 lines)
Lines 275-285 Link Here
275
				int c1, c2, c3, c4;
275
				int c1, c2, c3, c4;
276
				charLength++;
276
				charLength++;
277
				while (source[idx+charLength] == 'u') charLength++;
277
				while (source[idx+charLength] == 'u') charLength++;
278
				if (((c1 = ScannerHelper.getNumericValue(source[idx+charLength++])) > 15
278
				if (((c1 = ScannerHelper.getHexadecimalValue(source[idx+charLength++])) > 15 || c1 < 0)
279
					|| c1 < 0)
279
					|| ((c2 = ScannerHelper.getHexadecimalValue(source[idx+charLength++])) > 15 || c2 < 0)
280
					|| ((c2 = ScannerHelper.getNumericValue(source[idx+charLength++])) > 15 || c2 < 0)
280
					|| ((c3 = ScannerHelper.getHexadecimalValue(source[idx+charLength++])) > 15 || c3 < 0)
281
					|| ((c3 = ScannerHelper.getNumericValue(source[idx+charLength++])) > 15 || c3 < 0)
281
					|| ((c4 = ScannerHelper.getHexadecimalValue(source[idx+charLength++])) > 15 || c4 < 0)) {
282
					|| ((c4 = ScannerHelper.getNumericValue(source[idx+charLength++])) > 15 || c4 < 0)) {
283
					return ch;
282
					return ch;
284
				}
283
				}
285
				ch = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
284
				ch = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
Lines 474-484 Link Here
474
				int c1, c2, c3, c4;
473
				int c1, c2, c3, c4;
475
				unicodeSource[u++] = source[i];
474
				unicodeSource[u++] = source[i];
476
				unicodeSource[u++] = source[++i];
475
				unicodeSource[u++] = source[++i];
477
				if (((c1 = ScannerHelper.getNumericValue(source[i+1])) > 15
476
				if (((c1 = ScannerHelper.getHexadecimalValue(source[i+1])) > 15 || c1 < 0)
478
					|| c1 < 0)
477
					|| ((c2 = ScannerHelper.getHexadecimalValue(source[i+2])) > 15 || c2 < 0)
479
					|| ((c2 = ScannerHelper.getNumericValue(source[i+2])) > 15 || c2 < 0)
478
					|| ((c3 = ScannerHelper.getHexadecimalValue(source[i+3])) > 15 || c3 < 0)
480
					|| ((c3 = ScannerHelper.getNumericValue(source[i+3])) > 15 || c3 < 0)
479
					|| ((c4 = ScannerHelper.getHexadecimalValue(source[i+4])) > 15 || c4 < 0)) {
481
					|| ((c4 = ScannerHelper.getNumericValue(source[i+4])) > 15 || c4 < 0)) {
482
					throw new RuntimeException("Invalid unicode in source at "+i);
480
					throw new RuntimeException("Invalid unicode in source at "+i);
483
				}
481
				}
484
				for (int j=0; j<4; j++) unicodeSource[u++] = source[++i];
482
				for (int j=0; j<4; j++) unicodeSource[u++] = source[++i];

Return to bug 356746