Lines Matching +full:sub +full:- +full:spaces
2 # SPDX-License-Identifier: GPL-2.0
23 # Regular expressions used to parse kernel-doc markups at KernelDoc class.
43 # @{section-name}:
61 type_param = KernRe(r"@(\w*((\.\w+)|(->\w+))*(\.\.\.)?)", cache=False)
72 r'(?:[-:].*)?$', # description (not captured)
83 (KernRe(r"__attribute__\s*\(\([a-z0-9,_\*\s\(\)]*\)\)", flags=re.I | re.S, cache=False), ' '),
113 # - a recursive pattern: (?1)
114 # - an atomic grouping: (?>...)
145 re.S), r'unsigned long \1[1 << ((\2) - 1)]'),
199 text = search.sub(subst, text)
207 return multi_space.sub(' ', s.strip())
217 text = KernRe(r'/\*\s*private:.*?/\*\s*public:.*?\*/', flags=re.S).sub('', text)
218 text = KernRe(r'/\*\s*private:.*', flags=re.S).sub('', text)
222 return KernRe(r'\s*/\*.*?\*/\s*', flags=re.S).sub('', text).strip()
290 # TODO: rename to emit_message after removal of kernel-doc.pl
336 # Only warn on user-specified duplicate section names
340 # Treat as a new paragraph - add a blank line
365 undescribed = "-- undescribed --"
412 # TODO: rename it to store_declaration after removal of kernel-doc.pl
459 param = KernRe(r'[\[\)].*').sub('', param, count=1)
467 param = param[:-3]
497 # Strip spaces from param so that it is one continuous string on
506 org_arg = KernRe(r'\s\s+').sub(' ', org_arg)
519 args = arg_expr.sub(r"\1#", args)
523 arg = KernRe(r'\sPOS0?\s').sub(' ', arg)
525 # Strip leading/trailing spaces
527 arg = KernRe(r'\s+').sub(' ', arg, count=1)
538 # The pointer-to-function case.
553 # The array-of-pointers case. Dig the parameter name out from the middle
569 # Clean up extraneous spaces and split the string at commas; the first
572 arg = KernRe(r'\s*:\s*').sub(":", arg)
573 arg = KernRe(r'\s*\[').sub('[', arg)
575 args[0] = re.sub(r'(\*+)\s*', r' \1', args[0])
604 if dtype != "": # Skip unnamed bit-fields
680 # trick is in the ^{ below - it prevents a match of an outer struct/union
704 s_id = KernRe(r'[:\[].*').sub('', s_id)
705 s_id = KernRe(r'^\s*\**(\S+)\s*').sub(r'\1', s_id)
712 # Look for (type)(*name)(args) - pointer to function
717 # Pointer-to-function
724 # Otherwise a non-function member.
728 # Remove bitmap and array portions and spaces around commas
730 arg = KernRe(r':\s*\d+\s*').sub('', arg)
731 arg = KernRe(r'\[.*\]').sub('', arg)
732 arg = KernRe(r'\s*,\s*').sub(',', arg)
734 # Look for a normal decl - "type name[,name...]"
739 name = KernRe(r'^\s*\**(\S+)\s*').sub(r'\1', name)
753 # End of the tuple loop - search again and see if there are outer members
765 # Insert newlines, get rid of extra spaces.
767 declaration = KernRe(r'([\{;])').sub(r'\1\n', declaration)
768 declaration = KernRe(r'\}\s+;').sub('};', declaration)
774 declaration = r.sub(r'\1,\n\2', declaration)
783 clause = KernRe(r'\s+').sub(' ', clause.strip(), count=1)
786 level -= 1
819 for search, sub in struct_nested_prefixes:
820 members = nested.sub(search, sub, members)
826 members = re.sub(r'(\{[^\{\}]*\})', '', members)
845 proto = KernRe(r'#\s*((define|ifdef|if)\s+|endif)[^;]*;', flags=re.S).sub('', proto)
873 f"{proto}: wrong kernel-doc identifier on prototype")
887 members = KernRe(r'\([^;)]*\)').sub('', members)
891 arg = KernRe(r'^\s*(\w+).*').sub(r'\1', arg)
939 new_proto = KernRe(r"^#\s*define\s+").sub("", prototype)
967 # - parport_register_device (function pointer parameters)
968 # - atomic_set (macro)
969 # - pci_match_device, __copy_to_user (long return type)
976 # lets us easily filter out __acquires() and other post-args stuff. If
1106 symbol = symbol[:-len(suffix)]
1126 STATE_NAME: Looking for the "name - description" line
1161 f"This comment starts with '/**', but isn't a kernel-doc comment. Refer Documentation/doc-guide/kernel-doc.rst\n{line}")
1174 # (We should be able to capture this from the previous parsing - someday)
1176 r = KernRe("[-:](.*)")
1189 f"wrong kernel-doc identifier on line:\n{line}")
1245 r = KernRe(r'\s*\*\s*[a-zA-Z_0-9:.]+\*/')
1362 self.emit_msg(ln, f"Incorrect use of kernel-doc format: {line}")
1384 proto = re.sub(r'[\r\n]+', ' ', proto)
1391 proto = KernRe(r'SYSCALL_DEFINE.*\(').sub('long sys_', proto)
1395 proto = KernRe(',').sub('(', proto, count=1)
1397 proto = KernRe(r'\)').sub('(void)', proto, count=1)
1399 # Now delete all of the odd-numbered commas in the proto
1455 # strip C99-style comments to end of line
1456 line = KernRe(r"//.*$", re.S).sub('', line)
1470 # strip comments and surrounding spaces
1471 self.entry.prototype = KernRe(r'/\*.*\*/').sub('', self.entry.prototype).strip()
1479 self.entry.prototype = r.sub(r'\1\2', self.entry.prototype)
1500 # Strip C99-style comments and surrounding whitespace
1501 line = KernRe(r"//.*$", re.S).sub('', line).strip()
1523 self.entry.brcount -= 1
1604 Besides parsing kernel-doc tags, it also parses export symbols.
1638 # it was read twice. Here, we use the already-existing