linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] docs: kdoc: rework the BODY* processing states
@ 2025-06-21 20:35 Jonathan Corbet
  2025-06-21 20:35 ` [PATCH 1/9] docs: kdoc: Make body_with_blank_line parsing more flexible Jonathan Corbet
                   ` (8 more replies)
  0 siblings, 9 replies; 19+ messages in thread
From: Jonathan Corbet @ 2025-06-21 20:35 UTC (permalink / raw)
  To: linux-doc
  Cc: linux-kernel, Mauro Carvalho Chehab, Akira Yokosawa,
	Jonathan Corbet

This is a continuation of my effort to better understand the new kernel-doc
script and to clean up some of the legacy cruft brought over from the perl
version.

There were three states associated with the processing of the body of a
kerneldoc comment: BODY_MAYBE, BODY_WITH_BLANK_LINE, and BODY.
Unfortunately, these states did not actually match the state of the parser,
leading to a lot of deeply nested if-then-else code and special cases.
I've renamed the states to better reflect their meaning, and changed how
SPECIAL_SECTION, in particular, is managed.

  BODY_MAYBE becomes DECLARATION - we have seen the first line of the
  declaration that starts a kerneldoc comment, and don't know if we have
  hit the end of it or not.

  BODY_WITH_BLANK_LINE becomes SPECIAL_SECTION.  This state was used to
  recognize the sections within a comment with special rules -
  specifically, that the section ends with a blank line or the beginning of
  a new special section.  The declaration of parameters and sections like
  "Context" fit that description.  The old code recognized these sections
  at the *end*, with a lot of twisty logic; going into the proper state at
  the beginning simplifies things.  There are a few output changes, but I
  think they are all more correct.

  BODY remains BODY - a documentation section that does *not* end at a
  blank line.

To facilitate these changes, I have also begun the task of pulling more of
KernelEntry state management into the class itself; there is more to be
done on that front.

Jonathan Corbet (9):
  docs: kdoc: Make body_with_blank_line parsing more flexible
  docs: kdoc: consolidate the "begin section" logic
  docs: kdoc: separate out the handling of the declaration phase
  docs: kdoc: split out the special-section state
  docs: kdoc: coalesce the new-section handling
  docs: kdoc: rework the handling of SPECIAL_SECTION
  docs: kdoc: coalesce the end-of-comment processing
  docs: kdoc: Add some comments to process_decl()
  docs: kdoc: finish disentangling the BODY and SPECIAL_SECTION states

 scripts/lib/kdoc/kdoc_parser.py | 232 +++++++++++++++++++-------------
 1 file changed, 138 insertions(+), 94 deletions(-)

-- 
2.49.0


^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2025-06-22 11:54 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-21 20:35 [PATCH 0/9] docs: kdoc: rework the BODY* processing states Jonathan Corbet
2025-06-21 20:35 ` [PATCH 1/9] docs: kdoc: Make body_with_blank_line parsing more flexible Jonathan Corbet
2025-06-22 11:46   ` Mauro Carvalho Chehab
2025-06-21 20:35 ` [PATCH 2/9] docs: kdoc: consolidate the "begin section" logic Jonathan Corbet
2025-06-22 11:47   ` Mauro Carvalho Chehab
2025-06-21 20:35 ` [PATCH 3/9] docs: kdoc: separate out the handling of the declaration phase Jonathan Corbet
2025-06-22 11:48   ` Mauro Carvalho Chehab
2025-06-21 20:35 ` [PATCH 4/9] docs: kdoc: split out the special-section state Jonathan Corbet
2025-06-22 11:50   ` Mauro Carvalho Chehab
2025-06-21 20:35 ` [PATCH 5/9] docs: kdoc: coalesce the new-section handling Jonathan Corbet
2025-06-22 11:50   ` Mauro Carvalho Chehab
2025-06-21 20:35 ` [PATCH 6/9] docs: kdoc: rework the handling of SPECIAL_SECTION Jonathan Corbet
2025-06-22 11:51   ` Mauro Carvalho Chehab
2025-06-21 20:35 ` [PATCH 7/9] docs: kdoc: coalesce the end-of-comment processing Jonathan Corbet
2025-06-22 11:52   ` Mauro Carvalho Chehab
2025-06-21 20:35 ` [PATCH 8/9] docs: kdoc: Add some comments to process_decl() Jonathan Corbet
2025-06-22 11:53   ` Mauro Carvalho Chehab
2025-06-21 20:35 ` [PATCH 9/9] docs: kdoc: finish disentangling the BODY and SPECIAL_SECTION states Jonathan Corbet
2025-06-22 11:54   ` Mauro Carvalho Chehab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).