|
From: | John Snow |
Subject: | Re: cleanups with long-term benefits (was Re: [PATCH] schemas: Add vim modeline) |
Date: | Mon, 3 Aug 2020 14:10:29 -0400 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 |
On 8/3/20 8:01 AM, Paolo Bonzini wrote:
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.
Heresy:Docstrings could become part of the data format so they can be parsed, analyzed and validated. Parsers largely treat comments like non-semantic information and discard it. Round-trip parsers that preserve comments in any language are extremely rare.
If the docstrings are relevant to the generator and aren't discardable, they should be fully-fledged data members.
In a prototype I had for a YAML format, I just promoted docstrings directly to fields, so I could allow clients to query help text for individual commands.
--js
[Prev in Thread] | Current Thread | [Next in Thread] |