Example #1
0
        /// <summary>
        /// Returns stringIndex+shift, the next position to match
        /// </summary>
        ///
        public override int Matches(int stringIndex, String testString,
                                    MatchResultImpl matchResult)
        {
            int start = matchResult.GetConsumed(groupIndex);

            matchResult.SetConsumed(groupIndex, stringIndex);

            int size = children.Count;

            for (int i = 0; i < size; i++)
            {
                AbstractSet e     = (AbstractSet)children[i];
                int         shift = e.Matches(stringIndex, testString, matchResult);
                if (shift >= 0)
                {
                    // AtomicFset always returns true, but saves the index to run
                    // this next.match() from;
                    return(next.Matches(((AtomicFSet)fSet).GetIndex(), testString,
                                        matchResult));
                }
            }

            matchResult.SetConsumed(groupIndex, start);
            return(-1);
        }
Example #2
0
        /// <summary>
        /// Runs match starting from <c>set</c> specified against input
        /// sequence starting at <c>index</c> specified; Result of the match
        /// will be stored into matchResult instance;
        /// </summary>
        ///
        private bool RunMatch(AbstractSet set, int index,
                              MatchResultImpl matchResult_0)
        {
            if (set.Matches(index, str0, matchResult_0) >= 0)
            {
                matchResult_0.FinalizeMatch();
                return(true);
            }

            return(false);
        }
Example #3
0
        public override int Matches(int stringIndex, String testString,
                                    MatchResultImpl matchResult)
        {
            int start = matchResult.GetStart(groupIndex);

            matchResult.SetStart(groupIndex, stringIndex);
            int shift = kid.Matches(stringIndex, testString, matchResult);

            if (shift >= 0)
            {
                return(shift);
            }
            matchResult.SetStart(groupIndex, start);
            return(-1);
        }
        /// <summary>
        /// Returns stringIndex+shift, the next position to match
        /// </summary>
        ///
        public override int Matches(int stringIndex, String testString,
                                    MatchResultImpl matchResult)
        {
            int size = children.Count;

            for (int i = 0; i < size; i++)
            {
                AbstractSet e = (AbstractSet)children[i];
                if (e.Matches(stringIndex, testString, matchResult) >= 0)
                {
                    return(-1);
                }
            }

            return(next.Matches(stringIndex, testString, matchResult));
        }
        public override int Matches(int stringIndex, String testString,
                                    MatchResultImpl matchResult)
        {
            int shift = withoutSurrogates.Matches(stringIndex, testString,
                                                  matchResult);

            if (shift < 0)
            {
                shift = withSurrogates
                        .Matches(stringIndex, testString, matchResult);
            }

            if (shift >= 0)
            {
                return(shift);
            }
            return(-1);
        }
        /// <summary>
        /// Returns stringIndex+shift, the next position to match
        /// </summary>
        ///
        public override int Matches(int stringIndex, String testString,
                                    MatchResultImpl matchResult)
        {
            int size = children.Count;

            for (int i = 0; i < size; i++)
            {
                AbstractSet e     = (AbstractSet)children[i];
                int         shift = e.Matches(stringIndex, testString, matchResult);
                if (shift >= 0)
                {
                    // PosLookaheadFset always returns true, position remains the
                    // same
                    // next.match() from;
                    return(next.Matches(stringIndex, testString, matchResult));
                }
            }

            return(-1);
        }
Example #7
0
        /// <summary>
        /// Returns stringIndex+shift, the next position to match
        /// </summary>
        ///
        public override int Matches(int stringIndex, String testString,
                                    MatchResultImpl matchResult)
        {
            int start = matchResult.GetConsumed(groupIndex);

            matchResult.SetConsumed(groupIndex, stringIndex);

            int size = children.Count;

            for (int i = 0; i < size; i++)
            {
                AbstractSet e     = (AbstractSet)children[i];
                int         shift = e.Matches(stringIndex, testString, matchResult);
                if (shift >= 0)
                {
                    return(shift);
                }
            }
            matchResult.SetConsumed(groupIndex, start);
            return(-1);
        }