[PATCH] D31992: [clangd] Escape only necessary characters in JSON output

Marc-Andre Laperle via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 13 06:22:21 PDT 2017


malaperle-ericsson added a comment.

In https://reviews.llvm.org/D31992#725866, @krasimir wrote:

> Seems that we're starting to hit some YAML/JSON mismatches, or is it that your YAML string support is lacking?


I don't think so. It seems like JSON and YAML are not completely aligned on escaped characters. See http://yaml.org/spec/1.2/spec.html#id2776092 which specifies unicode 8, 16, and 32 bits are escaped with \x, \u, and \U whereas http://www.json.org/string.gif specifies that unicode 16 bit characters can be encoded with \u but \x and \U are not supported. This leads me to believe that a YAML parser can read JSON but a JSON parser will not necessarily be able to read YAML. I thought about using json cpp but that's a much bigger change


Repository:
  rL LLVM

https://reviews.llvm.org/D31992





More information about the cfe-commits mailing list