From 900bc42196d81bc6f136b98d31d5893419813d2c Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Sun, 9 Dec 2018 16:15:48 -0800 Subject: [PATCH] asmfmt: respace comments --- res/asmfmt.pl | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/res/asmfmt.pl b/res/asmfmt.pl index 60526f3..633c154 100755 --- a/res/asmfmt.pl +++ b/res/asmfmt.pl @@ -9,6 +9,11 @@ sub nospace($) { return $s; } +sub respace_comment($) { + my ($s) = @_; + $s =~ s/^(;+)\s+(.*)/$1 $2/g; + return $s; +} my $tab = 8; my $comment_column = 32; @@ -27,19 +32,19 @@ while () { } elsif (m/^(;;;.*)/) { # full line comment - flush left - $_ = $1; + $_ = respace_comment($1); } elsif (m/^(;;.*)/) { # indented comment - one tab stop - $_ = (' ' x $tab) . $1; + $_ = (' ' x $tab) . respace_comment($1); } else { my $comment = ''; if (m/^(.*?)(;.*)$/) { $_ = $1; - $comment = $2; + $comment = respace_comment($2); } if (m/^(\w+)\s*:=\s*(.*)$/) {