Example #1
0
        void AddIndent(BlockScalarModifier modifier, bool success)
        {
            if (success)
            {
                Indents.Push(currentIndent);
                currentIndent += modifier.GetIndent();
                detectIndent   = true;
            }
            else
            {
                IncreaseIndentIfZero();
            }

            CurrentChompingMethod = modifier.GetChompingMethod();
        }
        void AddIndent(BlockScalarModifier modifier, bool success)
        {
            if (success)
            {
                Indents.Push(currentIndent);
                currentIndent += modifier.GetIndent();
                detectIndent = true;
            }
            else
            {
                IncreaseIndentIfZero();
            }

            CurrentChompingMethod = modifier.GetChompingMethod();
        }
        private BlockScalarModifier ParseBlockScalarModifier(out bool success)
        {
            int errorCount = Errors.Count;
            BlockScalarModifier blockScalarModifier = new BlockScalarModifier();

            while (true)
            {
                int seq_start_position1 = position;
                blockScalarModifier.Indent = ParseIndentIndicator(out success);
                if (!success)
                {
                    Error("Failed to parse Indent of BlockScalarModifier.");
                    break;
                }

                blockScalarModifier.Chomp = ParseChompingIndicator(out success);
                success = true;
                break;
            }
            if (success) { ClearError(errorCount); return blockScalarModifier; }

            while (true)
            {
                int seq_start_position2 = position;
                blockScalarModifier.Chomp = ParseChompingIndicator(out success);
                if (!success)
                {
                    Error("Failed to parse Chomp of BlockScalarModifier.");
                    break;
                }

                blockScalarModifier.Indent = ParseIndentIndicator(out success);
                success = true;
                break;
            }
            if (success) { ClearError(errorCount); return blockScalarModifier; }

            return blockScalarModifier;
        }