Exemplo n.º 1
0
 public override bool Match(Parser p)
 {
     // TODO: make a more descriptive error message.
     if (!mRule.Match(p))
     {
         throw new Exception(msMsg);
     }
     return(true);
 }
Exemplo n.º 2
0
            public override bool Match(Parser p)
            {
                p.CreateNode(mLabel);
                bool result = mRule.Match(p);

                if (result)
                {
                    p.CompleteNode();
                }
                else
                {
                    p.AbandonNode();
                }
                return(result);
            }
Exemplo n.º 3
0
        public ParseNode Parse(Rule r)
        {
            Debug.Assert(r != null);

            if (!r.Match(this))
            {
                return(null);
            }

            if (mCur != mTree)
            {
                throw new Exception("internal error: parse tree and parse node do not match after parsing");
            }

            mCur.Complete(this);
            return(mTree);
        }
Exemplo n.º 4
0
        public ParseNode Parse(Rule r)
        {
            Debug.Assert(r != null);

            if (!r.Match(this))
                return null;
                            
            if (mCur != mTree)
                throw new Exception("internal error: parse tree and parse node do not match after parsing");
            
            mCur.Complete(this);
            return mTree;
        }