Example #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));
     }
 }
Example #2
0
        public override string ToString(int offset)
        {
            string result = description;

            if (expression != null)
            {
                result += "\r\n" + expression.ToString(offset + 2) +
                          new String(' ', offset) + "End Capture";
            }
            return(result);
        }
Example #3
0
 public RegexRef(RegexItem regexItem, int start, int end)
 {
     stringValue = regexItem.ToString(0);
     this.start  = start;
     this.end    = end;
 }