Skip to content

Commit f3341dc

Browse files
committed
kernel-doc/rst: add support for struct/union/enum member references
Link "&foo->bar", "&foo->bar()", "&foo.bar", and "&foo.bar()" to the struct/union/enum foo definition. The members themselves do not currently have anchors to link to, but this is better than nothing, and promotes a universal notation. Signed-off-by: Jani Nikula <jani.nikula@intel.com>
1 parent 47ae7ae commit f3341dc

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎scripts/kernel-doc‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,8 @@ my $type_enum_full = '\&(enum)\s*([_\w]+)';
214214
my $type_struct_full = '\&(struct)\s*([_\w]+)';
215215
my $type_typedef_full = '\&(typedef)\s*([_\w]+)';
216216
my $type_union_full = '\&(union)\s*([_\w]+)';
217+
my $type_member = '\&([_\w]+)((\.|->)[_\w]+)';
218+
my $type_member_func = $type_member . '\(\)';
217219

218220
# Output conversion substitutions.
219221
# One for each output format
@@ -282,6 +284,9 @@ my $blankline_text = "";
282284
# rst-mode
283285
my @highlights_rst = (
284286
[$type_constant, "``\$1``"],
287+
# Note: need to escape () to avoid func matching later
288+
[$type_member_func, "\\:c\\:type\\:`\$1\$2\\\\(\\\\) <\$1>`"],
289+
[$type_member, "\\:c\\:type\\:`\$1\$2 <\$1>`"],
285290
[$type_func, "\\:c\\:func\\:`\$1()`"],
286291
[$type_struct_full, "\\:c\\:type\\:`\$1 \$2 <\$2>`"],
287292
[$type_enum_full, "\\:c\\:type\\:`\$1 \$2 <\$2>`"],

0 commit comments

Comments
 (0)