<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 1, 2013 at 7:00 AM, Vane, Edwin <span dir="ltr"><<a href="mailto:edwin.vane@intel.com" target="_blank">edwin.vane@intel.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
<br>
> -----Original Message-----<br>
> From: Manuel Klimek [mailto:<a href="mailto:klimek@google.com">klimek@google.com</a>]<br>
</div><div class="im">> Sent: Thursday, August 01, 2013 9:40 AM<br>
> To: Vane, Edwin<br>
</div><div class="im">> Cc: Alex Rosenberg; Clang Dev List (<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a>)<br>
> Subject: Re: [cfe-dev] RFC: YAML as an intermediate format for<br>
> clang::tooling::Replacement data on disk<br>
<br>
...<br>
<br>
</div><div class="im">> Note that the compilation databases use the YAML parser. JSON is a subset of<br>
> YAML. I'd also (slightly) prefer to use JSON over YAML for the intermediate<br>
> representation.<br>
<br>
</div>Is it enough to hard-code the output into JSON format</blockquote><div><br></div><div>Unfortunately YAMLIO doesn't support JSON-formatted output. I had a brief interchange with Nick Kledzik about this a while back, and he seemed to have a pretty clear idea of how to cleanly and "properly" implement this within the YAMLIO framework, but it seemed like it would still require some dedicated work before becoming a reality. </div>
<div><br></div><div>TBH, outputting JSON isn't that hard really. I believe we already have somewhere in LLVM that does this. The most complicated part is probably escaping strings, which is basically just the "usual" (C-like) escapes. Probably a single function `writeAsEscapedJSONString(raw_ostream &OS, StringRef Str)` would be all the "abstraction" you need.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">and just use the YAML parser for reading? Or should we aim for a general purpose JSON reader/writer as with YAML in LLVM? Either way, I think the general purpose parser is beyond scope for what we want to achieve at this time with the migrator.<br>
</blockquote><div><br></div><div>As Manuel already pointed out, YAML is a superset of JSON, so the YAML parser serves as a perfectly adequate JSON parser (YAMLIO should also work fine for the reading side as well).</div><div>
</div><div>-- Sean Silva</div></div></div></div>