internal CharSubtraction(IBaseGroup baseGroup, IExcludedGroup excludedGroup) { if (baseGroup == null) throw new ArgumentNullException(nameof(baseGroup)); if (excludedGroup == null) throw new ArgumentNullException(nameof(excludedGroup)); _baseGroup = baseGroup; _excludedGroup = excludedGroup; }
/// <summary> /// Returns a pattern that matches a character from a specified base group except characters from a specified excluded group. /// </summary> /// <param name="baseGroup">A base group.</param> /// <param name="excludedGroup">An excluded group.</param> /// <exception cref="ArgumentNullException"><paramref name="baseGroup"/> or <paramref name="excludedGroup"/> is <c>null</c>.</exception> public static CharSubtraction Except(this IBaseGroup baseGroup, IExcludedGroup excludedGroup) { return(new CharSubtraction(baseGroup, excludedGroup)); }
internal CharSubtraction(IBaseGroup baseGroup, IExcludedGroup excludedGroup) { _baseGroup = baseGroup ?? throw new ArgumentNullException(nameof(baseGroup)); _excludedGroup = excludedGroup ?? throw new ArgumentNullException(nameof(excludedGroup)); }
/// <summary> /// Appends a pattern that matches a character from a specified base group except characters from a specified excluded group. /// </summary> /// <param name="baseGroup">A base group.</param> /// <param name="excludedGroup">An excluded group.</param> /// <exception cref="ArgumentNullException"><paramref name="baseGroup"/> or <paramref name="excludedGroup"/> is <c>null</c>.</exception> public void AppendSubtraction(IBaseGroup baseGroup, IExcludedGroup excludedGroup) { if (baseGroup == null) throw new ArgumentNullException(nameof(baseGroup)); if (excludedGroup == null) throw new ArgumentNullException(nameof(excludedGroup)); AppendCharGroupStart(); baseGroup.AppendBaseGroupTo(this); AppendDirect('-'); excludedGroup.AppendExcludedGroupTo(this); AppendCharGroupEnd(); }
/// <summary> /// Returns a pattern that matches a character from a specified base group except characters from a specified excluded group. /// </summary> /// <param name="baseGroup">A base group.</param> /// <param name="excludedGroup">An excluded group.</param> /// <returns></returns> /// <exception cref="ArgumentNullException"><paramref name="baseGroup"/> or <paramref name="excludedGroup"/> is <c>null</c>.</exception> public static CharSubtraction Except(this IBaseGroup baseGroup, IExcludedGroup excludedGroup) { return new CharSubtraction(baseGroup, excludedGroup); }