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


Reply via email to