<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I really like this! +1 for inclusion in LLVMSupport instead of lld.<br>
<br>
I have a project that could definitely make use of this. Right now,
I am using YAMLParser directly; it's not difficult, but this would
definitely make it easier.<br>
<br>
<div class="moz-cite-prefix">On 07/25/2012 03:43 PM, Nick Kledzik
wrote:<br>
</div>
<blockquote
cite="mid:6345947B-1A78-487B-A165-3EB4F2CD9025@apple.com"
type="cite">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
13px/normal Monaco; min-height: 17px; "><font
class="Apple-style-span" face="Times">I've been working on
reading and writing yaml encoded documents for the lld
project. Michael Spencer added the YAMLParser.h functionality
to llvm/Support to help in parsing yaml documents. That
parser greatly helps at the syntax level, but you still need
to hand write a lot of semantic checking and then convert the
various node types in to something usable. </font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
13px/normal Monaco; min-height: 17px; "><font
class="Apple-style-span" face="Times"><br>
</font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
13px/normal Monaco; min-height: 17px; "><font
class="Apple-style-span" face="Times">I've developed a layer
on top of YAMLParser.h I'm calling YAMLIO.h (yaml I/O) which
unifies parsing and writing yaml documents and handles most
semantic checking, and is very easy to use! Basically, you
define your yaml document schema as a mix of C++ structs and
vectors, and YAMLIO does the rest. Lets look at a quick
example first. Suppose this is your yaml document:</font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
13px/normal Monaco; min-height: 17px; "><font
class="Apple-style-span" face="Times"><br>
</font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; ">- name: Tom</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; "> age: 20</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; ">- name: Richard</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; "> age: 27</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; "> speaks-french: true</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; ">- name: Harry</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; "> age: 23</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
13px/normal Monaco; min-height: 17px; "><br class="">
</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
13px/normal Times; ">To read or write such yaml data you would
define a C++ type: for the mapping (a struct), one for the
sequence of those mappings (a typedef). In the struct you add a
yamlMapping() method which associates mapping keys with field
names and the fields's type. (Note: the yamlMapping() method was
inspired by the boost serialize() method).</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
13px/normal Times; min-height: 16px; "><br class="">
</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; font-family: Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">using
llvm::yaml::Sequence;</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-family: Monaco; font-size:
8px; "><span class="Apple-style-span" style="font-size: 12px;
">using llvm::yaml::DocumentList;</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-family: Monaco; font-size:
8px; "><span class="Apple-style-span" style="font-size: 12px;
">using llvm::yaml::IO;</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-family: Monaco; font-size:
8px; "><span class="Apple-style-span" style="font-size: 12px;
">using llvm::yaml::Input;</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-family: Monaco; font-size:
8px; "><span class="Apple-style-span" style="font-size: 12px;
">using llvm::yaml::Output;</span></div>
<div class="">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-family: Monaco; font-size:
8px; "><span class="Apple-style-span" style="font-size:
12px; ">using llvm::yaml::YamlMap;</span></div>
<div><br>
</div>
</div>
<div class="">struct Person : public YamlMap {</div>
</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; "> StringRef name;</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; "> uint8_t age;</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; "> bool speaks_french;</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; font-size: 8px; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; "><br
class="">
</span></div>
</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; font-size: 10px; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; "> void
yamlMapping(IO &io) {</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
requiredKey(io, </span><span class="Apple-style-span"
style="font-size: 12px; ">name</span><span
class="Apple-style-span" style="font-size: 12px; ">,
"</span><span class="Apple-style-span" style="font-size:
12px; ">name</span><span class="Apple-style-span"
style="font-size: 12px; ">");</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; "> </span><span
class="Apple-style-span" style="font-size: 12px; ">requiredKey(io, </span><span
class="Apple-style-span" style="font-size: 12px; ">age</span><span
class="Apple-style-span" style="font-size: 12px; ">,
"age");</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; "> </span><span
class="Apple-style-span" style="font-size: 12px; ">optionalKey(io, </span><span
class="Apple-style-span" style="font-size: 12px; ">speaks_french</span><span
class="Apple-style-span" style="font-size: 12px; ">, "</span><span
class="Apple-style-span" style="font-size: 12px; ">speaks-french</span><span
class="Apple-style-span" style="font-size: 12px; ">");</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; "> }</span></div>
</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; ">};</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; font-size: 8px; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; "><br
class="">
</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">typedef
Sequence<Person> </span><span
class="Apple-style-span" style="font-size: 12px; ">Person</span><span
class="Apple-style-span" style="font-size: 12px; ">List;</span></div>
<div class="" style="font-size: 12px; "><span
class="Apple-style-span" style="font-size: 8px; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">typedef
DocumentList<<span class="Apple-style-span"
style="font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">Person</span><span
class="Apple-style-span" style="font-size: 12px; ">List</span></span>>
PersonDocumentList</span><span class="Apple-style-span"
style="font-size: 12px; ">;</span></div>
<div style="font-size: 8px; "><span class="Apple-style-span"
style="font-size: 12px; "><br>
</span></div>
</span></div>
</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; "><span class="Apple-style-span"
style="font-family: Times; font-size: 13px; ">That's it. The
yamlMapping() method is processed by both the Input and
Output to properly handle key-values in a yaml mapping. The
Sequence and DocumentList templates are subclasses of
std::vector<>. </span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; "><span class="Apple-style-span"
style="font-family: Times; font-size: 13px; "><br class="">
</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; "><span class="Apple-style-span"
style="font-family: Times; font-size: 13px; ">The data
structures are regular structs and vectors. An example of
creating them:</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; "><span class="Apple-style-span"
style="font-family: Times; font-size: 13px; "><br>
</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; "> // build a person</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; font-size: 10px; "><span
class="Apple-style-span" style="font-family: Times; "><span
class="Apple-style-span" style="font-family: Monaco; ">
<div class=""><font class="Apple-style-span"
style="font-size: 12px; " size="4"> </font><span
class="Apple-style-span" style="font-size: 12px; ">Person
a;</span></div>
<div class=""><font class="Apple-style-span"
style="font-size: 12px; " size="4"> a.name = "Tom";</font></div>
<div class=""><font class="Apple-style-span"
style="font-size: 12px; " size="4"> a.age = 27;</font></div>
<div class=""><font class="Apple-style-span"
style="font-size: 12px; " size="4"> a.speaks_french =
false;</font></div>
<div class=""><font class="Apple-style-span"
style="font-size: 12px; " size="4"> // build sequence
of persons</font></div>
<div class=""><font class="Apple-style-span"
style="font-size: 12px; " size="4"> </font><span
class="Apple-style-span" style="font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">Person</span><span
class="Apple-style-span" style="font-size: 12px; ">List
persons.</span></span></div>
<div class=""><font class="Apple-style-span"
style="font-size: 12px; " size="4">
persons.push_back(a);</font></div>
<div class=""><font class="Apple-style-span"
style="font-size: 12px; " size="4"><br>
</font></div>
</span></span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; "><span class="Apple-style-span"
style="font-family: Times; font-size: 13px; ">To write a yaml
documents your code looks like:</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; "><span class="Apple-style-span"
style="font-family: Times; font-size: 13px; "><br class="">
</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 10px; ">
<div class="" style="font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">void
dump(</span><span class="Apple-style-span"
style="font-size: 10px; "><span class="Apple-style-span"
style="font-size: 8px; "><span class="Apple-style-span"
style="font-size: 12px; ">Person</span><span
class="Apple-style-span" style="font-size: 12px; ">List
&persons,</span></span> </span><span
class="Apple-style-span" style="font-size: 12px; ">raw_ostream
&out) {</span></div>
<div class=""><span class="Apple-style-span" style="font-size:
12px; "> Output yout(out);</span></div>
</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; "> </span><span
class="Apple-style-span" style="font-size: 12px; ">yout</span><span
class="Apple-style-span" style="font-size: 12px; "> <<
persons</span><span class="Apple-style-span"
style="font-size: 12px; ">;</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">}</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; "><br>
</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 10px; "><span
class="Apple-style-span" style="font-size: 12px; "><span
class="Apple-style-span" style="font-size: 8px; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; "><span
class="Apple-style-span" style="font-family: Times;
font-size: 13px; ">To read a yaml document your
code looks like:</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; "><span
class="Apple-style-span" style="font-family: Times;
font-size: 13px; "><br class="">
</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; ">
<div class="" style="margin-top: 0px; margin-right:
0px; margin-bottom: 0px; margin-left: 0px; font:
normal normal normal 12px/normal Monaco; font-size:
8px; ">
<div class="" style="font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px;
">void readYaml(StringRef filePath) {</span></div>
<div class="" style="font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px;
"> Input yin(filePath);</span></div>
</div>
</div>
</span></span><span class="Apple-style-span"
style="font-size: 12px; "> DocumentList<PersonList>
docList;</span>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 10px; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 10px; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
yin >> docList; </span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
// if there was an error parsing, message already
printed out</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
if ( </span><span class="Apple-style-span"
style="font-size: 12px; ">yin</span><span
class="Apple-style-span" style="font-size: 12px; ">.error()
) </span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
return;</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; "> </span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; "> for(</span><span
class="Apple-style-span" style="font-size: 12px; ">PersonList</span><span
class="Apple-style-span" style="font-size: 12px; "> &pl
: </span><span class="Apple-style-span"
style="font-size: 12px; ">docList</span><span
class="Apple-style-span" style="font-size: 12px; ">)
{</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
for(</span><span class="Apple-style-span"
style="font-size: 12px; ">Person</span><span
class="Apple-style-span" style="font-size: 12px; "> &person
: </span><span class="Apple-style-span"
style="font-size: 12px; ">pl</span><span
class="Apple-style-span" style="font-size: 12px; ">)
{</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
// process each Person</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
}</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
}</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">}</span></div>
<div style="font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; "><br>
</span></div>
</div>
</div>
</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 10px; "><font
class="Apple-style-span" face="Times"><span
class="Apple-style-span" style="font-size: 13px; "><br>
</span></font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; "><font class="Apple-style-span"
face="Times"><span class="Apple-style-span"
style="font-size: 13px;">YAMLIO also handles semantic
error checking for you. For instance if your document
contained an illegal value for a key like:</span></font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; "><font class="Apple-style-span"
face="Times"><span class="Apple-style-span"
style="font-size: 13px;"><br>
</span></font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; "><font
class="Apple-style-span">- name: Richard</font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; "> age: 27</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; "> speaks-french: oui</div>
<div class="" style="font-family: Times; margin-top: 0px;
margin-right: 0px; margin-bottom: 0px; margin-left: 0px;
font: normal normal normal 12px/normal Monaco; "><font
class="Apple-style-span" face="Times"><span
class="Apple-style-span" style="font-size: 13px; "><br>
</span></font></div>
<div class="" style="font-family: Times; margin-top: 0px;
margin-right: 0px; margin-bottom: 0px; margin-left: 0px;
font: normal normal normal 12px/normal Monaco; "><font
class="Apple-style-span" face="Times"><span
class="Apple-style-span" style="font-size: 13px; ">You
would get an error like:</span></font></div>
<div class="" style="font-family: Times; margin-top: 0px;
margin-right: 0px; margin-bottom: 0px; margin-left: 0px;
font: normal normal normal 12px/normal Monaco; "><font
class="Apple-style-span" face="Times"><span
class="Apple-style-span" style="font-size: 13px; "><br>
</span></font></div>
YAML:6:18: error: invalid boolean<font
class="Apple-style-span">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; "> speaks-french: oui</div>
</font>
<div class="" style="font-family: Times; margin-top: 0px;
margin-right: 0px; margin-bottom: 0px; margin-left: 0px;
font: normal normal normal 12px/normal Monaco; ">
^~~~</div>
<div><font class="Apple-style-span" face="Times"><span
class="Apple-style-span" style="font-size: 13px; "><br>
</span></font></div>
<div style="font-family: Times; "><font
class="Apple-style-span" face="Times"><span
class="Apple-style-span" style="font-size: 13px; ">If
the document has an key not in your schema like:</span></font></div>
<div class="" style="font-family: Times; margin-top: 0px;
margin-right: 0px; margin-bottom: 0px; margin-left: 0px;
font: normal normal normal 12px/normal Monaco; "><font
class="Apple-style-span" face="Times"><span
class="Apple-style-span" style="font-size: 13px; "><br>
</span></font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; "><font
class="Apple-style-span">- name: Tom</font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; "> pets: true</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; "> age: 20</div>
<div><br>
</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; "><font
class="Apple-style-span" face="Times"><span
class="Apple-style-span" style="font-size: 13px; ">You
would get an error like:</span></font></div>
<div style="font-family: Times; "><font
class="Apple-style-span" face="Times"><span
class="Apple-style-span" style="font-size: 13px; "><br>
</span></font></div>
</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; ">YAML:3:18: error: unknown key
'pets'</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; "> pets: true</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; "> ^~~~</div>
<div style="font-size: 13px; "><br>
</div>
</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; ">
<div class="" style="font-size: 12px; margin-top: 0px;
margin-right: 0px; margin-bottom: 0px; margin-left: 0px;
font: normal normal normal 12px/normal Monaco; "><font
class="Apple-style-span" face="Times"><span
class="Apple-style-span" style="font-size: 13px; ">As
you see, the model of YAMLIO is that you define
intermediate data structures which define your yaml
schema. The job of YAML IO is to convert between
those intermediate data structures and yaml documents.
YAMLIO most likely won't be able to convert between
your existing native data structures and yaml. You
will probably need to define new intermediate data
structures (the schema) and then write code to convert
between your native data structures and the
intermediate ones. But that glue code is super
simple, mostly just copying fields and iterating
lists. All the yaml specific work (formatting and
semantic checking) is done by YAMLIO.</span></font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; "><font
class="Apple-style-span" face="Times"><span
class="Apple-style-span" style="font-size: 13px;"><br>
</span></font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><font
class="Apple-style-span" style="font-size: 8px; "
face="Times"><span class="Apple-style-span"
style="font-size: 13px; "><br>
</span></font></div>
</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><font
class="Apple-style-span" style="font-size: 8px; "
face="Times"><span class="Apple-style-span"
style="font-size: 13px; ">In the example above the
scalar types </span></font><span
class="Apple-style-span" style="font-family: Times;
font-size: 13px; ">(strings, integers, booleans) </span><font
class="Apple-style-span" style="font-size: 8px; "
face="Times"><span class="Apple-style-span"
style="font-size: 13px; ">were all built-in types .
YAMLIO also has support for enumerations and bit masks.
</span></font><span class="Apple-style-span"
style="font-family: Times; font-size: 13px; ">Here is an
example of a simple enumeration (color) and a bit mask set
(flags). Suppose your data structures already defines
Colors and Flags:</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><font
class="Apple-style-span" style="font-size: 8px; "
face="Times"><span class="Apple-style-span"
style="font-size: 13px; "><br>
</span></font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; "><span class="Apple-style-span"
style="font-size: 10px; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
enum Colors {</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
cRed,</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
cBlue,</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
cGreen</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
};</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
#define FlagBig 1</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; "><span
class="Apple-style-span" style="font-size: 10px; ">
<div class="" style="margin-top: 0px; margin-right:
0px; margin-bottom: 0px; margin-left: 0px; font:
normal normal normal 12px/normal Monaco;
font-size: 8px; "><span class="Apple-style-span"
style="font-size: 12px; "> #define FlagLittle
2</span></div>
</span></span><span class="Apple-style-span"
style="font-size: 10px; ">
<div class="" style="margin-top: 0px; margin-right:
0px; margin-bottom: 0px; margin-left: 0px; font:
normal normal normal 12px/normal Monaco; font-size:
8px; "><span class="Apple-style-span"
style="font-size: 12px; "> #define FlagRound 4</span></div>
</span><span class="Apple-style-span" style="font-size:
10px; ">
<div class="" style="margin-top: 0px; margin-right:
0px; margin-bottom: 0px; margin-left: 0px; font:
normal normal normal 12px/normal Monaco; font-size:
8px; "><span class="Apple-style-span"
style="font-size: 12px; "> #define FlagPointy 8</span></div>
</span></div>
</span><span class="Apple-style-span" style="font-size:
12px; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-family: Monaco;
font-size: 8px; "><span class="Apple-style-span"
style="font-size: 12px; "><br>
</span></div>
</span><span class="Apple-style-span" style="font-family:
Times; font-size: 13px; ">And you want the yaml documents
to use human readable values for colors and flags, rather
than just the integer value used internally. To handle
that, you define conversion tables and hand them to
YAMLIO. For instance: </span>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-family: Monaco; font-size:
8px; "><span class="Apple-style-span" style="font-size:
12px; "> </span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-family: Monaco; font-size:
8px; "><span class="Apple-style-span" style="font-size:
12px; ">using llvm::yaml::IO;</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-family: Monaco; font-size:
8px; "><span class="Apple-style-span" style="font-size:
12px; ">using llvm::yaml::Input;</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-family: Monaco; font-size:
8px; "><span class="Apple-style-span" style="font-size:
12px; ">using llvm::yaml::Output;</span></div>
<div class="" style="font-size: 12px; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-family: Monaco;
font-size: 8px; "><span class="Apple-style-span"
style="font-size: 12px; ">using llvm::yaml::YamlMap;</span></div>
</div>
<span class="Apple-style-span" style="font-size: 12px; ">
<div class="">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-family: Monaco;
font-size: 8px; "><span class="Apple-style-span"
style="font-size: 12px; ">using
llvm::yaml::UniqueValue;</span></div>
</div>
</span><span class="Apple-style-span" style="font-size:
12px; ">
<div class="">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-family: Monaco;
font-size: 8px; "><span class="Apple-style-span"
style="font-size: 12px; ">using
llvm::yaml::BitValue;</span></div>
</div>
</span>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; "><br>
</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 10px; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 10px; "><font
class="Apple-style-span" style="font-size: 12px; "
size="4">static const UniqueValue<Colors>
colorConversions[] = {</font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; "> {</span><span
class="Apple-style-span" style="font-size: 12px; ">cRed</span><span
class="Apple-style-span" style="font-size: 12px; ">,
"red"},</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
{cBlue, "blue"},</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
{cGreen, "green"},</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
{cRed, NULL} // default value for optional keys</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">};</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; "><br>
</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 10px; "><span
class="Apple-style-span" style="font-size: 12px; "><span
class="Apple-style-span" style="font-size: 10px; ">
<div class="" style="margin-top: 0px; margin-right:
0px; margin-bottom: 0px; margin-left: 0px; font:
normal normal normal 12px/normal Monaco;
font-size: 10px; "><font class="Apple-style-span"
style="font-size: 12px; " size="4">static const
BitValue<uint32_t> flagConversions[] = {</font></div>
<div class="" style="margin-top: 0px; margin-right:
0px; margin-bottom: 0px; margin-left: 0px; font:
normal normal normal 12px/normal Monaco;
font-size: 8px; "><span class="Apple-style-span"
style="font-size: 12px; "> {</span><span
class="Apple-style-span" style="font-size: 12px;
">FlagBig</span><span class="Apple-style-span"
style="font-size: 12px; ">, "big"},</span></div>
<div class="" style="margin-top: 0px; margin-right:
0px; margin-bottom: 0px; margin-left: 0px; font:
normal normal normal 12px/normal Monaco;
font-size: 8px; "><span class="Apple-style-span"
style="font-size: 12px; "> {FlagLittle,
"little"},</span></div>
<div class="" style="margin-top: 0px; margin-right:
0px; margin-bottom: 0px; margin-left: 0px; font:
normal normal normal 12px/normal Monaco;
font-size: 8px; "><span class="Apple-style-span"
style="font-size: 12px; "> {FlagRound,
"round"},</span></div>
</span></span>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
{FlagPointy, "pointy"},</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
{0, NULL}</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">};</span></div>
<div><font class="Apple-style-span" style="font-size:
12px; " size="4"><br>
</font></div>
</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 10px; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 10px; ">
<div class=""><font class="Apple-style-span"
style="font-size: 12px; " size="4">struct Test :
public YamlMap {</font></div>
</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 10px; "><font
class="Apple-style-span" style="font-size: 12px; "
size="4"> </font><span class="Apple-style-span"
style="font-size: 12px; "> StringRef name;</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 10px; "><font
class="Apple-style-span" style="font-size: 12px; "
size="4"> Color color;</font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 10px; "><font
class="Apple-style-span" style="font-size: 12px; "
size="4"> uint32_t flags;</font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 10px; "><font
class="Apple-style-span" style="font-size: 12px; "
size="4"><br>
</font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 10px; ">
<div class="" style="margin-top: 0px; margin-right:
0px; margin-bottom: 0px; margin-left: 0px; font:
normal normal normal 12px/normal Monaco; font-size:
10px; "><font class="Apple-style-span"
style="font-size: 12px; " size="4"> void
yamlMapping(IO &io) {</font></div>
<div class="" style="margin-top: 0px; margin-right:
0px; margin-bottom: 0px; margin-left: 0px; font:
normal normal normal 12px/normal Monaco; font-size:
10px; "><font class="Apple-style-span"
style="font-size: 12px; " size="4">
requiredKey(io, name, "name");</font></div>
<div class="" style="margin-top: 0px; margin-right:
0px; margin-bottom: 0px; margin-left: 0px; font:
normal normal normal 12px/normal Monaco; font-size:
10px; "><font class="Apple-style-span"
style="font-size: 12px; " size="4">
optionalKey(io, </font><span
class="Apple-style-span" style="font-size: 12px; ">color</span><font
class="Apple-style-span" style="font-size: 12px; "
size="4">, "color", </font><span
class="Apple-style-span" style="font-size: 12px; ">colorConversions</span><span
class="Apple-style-span" style="font-size: 12px; ">);</span></div>
<div class="" style="margin-top: 0px; margin-right:
0px; margin-bottom: 0px; margin-left: 0px; font:
normal normal normal 12px/normal Monaco; font-size:
10px; "><font class="Apple-style-span"
style="font-size: 12px; " size="4">
requiredKey(io, </font><span
class="Apple-style-span" style="font-size: 12px; ">flags</span><font
class="Apple-style-span" style="font-size: 12px; "
size="4">, "</font><span class="Apple-style-span"
style="font-size: 12px; ">flags</span><font
class="Apple-style-span" style="font-size: 12px; "
size="4">", </font><span class="Apple-style-span"
style="font-size: 12px; ">flagConversions</span><span
class="Apple-style-span" style="font-size: 12px; ">);</span></div>
<div class="" style="margin-top: 0px; margin-right:
0px; margin-bottom: 0px; margin-left: 0px; font:
normal normal normal 12px/normal Monaco; font-size:
10px; "><span class="Apple-style-span"
style="font-size: 12px; "> }</span></div>
</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; font-size: 10px; "><font
class="Apple-style-span" style="font-size: 12px; "
size="4">};</font></div>
</div>
</div>
</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 10px; "><font
class="Apple-style-span" style="font-size: 12px; "
size="4"><br>
</font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 10px; "><font
class="Apple-style-span" style="font-size: 12px; "
size="4"><span class="Apple-style-span"
style="font-family: Times; font-size: 13px; ">The above
defines a yaml mapping with three keys: name, color, and
flags. When writing the color value out, the table
colorConversions is used to map the in memory value to a
string. In this case, the color field is marked as
optional. That means when reading the yaml document, if
there is no "color:" key, the struct's color field will
be filled in with the last value (the one with the NULL
string pointer) in the table, in this case the value
red.</span></font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 10px; "><font
class="Apple-style-span" style="font-size: 12px; "
size="4"><span class="Apple-style-span"
style="font-family: Times; font-size: 13px; "><br>
</span></font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 10px; "><font
class="Apple-style-span" style="font-size: 12px; "
size="4"><span class="Apple-style-span"
style="font-family: Times; font-size: 13px; ">When
writing the flags value out, the table flagConversion is
used to convert the bits in the flags field to a
sequence of flag values. </span></font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 10px; "><font
class="Apple-style-span" style="font-size: 12px; "
size="4"><span class="Apple-style-span"
style="font-family: Times; font-size: 13px; "><br>
</span></font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 10px; "><font
class="Apple-style-span" style="font-size: 12px; "
size="4"><span class="Apple-style-span"
style="font-family: Times; font-size: 13px; ">A valid
yaml document for this schema is:</span></font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 10px; "><font
class="Apple-style-span" face="Times"><span
class="Apple-style-span" style="font-size: 13px; "><br>
</span></font></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; ">- name: Tom</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; "> color:
blue</div>
</span><span class="Apple-style-span" style="font-size:
12px; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; "> flags: [
big ]</div>
</span><span class="Apple-style-span" style="font-size:
12px; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; ">- name:
Richard</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; "> color: red</div>
</span><span class="Apple-style-span" style="font-size:
12px; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; "> flags: [
little, pointy ]</div>
</span><span class="Apple-style-span" style="font-size:
12px; "></span><span class="Apple-style-span"
style="font-size: 12px; ">- name: Harry</span><span
class="Apple-style-span" style="font-size: 12px; "></span><span
class="Apple-style-span" style="font-size: 12px; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal
normal normal 12px/normal Monaco; "> flags: [
little, round ]</div>
<div><br>
</div>
</span><span class="Apple-style-span" style="font-size:
12px; "></span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-size: 12px; "><br>
</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-family: Times;
font-size: 13px; ">My initial plan was to add YAMLIO to
lld and let it mature there, but a got a request to move
this down into llvm for another llvm client to use. So,
I thought I'd see what llvm community thought of this
support.</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-family: Times;
font-size: 13px; "><br>
</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-family: Times;
font-size: 13px; ">To see a larger example, attached is a
sample mach-o object file (for hello world) encoded in
yaml along with the YAMLIO based schema for reading or
writing those documents.</span></div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-family: Times;
font-size: 13px; "></span></div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-family: Times;
font-size: 13px; "></span></div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
12px/normal Monaco; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; ">
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal
normal 12px/normal Monaco; font-size: 8px; "><span
class="Apple-style-span" style="font-family: Times;
font-size: 13px; "></span></div>
</div>
</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
13px/normal Times; min-height: 16px; "><br class="">
</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
13px/normal Times; min-height: 16px; ">-Nick</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
13px/normal Times; min-height: 16px; "><br class="">
</div>
<div class="" style="margin-top: 0px; margin-right: 0px;
margin-bottom: 0px; margin-left: 0px; font: normal normal normal
13px/normal Times; min-height: 16px; "><br class="">
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
LLVM Developers mailing list
<a class="moz-txt-link-abbreviated" href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a class="moz-txt-link-freetext" href="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</a>
<a class="moz-txt-link-freetext" href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Thanks,
Justin Holewinski</pre>
</body>
</html>