diff options
author | Ralph Amissah <ralph.amissah@gmail.com> | 2022-02-25 19:59:47 -0500 |
---|---|---|
committer | Ralph Amissah <ralph.amissah@gmail.com> | 2022-02-25 20:54:19 -0500 |
commit | 78a231014be3a76e9e546b31a5e6fa2a9a7b720e (patch) | |
tree | 89c64cc66898e20b7f2f81e837df68f265c62757 /src/ext_depends/D-YAML/source/dyaml | |
parent | verbosity level, "vox_gt[lv]" (voice greater than) (diff) |
external dependency update, housekeeping, routine
Diffstat (limited to 'src/ext_depends/D-YAML/source/dyaml')
-rw-r--r-- | src/ext_depends/D-YAML/source/dyaml/exception.d | 5 | ||||
-rw-r--r-- | src/ext_depends/D-YAML/source/dyaml/loader.d | 17 | ||||
-rw-r--r-- | src/ext_depends/D-YAML/source/dyaml/node.d | 4 | ||||
-rw-r--r-- | src/ext_depends/D-YAML/source/dyaml/reader.d | 3 | ||||
-rw-r--r-- | src/ext_depends/D-YAML/source/dyaml/scanner.d | 6 |
5 files changed, 33 insertions, 2 deletions
diff --git a/src/ext_depends/D-YAML/source/dyaml/exception.d b/src/ext_depends/D-YAML/source/dyaml/exception.d index 2f13a44..46d3047 100644 --- a/src/ext_depends/D-YAML/source/dyaml/exception.d +++ b/src/ext_depends/D-YAML/source/dyaml/exception.d @@ -94,6 +94,9 @@ struct MarkedYAMLExceptionData // Base class of YAML exceptions with marked positions of the problem. abstract class MarkedYAMLException : YAMLException { + /// Position of the error. + Mark mark; + // Construct a MarkedYAMLException with specified context and problem. this(string context, const Mark contextMark, string problem, const Mark problemMark, string file = __FILE__, size_t line = __LINE__) @safe pure nothrow @@ -102,6 +105,7 @@ abstract class MarkedYAMLException : YAMLException (contextMark != problemMark ? contextMark.toString() ~ '\n' : "") ~ problem ~ '\n' ~ problemMark.toString() ~ '\n'; super(msg, file, line); + mark = problemMark; } // Construct a MarkedYAMLException with specified problem. @@ -110,6 +114,7 @@ abstract class MarkedYAMLException : YAMLException @safe pure nothrow { super(problem ~ '\n' ~ problemMark.toString(), file, line); + mark = problemMark; } /// Construct a MarkedYAMLException from a struct storing constructor parameters. diff --git a/src/ext_depends/D-YAML/source/dyaml/loader.d b/src/ext_depends/D-YAML/source/dyaml/loader.d index 7e7096c..09c19db 100644 --- a/src/ext_depends/D-YAML/source/dyaml/loader.d +++ b/src/ext_depends/D-YAML/source/dyaml/loader.d @@ -165,6 +165,7 @@ struct Loader void name(string name) pure @safe nothrow @nogc { name_ = name; + scanner_.name = name; } /// Specify custom Resolver to use. @@ -392,3 +393,19 @@ struct Loader auto doc = Loader.fromString(yaml).load(); assert(doc.isValid); } + +@safe unittest +{ + import std.exception : collectException; + + auto yaml = q"EOS + value: invalid: string +EOS"; + auto filename = "invalid.yml"; + auto loader = Loader.fromString(yaml); + loader.name = filename; + + Node unused; + auto e = loader.load().collectException!ScannerException(unused); + assert(e.mark.name == filename); +} diff --git a/src/ext_depends/D-YAML/source/dyaml/node.d b/src/ext_depends/D-YAML/source/dyaml/node.d index 5cb318e..e96bcec 100644 --- a/src/ext_depends/D-YAML/source/dyaml/node.d +++ b/src/ext_depends/D-YAML/source/dyaml/node.d @@ -27,7 +27,7 @@ import dyaml.exception; import dyaml.style; /// Exception thrown at node related errors. -class NodeException : YAMLException +class NodeException : MarkedYAMLException { package: // Construct a NodeException. @@ -37,7 +37,7 @@ class NodeException : YAMLException this(string msg, Mark start, string file = __FILE__, size_t line = __LINE__) @safe { - super(msg ~ "\nNode at: " ~ start.toString(), file, line); + super(msg, start, file, line); } } diff --git a/src/ext_depends/D-YAML/source/dyaml/reader.d b/src/ext_depends/D-YAML/source/dyaml/reader.d index 9fe42fc..ae44c80 100644 --- a/src/ext_depends/D-YAML/source/dyaml/reader.d +++ b/src/ext_depends/D-YAML/source/dyaml/reader.d @@ -405,6 +405,9 @@ final class Reader /// Get file name. string name() const @safe pure nothrow @nogc { return name_; } + /// Set file name. + void name(string name) pure @safe nothrow @nogc { name_ = name; } + /// Get current line number. uint line() const @safe pure nothrow @nogc { return line_; } diff --git a/src/ext_depends/D-YAML/source/dyaml/scanner.d b/src/ext_depends/D-YAML/source/dyaml/scanner.d index 2009521..3f0f394 100644 --- a/src/ext_depends/D-YAML/source/dyaml/scanner.d +++ b/src/ext_depends/D-YAML/source/dyaml/scanner.d @@ -185,6 +185,12 @@ struct Scanner return tokens_.empty; } + /// Set file name. + void name(string name) @safe pure nothrow @nogc + { + reader_.name = name; + } + private: /// Most scanning error messages have the same format; so build them with this /// function. |