Code example for EOFException

0
			char[] buffer = new char[1];
			final int read = reader.read(buffer);
			if (read == -1)
				throw new EOFException("No more chars.");
			if (read == 0) {
				throw new EOFException("Could not read next char.");
			} 
			nextChar = buffer[0];
			consumed = false;
		} 
		return nextChar;
	} 
	 
	public char consumeChar() throws IOException, ParseException { 
		if (consumed) {
			try { 
				lookupChar(); 
			} catch (final EOFException e) {
				throw new ParseException("Unexpected end of expression at colum %d.", column);
			} 
		}