From 0b82a7440c22056745a925d0b1c070e18534aa0e Mon Sep 17 00:00:00 2001
From: Markus Armbruster <armbru@redhat.com>
Date: Fri, 16 Feb 2024 15:58:37 +0100
Subject: qapi: Merge adjacent untagged sections
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

The parser mostly doesn't create adjacent untagged sections, and
merging the ones it does create is hardly worth the bother.  I'm doing
it to avoid behavioral change in the next commit.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240216145841.2099240-14-armbru@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
---
 scripts/qapi/parser.py | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'scripts/qapi/parser.py')

diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index de2ce3ec2c..48cc9a6367 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -719,6 +719,9 @@ class QAPIDoc:
         self._start_symbol_section(self.features, name)
 
     def _start_section(self, tag: Optional[str] = None) -> None:
+        if not tag and not self._section.tag:
+            # extend current section
+            return
         if tag in ('Returns', 'Since') and self.has_section(tag):
             raise QAPIParseError(self._parser,
                                  "duplicated '%s' section" % tag)
-- 
cgit v1.2.3