private static void CalculateBraces(StringBuilder buffer, out int left, out int right)
        {
            left  = 0;
            right = 0;

            var enumerator = new StringBuilderEnumerator(buffer);

            while (enumerator.MoveNext())
            {
                switch (enumerator.Current)
                {
                case ']':
                    right++;
                    break;

                case '[':
                    left++;
                    break;
                }
            }
        }
Beispiel #2
0
        private static bool CanBreakAtSpace(StringBuilder buffer)
        {
            var left  = 0;
            var right = 0;

            var enumerator = new StringBuilderEnumerator(buffer);

            while (enumerator.MoveNext())
            {
                switch (enumerator.Current)
                {
                case ']':
                    right++;
                    break;

                case '[':
                    left++;
                    break;
                }
            }

            return(left == 0 || left == right);
        }