mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-07-27 04:13:53 -06:00
qapidoc: introduce QAPISchemaIfCond.docgen()
Instead of building the condition documentation from a list of string, use the result generated from QAPISchemaIfCond.docgen(). This changes the generated documentation from: - COND1, COND2... (where COND1, COND2 are Literal nodes, and ',' is Text) to: - COND1 and COND2 (the whole string as a Literal node) This will allow us to generate more complex conditions in the following patches, such as "(COND1 and COND2) or COND3". Adding back the differentiated formatting is left to the wish list. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20210804083105.97531-6-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> [TODO comment added] Signed-off-by: Markus Armbruster <armbru@redhat.com>
This commit is contained in:
parent
6cc2e4817f
commit
d806f89f87
3 changed files with 24 additions and 7 deletions
|
@ -205,6 +205,13 @@ def cgen_ifcond(ifcond: Union[str, List[str]]) -> str:
|
|||
return '(' + ') && ('.join(ifcond) + ')'
|
||||
|
||||
|
||||
def docgen_ifcond(ifcond: Union[str, List[str]]) -> str:
|
||||
# TODO Doc generated for conditions needs polish
|
||||
if not ifcond:
|
||||
return ''
|
||||
return ' and '.join(ifcond)
|
||||
|
||||
|
||||
def gen_if(cond: str) -> str:
|
||||
if not cond:
|
||||
return ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue