Esempio n. 1
0
        public override (bool success, int offset) IsMatch(string text, int startOffset = 0)
        {
            if (startOffset - 1 >= 0 && char.IsLetterOrDigit(text[startOffset - 1]))
            {
                return(false, 0);
            }

            (bool success, int offset) = _subPattern.IsMatch(text, startOffset);

            int next = startOffset + offset;

            return(success && next < text.Length && char.IsLetterOrDigit(text[next]) ? (false, 0) : (success, offset));
        }
Esempio n. 2
0
        public override (bool success, int offset) IsMatch(string text, int startOffset = 0)
        {
            int numPatterns = _subPatterns.Count;

            for (int i = 0; i < numPatterns; i++)
            {
                PatternMatcher matcher = _subPatterns[i];
                (bool success, int subOffset) = matcher.IsMatch(text, startOffset);
                if (success)
                {
                    return(true, subOffset);
                }
            }
            return(false, 0);
        }
Esempio n. 3
0
        public override (bool success, int offset) IsMatch(string text, int startOffset = 0)
        {
            int            offset  = startOffset;
            bool           success = true;
            int            subOffset;
            PatternMatcher subPattern = _subPattern;

            if (subPattern != null)
            {
                while (success)
                {
                    (success, subOffset) = subPattern.IsMatch(text, offset);
                    offset += subOffset;
                }
            }
            return(true, offset - startOffset);
        }
Esempio n. 4
0
        public override (bool success, int offset) IsMatch(string text, int startOffset = 0)
        {
            int            upperBounds = _upperBounds;
            int            offset      = startOffset;
            bool           subSuccess  = true;
            int            subOffset;
            PatternMatcher subPattern = _subPattern;
            int            matches    = 0;

            for (; matches < upperBounds && subSuccess; matches++)
            {
                (subSuccess, subOffset) = subPattern.IsMatch(text, offset);
                offset += subOffset;
            }
            bool success = subSuccess || matches >= _lowerBounds;

            return(success ? (true, offset - startOffset) : (false, 0));
        }
Esempio n. 5
0
 public override (bool success, int offset) IsMatch(string text, int startOffset = 0)
 {
     return(text.Length > startOffset && !_subPattern.IsMatch(text, startOffset).success ? (true, 0) : (false, 0));
 }
Esempio n. 6
0
 public override (bool success, int offset) IsMatch(string text, int startOffset = 0)
 {
     return(true, _subPattern.IsMatch(text, startOffset).offset);
 }