aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/kernel-doc
diff options
context:
space:
mode:
authorJonathan Corbet <corbet@lwn.net>2018-02-05 15:56:45 -0500
committerJonathan Corbet <corbet@lwn.net>2018-02-15 15:11:22 -0500
commit17b787171e693778eb9246978ad6116e52fa692c (patch)
treed1a46277ea20b2f309d824c63c693788a50e81a6 /scripts/kernel-doc
parent0bba924ce99aadf8dcd316b8bf8b98902925ea8a (diff)
docs: kernel-doc: Rename and split STATE_FIELD
STATE_FIELD describes a parser state that can handle any part of a kerneldoc comment body; rename it to STATE_BODY to reflect that. The $in_purpose variable was a hidden substate of STATE_FIELD; get rid of it and make a proper state (STATE_BODY_MAYBE) instead. This will make the subsequent process_file() splitup easier. Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts/kernel-doc')
-rwxr-xr-xscripts/kernel-doc22
1 files changed, 11 insertions, 11 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 5aa4ce211fc6..ad30c52f91ef 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -328,10 +328,11 @@ my $lineprefix="";
328use constant { 328use constant {
329 STATE_NORMAL => 0, # normal code 329 STATE_NORMAL => 0, # normal code
330 STATE_NAME => 1, # looking for function name 330 STATE_NAME => 1, # looking for function name
331 STATE_FIELD => 2, # scanning field start 331 STATE_BODY_MAYBE => 2, # body - or maybe more description
332 STATE_PROTO => 3, # scanning prototype 332 STATE_BODY => 3, # the body of the comment
333 STATE_DOCBLOCK => 4, # documentation block 333 STATE_PROTO => 4, # scanning prototype
334 STATE_INLINE => 5, # gathering documentation outside main block 334 STATE_DOCBLOCK => 5, # documentation block
335 STATE_INLINE => 6, # gathering documentation outside main block
335}; 336};
336my $state; 337my $state;
337my $in_doc_sect; 338my $in_doc_sect;
@@ -1784,7 +1785,6 @@ sub process_file($) {
1784 my $identifier; 1785 my $identifier;
1785 my $func; 1786 my $func;
1786 my $descr; 1787 my $descr;
1787 my $in_purpose = 0;
1788 my $initial_section_counter = $section_counter; 1788 my $initial_section_counter = $section_counter;
1789 my ($orig_file) = @_; 1789 my ($orig_file) = @_;
1790 my $leading_space; 1790 my $leading_space;
@@ -1830,7 +1830,7 @@ sub process_file($) {
1830 $identifier = $1; 1830 $identifier = $1;
1831 } 1831 }
1832 1832
1833 $state = STATE_FIELD; 1833 $state = STATE_BODY;
1834 # if there's no @param blocks need to set up default section 1834 # if there's no @param blocks need to set up default section
1835 # here 1835 # here
1836 $contents = ""; 1836 $contents = "";
@@ -1843,7 +1843,7 @@ sub process_file($) {
1843 $descr =~ s/\s*$//; 1843 $descr =~ s/\s*$//;
1844 $descr =~ s/\s+/ /g; 1844 $descr =~ s/\s+/ /g;
1845 $declaration_purpose = $descr; 1845 $declaration_purpose = $descr;
1846 $in_purpose = 1; 1846 $state = STATE_BODY_MAYBE;
1847 } else { 1847 } else {
1848 $declaration_purpose = ""; 1848 $declaration_purpose = "";
1849 } 1849 }
@@ -1875,7 +1875,7 @@ sub process_file($) {
1875 ++$warnings; 1875 ++$warnings;
1876 $state = STATE_NORMAL; 1876 $state = STATE_NORMAL;
1877 } 1877 }
1878 } elsif ($state == STATE_FIELD) { # look for head: lines, and include content 1878 } elsif ($state == STATE_BODY || $state == STATE_BODY_MAYBE) {
1879 if (/$doc_sect/i) { # case insensitive for supported section names 1879 if (/$doc_sect/i) { # case insensitive for supported section names
1880 $newsection = $1; 1880 $newsection = $1;
1881 $newcontents = $2; 1881 $newcontents = $2;
@@ -1902,7 +1902,7 @@ sub process_file($) {
1902 } 1902 }
1903 1903
1904 $in_doc_sect = 1; 1904 $in_doc_sect = 1;
1905 $in_purpose = 0; 1905 $state = STATE_BODY;
1906 $contents = $newcontents; 1906 $contents = $newcontents;
1907 $new_start_line = $.; 1907 $new_start_line = $.;
1908 while (substr($contents, 0, 1) eq " ") { 1908 while (substr($contents, 0, 1) eq " ") {
@@ -1941,8 +1941,8 @@ sub process_file($) {
1941 } else { 1941 } else {
1942 $contents .= "\n"; 1942 $contents .= "\n";
1943 } 1943 }
1944 $in_purpose = 0; 1944 $state = STATE_BODY;
1945 } elsif ($in_purpose == 1) { 1945 } elsif ($state == STATE_BODY_MAYBE) {
1946 # Continued declaration purpose 1946 # Continued declaration purpose
1947 chomp($declaration_purpose); 1947 chomp($declaration_purpose);
1948 $declaration_purpose .= " " . $1; 1948 $declaration_purpose .= " " . $1;