Mercurial > repo
comparison lib/kps/labels.pl @ 12274:3c04e9ef7a3a draft
<kspalaiologos> `` cp -rf /hackenv/tmp/asmbf-1.2.7/bin/* /hackenv/lib/kps/
author | HackEso <hackeso@esolangs.org> |
---|---|
date | Tue, 31 Dec 2019 17:47:30 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
12273:de2990eb5cdf | 12274:3c04e9ef7a3a |
---|---|
1 #!/usr/bin/perl | |
2 | |
3 # asm2bf label preprocessor. | |
4 # C'mon, who doesn't love regexes? | |
5 | |
6 $n=0;%o=();$_=do{local$/;<>};s/^[ \t]*@([A-Za-z_]+[A-Za-z0-9_]*).*$/$o{$1}=++$n;'lbl '.$n."\n";/gem; | |
7 s/(%([A-Za-z_]+[A-Za-z0-9_]*)|"[^"\n]*%([A-Za-z_]+[A-Za-z0-9_]*))/substr($1,0,1)eq'"'?$1:%o{substr$1,1}/ge;print; |