private void scanDigits(int pos, int digitRadix) { char saveCh; int savePos; do { if (reader.ch != '_') { reader.putChar(false); } else { if (!allowUnderscoresInLiterals) { lexError(pos, "unsupported.underscore.lit", source.name); allowUnderscoresInLiterals = true; } } saveCh = reader.ch; savePos = reader.bp; reader.scanChar(); } while (reader.digit(pos, digitRadix) >= 0 || reader.ch == '_'); if (saveCh == '_') lexError(savePos, "illegal.underscore"); }
private void scanDigits(int pos, int digitRadix) { char saveCh; int savePos; do { if (reader.ch != '_') { reader.putChar(false); } else { if (!allowUnderscoresInLiterals) { lexError(pos, "unsupported.underscore.lit", source.name); allowUnderscoresInLiterals = true; } } saveCh = reader.ch; savePos = reader.bp; reader.scanChar(); } while (reader.digit(pos, digitRadix) >= 0 || reader.ch == '_'); if (saveCh == '_') lexError(savePos, "illegal.underscore"); }
/** Read fractional part and 'd' or 'f' suffix of floating point number. */ private void scanHexFractionAndSuffix(int pos, boolean seendigit) { radix = 16; Assert.check(reader.ch == '.'); reader.putChar(true); skipIllegalUnderscores(); if (reader.digit(pos, 16) >= 0) { seendigit = true; scanDigits(pos, 16); } if (!seendigit) lexError(pos, "invalid.hex.number"); else scanHexExponentAndSuffix(pos); }
/** Read fractional part and 'd' or 'f' suffix of floating point number. */ private void scanHexFractionAndSuffix(int pos, boolean seendigit) { radix = 16; Assert.check(reader.ch == '.'); reader.putChar(true); skipIllegalUnderscores(); if (reader.digit(pos, 16) >= 0) { seendigit = true; scanDigits(pos, 16); } if (!seendigit) lexError(pos, "invalid.hex.number"); else scanHexExponentAndSuffix(pos); }
int digitRadix = (radix == 8 ? 10 : radix); boolean seendigit = false; if (reader.digit(pos, digitRadix) >= 0) { seendigit = true; scanDigits(pos, digitRadix);
case '4': case '5': case '6': case '7': char leadch = reader.ch; int oct = reader.digit(pos, 8); reader.scanChar(); if ('0' <= reader.ch && reader.ch <= '7') { oct = oct * 8 + reader.digit(pos, 8); reader.scanChar(); if (leadch <= '3' && '0' <= reader.ch && reader.ch <= '7') { oct = oct * 8 + reader.digit(pos, 8); reader.scanChar();
int digitRadix = (radix == 8 ? 10 : radix); boolean seendigit = false; if (reader.digit(pos, digitRadix) >= 0) { seendigit = true; scanDigits(pos, digitRadix);
case '4': case '5': case '6': case '7': char leadch = reader.ch; int oct = reader.digit(pos, 8); reader.scanChar(); if ('0' <= reader.ch && reader.ch <= '7') { oct = oct * 8 + reader.digit(pos, 8); reader.scanChar(); if (leadch <= '3' && '0' <= reader.ch && reader.ch <= '7') { oct = oct * 8 + reader.digit(pos, 8); reader.scanChar();
if (reader.ch == '.') { scanHexFractionAndSuffix(pos, false); } else if (reader.digit(pos, 16) < 0) { lexError(pos, "invalid.hex.number"); } else { if (reader.digit(pos, 2) < 0) { lexError(pos, "invalid.binary.number"); } else { reader.scanChar(); } while (reader.ch == '_'); if (reader.digit(pos, 10) < 0) { lexError(savePos, "illegal.underscore");
if (reader.ch == '.') { scanHexFractionAndSuffix(pos, false); } else if (reader.digit(pos, 16) < 0) { lexError(pos, "invalid.hex.number"); } else { if (reader.digit(pos, 2) < 0) { lexError(pos, "invalid.binary.number"); } else { reader.scanChar(); } while (reader.ch == '_'); if (reader.digit(pos, 10) < 0) { lexError(savePos, "illegal.underscore");