示例#1
0
 public RegSeed(IRandomGenerator random, IParserAlphabet parserAlphabet = null)
 {
     _alphabet = parserAlphabet ?? RegexAlphabetFactory.Default();
     _random   = random ?? new RandomGenerator(new Random());
     MaxCharClassInverseLength = _defaultCharClassInverseLength;
     _replaceWildCards         = false;
 }
示例#2
0
        public RegSeed(string regex, Random random = null, IParserAlphabet parserAlphabet = null)
        {
            _replaceWildCards         = false;
            MaxCharClassInverseLength = _defaultCharClassInverseLength;
            _alphabet = parserAlphabet ?? RegexAlphabetFactory.Default();
            _random   = new RandomGenerator(random ?? new Random());

            var loadRegexResult = TryLoadRegexPattern(regex);

            if (!loadRegexResult.IsSuccess)
            {
                throw new ArgumentException(loadRegexResult.ErrorType.ToExceptionMessage());
            }
        }