Markus Armbruster <arm...@redhat.com> writes: > Paolo Bonzini <pbonz...@redhat.com> writes: [...] >> That said, after a bit more research I'm skeptical about the possibility >> of using an off-the-shelf parser because most of them either don't >> support comments, or are based on YAJL which simply discards comments. >> >> Since '//' comments are harder to parse than "#" comments, this would >> actually _add_ code instead of removing it. Also since our doc comment >> syntax uses "##" as a delimiter, we'd have to bikeshed what the doc >> comments would look like ("//!", "///", etc.). > > Doc comments don't have to be comments in the schema language. They > could be doc strings. Requires decent support for long strings, which > JSON does not provide.
There's another complication besides multi-line strings: funny characters. Since QAPI schema strings are all names, and names are restricted to ASCII letters, digits, hyphen, and underscore, we limit strings to printable ASCII, so we don't have to deal with control characters, escape sequences, surrogate pairs, and all that crap. Comments are UTF-8. [...]