diff options
| author | Jeff Epler <jepler@gmail.com> | 2021-03-15 19:22:48 -0500 |
|---|---|---|
| committer | Jeff Epler <jepler@gmail.com> | 2021-03-15 19:23:16 -0500 |
| commit | b9a973c8e0f7287874d56ce043ed814a823b53ed (patch) | |
| tree | 8d36337951f945b110eb41dcf978ab6444b1e367 /tools | |
| parent | d3bf1fe15dd3720d6566e061a0d315add550b248 (diff) | |
codeformat: Do search&replace without sed
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/codeformat.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tools/codeformat.py b/tools/codeformat.py index 141ad7112..58c5a8e39 100644 --- a/tools/codeformat.py +++ b/tools/codeformat.py @@ -99,6 +99,10 @@ def fixup_c(filename): # Get next line. l = lines.pop(0) + # Revert "// |" back to "//| " + if l.startswith("// |"): + l = "//|" + l[4:] + # Dedent #'s to match indent of following line (not previous line). m = re.match(r"( +)#(if |ifdef |ifndef |elif |else|endif)", l) if m: @@ -167,8 +171,6 @@ def main(): batch(command, lang_files(C_EXTS)) for file in lang_files(C_EXTS): fixup_c(file) - # Revert "// |" back to "//|" - batch(["sed", "-i", "s,^// |,//|,"], lang_files(C_EXTS)) # Format Python files with black. if format_py: |
