public override bool Match(Parser p) { // TODO: make a more descriptive error message. if (!mRule.Match(p)) { throw new Exception(msMsg); } return(true); }
public override bool Match(Parser p) { p.CreateNode(mLabel); bool result = mRule.Match(p); if (result) { p.CompleteNode(); } else { p.AbandonNode(); } return(result); }
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); }
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; }