mirror of
https://github.com/mi57730/a2d.git
synced 2025-02-07 22:30:59 +00:00
asmfmt: respace comments
This commit is contained in:
parent
b3d1102161
commit
900bc42196
@ -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 (<STDIN>) {
|
||||
} 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*(.*)$/) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user