Skip to content
This repository was archived by the owner on Sep 23, 2026. It is now read-only.
nalilordPublic archive

About

Native Delphi YAML/KYAML DOM, parser, and flow-style writer

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TYAML

Native Delphi YAML/KYAML DOM, parser, and flow-style writer.

XENOME.YAML.pas provides one central object model for both Kubernetes KYAML and practical YAML input:

  • yeKYAML parses the safer Kubernetes KYAML flow-style subset.
  • yeYAML parses common YAML block/flow syntax into the same DOM.
  • The writer emits KYAML-compatible flow-style output in readable or condensed mode.
  • No external C libraries, DLL wrappers, or runtime parser dependencies are used.

Public DOM

Main classes:

  • TYAML
  • TYAMLValue
  • TYAMLNull
  • TYAMLString
  • TYAMLInteger
  • TYAMLFloat
  • TYAMLBoolean
  • TYAMLObject
  • TYAMLArray

Factory entry points:

Y := TYAML.NewObjectRoot;
Y := TYAML.NewArrayRoot;
Y := TYAML.FromString(Text, yeYAML);
Y := TYAML.FromFile(FileName, yeKYAML);
Y := TYAML.FromStream(Stream, yeYAML);

Object and array builders:

Root := Y.AsObject;
Root.Add('apiVersion', 'v1');
Root.SetOrAdd('kind', 'Pod');
Metadata := Root.GetOrAddObject('metadata');
Containers := Root.GetOrAddObject('spec').GetOrAddArray('containers');
Container := Containers.AddObject;
Container.Add('name', 'nginx');

Root and document access:

Y.Root;
Y.IsObject;
Y.AsObject;
Y.ObjectValue['kind'];
Y.ArrayValue[0];
Y.DocumentCount;
Y.DocumentAsObject(1);

KYAML Mode

yeKYAML intentionally rejects generic YAML features that Kubernetes KYAML excludes:

  • indentation-sensitive block mappings
  • unquoted string values
  • anchors and aliases
  • YAML tags
  • merge keys
  • block scalars
  • complex mapping keys

Example:

Y := TYAML.FromString(
  '--- {apiVersion: "v1", kind: "Pod", spec: {containers: [{name: "nginx"}]}}',
  yeKYAML);

YAML Mode

yeYAML accepts common YAML documents and streams while preserving the same DOM API used by KYAML. Supported areas include block mappings, sequences, flow collections, quoted/plain scalars, numeric/boolean/null scalars, anchors, aliases, merge keys, tags as ignored node properties, block scalars, and multi-document streams.

The DOM is intentionally JSON/KYAML-shaped, so YAML features without a natural DOM representation are normalized. For example, complex keys are converted to string keys.

Writing

The writer emits KYAML-compatible flow syntax:

Text := Y.WriteToString(ywmReadable);
Text := Y.WriteToString(ywmCondensed);
Y.WriteDocumentMarker := True;

String values are always double-quoted. Object keys are emitted plain when safe and quoted otherwise.

About

Native Delphi YAML/KYAML DOM, parser, and flow-style writer

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages