Пример #1
0
 /// <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);
 }
Пример #2
0
        /// <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));
        }