An SDLang (Simple Declarative Language) library for D
D Other
Clone or download
Permalink
Failed to load latest commit information.
ddoc Forgot to add "ddoc/macros.ddoc" several commits back. Aug 21, 2015
docs/public Fix CSS. Sep 22, 2016
src/sdlang Eliminate libInputVisitor dependency, use Phobos Generator instead. Jul 16, 2018
.gitignore Update .gitignore Sep 21, 2016
.travis.yml travis: "latest" compilers should use newer unit-threaded. Jul 16, 2018
CHANGELOG.md Fix #40: build-docs shouldn't rely on specific dir layout for deps. Jul 16, 2018
FAQ.md Manual word-wrapping in markdown files is fine. It won't mess up gith… Jun 9, 2017
HOWTO.md Update HOWTO.md Nov 4, 2016
LICENSE.txt Minor doc updates. [ci skip] Sep 25, 2016
README.md Add AppVeyor status badge. [ci skip] Jul 16, 2018
TOOLS.md Manual word-wrapping in markdown files is fine. It won't mess up gith… Jun 9, 2017
appveyor.yml Update compiler lists and allow_failure a few old ones getting myster… Jul 16, 2018
build-docs Fix #40: build-docs shouldn't rely on specific dir layout for deps. Jul 16, 2018
build-docs.bat Fix #40: build-docs shouldn't rely on specific dir layout for deps. Jul 16, 2018
ci_script Use updated unit-threaded only on new compilers that need it. Jul 16, 2018
ci_script.bat Don't use unit-threaded on AppVeyor. Jul 16, 2018
ci_script.d Don't use unit-threaded on AppVeyor. Jul 16, 2018
dub.sdl Eliminate libInputVisitor dependency, use Phobos Generator instead. Jul 16, 2018
dub.selections.json Eliminate libInputVisitor dependency, use Phobos Generator instead. Jul 16, 2018
dub.selections.ut-0.7.46.json Eliminate libInputVisitor dependency, use Phobos Generator instead. Jul 16, 2018
example.d Fix #50: Outputs certain floating point numbers in unsupported scien… Oct 4, 2016
example2.d Fix #50: Outputs certain floating point numbers in unsupported scien… Oct 4, 2016
sample.sdl Clean up 'sample.sdl'. Mar 26, 2013
spec_v2_wishlist.md A few more doc updates. Sep 25, 2016

README.md

SDLang-D Build Status Build status

An SDLang (Simple Declarative Language) library for D, to read and write SDLang. Both a DOM and a Pull Parser are provided.

Officially supported compiler versions are shown in .travis.yml.

SDL is a data language like JSON, XML or YAML, except it's:

  • Less verbose than JSON and XML.
  • Type-aware.
  • Easier to learn and read than YAML.

This is what SDL looks like (some of these examples, and more, are from the original SDL site:

// A couple basic values
first "Joe"
last "Coder"

// Supports values, named attributes, and various data types
numbers 12 53 2 635
names "Sally" "Frank N. Stein"
pets chihuahua="small" dalmation="hyper" mastiff="big"

mixed 34.7f "Tim" somedate=2010/08/14

// Supports child tags
folder "myFiles" color="yellow" protection=on {
    folder "my images" {
        file "myHouse.jpg" color=true date=2005/11/05
        file "myCar.jpg" color=false date=2002/01/05
    }
    folder "my documents" {
        document "resume.pdf"
    }
}

Tags are of this form:

[tag name] [values] [attributes] [children]

Attributes are simply values with names.

Tag and attribute names can optionally include a namespace prefix (ie, namespace:name). All parts are optional, the only exception being that an anonymous (ie, no name) tag must have at least one value.

Also:

  • Tags are separated by either newline or semicolon.
  • Whitespace and indentation is not significant (other than newlines).
  • The line-continuation operator is \ (backslash). This can be used to split a tag across multiple lines.
  • Line comments start with either #, // or --.
  • Block comments start with /* and end with the first occurrence of */ (ie, they do not nest).
  • Values always come before the attributes.
  • All the data types and syntax details are described in the Language Guide.
  • Note that, unlike C-based languages, opening curly braces must be on the same line, not the next line. Why?.

For more details on the langauge, see the Language Guide.

Differences from original Java implementation

  • License is zlib/libpng, not LGPL. (No source from the Java or Ruby implementations was used or looked at. The libraries were used to test compatibility, but the actual source code was not viewed.)
  • API is completely redesigned for D.
  • Anonymous tags are named "" (empty string) not "content".
  • Dates with unknown or invalid time zones use a special type indicating "unknown time zone" (DateTimeFracUnknownZone) instead of assuming GMT.

Documentation