qapi: Rewrite doc comment parser
commit3d035cd2cca66488f6f478a93b231c302466116b
authorMarkus Armbruster <armbru@redhat.com>
Fri, 16 Feb 2024 14:58:38 +0000 (16 15:58 +0100)
committerMarkus Armbruster <armbru@redhat.com>
Mon, 26 Feb 2024 09:43:56 +0000 (26 10:43 +0100)
treeefc6a66a887adae344e23ccd0b9c42fde6c2224b
parent0b82a7440c22056745a925d0b1c070e18534aa0e
qapi: Rewrite doc comment parser

QAPISchemaParser is a conventional recursive descent parser.  Except
QAPISchemaParser.get_doc() delegates most of the doc comment parsing
work to a state machine in QAPIDoc.  The state machine doesn't get
tokens like a recursive descent parser, it is fed tokens.

I find this state machine rather opaque and hard to maintain.

Replace it by a conventional parser, all in QAPISchemaParser.  Less
code, and (at least in my opinion) easier to understand.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240216145841.2099240-15-armbru@redhat.com>
Tested-by: Daniel P. Berrangé <berrange@redhat.com>
scripts/qapi/parser.py