/// <summary>
        /// Add an existing <see cref="RegexAtomicGroupNode"/> to the generator.
        /// </summary>
        /// <param name="group"><see cref="RegexAtomicGroupNode"/> to be added.</param>
        /// <returns><see cref="RegexGenerator"/></returns>
        /// <exception cref="AtomicGroupNotSupportedException">Atomic group is not supported by <see cref="RegexLanguage"/>.</exception>
        public RegexGenerator AddAtomicGroup(RegexAtomicGroupNode atomicGroup)
        {
            if (!IsAtomicGroupSupported)
            {
                throw new AtomicGroupNotSupportedException(RegexLanguage);
            }

            return(Add(atomicGroup));
        }
        public virtual string ToAtomicGroupString(RegexAtomicGroupNode atomicGroup)
        {
            if (!IsAtomicGroupSupported)
            {
                throw new AtomicGroupNotSupportedException(RegexLanguage);
            }
            if (atomicGroup == null)
            {
                throw new ArgumentNullException(nameof(atomicGroup));
            }

            var sb = new StringBuilder();

            sb.Append(ToTokenString(RegexToken.AtomicGroupOpen))
            .Append(atomicGroup.IsInnerNodeIncluded ? ToString(atomicGroup.InnerNode) : atomicGroup.Pattern)
            .Append(ToTokenString(RegexToken.AtomicGroupClose));

            return(AddQuantifier(sb.ToString(), atomicGroup.Minimum, atomicGroup.Maximum, atomicGroup.RegexQuantifierOption));
        }
        /// <summary>
        /// Create and add <see cref="RegexAtomicGroupNode"/> to the generator, and include another <see cref="RegexNode"/> inside.
        /// </summary>
        /// <param name="innerNode">An existing <see cref="RegexNode"/> to be included.</param>
        /// <param name="min">Optional minimum number of occurance.</param>
        /// <param name="max">Optional maximum number of occurance.</param>
        /// <param name="quantifierOption">Optional quantifier option.</param>
        /// <returns><see cref="RegexGenerator"/></returns>
        /// <exception cref="AtomicGroupNotSupportedException">Atomic group is not supported by <see cref="RegexLanguage"/>.</exception>
        public RegexGenerator AddAtomicGroup(RegexNode innerNode, int?min = null, int?max = null, RegexQuantifierOption quantifierOption = RegexQuantifierOption.Greedy)
        {
            var atomicGroup = new RegexAtomicGroupNode(innerNode, min, max, quantifierOption);

            return(AddAtomicGroup(atomicGroup));
        }
        /// <summary>
        /// Create and add <see cref="RegexAtomicGroupNode"/> to the generator.
        /// </summary>
        /// <param name="pattern">Regex pattern.</param>
        /// <param name="min">Optional minimum number of occurance.</param>
        /// <param name="max">Optional maximum number of occurance.</param>
        /// <param name="quantifierOption">Optional quantifier option.</param>
        /// <returns><see cref="RegexGenerator"/></returns>
        /// <exception cref="AtomicGroupNotSupportedException">Atomic group is not supported by <see cref="RegexLanguage"/>.</exception>
        public RegexGenerator AddAtomicGroup(string pattern, int?min = null, int?max = null, RegexQuantifierOption quantifierOption = RegexQuantifierOption.Greedy)
        {
            var atomicGroup = new RegexAtomicGroupNode(pattern, min, max, quantifierOption);

            return(AddAtomicGroup(atomicGroup));
        }