public void ReserveAll(Token token)
 {
     foreach (var c in Chars)
     {
         Reserve(c.Position, token);
     }
 }
        public void Reserve(int index, Token token)
        {
            if (index >= Chars.Count)
                throw new IndexOutOfRangeException();
            if (Chars[index].ReservedBy != null)
                throw new PositionAlreadyReservedException(index);

            token.Parent = Chars[index].ReservedBy;
            Chars[index].ReservedBy = token;
        }
        public void ReserveFromStartAndStopChar(char startChar, char endChar, Token token)
        {
            var currentString = ToStringOnlyNoneReserved();
            int start = currentString.IndexOf(startChar);
            if (start == -1) throw new CharNotFoundInStringException(startChar);

            int end = currentString.IndexOf(endChar, start + 1);
            if (end == -1) throw new CharNotFoundInStringException(startChar, start); ;

            ReserveRange(start, end, token);
        }
        public void ReserveRange(int from, int to, Token token)
        {
            if (from > to) throw new ArgumentException("From needs to be less or equal to to");

            for (int i = from; i <= to; i++) Reserve(i, token);
        }
 public string GetReserved(Token token)
 {
     return String.Concat(Chars.OrderBy(c => c.Position).Where(c => c.ReservedBy != null && c.ReservedBy.Id == token.Id).Select(c => c.Char));
 }