コード例 #1
0
 public void AddLookup(RegexItem item, int startLocation, int endLocation, bool canCoalesce)
 {
     if (inSeries)
     {
         // in a series, add character to the previous one...
         if (canCoalesce)
         {
             RegexRef lastItem = (RegexRef)expressionLookup[expressionLookup.Count - 1];
             lastItem.StringValue += item.ToString(0);
             lastItem.Length      += endLocation - startLocation + 1;
         }
         else
         {
             expressionLookup.Add(new RegexRef(item, startLocation, endLocation));
             inSeries = false;
         }
     }
     else
     {
         if (canCoalesce)
         {
             inSeries = true;
         }
         expressionLookup.Add(new RegexRef(item, startLocation, endLocation));
     }
 }
コード例 #2
0
ファイル: RegexRef.cs プロジェクト: wli3/RegexWB
        public int CompareTo(object o2)
        {
            RegexRef ref2 = (RegexRef)o2;

            if (this.Length < ref2.Length)
            {
                return(-1);
            }
            else if (this.Length > ref2.Length)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }