diff options
| -rw-r--r-- | src/ext_depends/D-YAML.meta | 2 | ||||
| -rw-r--r-- | src/ext_depends/D-YAML/docs/tutorials/custom_types.md | 4 | ||||
| -rw-r--r-- | src/ext_depends/D-YAML/docs/tutorials/getting_started.md | 6 | ||||
| -rw-r--r-- | src/ext_depends/D-YAML/source/dyaml/dumper.d | 13 | ||||
| -rw-r--r-- | src/ext_depends/D-YAML/source/dyaml/emitter.d | 2 | ||||
| -rw-r--r-- | src/ext_depends/D-YAML/source/dyaml/exception.d | 28 | ||||
| -rw-r--r-- | src/ext_depends/D-YAML/source/dyaml/parser.d | 2 | ||||
| -rw-r--r-- | src/ext_depends/D-YAML/source/dyaml/representer.d | 8 | 
8 files changed, 38 insertions, 27 deletions
| diff --git a/src/ext_depends/D-YAML.meta b/src/ext_depends/D-YAML.meta index 2f64a9f..a0cc85c 100644 --- a/src/ext_depends/D-YAML.meta +++ b/src/ext_depends/D-YAML.meta @@ -1,3 +1,3 @@ -D-YAML 16e6d17e +D-YAML e157571e  https://github.com/dlang-community/D-YAML  Boost Software License 1.0 (BSL-1.0) diff --git a/src/ext_depends/D-YAML/docs/tutorials/custom_types.md b/src/ext_depends/D-YAML/docs/tutorials/custom_types.md index 7e4e10b..6b1b7a5 100644 --- a/src/ext_depends/D-YAML/docs/tutorials/custom_types.md +++ b/src/ext_depends/D-YAML/docs/tutorials/custom_types.md @@ -236,13 +236,13 @@ void main()  {      try      { -        auto dumper = dumper(File("output.yaml", "w").lockingTextWriter); +        auto dumper = dumper();          auto document = Node([Color(255, 0, 0),                                Color(0, 255, 0),                                Color(0, 0, 255)]); -        dumper.dump(document); +        dumper.dump(File("output.yaml", "w").lockingTextWriter, document);      }      catch(YAMLException e)      { diff --git a/src/ext_depends/D-YAML/docs/tutorials/getting_started.md b/src/ext_depends/D-YAML/docs/tutorials/getting_started.md index 58cf191..3947e37 100644 --- a/src/ext_depends/D-YAML/docs/tutorials/getting_started.md +++ b/src/ext_depends/D-YAML/docs/tutorials/getting_started.md @@ -58,7 +58,7 @@ void main()      writeln("The answer is ", root["Answer"].as!int);      //Dump the loaded document to output.yaml. -    dumper(File("output.yaml", "w").lockingTextWriter).dump(root); +    dumper.dump(File("output.yaml", "w").lockingTextWriter, root);  }  ``` @@ -100,8 +100,8 @@ will try to convert it, throwing *YAMLException* if not possible.  Finally we dump the document we just read to `output.yaml` with the  *Dumper.dump()* method. *Dumper* is a struct used to dump YAML -documents. *dumper()* accepts a range to write the document to. -The *dump()* method writes one or more documents to the range, +documents. *dumper()* returns a *Dumper* with the default setting. +The *dump()* method writes one or more documents to a range,  throwing *YAMLException* if it could not be written to.  D:YAML tries to preserve style information in documents so e.g. `[Hello, diff --git a/src/ext_depends/D-YAML/source/dyaml/dumper.d b/src/ext_depends/D-YAML/source/dyaml/dumper.d index 51f232f..03d3620 100644 --- a/src/ext_depends/D-YAML/source/dyaml/dumper.d +++ b/src/ext_depends/D-YAML/source/dyaml/dumper.d @@ -228,7 +228,7 @@ struct Dumper      dumper.explicitStart = false;      dumper.YAMLVersion = null;      dumper.dump(stream, node); -    assert(stream.data == "[!!str 'Hello world!', [!!str 'Hello', !!str 'world!']]\n"); +    assert(stream.data == "['Hello world!', ['Hello', 'world!']]\n");  }  // Explicit document start/end markers  @safe unittest @@ -245,6 +245,17 @@ struct Dumper      //account for newline at end      assert(stream.data[$-4..$-1] == "...");  } +@safe unittest +{ +    auto stream = new Appender!string(); +    auto node = Node([Node("Te, st2")]); +    auto dumper = dumper(); +    dumper.explicitStart = true; +    dumper.explicitEnd = false; +    dumper.YAMLVersion = null; +    dumper.dump(stream, node); +    assert(stream.data == "--- ['Te, st2']\n"); +}  // No explicit document start/end markers  @safe unittest  { diff --git a/src/ext_depends/D-YAML/source/dyaml/emitter.d b/src/ext_depends/D-YAML/source/dyaml/emitter.d index a436c7c..5cf6a92 100644 --- a/src/ext_depends/D-YAML/source/dyaml/emitter.d +++ b/src/ext_depends/D-YAML/source/dyaml/emitter.d @@ -774,7 +774,7 @@ struct Emitter(Range, CharType) if (isOutputRange!(Range, CharType))              {                  if(style_ == ScalarStyle.invalid){style_ = chooseScalarStyle();}                  if((!canonical_ || (tag is null)) && -                   (style_ == ScalarStyle.plain ? event_.implicit : !event_.implicit && (tag is null))) +                   ((tag == "tag:yaml.org,2002:str") || (style_ == ScalarStyle.plain ? event_.implicit : !event_.implicit && (tag is null))))                  {                      preparedTag_ = null;                      return; diff --git a/src/ext_depends/D-YAML/source/dyaml/exception.d b/src/ext_depends/D-YAML/source/dyaml/exception.d index 46d3047..15e9c61 100644 --- a/src/ext_depends/D-YAML/source/dyaml/exception.d +++ b/src/ext_depends/D-YAML/source/dyaml/exception.d @@ -77,20 +77,6 @@ struct Mark          }  } -package: -// A struct storing parameters to the MarkedYAMLException constructor. -struct MarkedYAMLExceptionData -{ -    // Context of the error. -    string context; -    // Position of the context in a YAML buffer. -    Mark contextMark; -    // The error itself. -    string problem; -    // Position if the error. -    Mark problemMark; -} -  // Base class of YAML exceptions with marked positions of the problem.  abstract class MarkedYAMLException : YAMLException  { @@ -124,6 +110,20 @@ abstract class MarkedYAMLException : YAMLException      }  } +package: +// A struct storing parameters to the MarkedYAMLException constructor. +struct MarkedYAMLExceptionData +{ +    // Context of the error. +    string context; +    // Position of the context in a YAML buffer. +    Mark contextMark; +    // The error itself. +    string problem; +    // Position if the error. +    Mark problemMark; +} +  // Constructors of YAML exceptions are mostly the same, so we use a mixin.  //  // See_Also: YAMLException diff --git a/src/ext_depends/D-YAML/source/dyaml/parser.d b/src/ext_depends/D-YAML/source/dyaml/parser.d index 7e0b78a..befdfa4 100644 --- a/src/ext_depends/D-YAML/source/dyaml/parser.d +++ b/src/ext_depends/D-YAML/source/dyaml/parser.d @@ -25,7 +25,6 @@ import dyaml.token;  import dyaml.tagdirective; -package:  /**   * The following YAML grammar is LL(1) and is parsed by a recursive descent   * parser. @@ -99,6 +98,7 @@ class ParserException : MarkedYAMLException      mixin MarkedExceptionCtors;  } +package:  /// Generates events from tokens provided by a Scanner.  ///  /// While Parser receives tokens with non-const character slices, the events it diff --git a/src/ext_depends/D-YAML/source/dyaml/representer.d b/src/ext_depends/D-YAML/source/dyaml/representer.d index 98c825b..f903b60 100644 --- a/src/ext_depends/D-YAML/source/dyaml/representer.d +++ b/src/ext_depends/D-YAML/source/dyaml/representer.d @@ -91,7 +91,9 @@ Node representData(const Node data, ScalarStyle defaultScalarStyle, CollectionSt              {                  result.collectionStyle = defaultCollectionStyle;              } +            break;          case NodeID.invalid: +            break;      } @@ -123,7 +125,7 @@ Node representData(const Node data, ScalarStyle defaultScalarStyle, CollectionSt  @safe unittest  { -    assert(representData(Node(cast(string)null), ScalarStyle.invalid, CollectionStyle.invalid) == Node("null", "tag:yaml.org,2002:null")); +    assert(representData(Node(cast(string)null), ScalarStyle.invalid, CollectionStyle.invalid) == Node("", "tag:yaml.org,2002:str"));      assert(representData(Node("Hello world!"), ScalarStyle.invalid, CollectionStyle.invalid) == Node("Hello world!", "tag:yaml.org,2002:str"));  } @@ -289,9 +291,7 @@ Node representNull() @safe  Node representString(const Node node) @safe  {      string value = node.as!string; -    return value is null -           ? Node("null", "tag:yaml.org,2002:null") -           : Node(value, "tag:yaml.org,2002:str"); +    return Node(value, "tag:yaml.org,2002:str");  }  //Represent a bytes _node as a binary scalar. | 
