protected void putChar(boolean scan) { putChar(ch, scan); }
protected void putChar(char ch) { putChar(ch, false); }
protected void putChar(boolean scan) { putChar(ch, scan); }
protected void putChar(char ch) { putChar(ch, false); }
/** Read fractional part and 'd' or 'f' suffix of floating point number. */ private void scanFractionAndSuffix(int pos) { radix = 10; scanFraction(pos); if (reader.ch == 'f' || reader.ch == 'F') { reader.putChar(true); tk = TokenKind.FLOATLITERAL; } else { if (reader.ch == 'd' || reader.ch == 'D') { reader.putChar(true); } tk = TokenKind.DOUBLELITERAL; } }
/** Read fractional part and 'd' or 'f' suffix of floating point number. */ private void scanFractionAndSuffix(int pos) { radix = 10; scanFraction(pos); if (reader.ch == 'f' || reader.ch == 'F') { reader.putChar(true); tk = TokenKind.FLOATLITERAL; } else { if (reader.ch == 'd' || reader.ch == 'D') { reader.putChar(true); } tk = TokenKind.DOUBLELITERAL; } }
@Override public void putChar(char ch, boolean scan) { // At this point, bp is the position of the current character in buf, // and sp is the position in sbuf where this character will be put. // Record a new entry in pbuf if pbuf is empty or if sp and its // corresponding source position are not equidistant from the // corresponding values in the latest entry in the pbuf array. // (i.e. there is a discontinuity in the map function.) if ((pp == 0) || (sp - pbuf[pp - 2] != (startPos + bp) - pbuf[pp - 1])) { if (pp + 1 >= pbuf.length) { int[] new_pbuf = new int[pbuf.length * 2]; System.arraycopy(pbuf, 0, new_pbuf, 0, pbuf.length); pbuf = new_pbuf; } pbuf[pp] = sp; pbuf[pp + 1] = startPos + bp; pp += 2; } super.putChar(ch, scan); } }
@Override public void putChar(char ch, boolean scan) { // At this point, bp is the position of the current character in buf, // and sp is the position in sbuf where this character will be put. // Record a new entry in pbuf if pbuf is empty or if sp and its // corresponding source position are not equidistant from the // corresponding values in the latest entry in the pbuf array. // (i.e. there is a discontinuity in the map function.) if ((pp == 0) || (sp - pbuf[pp - 2] != (startPos + bp) - pbuf[pp - 1])) { if (pp + 1 >= pbuf.length) { int[] new_pbuf = new int[pbuf.length * 2]; System.arraycopy(pbuf, 0, new_pbuf, 0, pbuf.length); pbuf = new_pbuf; } pbuf[pp] = sp; pbuf[pp + 1] = startPos + bp; pp += 2; } super.putChar(ch, scan); } }
/** 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; } }
/** Read longest possible sequence of special characters and convert * to token. */ private void scanOperator() { while (true) { reader.putChar(false); Name newname = reader.name(); TokenKind tk1 = tokens.lookupKind(newname); if (tk1 == TokenKind.IDENTIFIER) { reader.sp--; break; } tk = tk1; reader.scanChar(); if (!isSpecial(reader.ch)) break; } }
/** Read longest possible sequence of special characters and convert * to token. */ private void scanOperator() { while (true) { reader.putChar(false); Name newname = reader.name(); TokenKind tk1 = tokens.lookupKind(newname); if (tk1 == TokenKind.IDENTIFIER) { reader.sp--; break; } tk = tk1; reader.scanChar(); if (!isSpecial(reader.ch)) break; } }
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); }
scanHexExponentAndSuffix(pos); } else if (digitRadix == 10 && reader.ch == '.') { reader.putChar(true); scanFractionAndSuffix(pos); } else if (digitRadix == 10 &&
scanHexExponentAndSuffix(pos); } else if (digitRadix == 10 && reader.ch == '.') { reader.putChar(true); scanFractionAndSuffix(pos); } else if (digitRadix == 10 &&