[][src]Crate sdlang

An SDLang parser library.

SDLang is a simple and concise way to textually represent data. It has an XML-like structure - tags, values, and attributes - which makes it a versatily choice for data serialization, configuration files, or declarative languages. Its syntax was inspired by the C family of languages (C/C++, C#, D, Java, ...).

Here's an example from the official website:

// This is a node with a single string value
title "Hello, World"

// Multiple values are supported, too
bookmarks 12 15 188 1234

// Nodes can have attributes
author "Peter Parker" email="peter@example.org" active=true

// Nodes can be arbitrarily nested
contents {
    section "First Section" {
        paragraph "This is the first paragraph"
        paragraph "This is the second paragraph"

// Anonymous nodes are supported
"This text is the value of an anonymous node!"

// This makes things like matrix definiotns very convenient
matrix {
    1 0 0
    0 1 0
    0 0 1

Parsing is made as easy as this:

extern crate sdlang;

// Prints `tag hello_world: "text"`
println!("{}", sdlang::parse_text("hello_world \"text\"").unwrap());

Note that all SDLang-related types (i.e Tag, Attribute and Value) implement FromStr so that they can be used with str::parse. Note, however, that in order to parse a whole file, which may have multiple root tags, use parse_text or parse_file.



A value with an associated name, forming a single attribute.


A series of values and attributes, with a name (and namespace), and optionally a subtree of tags.



The value type encasing all possible SDLang value types.



Reads everything from the given Reader and parses it.


Parses the given text into a root tag.

Type Definitions


chrono's timezone-naive date struct.


chrono's timezone-aware date-time struct.


The parsing error type, generated by Pest.


The parsing result type, based on Error.