Received: by 10.223.176.5 with SMTP id f5csp436690wra; Fri, 9 Feb 2018 01:22:08 -0800 (PST) X-Google-Smtp-Source: AH8x226VEo9KGo+jYDQ4TAGoaTdItfL7g2KzZwyEAmAHmdNwAjAEnoypRZgkUJIjjlzNNf7aHoXX X-Received: by 2002:a17:902:ab85:: with SMTP id f5-v6mr1962764plr.199.1518168128797; Fri, 09 Feb 2018 01:22:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518168128; cv=none; d=google.com; s=arc-20160816; b=S7HzAvb7nFAddyLyaBYJe0oew2Vk4b13Ziw9+2R9kciBUi5fXTOV4jlibGyNa++BRz pBcLE5VN2hIjh77OWMTlE1S/1NaTOMU8o931OzDnEfeSTNu8fkVGZFS+6cG53a/E2Pph HK6qBIHxit0Br92jZ9iKmdbKy6DDxsB7LG9BC9GQqUBufiywZoj7DPQUjOp+QcC1FpdE oHqH1Zx2FNSdYII08+KQ6mNNMRylTdBi/GLCfD0Ai4+p12Io4cihjSE8U2VwpOvfOIz2 0wtCgTxd9Q+aiv4y0KJJVWqWAnJsd36orYEZC/K/YwdKmzG58qlc/HTSo63W/UKQ9cbD H9xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :organization:in-reply-to:subject:cc:to:from :arc-authentication-results; bh=jkIXBsVI618tIX42/Nu6Th/dUy+ZntB4V5s4kzHKQIY=; b=lxN+E99sILjcqjz/+czg2sCdX6TpcchWkNl5rJyJLviTmY3yTJOoanthd9j0uv/xIF H7C4yJyaqE8yMH0/jw1M2NG2Pqa6Gvipy0Y8909hxTQKNDpyCrIdf5JOUF7oSQfTS9cb WtNW8l6V7fg1AEby5YKiFI4dVjDi6oKfCDNYofOn5Fn0JlSZkiWv0WfZvvFee6ry4uwx 3fueFv+3+tShQm0FsdA+DNG6N4aK8cR6RoHRh3gIAShjR7k5m+i3MPNW4EsZHB6yHZ8G 8/cHB+RgQTbFDx5KBn4d5+S9J0uKi27qxXX84o6AZ6Zok28GeWedD7sMVH9ysi68uVLF Up0A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e18si1136899pgo.365.2018.02.09.01.21.51; Fri, 09 Feb 2018 01:22:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751201AbeBIJUv (ORCPT + 99 others); Fri, 9 Feb 2018 04:20:51 -0500 Received: from mga03.intel.com ([134.134.136.65]:27716 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751107AbeBIJUt (ORCPT ); Fri, 9 Feb 2018 04:20:49 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Feb 2018 01:20:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,482,1511856000"; d="scan'208";a="29436314" Received: from jnikula-mobl2.fi.intel.com (HELO localhost) ([10.237.72.62]) by fmsmga001.fm.intel.com with ESMTP; 09 Feb 2018 01:20:45 -0800 From: Jani Nikula To: Jonathan Corbet , linux-doc@vger.kernel.org Cc: linux-kernel@vger.kernel.org, mchehab@kernel.org, me@tobin.cc, Jonathan Corbet Subject: Re: [PATCH 2/8] docs: kernel-doc: Rename and split STATE_FIELD In-Reply-To: <20180207172624.24555-3-corbet@lwn.net> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20180207172624.24555-1-corbet@lwn.net> <20180207172624.24555-3-corbet@lwn.net> Date: Fri, 09 Feb 2018 11:20:41 +0200 Message-ID: <87fu6aa592.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 07 Feb 2018, Jonathan Corbet wrote: > 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. > > Signed-off-by: Jonathan Corbet I really wanted to avoid leaving behind any evidence that I've ever reviewed perl, but my sympathy for you updating the script won. But just barely. Reviewed-by: Jani Nikula > --- > scripts/kernel-doc | 22 +++++++++++----------- > 1 file 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=""; > use constant { > STATE_NORMAL => 0, # normal code > STATE_NAME => 1, # looking for function name > - STATE_FIELD => 2, # scanning field start > - STATE_PROTO => 3, # scanning prototype > - STATE_DOCBLOCK => 4, # documentation block > - STATE_INLINE => 5, # gathering documentation outside main block > + STATE_BODY_MAYBE => 2, # body - or maybe more description > + STATE_BODY => 3, # the body of the comment > + STATE_PROTO => 4, # scanning prototype > + STATE_DOCBLOCK => 5, # documentation block > + STATE_INLINE => 6, # gathering documentation outside main block > }; > my $state; > my $in_doc_sect; > @@ -1784,7 +1785,6 @@ sub process_file($) { > my $identifier; > my $func; > my $descr; > - my $in_purpose = 0; > my $initial_section_counter = $section_counter; > my ($orig_file) = @_; > my $leading_space; > @@ -1830,7 +1830,7 @@ sub process_file($) { > $identifier = $1; > } > > - $state = STATE_FIELD; > + $state = STATE_BODY; > # if there's no @param blocks need to set up default section > # here > $contents = ""; > @@ -1843,7 +1843,7 @@ sub process_file($) { > $descr =~ s/\s*$//; > $descr =~ s/\s+/ /g; > $declaration_purpose = $descr; > - $in_purpose = 1; > + $state = STATE_BODY_MAYBE; > } else { > $declaration_purpose = ""; > } > @@ -1875,7 +1875,7 @@ sub process_file($) { > ++$warnings; > $state = STATE_NORMAL; > } > - } elsif ($state == STATE_FIELD) { # look for head: lines, and include content > + } elsif ($state == STATE_BODY || $state == STATE_BODY_MAYBE) { > if (/$doc_sect/i) { # case insensitive for supported section names > $newsection = $1; > $newcontents = $2; > @@ -1902,7 +1902,7 @@ sub process_file($) { > } > > $in_doc_sect = 1; > - $in_purpose = 0; > + $state = STATE_BODY; > $contents = $newcontents; > $new_start_line = $.; > while (substr($contents, 0, 1) eq " ") { > @@ -1941,8 +1941,8 @@ sub process_file($) { > } else { > $contents .= "\n"; > } > - $in_purpose = 0; > - } elsif ($in_purpose == 1) { > + $state = STATE_BODY; > + } elsif ($state == STATE_BODY_MAYBE) { > # Continued declaration purpose > chomp($declaration_purpose); > $declaration_purpose .= " " . $1; -- Jani Nikula, Intel Open Source Technology Center