コード例 #1
0
 void SetDataItemProperty(DataItem dataItem, NodeProperty property)
 {
     if (property.Anchor != null)
     {
         currentDocument.AnchoredItems[property.Anchor] = dataItem;
     }
     dataItem.Property = property;
 }
コード例 #2
0
        private DataItem ParseDataItem(out bool success)
        {
            int errorCount = Errors.Count;
            DataItem dataItem = new DataItem();
            int start_position = position;

            while (true)
            {
                int seq_start_position1 = position;
                dataItem.Property = ParseNodeProperty(out success);
                if (!success)
                {
                    Error("Failed to parse Property of DataItem.");
                    break;
                }

                ParseSeparationLines(out success);
                if (!success)
                {
                    Error("Failed to parse SeparationLines of DataItem.");
                    position = seq_start_position1;
                }
                break;
            }
            success = true;

            ErrorStatck.Push(errorCount); errorCount = Errors.Count;
            while (true)
            {
                dataItem = ParseScalar(out success);
                if (success) { ClearError(errorCount); break; }

                dataItem = ParseSequence(out success);
                if (success) { ClearError(errorCount); break; }

                dataItem = ParseMapping(out success);
                if (success) { ClearError(errorCount); break; }

                break;
            }
            errorCount = ErrorStatck.Pop();
            if (!success)
            {
                Error("Failed to parse (Scalar / Sequence / Mapping) of DataItem.");
                position = start_position;
            }

            if (success) { ClearError(errorCount); }
            return dataItem;
        }
コード例 #3
0
        private DataItem ParseEmptyFlow(out bool success)
        {
            int errorCount = Errors.Count;
            DataItem dataItem = new DataItem();

            success = true;
            if (success) { return new Scalar(); }
            return dataItem;
        }