private Item checkCompetitiveGroups(ResultTree result, Item item, InputText input, List competitors, int bestMark, Map expectedTokenSymbols)
		throws IOException
	{
		int max = bestMark - input.getMark();
		
		for (int i = 0; i < competitors.size(); i++)	{
			Item competitor = (Item) competitors.get(i);
			
			// let take part only if no expected symbols or is in expected symbols
			if (expectedTokenSymbols != null && expectedTokenSymbols.get(competitor.getSymbol()) == null)
				continue;

			int mark = input.getMark();	// memorize current input mark

			ResultTree r = competitor.consume(input);	// consume
			int len = input.getMark() - mark;
			
			if (r != null && len > max)	{	// scanned longer
				bestMark = input.getMark();
				max = len;
				item = competitor;
			}
			
			input.setMark(mark);	// reset for next candidate
		}

		input.setMark(bestMark);	// set mark forward to best scan result
		
		return item;
	}