List of usage examples for org.eclipse.jdt.internal.compiler.parser ScannerHelper getNumericValue
public static int getNumericValue(char c)
From source file:org.eclipse.jdt.internal.compiler.parser.Parser.java
License:Open Source License
protected void consumeEmptyStatement() { // EmptyStatement ::= ';' char[] source = this.scanner.source; if (source[this.endStatementPosition] == ';') { pushOnAstStack(new EmptyStatement(this.endStatementPosition, this.endStatementPosition)); } else {/* w w w . ja va2 s . c o m*/ if (source.length > 5) { int c1 = 0, c2 = 0, c3 = 0, c4 = 0; int pos = this.endStatementPosition - 4; while (source[pos] == 'u') { pos--; } if (source[pos] == '\\' && !((c1 = ScannerHelper.getNumericValue(source[this.endStatementPosition - 3])) > 15 || c1 < 0 || (c2 = ScannerHelper.getNumericValue(source[this.endStatementPosition - 2])) > 15 || c2 < 0 || (c3 = ScannerHelper.getNumericValue(source[this.endStatementPosition - 1])) > 15 || c3 < 0 || (c4 = ScannerHelper.getNumericValue(source[this.endStatementPosition])) > 15 || c4 < 0) && ((char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4)) == ';') { // we have a Unicode for the ';' (/u003B) pushOnAstStack(new EmptyStatement(pos, this.endStatementPosition)); return; } } pushOnAstStack(new EmptyStatement(this.endPosition + 1, this.endStatementPosition)); } }
From source file:org.eclipse.jdt.internal.compiler.parser.Parser.java
License:Open Source License
protected char getNextCharacter(char[] comment, int[] index) { char nextCharacter = comment[index[0]++]; switch (nextCharacter) { case '\\': int c1, c2, c3, c4; index[0]++;/*from w ww .ja v a2 s. c om*/ while (comment[index[0]] == 'u') index[0]++; if (!(((c1 = ScannerHelper.getNumericValue(comment[index[0]++])) > 15 || c1 < 0) || ((c2 = ScannerHelper.getNumericValue(comment[index[0]++])) > 15 || c2 < 0) || ((c3 = ScannerHelper.getNumericValue(comment[index[0]++])) > 15 || c3 < 0) || ((c4 = ScannerHelper.getNumericValue(comment[index[0]++])) > 15 || c4 < 0))) { nextCharacter = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4); } break; } return nextCharacter; }