- 129 名前:perl16 [02/04/20 11:51]
- >>128
あっ、考えてない。 perl5だけしか… >>105 を改良、7行になったけどバグあり。 #--- indent.pl ---# chop($f=<>);open(F,"<$f")||die$!;while(<F>){s/\s?\n$//;$_.=" "if/sub$/;$d.=$_; }close(F);$d=~s/(;|\{|\})/$1\n/g;$d=~s/\\\//\&\&\&/g;$d=~s/\\"/\@\@\@/g;@p=( '(q|qq|=~m|=~)\/.*?\/','(s|tr|y)\/.*?\/.*?\/','\(.*?\)','(\'|").*?\1.*?;');for (@p){while($d=~/$_/s){$o[$c]=$`;$j[$c++]=$&;$d=$';}$c=0;for(@j){s/\n//g; s/"/\$\$\$/g;s/'/\%\%\%/g;$t.="$o[$c++]$_";}$d="$t$d";$t="";$c=0;$#o=$#j=-1;} $d=~s/\&\&\&/\\\//g;$d=~s/\@\@\@/\\"/g;$d=~s/\$\$\$/"/g;$d=~s/\%\%\%/'/g;$f.= ".bak";open(F,">$f");print F$d;close(F); ↑のインデントバージョン www2.freejpn.com/~az1028/indent/indent.txt ↑のツールを使って自分自身を実行した結果。 www2.freejpn.com/~az1028/indent/indent2.txt
|

|