示例#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);
        }
        public override bool HasConsumed(MatchResultImpl matchResult)
        {
            int  cons;
            bool res = ((cons = matchResult.GetConsumed(consCounter)) < 0 || cons > 0);

            matchResult.SetConsumed(consCounter, -1);
            return(res);
        }
示例#3
0
        public override int Matches(int stringIndex, String testString,
                                    MatchResultImpl matchResult)
        {
            int gr         = GetGroupIndex();
            int rightBound = matchResult.GetConsumed(gr);

            return((rightBound == stringIndex) ? stringIndex : -1);
        }
示例#4
0
        public override int Matches(int stringIndex, String testString,
                                    MatchResultImpl matchResult)
        {
            int gr = GetGroupIndex();

            matchResult.SetConsumed(gr, stringIndex - matchResult.GetConsumed(gr));

            return(next.Matches(stringIndex, testString, matchResult));
        }
示例#5
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);
        }
示例#6
0
        public override bool HasConsumed(MatchResultImpl matchResult)
        {
            int cons = matchResult.GetConsumed(groupIndex);

            return(cons != 0);
        }