From 5267dd354bcd267f76d0f97193fe8a93899f8986 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Mon, 2 Jan 2017 16:22:26 +0100 Subject: [PATCH] kernel-doc: make member highlighting available in all backends Note that, in order to produce the correct Docbook markup, the "." or "->" must be separated from the member name in the regex's captured fields. For consistency, this change is applied to $type_member and $type_member_func too, not just to $type_member_xml. List mode only prints the struct name, to avoid any undesired change in the operation of docproc. Signed-off-by: Paolo Bonzini Acked-by: Jani Nikula Signed-off-by: Jonathan Corbet --- scripts/kernel-doc | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 5476cf4f4673..d5e9f765b4fc 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -199,12 +199,12 @@ EOF # 'funcname()' - function # '$ENVVAR' - environmental variable # '&struct_name' - name of a structure (up to two words including 'struct') +# '&struct_name.member' - name of a structure member # '@parameter' - name of a parameter # '%CONST' - name of a constant. ## init lots of data - my $errors = 0; my $warnings = 0; my $anon_struct_union = 0; @@ -221,7 +221,8 @@ my $type_enum_full = '\&(enum)\s*([_\w]+)'; my $type_struct_full = '\&(struct)\s*([_\w]+)'; my $type_typedef_full = '\&(typedef)\s*([_\w]+)'; my $type_union_full = '\&(union)\s*([_\w]+)'; -my $type_member = '\&([_\w]+)((\.|->)[_\w]+)'; +my $type_member = '\&([_\w]+)(\.|->)([_\w]+)'; +my $type_member_xml = '\&([_\w]+)(\.|-\>)([_\w]+)'; my $type_member_func = $type_member . '\(\)'; # Output conversion substitutions. @@ -233,7 +234,8 @@ my @highlights_html = ( [$type_func, "\$1"], [$type_struct_xml, "\$1"], [$type_env, "\$1"], - [$type_param, "\$1"] + [$type_param, "\$1"], + [$type_member_xml, "\$1\$2\$3"] ); my $local_lt = "\\\\\\\\lt:"; my $local_gt = "\\\\\\\\gt:"; @@ -245,7 +247,8 @@ my @highlights_html5 = ( [$type_func, "\$1"], [$type_struct_xml, "\$1"], [$type_env, "\$1"], - [$type_param, "\$1]"] + [$type_param, "\$1]"], + [$type_member_xml, "\$1\$2\$3"] ); my $blankline_html5 = $local_lt . "br /" . $local_gt; @@ -256,7 +259,8 @@ my @highlights_xml = ( [$type_struct_xml, "\$1"], [$type_param, "\$1"], [$type_func, "\$1"], - [$type_env, "\$1"] + [$type_env, "\$1"], + [$type_member_xml, "\$1\$2\$3"] ); my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $local_gt . "\n"; @@ -266,7 +270,8 @@ my @highlights_gnome = ( [$type_func, "\$1"], [$type_struct, "\$1"], [$type_env, "\$1"], - [$type_param, "\$1" ] + [$type_param, "\$1" ], + [$type_member, "\$1\$2\$3"] ); my $blankline_gnome = "\n"; @@ -275,7 +280,8 @@ my @highlights_man = ( [$type_constant, "\$1"], [$type_func, "\\\\fB\$1\\\\fP"], [$type_struct, "\\\\fI\$1\\\\fP"], - [$type_param, "\\\\fI\$1\\\\fP"] + [$type_param, "\\\\fI\$1\\\\fP"], + [$type_member, "\\\\fI\$1\$2\$3\\\\fP"] ); my $blankline_man = ""; @@ -284,7 +290,8 @@ my @highlights_text = ( [$type_constant, "\$1"], [$type_func, "\$1"], [$type_struct, "\$1"], - [$type_param, "\$1"] + [$type_param, "\$1"], + [$type_member, "\$1\$2\$3"] ); my $blankline_text = ""; @@ -292,8 +299,8 @@ my $blankline_text = ""; my @highlights_rst = ( [$type_constant, "``\$1``"], # Note: need to escape () to avoid func matching later - [$type_member_func, "\\:c\\:type\\:`\$1\$2\\\\(\\\\) <\$1>`"], - [$type_member, "\\:c\\:type\\:`\$1\$2 <\$1>`"], + [$type_member_func, "\\:c\\:type\\:`\$1\$2\$3\\\\(\\\\) <\$1>`"], + [$type_member, "\\:c\\:type\\:`\$1\$2\$3 <\$1>`"], [$type_fp_param, "**\$1\\\\(\\\\)**"], [$type_func, "\\:c\\:func\\:`\$1()`"], [$type_struct_full, "\\:c\\:type\\:`\$1 \$2 <\$2>`"], @@ -311,7 +318,8 @@ my @highlights_list = ( [$type_constant, "\$1"], [$type_func, "\$1"], [$type_struct, "\$1"], - [$type_param, "\$1"] + [$type_param, "\$1"], + [$type_member, "\$1"] ); my $blankline_list = "";