Lines Matching +full:sub +full:- +full:spaces
5 # Copyright (c) 2013-2018 Red Hat Inc.
12 # See the COPYING file in the top-level directory.
30 def camel_to_upper(value: str) -> str:
36 ENUMName -> ENUM_NAME
37 EnumName1 -> ENUM_NAME1
38 ENUM_NAME -> ENUM_NAME
39 ENUM_NAME1 -> ENUM_NAME1
40 ENUM_Name2 -> ENUM_NAME2
41 ENUM24_Name -> ENUM24_NAME
54 if len(ret) > 2 and ret[-2].isalnum():
55 ret = ret[:-1] + '_' + ret[-1]
59 if ret[-1].isalnum():
69 prefix: Optional[str] = None) -> str:
82 def c_name(name: str, protect: bool = True) -> str:
90 '__a.b_c' -> '__a_b_c', 'x-foo' -> 'x_foo'
91 protect=True: 'int' -> 'q_int'; protect=False: 'int' -> 'int'
97 # ANSI X3J11/88-090, 3.1.1
109 # GCC http://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/C-Extensions.html
124 name = re.sub(r'[^A-Za-z0-9_]', '_', name)
136 :param initial: Initial number of spaces, default 0.
138 def __init__(self, initial: int = 0) -> None:
141 def __repr__(self) -> str:
144 def __str__(self) -> str:
145 """Return the current indentation as a string of spaces."""
148 def increase(self, amount: int = 4) -> None:
152 def decrease(self, amount: int = 4) -> None:
155 self._level -= amount
162 def cgen(code: str, **kwds: object) -> str:
171 raw = re.sub(r'^(?!(#|$))', pfx, raw, flags=re.MULTILINE)
172 return re.sub(re.escape(EATSPACE) + r' *', '', raw)
175 def mcgen(code: str, **kwds: object) -> str:
181 def c_fname(filename: str) -> str:
182 return re.sub(r'[^A-Za-z0-9_]', '_', filename)
185 def guardstart(name: str) -> str:
194 def guardend(name: str) -> str:
204 all_operator: str, any_operator: str) -> str:
207 need_parens: bool) -> str:
221 def gen_infix(operator: str, operands: Sequence[Any]) -> str:
229 def cgen_ifcond(ifcond: Optional[Union[str, Dict[str, Any]]]) -> str:
233 def docgen_ifcond(ifcond: Optional[Union[str, Dict[str, Any]]]) -> str:
238 def gen_if(cond: str) -> str:
246 def gen_endif(cond: str) -> str:
254 def must_match(pattern: str, string: str) -> Match[str]: