Пример #1
0
 //[System.Runtime.CompilerServices.MethodImpl(Runtime.CompilerServices.MethodImplOptions.Synchronized)]
 public static Match Synchronized(Match inner)
 {
     if (inner == null)
     {
         throw new ArgumentNullException("inner");
     }
     int length = inner._matchcount.Length;
     for (int i = 0; i < length; ++i)
     {
         Group group = inner.Groups[i];
         Group.Synchronized(group);
     }
     return inner;
 }
Пример #2
0
 public bool MoveNext()
 {
     if (this._done)
     {
         return false;
     }
     this._match = this._matchcoll.GetMatch(this._curindex++);
     if (this._match == null)
     {
         this._done = true;
         return false;
     }
     return true;
 }
Пример #3
0
 // Methods
 internal GroupCollection(Match match, Hashtable caps)
 {
     this._match = match;
     this._captureMap = caps;
 }
Пример #4
0
 /// <summary>
 /// Transfers a Capture to a Match
 /// </summary>
 /// <param name="match"></param>
 /// <param name="capnum"></param>
 /// <param name="uncapnum"></param>
 /// <param name="start"></param>
 /// <param name="end"></param>
 internal void TransferCapture(Match match, int capnum, int uncapnum, int start, int end)
 {
     if (end < start)
     {
         int numx = end;
         end = start;
         start = numx;
     }
     int num = match.MatchIndex(uncapnum);
     int num2 = match.MatchLength(uncapnum);
     if (start >= num2)
     {
         end = start;
         start = num2;
     }
     else if (end <= num)
     {
         start = num;
     }
     else
     {
         if (end > num2)
         {
             end = num2;
         }
         if (num > start)
         {
             start = num;
         }
     }
     //this.Crawl(uncapnum);
     match.BalanceMatch(uncapnum);
     if (capnum != -1)
     {
         //this.Crawl(capnum);
         match.AddMatch(capnum, start, end - start);
     }
 }
Пример #5
0
 /// <summary>
 /// Searches the specified input string for the first occurrence of the specified regular expression.
 /// </summary>
 /// <param name="input">The input string to match at</param>
 /// <param name="beginning">The place to start matching</param>
 ///<param name="length">NOT YET USED</param>
 /// <returns>The Match resulting from the input against the compiled pattern</returns>
 internal Match Match(string input, int beginning, int length)
 {
     //Sanity checks
     if (beginning < 0 || beginning > input.Length) throw new ArgumentException("beginning");
     //Set timing flag
     //If the RegexOption is set OR the timed flag passed
     this.timed = (this.Options & RegexOptions.Timed) == RegexOptions.Timed;
     //Attempt a match
     Match result = RegularExpressions.Match.Empty;
     if (IsMatch(input, beginning))
     {
         result = new Match(this, matchCount, input, start0, end0 - start0, beginning);
         //Must call AddMatch to ensure the start and ends are allocated to result.groups[i].caps
         for (int i = 0; i < matchCount; ++i)
         {
             int start = GroupStart(i), end = GroupEnd(i), len = end - start;
             result.AddMatch(i, start, len);
         }
         //Clean up the result using the members calculated when AddMatch was called
         result._index = result._matches[0][0];
         result._length = result._matches[0][1];
         result._capcount = result._matchcount[0];
         //Set the position of the result which is the end of the first subexpression
         //subsequent matches will proceed from this index
         result._textpos = end0;
     }
     return result;
 }
Пример #6
0
 /// <summary>
 /// Adds a match to a Match
 /// </summary>
 /// <param name="capnum"></param>
 /// <param name="start"></param>
 /// <param name="end"></param>
 internal void Capture(Match match, int capnum, int start, int end)
 {
     if (end < start)
     {
         int num = end;
         end = start;
         start = num;
     }
     //this.Crawl(capnum);
     match.AddMatch(capnum, start, end - start);
 }
Пример #7
0
 public void Reset()
 {
     this._curindex = 0;
     this._done = false;
     this._match = null;
 }