/// <summary> /// Clear inline expression /// </summary> public InlineOptions UnWrap() { InlineOptions o = this; o.innerExpression = string.Empty; return(o); }
//---------------------------------------------------------------------- #region Operations /// <summary> /// Set inline expression /// </summary> public InlineOptions Wrap(string exp) { InlineOptions o = this; o.innerExpression = exp; return(o); }
/// <summary> /// Creates inline options that can enable or disable options for the remainder of the current expression. /// </summary> /// <param name="enabled">The options to enable.</param> /// <param name="disabled">The options to disable.</param> /// <returns>The options group.</returns> public static IInlineOptions For(GroupRegexOptions enabled, GroupRegexOptions disabled) { Group.ValidateRegexOptions(nameof(enabled), enabled); Group.ValidateRegexOptions(nameof(disabled), disabled); var options = new InlineOptions() { EnabledOptions = enabled, DisabledOptions = disabled }; return(options); }
/// <summary> /// combine positive and nagetive options /// </summary> public static InlineOptions operator -(InlineOptions l, InlineOptions r) { string iexp = l.innerExpression; if (string.IsNullOrEmpty(iexp)) { iexp = r.innerExpression; } string pexp = l.prevExpression; if (string.IsNullOrEmpty(pexp)) { iexp = r.prevExpression; } InlineOptions o = new InlineOptions { negative = 0, positive = 0, innerExpression = iexp, prevExpression = pexp }; for (byte b = 0; b < length; b++) { if ((r.positive & (one << b)) != 0) { o.negative |= one << b; } else if ((l.positive & (one << b)) != 0) { o.positive |= one << b; } } return(o); }
public static InlineOptions operator +(InlineOptions l, InlineOptions r) { InlineOptions o = new InlineOptions { negative = 0, positive = 0, innerExpression = l.innerExpression, prevExpression = l.prevExpression }; for (byte b = 0; b < length; b++) { if ((r.positive & (one << b)) != 0) { o.positive |= one << b; } else if ((l.positive & (one << b)) != 0) { o.positive |= one << b; } } return(o); }