Class HumlDocument

Namespace
Huml.Net.Parser
Assembly
Huml.Net.dll

Represents a mapping block in the HUML AST. Used for both the document root and for every nested multiline mapping block introduced by the :: vector indicator.

public sealed record HumlDocument : HumlNode, IEquatable<HumlNode>, IEquatable<HumlDocument>
Inheritance
HumlDocument
Implements
Inherited Members

Remarks

A single type is used for all multiline mapping contexts to keep the AST hierarchy shallow. Inline { key: value } notation and empty {} dicts produce a HumlInlineMapping node instead.

Constructors

HumlDocument(IReadOnlyList<HumlNode>)

Represents a mapping block in the HUML AST. Used for both the document root and for every nested multiline mapping block introduced by the :: vector indicator.

public HumlDocument(IReadOnlyList<HumlNode> Entries)

Parameters

Entries IReadOnlyList<HumlNode>

The mapping entries or list items in this block.

Remarks

A single type is used for all multiline mapping contexts to keep the AST hierarchy shallow. Inline { key: value } notation and empty {} dicts produce a HumlInlineMapping node instead.

Properties

DetectedVersion

The HUML spec version detected from the %HUML header in the source document, or null when no header was present or the document was constructed directly in code.

public HumlSpecVersion? DetectedVersion { get; init; }

Property Value

HumlSpecVersion?

Remarks

Populated by Huml.Net.Parser.HumlParser during parsing. Use this property to preserve the original spec version when round-tripping:

var doc = HumlSerializer.Parse(input);
var output = HumlSerializer.Serialize(dto,
    new HumlOptions { SpecVersion = doc.DetectedVersion ?? HumlSpecVersion.V0_2 });

Entries

The mapping entries or list items in this block.

public IReadOnlyList<HumlNode> Entries { get; init; }

Property Value

IReadOnlyList<HumlNode>

Methods

Equals(HumlDocument?)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(HumlDocument? other)

Parameters

other HumlDocument

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

GetHashCode()

Returns a hash code based only on the runtime type, consistent with the overridden Equals(HumlNode?) that excludes Line and Column. Derived types override this further to incorporate their primary-constructor parameters.

public override int GetHashCode()

Returns

int