< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/parser/UnicodeReader.java

Print this page
rev 51519 : 8206981: Compiler support for Raw String Literals
Reviewed-by: mcimadamore

*** 62,71 **** --- 62,75 ---- /** The buffer index of the last converted unicode character */ protected int unicodeConversionBp = -1; + /** Control conversion of unicode characters + */ + protected boolean unicodeConversion = true; + protected Log log; protected Names names; /** A character buffer for saved chars. */
*** 152,166 **** String chars() { return new String(sbuf, 0, sp); } /** Convert unicode escape; bp points to initial '\' character * (Spec 3.3). */ protected void convertUnicode() { ! if (ch == '\\' && unicodeConversionBp != bp) { bp++; ch = buf[bp]; if (ch == 'u') { do { bp++; ch = buf[bp]; } while (ch == 'u'); --- 156,176 ---- String chars() { return new String(sbuf, 0, sp); } + protected boolean setUnicodeConversion(boolean newState) { + boolean oldState = unicodeConversion; + unicodeConversion = newState; + return oldState; + } + /** Convert unicode escape; bp points to initial '\' character * (Spec 3.3). */ protected void convertUnicode() { ! if (ch == '\\' && unicodeConversion && unicodeConversionBp != bp ) { bp++; ch = buf[bp]; if (ch == 'u') { do { bp++; ch = buf[bp]; } while (ch == 'u');
*** 252,261 **** --- 262,289 ---- protected char peekChar() { return buf[bp + 1]; } + protected char peekBack() { + return buf[bp]; + } + + /** + * Skips consecutive occurrences of the current character, leaving bp positioned + * at the last occurrence. Returns the occurrence count. + */ + protected int skipRepeats() { + int start = bp; + while (bp < buflen) { + if (buf[bp] != buf[bp + 1]) + break; + bp++; + } + return bp - start; + } + /** * Returns a copy of the input buffer, up to its inputLength. * Unicode escape sequences are not translated. */ public char[] getRawCharacters() {
< prev index next >