Exemple #1
0
        private static Gen <Regex <char> > DefineGen()
        {
            var delayedRegex = Gen.Delay(new GetRegex());

            return(Gen.ChoiceRecursive(
                       new[]
            {
                from c in Gen.Unicode
                select Regex <char> .Just(c),

                Gen.Constant(Regex <char> .Fail),

                Gen.Constant(Regex <char> .Epsilon),
            },
                       new[]
            {
                from c in delayedRegex
                select ~c,

                from c in delayedRegex
                select !c,

                from l in delayedRegex
                from r in delayedRegex
                select l *r,

                from l in delayedRegex
                from r in delayedRegex
                select l + r,

                from l in delayedRegex
                from r in delayedRegex
                select l& r,
            }));
        }