/// <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) { var recursive = new RecursiveRule(() => 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) { var recursive = new RecursiveRule(() => Nested(begin, end)); return(begin + NoFailSeq(Star(recursive | Not(end) + Not(begin) + Anything()) + end)); }