Merge pull request #159 from BBasile/style-resolver
style, address D-Scanner warnings on resolver.d, also fix some DDOC stuff merged-on-behalf-of: BBasile <BBasile@users.noreply.github.com>
This commit is contained in:
commit
444156ce94
|
@ -98,11 +98,12 @@ final class Resolver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// Resolve scalars starting with 'A' to !_tag
|
/// Resolve scalars starting with 'A' to !_tag
|
||||||
unittest {
|
unittest
|
||||||
|
{
|
||||||
import std.file : write;
|
import std.file : write;
|
||||||
import std.regex;
|
import std.regex : regex;
|
||||||
|
import dyaml.loader : Loader;
|
||||||
import dyaml;
|
import dyaml.resolver : Resolver;
|
||||||
|
|
||||||
write("example.yaml", "A");
|
write("example.yaml", "A");
|
||||||
|
|
||||||
|
@ -119,7 +120,7 @@ final class Resolver
|
||||||
}
|
}
|
||||||
|
|
||||||
package:
|
package:
|
||||||
/*
|
/**
|
||||||
* Resolve tag of a node.
|
* Resolve tag of a node.
|
||||||
*
|
*
|
||||||
* Params: kind = Type of the node.
|
* Params: kind = Type of the node.
|
||||||
|
@ -165,10 +166,10 @@ final class Resolver
|
||||||
|
|
||||||
bool tagMatch(string tag, string[] values) @safe
|
bool tagMatch(string tag, string[] values) @safe
|
||||||
{
|
{
|
||||||
string expected = tag;
|
const string expected = tag;
|
||||||
foreach(value; values)
|
foreach(value; values)
|
||||||
{
|
{
|
||||||
string resolved = resolver.resolve(NodeID.Scalar, null, value, true);
|
const string resolved = resolver.resolve(NodeID.Scalar, null, value, true);
|
||||||
if(expected != resolved)
|
if(expected != resolved)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -199,13 +200,13 @@ final class Resolver
|
||||||
assert(tagMatch("tag:yaml.org,2002:yaml", ["!", "&", "*"]));
|
assert(tagMatch("tag:yaml.org,2002:yaml", ["!", "&", "*"]));
|
||||||
}
|
}
|
||||||
|
|
||||||
///Return default scalar tag.
|
///Returns: Default scalar tag.
|
||||||
@property string defaultScalarTag() const pure @safe nothrow {return defaultScalarTag_;}
|
@property string defaultScalarTag() const pure @safe nothrow {return defaultScalarTag_;}
|
||||||
|
|
||||||
///Return default sequence tag.
|
///Returns: Default sequence tag.
|
||||||
@property string defaultSequenceTag() const pure @safe nothrow {return defaultSequenceTag_;}
|
@property string defaultSequenceTag() const pure @safe nothrow {return defaultSequenceTag_;}
|
||||||
|
|
||||||
///Return default mapping tag.
|
///Returns: Default mapping tag.
|
||||||
@property string defaultMappingTag() const pure @safe nothrow {return defaultMappingTag_;}
|
@property string defaultMappingTag() const pure @safe nothrow {return defaultMappingTag_;}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue