Exemplo n.º 1
0
        public override int Match(MatchContent content)
        {
            int charCount = 0;

            if (content.Direction == MatchDirection.Forward)
            {
                for (int i = 0; i < _inners.Length; i++)
                {
                    var c = _inners[i].Match(content.Offset(charCount));
                    if (c == NotMatch)
                    {
                        return(NotMatch);
                    }
                    else
                    {
                        charCount += c;
                    }
                }
            }
            else
            {
                for (int i = _inners.Length - 1; i >= 0; i--)
                {
                    var c = _inners[i].Match(content.Offset(charCount));
                    if (c == NotMatch)
                    {
                        return(NotMatch);
                    }
                    else
                    {
                        charCount += c;
                    }
                }
            }
            return(charCount);
        }
Exemplo n.º 2
0
        public override int Match(MatchContent content)
        {
            int charCount = 0;

            foreach (var m in _inners)
            {
                var c = m.Match(content.Offset(charCount));
                if (c == NotMatch)
                {
                    return(NotMatch);
                }
                else
                {
                    charCount += c;
                }
            }
            return(charCount);
        }
Exemplo n.º 3
0
        public override int Match(MatchContent content)
        {
            int totalCharCount = 0;
            int count          = 0;

            while (true)
            {
                var currentCharCount = _inner.Match(content.Offset(totalCharCount));
                if (currentCharCount <= 0)
                {
                    return(count >= _minOccur ? totalCharCount : NotMatch);
                }
                totalCharCount += currentCharCount;
                count++;
                if (count >= _maxOccur)
                {
                    return(totalCharCount);
                }
                if (content.Length == totalCharCount)
                {
                    return(count >= _minOccur ? totalCharCount : NotMatch);
                }
            }
        }