Beispiel #1
0
        public override int Matches(int stringIndex, String testString,
                                    MatchResultImpl matchResult)
        {
            int strLength = matchResult.GetRightBound();

            if (stringIndex + 1 > strLength)
            {
                matchResult.hitEnd = true;
                return(-1);
            }
            char high = testString[stringIndex];

            if (System.Char.IsHighSurrogate(high) && (stringIndex + 2 <= strLength))
            {
                char low = testString[stringIndex + 1];

                if (System.Char.IsSurrogatePair(high, low))
                {
                    return((lt.IsLineTerminator(Character.ToCodePoint(high, low))) ? -1
                                                        : next.Matches(stringIndex + 2, testString, matchResult));
                }
            }

            return((lt.IsLineTerminator(high)) ? -1 : next.Matches(stringIndex + 1,
                                                                   testString, matchResult));
        }
Beispiel #2
0
 /*
  * All line terminators are from Basic Multilingual Pane
  */
 private int FindLineTerminator(int from, int to, String testString)
 {
     for (int i = from; i < to; i++)
     {
         if (lt.IsLineTerminator(testString[i]))
         {
             return(i);
         }
     }
     return(-1);
 }