public TagNode parse(InputStream __source) throws TagParserException, IOException
	{
		// Prepare
		long time = System.nanoTime();
		BufferedInputStream source = new BufferedInputStream(__source);
		ParseState state = new ParseState();
		
		// Read the document, character by character, byte by byte.
		while(true)
		{
			// Read the next character/symbol.
			int in = this.readNext(source);
			
			// Check for End-Of-Stream
			if(in == -1)
			{
				break;
			}
			
			// State-Update, also determine if we have to consume this character.
			boolean consume = state.nextSymbol(in);
			
			// Consume the character if needed.
			if(consume)
			{
				this.consumeSymbol(state);
			}
			
			// State-Update
			state.endNextSymbol(in);
			
		}
		
		// Sanity check!
		if(state.containerStack.size() != 1)
		{
			throw new TagParserException(Integer.MAX_VALUE, Integer.MAX_VALUE, "A tag is not correctly escaped."); // Which one?
		}
		
		// Store the result
		this.result_time = (System.nanoTime() - time);
		this.result_document = state.containerStack.pop();
		
		// end
		return this.result_document;
	}