Commit 07048d13 authored by Jonathan Corbet's avatar Jonathan Corbet

docs: kernel-doc: Move STATE_NORMAL processing into its own function

Begin the process of splitting up the nearly 500-line process_file()
function by moving STATE_NORMAL processing to a separate function.
Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
parent 17b78717
...@@ -1780,6 +1780,21 @@ sub process_export_file($) { ...@@ -1780,6 +1780,21 @@ sub process_export_file($) {
close(IN); close(IN);
} }
#
# Parsers for the various processing states.
#
# STATE_NORMAL: looking for the /** to begin everything.
#
sub process_normal() {
if (/$doc_start/o) {
$state = STATE_NAME; # next line is always the function name
$in_doc_sect = 0;
$declaration_start_line = $. + 1;
}
}
sub process_file($) { sub process_file($) {
my $file; my $file;
my $identifier; my $identifier;
...@@ -1807,11 +1822,7 @@ sub process_file($) { ...@@ -1807,11 +1822,7 @@ sub process_file($) {
# Replace tabs by spaces # Replace tabs by spaces
while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}; while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {};
if ($state == STATE_NORMAL) { if ($state == STATE_NORMAL) {
if (/$doc_start/o) { process_normal();
$state = STATE_NAME; # next line is always the function name
$in_doc_sect = 0;
$declaration_start_line = $. + 1;
}
} elsif ($state == STATE_NAME) {# this line is the function name (always) } elsif ($state == STATE_NAME) {# this line is the function name (always)
if (/$doc_block/o) { if (/$doc_block/o) {
$state = STATE_DOCBLOCK; $state = STATE_DOCBLOCK;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment