<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Apr 9, 2014 at 1:16 PM, David Majnemer <span dir="ltr"><<a href="mailto:david.majnemer@gmail.com" target="_blank">david.majnemer@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">YAML 1.1 has just zero as an octal prefix: <a href="http://www.yaml.org/spec/1.1/#id858600" target="_blank">http://www.yaml.org/spec/1.1/#id858600</a><br>
<br><div>This seems to be the behavior of the most popular YAML readers I can get my hands on:</div>
<div><div>irb(main):002:0> YAML.load("010")</div><div>=> 8</div></div><div><br></div><div><div>>>> yaml.load("010")</div><div>8</div></div><div><br></div><div><br></div><div>We get the distinction between strings and integers wrong without this change.  It's pretty easy to see this if you serialize a StringRef holding a decimal (like "3") or hexadecimal number (like "0x3"), we will write it out unquoted which turns it into a number.</div>
</blockquote><div><br></div><div>This failure to correctly distinguish between numbers and strings is the biggest problem IMO. Thanks for working on this David.</div><div><br></div><div>Regarding the strange octal behavior of other implementations: I hate going against the spec, but if this patch is required for compatibility with existing implementations I support it. IMO one of the big advantages of using YAML is the easy interoperation with external tools and scripts.</div>
<div><br></div><div>One thing: I would at least like a small comment indicating that the "just leading zero"-octal isn't actually needed by the spec, but that we use this behavior (which results in perfectly compliant YAML either way) for compatibility with other implementations.</div>
<div><br></div><div>-- Sean Silva</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div class="">
<div class="h5">
<br><div>On Wed Apr 09 2014 at 7:50:30 AM, Michael Spencer <<a href="mailto:bigcheesegs@gmail.com" target="_blank">bigcheesegs@gmail.com</a>> wrote:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

On Wed, Apr 9, 2014 at 8:56 AM, David Majnemer <<a href="mailto:david.majnemer@gmail.com" target="_blank">david.majnemer@gmail.com</a>> wrote:<br>
> Author: majnemer<br>
> Date: Wed Apr  9 02:56:27 2014<br>
> New Revision: 205839<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=205839&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project?rev=205839&view=rev</a><br>
> Log:<br>
> YAMLIO: Encode ambiguous hex strings explicitly<br>
><br>
> YAMLIO would turn a BinaryRef into the string 0000000004000000.<br>
> However, the leading zero causes parsers to interpret it as being an<br>
> octal number instead of a hexadecimal one.<br>
><br>
> Instead, escape such strings as needed.<br>
><br>
<br>
This is wrong. In YAML all numbers are treated as decimal. Also this<br>
changes the tag type of the value to !!str.<br>
<br>
The correct change is to fix the reader to always do decimal and<br>
handle the 0x and 0o prefixes.<br>
<br>
See: <a href="http://www.yaml.org/spec/1.2/spec.html#id2805071" target="_blank">http://www.yaml.org/spec/1.2/<u></u>spec.html#id2805071</a><br>
<br>
- Michael Spencer<br>
</blockquote>
</div></div><br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div></div>