From d806f89f87152def5f422e946c84948831615236 Mon Sep 17 00:00:00 2001 From: Marc-André Lureau Date: Wed, 4 Aug 2021 12:31:00 +0400 Subject: 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 Message-Id: <20210804083105.97531-6-marcandre.lureau@redhat.com> Reviewed-by: Markus Armbruster [TODO comment added] Signed-off-by: Markus Armbruster --- scripts/qapi/schema.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'scripts/qapi/schema.py') diff --git a/scripts/qapi/schema.py b/scripts/qapi/schema.py index 4ea7e88846..a9345af7b7 100644 --- a/scripts/qapi/schema.py +++ b/scripts/qapi/schema.py @@ -19,7 +19,12 @@ import os import re from typing import Optional -from .common import POINTER_SUFFIX, c_name, cgen_ifcond +from .common import ( + POINTER_SUFFIX, + c_name, + cgen_ifcond, + docgen_ifcond, +) from .error import QAPIError, QAPISemError, QAPISourceError from .expr import check_exprs from .parser import QAPISchemaParser @@ -32,6 +37,9 @@ class QAPISchemaIfCond: def cgen(self): return cgen_ifcond(self.ifcond) + def docgen(self): + return docgen_ifcond(self.ifcond) + def is_present(self): return bool(self.ifcond) -- cgit v1.2.3-55-g7522