double parseImaginaryPart(SeekableStringReader sr)
	{
		//imaginary       = ['+' | '-' ] ( float | int ) 'j' .
		if(!sr.hasMore())
			throw new ParseException("unexpected end of input string");
		char sign_or_digit = sr.peek();
		
		if(sign_or_digit=='+')
			sr.read();   // skip the '+'
		
		// now an int or float follows.
		double double_value;
		int bookmark = sr.bookmark();
		try {
			PrimitiveNode<Double> float_part = parseFloat(sr);
			double_value = float_part.value;
		} catch (ParseException x1) {
			sr.flipBack(bookmark);
			INode integer_part = parseInt(sr);
			if(integer_part instanceof IntegerNode) {
				double_value = ((IntegerNode)integer_part).value;
			}
			else if(integer_part instanceof LongNode) {
				double_value = ((LongNode)integer_part).value;
			}
			else if(integer_part instanceof BigIntNode) {
				double_value = ((BigIntNode)integer_part).value.doubleValue();
			}
			else {
				throw new ParseException("not an integer for the imaginary part");
			}
		}
		
		// now a 'j' must follow!
		sr.skipWhitespace();
		try {
			char j_char = sr.read();
			if(j_char!='j')
				throw new ParseException("not an imaginary part");
		} catch (IndexOutOfBoundsException x) {
			throw new ParseException("not an imaginary part");
		}
		return double_value;
	}