[yaml_cpp] Customize tag emitting for Drake

Upstream yaml-cpp does not support writing out primary tags, so here
we patch our vendored copy of yaml-cpp's emitter to write them, so
that Drake's YamlWriteArchive can support std::variant<> emitting.

--- src/emitfromevents.cpp
+++ src/emitfromevents.cpp
@@ -109,8 +109,18 @@ void EmitFromEvents::BeginNode() {
 }
 
 void EmitFromEvents::EmitProps(const std::string& tag, anchor_t anchor) {
-  if (!tag.empty() && tag != "?" && tag != "!")
-    m_emitter << VerbatimTag(tag);
+  if (!tag.empty() && tag != "?" && tag != "!") {
+    // N.B. The upstream yaml-cpp uses VerbatimTag here, but Drake has patched
+    // this file to meet our needs instead. Upstream support for custom tags
+    // during emitting is "pretty bad" (i.e., non-existent); for details see
+    // https://github.com/jbeder/yaml-cpp/issues/311 and
+    // https://github.com/jbeder/yaml-cpp/issues/447.
+    if (tag.substr(0, 2) == "!!") {
+      m_emitter << SecondaryTag(tag.substr(2));
+    } else {
+      m_emitter << LocalTag(tag);
+    }
+  }
   if (anchor)
     m_emitter << Anchor(ToString(anchor));
 }
