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), ' '),
115 # - a recursive pattern: (?1)
116 # - an atomic grouping: (?>...)
147 re.S), r'unsigned long \1[1 << ((\2) - 1)]'),
202 text = search.sub(subst, text)
210 return multi_space.sub(' ', s.strip())
220 text = KernRe(r'/\*\s*private:.*?/\*\s*public:.*?\*/', flags=re.S).sub('', text)
221 text = KernRe(r'/\*\s*private:.*', flags=re.S).sub('', text)
225 return KernRe(r'\s*/\*.*?\*/\s*', flags=re.S).sub('', text).strip()
296 # TODO: rename to emit_message after removal of kernel-doc.pl
344 # Only warn on user-specified duplicate section names
348 # Treat as a new paragraph - add a blank line
374 undescribed = "-- undescribed --"
425 # TODO: rename it to store_declaration after removal of kernel-doc.pl
480 param = KernRe(r'[\[\)].*').sub('', param, count=1)
488 param = param[:-3]
518 # Strip spaces from param so that it is one continuous string on
527 org_arg = KernRe(r'\s\s+').sub(' ', org_arg)
540 args = arg_expr.sub(r"\1#", args)
544 arg = KernRe(r'\sPOS0?\s').sub(' ', arg)
546 # Strip leading/trailing spaces
548 arg = KernRe(r'\s+').sub(' ', arg, count=1)
559 # The pointer-to-function case.
574 # The array-of-pointers case. Dig the parameter name out from the middle
590 # Clean up extraneous spaces and split the string at commas; the first
593 arg = KernRe(r'\s*:\s*').sub(":", arg)
594 arg = KernRe(r'\s*\[').sub('[', arg)
596 args[0] = re.sub(r'(\*+)\s*', r' \1', args[0])
625 if dtype != "": # Skip unnamed bit-fields
701 # trick is in the ^{ below - it prevents a match of an outer struct/union
725 s_id = KernRe(r'[:\[].*').sub('', s_id)
726 s_id = KernRe(r'^\s*\**(\S+)\s*').sub(r'\1', s_id)
733 # Look for (type)(*name)(args) - pointer to function
738 # Pointer-to-function
745 # Otherwise a non-function member.
749 # Remove bitmap and array portions and spaces around commas
751 arg = KernRe(r':\s*\d+\s*').sub('', arg)
752 arg = KernRe(r'\[.*\]').sub('', arg)
753 arg = KernRe(r'\s*,\s*').sub(',', arg)
755 # Look for a normal decl - "type name[,name...]"
760 name = KernRe(r'^\s*\**(\S+)\s*').sub(r'\1', name)
774 # End of the tuple loop - search again and see if there are outer members
786 # Insert newlines, get rid of extra spaces.
788 declaration = KernRe(r'([\{;])').sub(r'\1\n', declaration)
789 declaration = KernRe(r'\}\s+;').sub('};', declaration)
795 declaration = r.sub(r'\1,\n\2', declaration)
804 clause = KernRe(r'\s+').sub(' ', clause.strip(), count=1)
807 level -= 1
840 for search, sub in struct_nested_prefixes:
841 members = nested.sub(search, sub, members)
847 members = re.sub(r'(\{[^\{\}]*\})', '', members)
866 proto = KernRe(r'#\s*((define|ifdef|if)\s+|endif)[^;]*;', flags=re.S).sub('', proto)
894 f"{proto}: wrong kernel-doc identifier on prototype")
908 members = KernRe(r'\([^;)]*\)').sub('', members)
912 arg = KernRe(r'^\s*(\w+).*').sub(r'\1', arg)
960 new_proto = KernRe(r"^#\s*define\s+").sub("", prototype)
988 # - parport_register_device (function pointer parameters)
989 # - atomic_set (macro)
990 # - pci_match_device, __copy_to_user (long return type)
997 # lets us easily filter out __acquires() and other post-args stuff. If
1127 symbol = symbol[:-len(suffix)]
1147 STATE_NAME: Looking for the "name - description" line
1182 …his comment starts with '/**', but isn't a kernel-doc comment. Refer to Documentation/doc-guide/ke…
1195 # (We should be able to capture this from the previous parsing - someday)
1197 r = KernRe("[-:](.*)")
1210 f"wrong kernel-doc identifier on line:\n{line}")
1266 r = KernRe(r'\s*\*\s*[a-zA-Z_0-9:.]+\*/')
1383 self.emit_msg(ln, f"Incorrect use of kernel-doc format: {line}")
1405 proto = re.sub(r'[\r\n]+', ' ', proto)
1412 proto = KernRe(r'SYSCALL_DEFINE.*\(').sub('long sys_', proto)
1416 proto = KernRe(',').sub('(', proto, count=1)
1418 proto = KernRe(r'\)').sub('(void)', proto, count=1)
1420 # Now delete all of the odd-numbered commas in the proto
1476 # strip C99-style comments to end of line
1477 line = KernRe(r"//.*$", re.S).sub('', line)
1491 # strip comments and surrounding spaces
1492 self.entry.prototype = KernRe(r'/\*.*\*/').sub('', self.entry.prototype).strip()
1500 self.entry.prototype = r.sub(r'\1\2', self.entry.prototype)
1521 # Strip C99-style comments and surrounding whitespace
1522 line = KernRe(r"//.*$", re.S).sub('', line).strip()
1544 self.entry.brcount -= 1
1625 Besides parsing kernel-doc tags, it also parses export symbols.
1659 # it was read twice. Here, we use the already-existing