< prev index next >

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

Print this page




 137         if (scan)
 138             scanChar();
 139     }
 140 
 141     protected void putChar(char ch) {
 142         putChar(ch, false);
 143     }
 144 
 145     protected void putChar(boolean scan) {
 146         putChar(ch, scan);
 147     }
 148 
 149     Name name() {
 150         return names.fromChars(sbuf, 0, sp);
 151     }
 152 
 153     String chars() {
 154         return new String(sbuf, 0, sp);
 155     }
 156 
 157     /** Add 'count' copies of the character 'ch' to the string buffer.
 158      */
 159     protected void repeat(char ch, int count) {
 160         for ( ; 0 < count; count--) {
 161             putChar(ch, false);
 162         }
 163     }
 164 
 165     /** Reset the scan buffer pointer to 'pos'.
 166      */
 167     protected void reset(int pos) {
 168         bp = pos - 1;
 169         scanChar();
 170     }
 171 
 172     /** Convert unicode escape; bp points to initial '\' character
 173      *  (Spec 3.3).
 174      */
 175     protected void convertUnicode() {
 176         if (ch == '\\' && unicodeConversionBp != bp ) {
 177             bp++; ch = buf[bp];
 178             if (ch == 'u') {
 179                 do {
 180                     bp++; ch = buf[bp];
 181                 } while (ch == 'u');
 182                 int limit = bp + 3;
 183                 if (limit < buflen) {
 184                     int d = digit(bp, 16);
 185                     int code = d;
 186                     while (bp < limit && d >= 0) {
 187                         bp++; ch = buf[bp];
 188                         d = digit(bp, 16);
 189                         code = (code << 4) + d;
 190                     }
 191                     if (d >= 0) {




 137         if (scan)
 138             scanChar();
 139     }
 140 
 141     protected void putChar(char ch) {
 142         putChar(ch, false);
 143     }
 144 
 145     protected void putChar(boolean scan) {
 146         putChar(ch, scan);
 147     }
 148 
 149     Name name() {
 150         return names.fromChars(sbuf, 0, sp);
 151     }
 152 
 153     String chars() {
 154         return new String(sbuf, 0, sp);
 155     }
 156 















 157     /** Convert unicode escape; bp points to initial '\' character
 158      *  (Spec 3.3).
 159      */
 160     protected void convertUnicode() {
 161         if (ch == '\\' && unicodeConversionBp != bp ) {
 162             bp++; ch = buf[bp];
 163             if (ch == 'u') {
 164                 do {
 165                     bp++; ch = buf[bp];
 166                 } while (ch == 'u');
 167                 int limit = bp + 3;
 168                 if (limit < buflen) {
 169                     int d = digit(bp, 16);
 170                     int code = d;
 171                     while (bp < limit && d >= 0) {
 172                         bp++; ch = buf[bp];
 173                         d = digit(bp, 16);
 174                         code = (code << 4) + d;
 175                     }
 176                     if (d >= 0) {


< prev index next >