public void ParseRepetitions(CharacterBuffer buffer)
 {
     int currentIndex = buffer.CurrentIndex;
     buffer.SkipWhiteSpace();
     if (buffer.IsAtEnd)
     {
         RepeatType = Repeat.Once;
         buffer.MoveTo(currentIndex);
         End = buffer.IndexInOriginalBuffer;
         return;
     }
     char current = buffer.CurrentCharacter;
     switch (current)
     {
         case '*':
             {
                 this.RepeatType = Repeat.Any;
                 Element element = this;
                 element.Literal = string.Concat(element.Literal, buffer.CurrentCharacter);
                 buffer.MoveNext();
                 break;
             }
         case '+':
             {
                 this.RepeatType = Repeat.OneOrMore;
                 Element element1 = this;
                 element1.Literal = string.Concat(element1.Literal, buffer.CurrentCharacter);
                 buffer.MoveNext();
                 break;
             }
         default:
             {
                 if (current == '?')
                 {
                     this.RepeatType = Repeat.ZeroOrOne;
                     Element element2 = this;
                     element2.Literal = string.Concat(element2.Literal, buffer.CurrentCharacter);
                     buffer.MoveNext();
                     break;
                 }
                 else
                 {
                     if (current != '{')
                     {
                         this.RepeatType = Repeat.Once;
                         buffer.MoveTo(currentIndex);
                         this.End = buffer.IndexInOriginalBuffer;
                         return;
                     }
                     this.ParseBrackets(buffer);
                     break;
                 }
             }
     }
     currentIndex = buffer.CurrentIndex;
     buffer.SkipWhiteSpace();
     if (buffer.IsAtEnd || buffer.CurrentCharacter != '?')
     {
         buffer.MoveTo(currentIndex);
     }
     else
     {
         this.AsFewAsPossible = true;
         Element element3 = this;
         element3.Literal = string.Concat(element3.Literal, buffer.CurrentCharacter);
         buffer.MoveNext();
     }
     this.End = buffer.IndexInOriginalBuffer;
 }