/// <summary> /// Creates a rule that matches a pair of rules, consuming all nested pairs within /// as well. /// </summary> /// <param name="begin"></param> /// <param name="end"></param> /// <returns></returns> public Rule Nested(Rule begin, Rule end) { RecursiveRule recursive = new RecursiveRule(() => { return Nested(begin, end); }); return begin + NoFailSeq(Star(recursive | Not(end) + Not(begin) + Anything()) + end); }
/// <summary> /// Creates a rule that matches a pair of rules, consuming all nested pairs within /// as well. /// </summary> /// <param name="begin"></param> /// <param name="end"></param> /// <returns></returns> public Rule Nested(Rule begin, Rule end) { RecursiveRule recursive = new RecursiveRule(() => { return(Nested(begin, end)); }); return(begin + NoFailSeq(Star(recursive | Not(end) + Not(begin) + Anything()) + end)); }