Lines Matching +full:sub +full:- +full:spaces
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2016-2025 by Mauro Carvalho Chehab <mchehab@kernel.org>.
13 enums and enum symbols and create cross-references for all of them.
31 Creates an enriched version of a Kernel header file with cross-links
35 uAPI headers will create cross-reference links to the code.
38 enums and enum symbols and create cross-references for all of them.
58 - A simple symbol name;
59 - A full Sphinx reference.
65 Sets C namespace to be used during cross-reference generation. Can
69 - ioctl: for defines that end with _IO*, e.g. ioctl definitions
70 - define: for other defines
71 - symbol: for symbols defined within enums;
72 - typedef: for typedefs;
73 - enum: for the name of a non-anonymous enum;
74 - struct: for structs.
166 with open(fname, "r", encoding="utf-8", errors="backslashreplace") as f:
247 By default, underscores are replaced by "-"
260 # c-type references don't support hash
262 ref_name = ref_name.replace("_", "-")
293 encoding="utf-8", errors="backslashreplace") as f:
300 multiline += line[-1]
312 # Strip C99-style comments
313 line = re.sub(r"(//.*)", "", line)
323 # if lines end with \ or if they have multi-line comments
327 line = re.sub(r"(/\*.*\*/)", "", line)
332 # having comments stripped and multi-lines grouped.
339 # 1. it makes easier to debug issues not-parsed symbols;
400 print(f" #{ln:<5d} {symbol} -> {ref}")
408 text = re.sub(r"\s+$", "", self.data) + "\n"
409 text = re.sub(r"\n\s+\n", "\n\n", text)
412 text = re.sub(r"([\_\`\*\<\>\&\\\\:\/\|\%\$\#\{\}\~\^])", r"\\\1", text)
415 text = re.sub(r"DEPRECATED", "**DEPRECATED**", text)
424 symbol = re.escape(re.sub(r"([\_\`\*\<\>\&\\\\:\/])", r"\\\1", symbol))
425 text = re.sub(fr'{start_delim}{symbol}{end_delim}',
428 # Remove "\ " where not needed: before spaces and at the end of lines
429 text = re.sub(r"\\ ([\n ])", r"\1", text)
430 text = re.sub(r" \\ ", " ", text)
455 text.append("-" * len(description))
460 text.append(f"- LINENO_{ln}: {ref}")
474 with open(file_out, "w", encoding="utf-8", errors="backslashreplace") as f:
475 f.write(".. -*- coding: utf-8; mode: rst -*-\n\n")
480 f.write(".. parsed-literal::\n\n")