Esempio n. 1
0
        public override int Matches(int strIndex, String testString,
                                    MatchResultImpl matchResult)
        {
            int rightBound = (matchResult.HasAnchoringBounds()) ? matchResult
                             .GetRightBound() : testString.Length;

            if (strIndex >= rightBound)
            {
                matchResult.SetConsumed(consCounter, 0);
                return(next.Matches(strIndex, testString, matchResult));
            }

            // check final line terminator;
            if ((rightBound - strIndex) == 2 && testString[strIndex] == '\r' &&
                testString[strIndex + 1] == '\n')
            {
                matchResult.SetConsumed(consCounter, 0);
                return(next.Matches(strIndex, testString, matchResult));
            }
            char ch;

            if ((rightBound - strIndex) == 1 &&
                (((ch = testString[strIndex]) == '\n' || ch == '\r' ||
                  ch == '\u0085' || (ch | 1) == '\u2029')))
            {
                matchResult.SetConsumed(consCounter, 0);
                return(next.Matches(strIndex, testString, matchResult));
            }

            return(-1);
        }
Esempio n. 2
0
 public override int Matches(int strIndex, String testString,
                             MatchResultImpl matchResult)
 {
     if (strIndex == 0 ||
         (matchResult.HasAnchoringBounds() && strIndex == matchResult
          .GetLeftBound()))
     {
         return(next.Matches(strIndex, testString, matchResult));
     }
     return(-1);
 }
Esempio n. 3
0
        public override int Matches(int strIndex, String testString,
                                    MatchResultImpl matchResult)
        {
            if (strIndex != matchResult.GetRightBound() &&
                ((strIndex == 0 || (matchResult.HasAnchoringBounds() && strIndex == matchResult
                                    .GetLeftBound())) || lt.IsAfterLineTerminator(
                     testString[strIndex - 1],
                     testString[strIndex])))
            {
                return(next.Matches(strIndex, testString, matchResult));
            }

            return(-1);
        }
Esempio n. 4
0
        public override int Matches(int strIndex, String testString,
                                    MatchResultImpl matchResult)
        {
            int strDif = (matchResult.HasAnchoringBounds()) ? matchResult
                         .GetLeftBound() - strIndex : testString.Length - strIndex;
            char ch1;
            char ch2;

            if (strDif == 0)
            {
                matchResult.SetConsumed(consCounter, 0);
                return(next.Matches(strIndex, testString, matchResult));
            }
            else if (strDif >= 2)
            {
                ch1 = testString[strIndex];
                ch2 = testString[strIndex + 1];
            }
            else
            {
                ch1 = testString[strIndex];
                ch2 = 'a';
            }

            switch ((int)ch1)
            {
            case '\r': {
                if (ch2 == '\n')
                {
                    matchResult.SetConsumed(consCounter, 0);
                    return(next.Matches(strIndex, testString, matchResult));
                }
                matchResult.SetConsumed(consCounter, 0);
                return(next.Matches(strIndex, testString, matchResult));
            }

            case '\n':
            case '\u0085':
            case '\u2028':
            case '\u2029': {
                matchResult.SetConsumed(consCounter, 0);
                return(next.Matches(strIndex, testString, matchResult));
            }

            default:
                return(-1);
            }
        }
Esempio n. 5
0
        public override int Matches(int strIndex, String testString,
                                    MatchResultImpl matchResult)
        {
            int strDif = (matchResult.HasAnchoringBounds()) ? matchResult
                         .GetRightBound() - strIndex : testString.Length - strIndex;

            if (strDif <= 0)
            {
                matchResult.SetConsumed(consCounter, 0);
                return(next.Matches(strIndex, testString, matchResult));
            }
            else if (testString[strIndex] == '\n')
            {
                matchResult.SetConsumed(consCounter, 1);
                return(next.Matches(strIndex + 1, testString, matchResult));
            }
            return(-1);
        }
Esempio n. 6
0
 /// @com.intel.drl.spec_ref
 public bool HasAnchoringBounds()
 {
     return(matchResult.HasAnchoringBounds());
 }