diff options
| author | Jonathan Corbet <corbet@lwn.net> | 2018-02-05 16:15:19 -0500 |
|---|---|---|
| committer | Jonathan Corbet <corbet@lwn.net> | 2018-02-15 15:11:22 -0500 |
| commit | 07048d13136bc068efb20e1d3e372577c2ef6906 (patch) | |
| tree | 303f9e419d3905118495fd1183266a2f2de1f2af /scripts/kernel-doc | |
| parent | 17b787171e693778eb9246978ad6116e52fa692c (diff) | |
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/kernel-doc')
| -rwxr-xr-x | scripts/kernel-doc | 21 |
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($) { | |||
| 1780 | close(IN); | 1780 | close(IN); |
| 1781 | } | 1781 | } |
| 1782 | 1782 | ||
| 1783 | # | ||
| 1784 | # Parsers for the various processing states. | ||
| 1785 | # | ||
| 1786 | # STATE_NORMAL: looking for the /** to begin everything. | ||
| 1787 | # | ||
| 1788 | sub process_normal() { | ||
| 1789 | if (/$doc_start/o) { | ||
| 1790 | $state = STATE_NAME; # next line is always the function name | ||
| 1791 | $in_doc_sect = 0; | ||
| 1792 | $declaration_start_line = $. + 1; | ||
| 1793 | } | ||
| 1794 | } | ||
| 1795 | |||
| 1796 | |||
| 1797 | |||
| 1783 | sub process_file($) { | 1798 | sub process_file($) { |
| 1784 | my $file; | 1799 | my $file; |
| 1785 | my $identifier; | 1800 | my $identifier; |
| @@ -1807,11 +1822,7 @@ sub process_file($) { | |||
| 1807 | # Replace tabs by spaces | 1822 | # Replace tabs by spaces |
| 1808 | while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}; | 1823 | while ($_ =~ s/\t+/' ' x (length($&) * 8 - length($`) % 8)/e) {}; |
| 1809 | if ($state == STATE_NORMAL) { | 1824 | if ($state == STATE_NORMAL) { |
| 1810 | if (/$doc_start/o) { | 1825 | process_normal(); |
| 1811 | $state = STATE_NAME; # next line is always the function name | ||
| 1812 | $in_doc_sect = 0; | ||
| 1813 | $declaration_start_line = $. + 1; | ||
| 1814 | } | ||
| 1815 | } elsif ($state == STATE_NAME) {# this line is the function name (always) | 1826 | } elsif ($state == STATE_NAME) {# this line is the function name (always) |
| 1816 | if (/$doc_block/o) { | 1827 | if (/$doc_block/o) { |
| 1817 | $state = STATE_DOCBLOCK; | 1828 | $state = STATE_DOCBLOCK; |
