2019-01-15 07:37:50 +00:00
|
|
|
import std.regex;
|
2011-08-16 12:53:13 +00:00
|
|
|
import std.stdio;
|
2018-04-27 03:17:09 +00:00
|
|
|
import dyaml;
|
2011-08-16 12:53:13 +00:00
|
|
|
|
2019-01-15 07:37:50 +00:00
|
|
|
int main(string[] args)
|
2011-08-16 12:53:13 +00:00
|
|
|
{
|
2019-01-15 07:37:50 +00:00
|
|
|
string path = "input.yaml";
|
|
|
|
if (args.length > 1)
|
2011-10-17 10:53:38 +00:00
|
|
|
{
|
2019-01-15 07:37:50 +00:00
|
|
|
path = args[1];
|
2011-10-17 10:53:38 +00:00
|
|
|
}
|
|
|
|
|
2019-01-15 07:37:50 +00:00
|
|
|
try
|
2011-10-17 10:53:38 +00:00
|
|
|
{
|
2019-01-15 07:37:50 +00:00
|
|
|
auto resolver = new Resolver;
|
|
|
|
resolver.addImplicitResolver("!color", regex("[0-9a-fA-F]{6}"),
|
|
|
|
"0123456789abcdefABCDEF");
|
2011-10-17 10:53:38 +00:00
|
|
|
|
2019-01-15 07:37:50 +00:00
|
|
|
auto loader = Loader.fromFile("input.yaml");
|
|
|
|
loader.resolver = resolver;
|
|
|
|
|
|
|
|
auto root = loader.load();
|
|
|
|
|
|
|
|
if(root["scalar-red"].tag == "!color" &&
|
|
|
|
root["scalar-orange"].tag == "!color")
|
2011-10-17 10:53:38 +00:00
|
|
|
{
|
2019-01-15 07:37:50 +00:00
|
|
|
writeln("SUCCESS");
|
|
|
|
return 0;
|
2011-10-17 10:53:38 +00:00
|
|
|
}
|
2019-01-15 07:37:50 +00:00
|
|
|
}
|
|
|
|
catch(YAMLException e)
|
|
|
|
{
|
|
|
|
writeln(e.msg);
|
2011-10-17 10:53:38 +00:00
|
|
|
}
|
|
|
|
|
2019-01-15 07:37:50 +00:00
|
|
|
writeln("FAILURE");
|
|
|
|
return 1;
|
2011-08-16 12:53:13 +00:00
|
|
|
}
|