ddn.data.sdl

SDL (Simple Declarative Language) Parser and Writer

This module provides complete SDL support including:

  • Parsing SDL documents into CDM structures
  • Preserving comments, formatting, and source locations
  • Serializing CDM documents back to SDL
  • Support for all 13 SDL literal types
  • Namespace support for tags and attributes
  • Anonymous tags and line continuation
  • Four comment styles (hash, double-slash, block, double-dash)

SDL is a tag-based configuration language with rich literal types including dates, timespans, and binary data.

Types 5

structSdlError

Error information for SDL parsing failures.

Fields
size_t line
size_t column
string message
string source
Methods
string toString() const @safeFormat error as human-readable string.
structSdlPolicy

Policy options for SDL parsing.

Fields
size_t maxDepth

Options for SDL serialization.

Fields
bool prettyPrint
uint indentWidth
bool preserveRawText
enumSdlTokenKind : ubyte

SDL token kinds produced by the lexer.

UNKNOWNInvalid/unrecognised input
EOFEnd of input
LBRACE{
RBRACE}
SEMICOLON;
NEWLINEEnd of line (tag statement terminator)
EQUALS=
COLON: (namespace or in datetime literal)
LINE_COMMENT_HASH# ...
LINE_COMMENT_DSLASH// ...
LINE_COMMENT_DASH-- ...
BLOCK_COMMENT/ ... /
STRING"..." double-quoted string
BACKTICK`...` backtick/raw string
CHARACTER'x' single character
INTEGER123, 123L
FLOAT3.14, 3.14F, 3.14d, 123.44BD
BOOLEANtrue, false, on, off
DATE2005/12/05
DATETIME2005/12/05 14:12:23.345-ZONE
TIMESPAN12:14:42, 12:14:42.532
BINARY[base64...]
NULL_LITnull
IDENTIFIERmyName, my-name, com.example.foo
structSdlToken

A single SDL token produced by the lexer.

Fields
string value
string rawText
size_t line
size_t column
size_t offset

Functions 5

fnauto parseSdlCdm(Builder = CdmBuilder)(const(char)[] input, string source = "") @safeParse SDL text into a CDM document.
fnauto parseSdlCdm(Builder = CdmBuilder)(File file) @safeParse SDL from an open file handle.
fnbool parseSdlCdm(out CdmDocument doc, const(char)[] input, out SdlError err, string source = "", SdlPolicy policy = SdlPolicy.init) @trustedNon-throwing parse variant.
fnstring toSdl(const ref CdmDocument doc, SdlWriteOptions opts = SdlWriteOptions.init) @safeSerialize a CDM document to SDL text.
fnvoid toSdl(Out)(const ref CdmDocument doc, ref Out output, SdlWriteOptions opts = SdlWriteOptions.init) @safeOutput range variant of toSdl().