Esempio n. 1
0
        protected override ParsingState MatchImpl(ParsingState st)
        {
            //int pos = st.Pos;
            //if (this.Child.Match(st).LastMatchSuccessed == true)
            //    return st.ExitChild(false, pos - st.Pos);
            //else
            //    return st.ExitChild(true, st.Pos - pos);

            var newState = this.Child.Match(st.EnterChild(this.Child));

            return(newState.ExitChild(!newState.LastMatchSuccessed.Value, -(newState.Pos - st.Pos)));
        }
Esempio n. 2
0
 protected override ParsingState MatchImpl(ParsingState st)
 {
     //int startPos = st.Pos;
     foreach (var item in this.Items)
     {
         st = item.Match(st.EnterChild(item));
         if (st.LastMatchSuccessed == false)
         {
             return(st.ExitChild(false));
         }
     }
     return(st.ExitChild(true, 0));
 }
Esempio n. 3
0
        protected override ParsingState MatchImpl(ParsingState st)
        {
            int count    = 0;
            int startPos = st.Pos;

            for (; count < this.Max; ++count)
            {
                st = this.Child.Match(st.EnterChild(this.Child));
                if (st.LastMatchSuccessed == false)
                {
                    break;
                }
            }

            if (count >= this.Min && count <= this.Max)
            {
                return(st.ExitChild(true));
            }
            else
            {
                return(st.ExitChild(false));
            }
        }