private void Load(EventReader events, DocumentLoadingState state) { SequenceStart sequence = events.Expect <SequenceStart>(); base.Load(sequence, state); Style = sequence.Style; bool hasUnresolvedAliases = false; while (!events.Accept <SequenceEnd>()) { YamlNode child = ParseNode(events, state); children.Add(child); hasUnresolvedAliases |= child is YamlAliasNode; } if (hasUnresolvedAliases) { state.AddNodeWithUnresolvedAliases(this); } #if DEBUG else { foreach (var child in children) { if (child is YamlAliasNode) { throw new InvalidOperationException("Error in alias resolution."); } } } #endif events.Expect <SequenceEnd>(); }
/// <summary> /// Get scalar style corresponding to current sequence style /// </summary> /// <param name="_this">Sequence style</param> /// <returns>Corresponding scalar style</returns> public static ScalarStyle ToScalarStyle(this SequenceStyle _this) { if (_this == SequenceStyle.Raw) { return(ScalarStyle.Hex); } return(ScalarStyle.Plain); }
private void Load(IParser parser, DocumentLoadingState state) { SequenceStart sequenceStart = parser.Expect <SequenceStart>(); Load(sequenceStart, state); Style = sequenceStart.Style; bool flag = false; while (!parser.Accept <SequenceEnd>()) { YamlNode yamlNode = YamlNode.ParseNode(parser, state); children.Add(yamlNode); flag |= (yamlNode is YamlAliasNode); } if (flag) { state.AddNodeWithUnresolvedAliases(this); } parser.Expect <SequenceEnd>(); }
private void Load(IParser parser, DocumentLoadingState state) { var sequence = parser.Consume <SequenceStart>(); Load(sequence, state); Style = sequence.Style; var hasUnresolvedAliases = false; while (!parser.TryConsume <SequenceEnd>(out var _)) { var child = ParseNode(parser, state); children.Add(child); hasUnresolvedAliases |= child is YamlAliasNode; } if (hasUnresolvedAliases) { state.AddNodeWithUnresolvedAliases(this); } }
public SequenceStartBuilder(SequenceStyle style) { this.style = style; @implicit = DefaultImplicit; }
/// <summary> /// Initializes a new instance of the <see cref="SequenceStart"/> class. /// </summary> public SequenceStart(string?anchor, string?tag, bool isImplicit, SequenceStyle style) : this(anchor, tag, isImplicit, style, Mark.Empty, Mark.Empty) { }
/// <summary> /// Initializes a new instance of the <see cref="SequenceStart"/> class. /// </summary> /// <param name="anchor">The anchor.</param> /// <param name="tag">The tag.</param> /// <param name="isImplicit">if set to <c>true</c> [is implicit].</param> /// <param name="style">The style.</param> /// <param name="start">The start position of the event.</param> /// <param name="end">The end position of the event.</param> public SequenceStart(string?anchor, string?tag, bool isImplicit, SequenceStyle style, Mark start, Mark end) : base(anchor, tag, start, end) { this.IsImplicit = isImplicit; this.Style = style; }
/// <summary> /// Initializes a new instance of the <see cref="SequenceStart"/> class. /// </summary> public SequenceStart(string anchor, string tag, bool isImplicit, SequenceStyle style) : this(anchor, tag, isImplicit, style, Mark.Empty, Mark.Empty) { }
/// <summary> /// Initializes a new instance of the <see cref="SequenceStart"/> class. /// </summary> /// <param name="anchor">The anchor.</param> /// <param name="tag">The tag.</param> /// <param name="isImplicit">if set to <c>true</c> [is implicit].</param> /// <param name="style">The style.</param> /// <param name="start">The start position of the event.</param> /// <param name="end">The end position of the event.</param> public SequenceStart(string anchor, string tag, bool isImplicit, SequenceStyle style, Mark start, Mark end) : base(anchor, tag, start, end) { this.isImplicit = isImplicit; this.style = style; }
public static bool IsAnyBlock(this SequenceStyle _this) { return(_this == SequenceStyle.Block || _this == SequenceStyle.BlockCurve); }
public YAMLSequenceNode(SequenceStyle style) { Style = style; }
/// <summary> /// Get scalar style corresponding to current sequence style /// </summary> /// <param name="_this">Sequence style</param> /// <returns>Corresponding scalar style</returns> public static ScalarStyle ToScalarStyle(this SequenceStyle _this) { return(_this == SequenceStyle.Raw ? ScalarStyle.Hex : ScalarStyle.Plain); }
public static bool IsRaw(this SequenceStyle _this) { return(_this == SequenceStyle.Raw); }
/// <summary> /// Initializes a new instance of the <see cref="SequenceStart"/> class. /// </summary> public SequenceStart(AnchorName anchor, TagName tag, bool isImplicit, SequenceStyle style) : this(anchor, tag, isImplicit, style, Mark.Empty, Mark.Empty) { }
/// <summary> /// Initializes a new instance of the <see cref="SequenceStart"/> class. /// </summary> /// <param name="anchor">The anchor.</param> /// <param name="tag">The tag.</param> /// <param name="isImplicit">if set to <c>true</c> [is implicit].</param> /// <param name="style">The style.</param> /// <param name="start">The start position of the event.</param> /// <param name="end">The end position of the event.</param> public SequenceStart(AnchorName anchor, TagName tag, bool isImplicit, SequenceStyle style, Mark start, Mark end) : base(anchor, tag, start, end) { this.IsImplicit = isImplicit; this.Style = style; }