[llvm-commits] [PATCH] YAML I/O

Sean Silva silvas at purdue.edu
Tue Aug 7 14:07:33 PDT 2012


Thanks for writing awesome docs!

+Sometime sequences are known to be short and the one entry per line is too
+verbose, so YAML offers an alternate syntax for sequences called a "Flow
+Sequence" in which you put comma separated sequence elements into square
+brackets.  The above example could then be simplified to :

It's probably worth mentioning here that the "Flow" syntax is
(exactly?) JSON. Also, noting that JSON is a proper subset of YAML is
in general is probably worth mentioning.

+   .. code-block:: none

pygments (and hence Sphinx) supports `yaml` highlighting
<http://pygments.org/docs/lexers/>

+the following document:
+
+   .. code-block:: none

The precedent for code listings is generally that the `..
code-block::` is at the same level of indentation as the paragraph
introducing it.

+You can combine mappings and squences by indenting.  For example a sequence
+of mappings in which one of the mapping values is itself a sequence:

s/squences/sequences/

+UniqueValue
+-----------

I think that EnumValue be more self-documenting than UniqueValue.

+of a new document is denoted with "---".  So in order for Input to handle
+multiple documents, it operators on an llvm::yaml::Document<>.

s/operators/operates/

+can set values in the context in the outer map's yamlMapping() method and
+retrive those values in the inner map's yamlMapping() method.

s/retrive/retrieve/

+of a new document is denoted with "---".  So in order for Input to handle

For clarity, I would put the --- in monospace (e.g. "``---``"), here
and in other places.



At a design level, what are the pros/cons of this approach compared
with a traits-based approach? What made you choose this design versus
a traits-based approach?

--Sean Silva

On Mon, Aug 6, 2012 at 12:17 PM, Nick Kledzik <kledzik at apple.com> wrote:
> Attached is a patch for review which implements the Yaml I/O library I proposed on llvm-dev July 25th.
>
>
>
>
> The patch includes the implementation, test cases, and documentation.
>
> I've included a PDF of the documentation, so you don't have to install the patch and run sphinx to read it.
>
>
>
> There are probably more aspects of yaml we can support in YAML I/O, but the current patch is enough to support my needs for encoding mach-o as yaml for lld test cases.
>
> I was initially planning on just adding this code to lld, but I've had two requests to push it down into llvm.
>
> Again, here are examples of the mach-o schema and an example mach-o document:
>
>
>
>
>
>
> -Nick
>
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>



More information about the llvm-commits mailing list