Re: SDLang-D v0.10.0 - Big convenience improvements

2016-09-30 Thread Chris via Digitalmars-d-announce
On Tuesday, 27 September 2016 at 15:26:04 UTC, Nick Sabalausky 
wrote:

On 09/27/2016 04:55 AM, Chris wrote:


I was actually thinking of using SDL for pseudo code 
non-programmers
could write, e.g. to create rule files that a program could 
execute. It

could work nicely with `if` and `else` tags + attributes.


A simple programming language that's SDLang-compliant would 
definitely be interesting!


I think SDLang is underrated and I hope it will find more 
adopters in the future. JSON is useful and used all over the 
place. But it has shortcomings that are probably due to the fact 
that it was never meant to be used as widely as it is today (i.e. 
outside JS). The lack of comments is a big minus.


Re: SDLang-D v0.10.0 - Big convenience improvements

2016-09-27 Thread Nick Sabalausky via Digitalmars-d-announce

On 09/27/2016 04:55 AM, Chris wrote:


I was actually thinking of using SDL for pseudo code non-programmers
could write, e.g. to create rule files that a program could execute. It
could work nicely with `if` and `else` tags + attributes.


A simple programming language that's SDLang-compliant would definitely 
be interesting!




Re: SDLang-D v0.10.0 - Big convenience improvements

2016-09-27 Thread Chris via Digitalmars-d-announce
On Sunday, 25 September 2016 at 22:12:21 UTC, Nick Sabalausky 
wrote:

https://github.com/Abscissa/SDLang-D

New in v0.10.0:
Big convenience enhancements to DOM interface and an improved 
pull parser interface. Plus documentation improvements and a 
couple bugfixes.


Full changelog:
https://github.com/Abscissa/SDLang-D/blob/master/CHANGELOG.md

===

SDLang-D is a D library to read and write SDLang. Both a DOM 
and a Pull Parser are provided.


SDLang  is similar to XML/JSON/YAML, but 
much simpler and less verbose. It look like this:


-
// A few basic values
first "Joe"
last "Coder"
ip "127.0.0.1" port=80

// Supports child tags
folder "myFiles" color="yellow" protection=on {
folder "my documents" {
document "resume.pdf"
}
}
-
Language Guide: 
https://github.com/Abscissa/SDLang-D/wiki/Language-Guide


I was actually thinking of using SDL for pseudo code 
non-programmers could write, e.g. to create rule files that a 
program could execute. It could work nicely with `if` and `else` 
tags + attributes.


Re: SDLang-D v0.10.0 - Big convenience improvements

2016-09-26 Thread Nick Sabalausky via Digitalmars-d-announce

On 09/25/2016 06:12 PM, Nick Sabalausky wrote:


-
// A few basic values
first "Joe"
last "Coder"
ip "127.0.0.1" port=80

// Supports child tags
folder "myFiles" color="yellow" protection=on {
 folder "my documents" {
 document "resume.pdf"
 }
}
-


Example of using some of the new API features:

-
import sdlang;

Tag root = parseFile("the-above.sdl");

string first = root.expectTagValue!string("first"); // Required
string last  = root.getTagValue!string("last"); // Optional

// Custom default values (if omitted, default value is T.init):
string ip = root.getTagValue!string("ip", "192.168.1.1");
int port = root.getTagAttribute!int("ip", "port", 8080);

Tag folder = root.expectTag("folder");
string folderName = folder.expectValue!string();
assert(folderName == "myFiles");
bool folderProtection = folder.getAttribute!bool("protection");

string subfolderName = folder.getTagValue!string("folder");
assert(subfolderName == "my documents");
-