Represents a class that enables to create a text representation of the Pattern. This class cannot be inherited.
Пример #1
0
 internal override void AppendTo(PatternBuilder builder)
 {
     if (_count2 == -1)
         builder.AppendCountInternal(_count1);
     else
         builder.AppendCountInternal(_count1, _count2);
 }
Пример #2
0
            protected override void AppendItemContentTo(PatternBuilder builder)
            {
                if (builder == null)
                    throw new ArgumentNullException(nameof(builder));

                builder.Append(_value, true);
            }
Пример #3
0
        /// <summary>
        /// Appends the text representation of the current instance of the character subtraction to the specified <see cref="PatternBuilder"/>.
        /// </summary>
        /// <param name="builder">The builder to use for appending the text.</param>
        /// <exception cref="ArgumentNullException"><paramref name="builder"/> is <c>null</c>.</exception>
        public void AppendExcludedGroupTo(PatternBuilder builder)
        {
            if (builder == null)
                throw new ArgumentNullException(nameof(builder));

            AppendTo(builder);
        }
Пример #4
0
            protected override void AppendQuantifierTo(PatternBuilder builder)
            {
                if (builder == null)
                    throw new ArgumentNullException(nameof(builder));

                builder.AppendCountFromInternal(_minCount);
            }
Пример #5
0
        internal override void AppendTo(PatternBuilder builder)
        {
            builder.Append(_contentBefore);

            builder.Append(_content);

            builder.Append(_contentAfter);
        }
Пример #6
0
        internal override void AppendTo(PatternBuilder builder)
        {
            if (AddGroup)
                builder.AppendNoncapturingGroup(Content);
            else
                builder.AppendGroupContent(Content);

            AppendQuantifierTo(builder);
        }
 internal override void AppendTo(PatternBuilder builder)
 {
     if (!string.IsNullOrEmpty(_text))
     {
         if (_ignoreCase)
             builder.AppendOptions(RegexOptions.IgnoreCase, _text);
         else
             builder.AppendOptions(RegexOptions.None, RegexOptions.IgnoreCase, _text);
     }
 }
Пример #8
0
            protected override void AppendQuantifierTo(PatternBuilder builder)
            {
                if (builder == null)
                    throw new ArgumentNullException(nameof(builder));

                if (_count2 == -1)
                    builder.AppendCountInternal(_count1);
                else
                    builder.AppendCountInternal(_count1, _count2);
            }
Пример #9
0
 internal override void AppendTo(PatternBuilder builder)
 {
     var values = _content as object[];
     if (values != null)
     {
         for (int i = 0; i < values.Length; i++)
             builder.Append(values[i]);
     }
     else
     {
         var items = _content as IEnumerable;
         if (items != null)
         {
             foreach (var item in items)
                 builder.Append(item);
         }
     }
 }
Пример #10
0
        internal override void AppendTo(PatternBuilder builder)
        {
            var values = _content as object[];
            if (values != null)
            {
                if (values.Length > 0)
                {
                    builder.Append(values[0]);

                    if (values.Length > 1)
                    {
                        for (int i = 1; i < values.Length; i++)
                        {
                            builder.Append(_separator);
                            builder.Append(values[i]);
                        }
                    }
                }
            }
            else
            {
                var items = _content as IEnumerable;

                IEnumerator en = items.GetEnumerator();

                if (en.MoveNext())
                {
                    builder.Append(en.Current);

                    if (en.MoveNext())
                    {
                        builder.Append(_separator);
                        builder.Append(en.Current);

                        while (en.MoveNext())
                        {
                            builder.Append(_separator);
                            builder.Append(en.Current);
                        }
                    }
                }
            }
        }
Пример #11
0
 internal override void AppendTo(PatternBuilder builder)
 {
     builder.AppendBackAssertion(_backAssertion);
     builder.Append(_content);
     builder.AppendAssertion(_assertion);
 }
Пример #12
0
 internal override void AppendTo(PatternBuilder builder)
 {
     builder.AppendOneMany();
 }
Пример #13
0
 internal override void AppendTo(PatternBuilder builder)
 {
     builder.AppendCountFromInternal(_minCount);
 }
Пример #14
0
 internal override void AppendTo(PatternBuilder builder)
 {
     builder.AppendIfGroupInternal(GroupName, _trueContent, _falseContent, false);
 }
Пример #15
0
 internal override void AppendTo(PatternBuilder builder)
 {
     builder.AppendMaybe();
 }
Пример #16
0
 internal override void AppendTo(PatternBuilder builder)
 {
     builder.AppendOptions(_applyOptions, _disableOptions, Content);
 }
Пример #17
0
 /// <summary>
 /// Returns the text representation of this instance.
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     var builder = new PatternBuilder();
     AppendContentTo(builder);
     return builder.ToString();
 }
Пример #18
0
            protected override void AppendItemContentTo(PatternBuilder builder)
            {
                if (builder == null)
                    throw new ArgumentNullException(nameof(builder));

                builder.AppendNamedBlock(_block, Negative);
            }
Пример #19
0
 internal override void AppendTo(PatternBuilder builder)
 {
     builder.AppendNamedBlock(_block, _negative);
 }
Пример #20
0
 internal override void AppendTo(PatternBuilder builder)
 {
     builder.AppendBeginningOfInputOrLine();
 }
Пример #21
0
            protected override void AppendItemContentTo(PatternBuilder builder)
            {
                if (builder == null)
                    throw new ArgumentNullException(nameof(builder));

                builder.AppendGeneralCategory(_category, Negative);
            }
Пример #22
0
        internal void AppendContentTo(PatternBuilder builder)
        {
            if (Previous != null)
            {
                Stack<CharGrouping> stack = builder.CharGroupings;
                int cnt = stack.Count;
                CharGrouping item = this;

                do
                {
                    stack.Push(item);
                    item = item.Previous;
                } while (item != null);

                while (stack.Count > cnt)
                {
                    stack.Pop().AppendItemContentTo(builder);
                }
            }
            else
            {
                AppendItemContentTo(builder);
            }
        }
Пример #23
0
        /// <summary>
        /// Appends the text representation of the current instance of the character grouping to the specified <see cref="PatternBuilder"/>.
        /// </summary>
        /// <param name="builder">The builder to use for appending the text.</param>
        /// <exception cref="ArgumentNullException"></exception>
        public void AppendBaseGroupTo(PatternBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            AppendContentTo(builder);
        }
Пример #24
0
 /// <summary>
 /// Appends a core content of the current instance to a specified <see cref="PatternBuilder"/>.
 /// </summary>
 /// <param name="builder">The builder to use for appending the text.</param>
 protected abstract void AppendItemContentTo(PatternBuilder builder);
Пример #25
0
 internal override void AppendTo(PatternBuilder builder)
 {
     builder.Append(_value);
 }
Пример #26
0
 internal override void AppendTo(PatternBuilder builder)
 {
     builder.AppendGeneralCategory(_category, _negative);
 }
Пример #27
0
 /// <summary>
 /// Appends a quantifier to a specified <see cref="PatternBuilder"/>.
 /// </summary>
 /// <param name="builder">The builder to use for appending the text.</param>
 protected abstract void AppendQuantifierTo(PatternBuilder builder);
Пример #28
0
 internal override void AppendTo(PatternBuilder builder)
 {
     builder.AppendNoncapturingGroup(Content);
 }
Пример #29
0
            protected override void AppendItemContentTo(PatternBuilder builder)
            {
                if (builder == null)
                    throw new ArgumentNullException(nameof(builder));

                builder.AppendCharRange(_firstChar, _lastChar);
            }
Пример #30
0
 internal override void AppendTo(PatternBuilder builder)
 {
     builder.AppendIfAssert(_testContent, _trueContent, _falseContent);
 }