forked from OSchip/llvm-project
add scrubber for excessive leading whitespace
llvm-svn: 264542
This commit is contained in:
parent
507d696cac
commit
d859271d5d
|
@ -19,6 +19,7 @@ import re
|
||||||
|
|
||||||
# RegEx: this is where the magic happens.
|
# RegEx: this is where the magic happens.
|
||||||
|
|
||||||
|
SCRUB_LEADING_WHITESPACE_RE = re.compile(r'^(\s+)')
|
||||||
SCRUB_WHITESPACE_RE = re.compile(r'(?!^(| \w))[ \t]+', flags=re.M)
|
SCRUB_WHITESPACE_RE = re.compile(r'(?!^(| \w))[ \t]+', flags=re.M)
|
||||||
SCRUB_TRAILING_WHITESPACE_RE = re.compile(r'[ \t]+$', flags=re.M)
|
SCRUB_TRAILING_WHITESPACE_RE = re.compile(r'[ \t]+$', flags=re.M)
|
||||||
SCRUB_X86_SHUFFLES_RE = (
|
SCRUB_X86_SHUFFLES_RE = (
|
||||||
|
@ -321,6 +322,8 @@ def main():
|
||||||
if is_in_function:
|
if is_in_function:
|
||||||
if should_add_line_to_output(input_line, prefix_set) == True:
|
if should_add_line_to_output(input_line, prefix_set) == True:
|
||||||
# This input line of the function body will go as-is into the output.
|
# This input line of the function body will go as-is into the output.
|
||||||
|
# Except make leading whitespace uniform: 2 spaces.
|
||||||
|
input_line = SCRUB_LEADING_WHITESPACE_RE.sub(r' ', input_line)
|
||||||
output_lines.append(input_line)
|
output_lines.append(input_line)
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Reference in New Issue