Beispiel #1
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));
 }
Beispiel #2
0
        protected override ParsingState MatchImpl(ParsingState st)
        {
            if (st.Pos >= st.Text.Length)
            {
                return(st.ExitChild(false));
            }

            if (this.ClassTest(st.Text[st.Pos]))
            {
                return(st.ExitChild(true, 1));
            }
            return(st.ExitChild(false));
        }
Beispiel #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));
            }
        }
Beispiel #4
0
        protected override ParsingState MatchImpl(ParsingState st)
        {
            int startPos = st.Pos;

            if (st.Pos + this.Chars.Length > st.Text.Length)
            {
                return(st.ExitChild(false));
            }

            int j = st.Pos;

            for (int i = 0; i < this.Chars.Length; i++)
            {
                if (st.Text[j] != this.Chars[i])
                {
                    return(st.ExitChild(false));
                }

                ++j;
            }

            return(st.ExitChild(true, j - startPos));
        }