Lines Matching +full:sub +full:- +full:group

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), ' '),
100 # 1. drop struct group arguments that aren't at MEMBERS,
113 # - a recursive pattern: (?1)
114 # - an atomic grouping: (?>...)
145 re.S), r'unsigned long \1[1 << ((\2) - 1)]'),
157 # the start delimiter. Yet, right now, only one replace group
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
327 name = type_param.group(1)
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]
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)
527 arg = KernRe(r'\s+').sub(' ', arg, count=1)
538 # The pointer-to-function case.
546 param = r.group(1)
553 # The array-of-pointers case. Dig the parameter name out from the middle
561 param = r.group(1)
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])
583 args[0] = r.group(2)
584 dtype = r.group(1)
597 self.push_parameter(ln, decl_type, r.group(2),
598 f"{dtype} {r.group(1)}",
604 if dtype != "": # Skip unnamed bit-fields
605 self.push_parameter(ln, decl_type, bitfield_re.group(1),
606 f"{dtype}:{bitfield_re.group(2)}",
661 return (r.group(1), r.group(2), r.group(3))
665 return (r.group(1), r.group(3), r.group(2))
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
716 dtype, name, extra = r.group(1), r.group(2), r.group(3)
717 # Pointer-to-function
724 # Otherwise a non-function member.
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...]"
738 for name in r.group(2).split(','):
739 name = KernRe(r'^\s*\**(\S+)\s*').sub(r'\1', name)
742 newmember += f"{r.group(1)} {name}; "
744 newmember += f"{r.group(1)} {s_id}.{name}; "
753 # End of the tuple loop - search again and see if there are outer members
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)
851 declaration_name = r.group(2)
852 members = trim_private_members(r.group(1))
859 declaration_name = r.group(1)
860 members = trim_private_members(r.group(2))
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)
951 declaration_name = r.group(1)
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
995 return_type = r.group(1)
996 declaration_name = r.group(2)
997 args = r.group(3)
1044 return_type = r.group(1).strip()
1045 declaration_name = r.group(2)
1046 args = r.group(3)
1065 declaration_name = r.group(1)
1095 symbol = export_symbol.group(2)
1097 symbol = export_symbol_ns.group(2)
1106 symbol = symbol[:-len(suffix)]
1126 STATE_NAME: Looking for the "name - description" line
1133 if not doc_block.group(1):
1136 self.entry.begin_section(ln, doc_block.group(1))
1144 self.entry.identifier = doc_decl.group(1)
1148 self.entry.decl_type = doc_begin_data.group(1)
1149 self.entry.identifier = doc_begin_data.group(2)
1154 self.entry.identifier = doc_begin_func.group(1)
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("[-:](.*)")
1178 self.entry.declaration_purpose = trim_whitespace(r.group(1))
1189 f"wrong kernel-doc identifier on line:\n{line}")
1211 newsection = doc_sect.group(1)
1226 newcontents = doc_sect.group(2)
1245 r = KernRe(r'\s*\*\s*[a-zA-Z_0-9:.]+\*/')
1267 cont = doc_content.group(1)
1307 cont = doc_content.group(1)
1317 self.entry.leading_space = len(r.group(1))
1345 cont = doc_content.group(1)
1355 self.entry.begin_section(ln, doc_inline_sect.group(1))
1356 self.entry.add_text(doc_inline_sect.group(2).lstrip())
1362 self.emit_msg(ln, f"Incorrect use of kernel-doc format: {line}")
1373 self.entry.add_text(doc_content.group(1))
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
1426 tracepointname = r.group(1)
1430 tracepointname = r.group(1)
1434 tracepointname = r.group(2)
1441 tracepointargs = r.group(1)
1455 # strip C99-style comments to end of line
1456 line = KernRe(r"//.*$", re.S).sub('', line)
1465 self.entry.prototype += r.group(1) + " "
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
1538 self.entry.begin_section(ln, doc_inline_oneline.group(1))
1539 self.entry.add_text(doc_inline_oneline.group(2))
1560 self.entry.add_text(doc_content.group(1))
1604 Besides parsing kernel-doc tags, it also parses export symbols.
1618 # Group continuation lines on prototypes
1638 # it was read twice. Here, we use the already-existing