[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 05/13] qapi/parser: fix comment parsing immediately following a do
From: |
Markus Armbruster |
Subject: |
[PULL 05/13] qapi/parser: fix comment parsing immediately following a doc block |
Date: |
Sat, 6 Jul 2024 09:24:08 +0200 |
From: John Snow <jsnow@redhat.com>
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 | 2 +-
tests/qapi-schema/doc-good.json | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/scripts/qapi/parser.py b/scripts/qapi/parser.py
index 1ef1f85b02..c3d20cc01b 100644
--- a/scripts/qapi/parser.py
+++ b/scripts/qapi/parser.py
@@ -583,7 +583,7 @@ def get_doc(self) -> 'QAPIDoc':
line = self.get_doc_line()
first = False
- self.accept(False)
+ self.accept()
doc.end()
return doc
diff --git a/tests/qapi-schema/doc-good.json b/tests/qapi-schema/doc-good.json
index de38a386e8..8b39eb946a 100644
--- a/tests/qapi-schema/doc-good.json
+++ b/tests/qapi-schema/doc-good.json
@@ -55,6 +55,8 @@
# - {braces}
##
+# Not a doc comment
+
##
# @Enum:
#
--
2.45.0
- [PULL 00/13] QAPI patches patches for 2024-07-06, Markus Armbruster, 2024/07/06
- [PULL 02/13] docs/qapidoc: remove unused intersperse function, Markus Armbruster, 2024/07/06
- [PULL 04/13] qapi/parser: preserve indentation in QAPIDoc sections, Markus Armbruster, 2024/07/06
- [PULL 10/13] qapi: update prose in note blocks, Markus Armbruster, 2024/07/06
- [PULL 03/13] docs/qapidoc: delint a tiny portion of the module, Markus Armbruster, 2024/07/06
- [PULL 09/13] qapi: convert "Note" sections to plain rST, Markus Armbruster, 2024/07/06
- [PULL 06/13] docs/qapidoc: fix nested parsing under untagged sections, Markus Armbruster, 2024/07/06
- [PULL 05/13] qapi/parser: fix comment parsing immediately following a doc block,
Markus Armbruster <=
- [PULL 11/13] qapi: add markup to note blocks, Markus Armbruster, 2024/07/06
- [PULL 08/13] qapi: nail down convention that Errors sections are lists, Markus Armbruster, 2024/07/06
- [PULL 13/13] sphinx/qapidoc: Fix to generate doc for explicit, unboxed arguments, Markus Armbruster, 2024/07/06
- [PULL 01/13] qapi: linter fixups, Markus Armbruster, 2024/07/06
- [PULL 07/13] qapi: fix non-compliant JSON examples, Markus Armbruster, 2024/07/06
- [PULL 12/13] qapi/parser: don't parse rST markup as section headers, Markus Armbruster, 2024/07/06
- Re: [PULL 00/13] QAPI patches patches for 2024-07-06, Richard Henderson, 2024/07/08