private void skipIllegalUnderscores() { if (reader.ch == '_') { lexError(reader.bp, "illegal.underscore"); while (reader.ch == '_') reader.scanChar(); } }
private void skipIllegalUnderscores() { if (reader.ch == '_') { lexError(reader.bp, "illegal.underscore"); while (reader.ch == '_') reader.scanChar(); } }
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); }
/** Read fractional part of floating point number. */ private void scanFraction(int pos) { skipIllegalUnderscores(); if ('0' <= reader.ch && reader.ch <= '9') { scanDigits(pos, 10); } int sp1 = reader.sp; if (reader.ch == 'e' || reader.ch == 'E') { reader.putChar(true); skipIllegalUnderscores(); if (reader.ch == '+' || reader.ch == '-') { reader.putChar(true); } skipIllegalUnderscores(); if ('0' <= reader.ch && reader.ch <= '9') { scanDigits(pos, 10); return; } lexError(pos, "malformed.fp.lit"); reader.sp = sp1; } }
/** Read fractional part of floating point number. */ private void scanFraction(int pos) { skipIllegalUnderscores(); if ('0' <= reader.ch && reader.ch <= '9') { scanDigits(pos, 10); } int sp1 = reader.sp; if (reader.ch == 'e' || reader.ch == 'E') { reader.putChar(true); skipIllegalUnderscores(); if (reader.ch == '+' || reader.ch == '-') { reader.putChar(true); } skipIllegalUnderscores(); if ('0' <= reader.ch && reader.ch <= '9') { scanDigits(pos, 10); return; } lexError(pos, "malformed.fp.lit"); reader.sp = sp1; } }
scanHexFractionAndSuffix(pos, false); } else if (reader.digit(pos, 16) < 0) { lexError(pos, "invalid.hex.number"); } else { scanNumber(pos, 16); lexError(pos, "unsupported.binary.lit", source.name); allowBinaryLiterals = true; skipIllegalUnderscores(); if (reader.digit(pos, 2) < 0) { lexError(pos, "invalid.binary.number"); } else { scanNumber(pos, 2); } while (reader.ch == '_'); if (reader.digit(pos, 10) < 0) { lexError(savePos, "illegal.underscore"); tk = TokenKind.ELLIPSIS; } else { lexError(savePos, "illegal.dot"); break; } else { lexError(pos, "unclosed.comment"); break loop; reader.scanChar();
scanHexFractionAndSuffix(pos, false); } else if (reader.digit(pos, 16) < 0) { lexError(pos, "invalid.hex.number"); } else { scanNumber(pos, 16); lexError(pos, "unsupported.binary.lit", source.name); allowBinaryLiterals = true; skipIllegalUnderscores(); if (reader.digit(pos, 2) < 0) { lexError(pos, "invalid.binary.number"); } else { scanNumber(pos, 2); } while (reader.ch == '_'); if (reader.digit(pos, 10) < 0) { lexError(savePos, "illegal.underscore"); tk = TokenKind.ELLIPSIS; } else { lexError(savePos, "illegal.dot"); break; } else { lexError(pos, "unclosed.comment"); break loop; reader.scanChar();
reader.putChar('\\', true); break; default: lexError(reader.bp, "illegal.esc.char");
reader.putChar('\\', true); break; default: lexError(reader.bp, "illegal.esc.char");