diff options
| author | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2017-03-30 16:11:28 -0400 |
|---|---|---|
| committer | Jonathan Corbet <corbet@lwn.net> | 2017-04-02 16:06:50 -0400 |
| commit | b97f193abf83e30ef43317ba4883ce3a82f8e8b2 (patch) | |
| tree | 88802fd6ef27be1484937d7a8e46d83a441748ea /scripts/kernel-doc | |
| parent | c46988aef2de6d290b7c5453d58f1293337aefaa (diff) | |
scripts/kernel-doc: fix parser for apostrophes
On ReST, adding a text like ``literal`` is valid. However,
the kernel-doc script won't handle it fine.
We really need this feature, in order to escape things like
%ph, with is found on some C files.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Diffstat (limited to 'scripts/kernel-doc')
| -rwxr-xr-x | scripts/kernel-doc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 33c85dfdfce9..a4e5cc3b38e8 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc | |||
| @@ -202,6 +202,7 @@ EOF | |||
| 202 | # '&struct_name.member' - name of a structure member | 202 | # '&struct_name.member' - name of a structure member |
| 203 | # '@parameter' - name of a parameter | 203 | # '@parameter' - name of a parameter |
| 204 | # '%CONST' - name of a constant. | 204 | # '%CONST' - name of a constant. |
| 205 | # '``LITERAL``' - literal string without any spaces on it. | ||
| 205 | 206 | ||
| 206 | ## init lots of data | 207 | ## init lots of data |
| 207 | 208 | ||
| @@ -210,7 +211,8 @@ my $warnings = 0; | |||
| 210 | my $anon_struct_union = 0; | 211 | my $anon_struct_union = 0; |
| 211 | 212 | ||
| 212 | # match expressions used to find embedded type information | 213 | # match expressions used to find embedded type information |
| 213 | my $type_constant = '\%([-_\w]+)'; | 214 | my $type_constant = '\b``([^\`]+)``\b'; |
| 215 | my $type_constant2 = '\%([-_\w]+)'; | ||
| 214 | my $type_func = '(\w+)\(\)'; | 216 | my $type_func = '(\w+)\(\)'; |
| 215 | my $type_param = '\@(\w+(\.\.\.)?)'; | 217 | my $type_param = '\@(\w+(\.\.\.)?)'; |
| 216 | my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params | 218 | my $type_fp_param = '\@(\w+)\(\)'; # Special RST handling for func ptr params |
| @@ -235,6 +237,7 @@ my $type_member_func = $type_member . '\(\)'; | |||
| 235 | # these work fairly well | 237 | # these work fairly well |
| 236 | my @highlights_html = ( | 238 | my @highlights_html = ( |
| 237 | [$type_constant, "<i>\$1</i>"], | 239 | [$type_constant, "<i>\$1</i>"], |
| 240 | [$type_constant2, "<i>\$1</i>"], | ||
| 238 | [$type_func, "<b>\$1</b>"], | 241 | [$type_func, "<b>\$1</b>"], |
| 239 | [$type_enum_xml, "<i>\$1</i>"], | 242 | [$type_enum_xml, "<i>\$1</i>"], |
| 240 | [$type_struct_xml, "<i>\$1</i>"], | 243 | [$type_struct_xml, "<i>\$1</i>"], |
| @@ -252,6 +255,7 @@ my $blankline_html = $local_lt . "p" . $local_gt; # was "<p>" | |||
| 252 | # html version 5 | 255 | # html version 5 |
| 253 | my @highlights_html5 = ( | 256 | my @highlights_html5 = ( |
| 254 | [$type_constant, "<span class=\"const\">\$1</span>"], | 257 | [$type_constant, "<span class=\"const\">\$1</span>"], |
| 258 | [$type_constant2, "<span class=\"const\">\$1</span>"], | ||
| 255 | [$type_func, "<span class=\"func\">\$1</span>"], | 259 | [$type_func, "<span class=\"func\">\$1</span>"], |
| 256 | [$type_enum_xml, "<span class=\"enum\">\$1</span>"], | 260 | [$type_enum_xml, "<span class=\"enum\">\$1</span>"], |
| 257 | [$type_struct_xml, "<span class=\"struct\">\$1</span>"], | 261 | [$type_struct_xml, "<span class=\"struct\">\$1</span>"], |
| @@ -268,6 +272,7 @@ my $blankline_html5 = $local_lt . "br /" . $local_gt; | |||
| 268 | my @highlights_xml = ( | 272 | my @highlights_xml = ( |
| 269 | ["([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>"], | 273 | ["([^=])\\\"([^\\\"<]+)\\\"", "\$1<quote>\$2</quote>"], |
| 270 | [$type_constant, "<constant>\$1</constant>"], | 274 | [$type_constant, "<constant>\$1</constant>"], |
| 275 | [$type_constant2, "<constant>\$1</constant>"], | ||
| 271 | [$type_enum_xml, "<type>\$1</type>"], | 276 | [$type_enum_xml, "<type>\$1</type>"], |
| 272 | [$type_struct_xml, "<structname>\$1</structname>"], | 277 | [$type_struct_xml, "<structname>\$1</structname>"], |
| 273 | [$type_typedef_xml, "<type>\$1</type>"], | 278 | [$type_typedef_xml, "<type>\$1</type>"], |
| @@ -283,6 +288,7 @@ my $blankline_xml = $local_lt . "/para" . $local_gt . $local_lt . "para" . $loca | |||
| 283 | # gnome, docbook format | 288 | # gnome, docbook format |
| 284 | my @highlights_gnome = ( | 289 | my @highlights_gnome = ( |
| 285 | [$type_constant, "<replaceable class=\"option\">\$1</replaceable>"], | 290 | [$type_constant, "<replaceable class=\"option\">\$1</replaceable>"], |
| 291 | [$type_constant2, "<replaceable class=\"option\">\$1</replaceable>"], | ||
| 286 | [$type_func, "<function>\$1</function>"], | 292 | [$type_func, "<function>\$1</function>"], |
| 287 | [$type_enum, "<type>\$1</type>"], | 293 | [$type_enum, "<type>\$1</type>"], |
| 288 | [$type_struct, "<structname>\$1</structname>"], | 294 | [$type_struct, "<structname>\$1</structname>"], |
| @@ -298,6 +304,7 @@ my $blankline_gnome = "</para><para>\n"; | |||
| 298 | # these are pretty rough | 304 | # these are pretty rough |
| 299 | my @highlights_man = ( | 305 | my @highlights_man = ( |
| 300 | [$type_constant, "\$1"], | 306 | [$type_constant, "\$1"], |
| 307 | [$type_constant2, "\$1"], | ||
| 301 | [$type_func, "\\\\fB\$1\\\\fP"], | 308 | [$type_func, "\\\\fB\$1\\\\fP"], |
| 302 | [$type_enum, "\\\\fI\$1\\\\fP"], | 309 | [$type_enum, "\\\\fI\$1\\\\fP"], |
| 303 | [$type_struct, "\\\\fI\$1\\\\fP"], | 310 | [$type_struct, "\\\\fI\$1\\\\fP"], |
| @@ -312,6 +319,7 @@ my $blankline_man = ""; | |||
| 312 | # text-mode | 319 | # text-mode |
| 313 | my @highlights_text = ( | 320 | my @highlights_text = ( |
| 314 | [$type_constant, "\$1"], | 321 | [$type_constant, "\$1"], |
| 322 | [$type_constant2, "\$1"], | ||
| 315 | [$type_func, "\$1"], | 323 | [$type_func, "\$1"], |
| 316 | [$type_enum, "\$1"], | 324 | [$type_enum, "\$1"], |
| 317 | [$type_struct, "\$1"], | 325 | [$type_struct, "\$1"], |
| @@ -326,6 +334,7 @@ my $blankline_text = ""; | |||
| 326 | # rst-mode | 334 | # rst-mode |
| 327 | my @highlights_rst = ( | 335 | my @highlights_rst = ( |
| 328 | [$type_constant, "``\$1``"], | 336 | [$type_constant, "``\$1``"], |
| 337 | [$type_constant2, "``\$1``"], | ||
| 329 | # Note: need to escape () to avoid func matching later | 338 | # Note: need to escape () to avoid func matching later |
| 330 | [$type_member_func, "\\:c\\:type\\:`\$1\$2\$3\\\\(\\\\) <\$1>`"], | 339 | [$type_member_func, "\\:c\\:type\\:`\$1\$2\$3\\\\(\\\\) <\$1>`"], |
| 331 | [$type_member, "\\:c\\:type\\:`\$1\$2\$3 <\$1>`"], | 340 | [$type_member, "\\:c\\:type\\:`\$1\$2\$3 <\$1>`"], |
| @@ -344,6 +353,7 @@ my $blankline_rst = "\n"; | |||
| 344 | # list mode | 353 | # list mode |
| 345 | my @highlights_list = ( | 354 | my @highlights_list = ( |
| 346 | [$type_constant, "\$1"], | 355 | [$type_constant, "\$1"], |
| 356 | [$type_constant2, "\$1"], | ||
| 347 | [$type_func, "\$1"], | 357 | [$type_func, "\$1"], |
| 348 | [$type_enum, "\$1"], | 358 | [$type_enum, "\$1"], |
| 349 | [$type_struct, "\$1"], | 359 | [$type_struct, "\$1"], |
