qapi/parser: fix comment parsing immediately following a doc block
authorJohn Snow <jsnow@redhat.com>
Wed, 26 Jun 2024 22:21:12 +0000 (18:21 -0400)
committerMarkus Armbruster <armbru@redhat.com>
Sat, 6 Jul 2024 06:58:24 +0000 (08:58 +0200)
If a comment immediately follows a doc block, the parser doesn't ignore
that token appropriately. Fix that.

e.g.

> ##
> # = Hello World!
> ##
>
> # I'm a comment!

will break the parser, because it does not properly ignore the comment
token if it immediately follows a doc block.

Fixes: 3d035cd2cca6 (qapi: Rewrite doc comment parser)
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20240626222128.406106-7-jsnow@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
scripts/qapi/parser.py
tests/qapi-schema/doc-good.json

index 1ef1f85b028fa86907d0f11b7be1815f7f5ef2fa..c3d20cc01bc41b8d54fa24d6fa616e8a1462c349 100644 (file)
@@ -583,7 +583,7 @@ class QAPISchemaParser:
                 line = self.get_doc_line()
                 first = False
 
-        self.accept(False)
+        self.accept()
         doc.end()
         return doc
 
index de38a386e8f6c853d0c6f6bac50418ddeefc3a60..8b39eb946af3dc79d3d84413bc97c252f5acef6c 100644 (file)
@@ -55,6 +55,8 @@
 # - {braces}
 ##
 
+# Not a doc comment
+
 ##
 # @Enum:
 #