Assists in walking an SDL tree which supports the StAX method of parsing. Examples:
Tag tag; AsonWalker walker = AsonWalker(&tag, sdl); while(walker.pop()) { // use tag to process the current tag auto depth = tag.childrenDepth(); while(walker.pop(depth)) { // process tag again as a child tag } }
/+
mixin(scopedTest!"AsonWalker");
void testPackage(bool copyAson, string sdlText, ref Package expectedPackage)
{
Package parsedPackage;
parsedPackage.parseAsonPackage(copyAson, sdlText);
if(expectedPackage != parsedPackage) {
writefln("Expected package: %s", expectedPackage);
writefln(" but got package: %s", parsedPackage);
assert(0);
}
}
string sdl;
Package expectedPackage;
expectedPackage = Package("my-package", "an example sdl package",
["Jonathan", "David", "Amy"]);
testPackage(false, `
name "my-package"
description "an example sdl package"
authors "Jonathan" "David" "Amy"
`, expectedPackage);
sdl = `
name "my-package"
description "an example sdl package"
authors "Jonathan" "David" "Amy"
`;
+/