summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2018-02-05 14:15:19 -0700
committerJonathan Corbet <corbet@lwn.net>2018-02-15 13:11:22 -0700
commit07048d13136bc068efb20e1d3e372577c2ef6906 (patch)
tree303f9e419d3905118495fd1183266a2f2de1f2af /scripts
parent17b787171e693778eb9246978ad6116e52fa692c (diff)
downloadlwn-07048d13136bc068efb20e1d3e372577c2ef6906.tar.gz
lwn-07048d13136bc068efb20e1d3e372577c2ef6906.zip
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: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/kernel-doc21
1 files changed, 16 insertions, 5 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index ad30c52f91ef..65150b7c8472 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -1780,6 +1780,21 @@ sub process_export_file($) {
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($) {
my $file;
my $identifier;
@@ -1807,11 +1822,7 @@ sub process_file($) {
# Replace tabs by spaces
while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {};
if ($state == STATE_NORMAL) {
- if (/$doc_start/o) {
- $state = STATE_NAME; # next line is always the function name
- $in_doc_sect = 0;
- $declaration_start_line = $. + 1;
- }
+ process_normal();
} elsif ($state == STATE_NAME) {# this line is the function name (always)
if (/$doc_block/o) {
$state = STATE_DOCBLOCK;