Represents the rules for repeating an expression.
Пример #1
0
        public void Constructor_WhenGivenANullExpression_ThrowsException()
        {
            var start = new Cursor("OK");
            var end = start.Advance(2);
            var quantifier = new Quantifier(start, end, 0);

            Assert.That(() => new RepetitionExpression(null, quantifier), Throws.InstanceOf<ArgumentNullException>());
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RepetitionExpression"/> class.
        /// </summary>
        /// <param name="expression">The expression to be repeatedly matched.</param>
        /// <param name="quantifier">The quantifier that specifies how many times to match and the delimiter of the matches.</param>
        public RepetitionExpression(Expression expression, Quantifier quantifier)
        {
            if (expression == null)
            {
                throw new ArgumentNullException(nameof(expression));
            }

            if (quantifier == null)
            {
                throw new ArgumentNullException(nameof(quantifier));
            }

            this.Expression = expression;
            this.Quantifier = quantifier;
        }
Пример #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RepetitionExpression"/> class.
        /// </summary>
        /// <param name="expression">The expression to be repeatedly matched.</param>
        /// <param name="quantifier">The quantifier that specifies how many times to match and the delimiter of the matches.</param>
        public RepetitionExpression(Expression expression, Quantifier quantifier)
        {
            if (expression == null)
            {
                throw new ArgumentNullException("expression");
            }

            if (quantifier == null)
            {
                throw new ArgumentNullException("quantifier");
            }

            this.expression = expression;
            this.quantifier = quantifier;
        }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RepetitionExpression"/> class.
        /// </summary>
        /// <param name="expression">The expression to be repeatedly matched.</param>
        /// <param name="quantifier">The quantifier that specifies how many times to match and the delimiter of the matches.</param>
        public RepetitionExpression(Expression expression, Quantifier quantifier)
        {
            if (expression == null)
            {
                throw new ArgumentNullException(nameof(expression));
            }

            if (quantifier == null)
            {
                throw new ArgumentNullException(nameof(quantifier));
            }

            this.Expression = expression;
            this.Quantifier = quantifier;
        }