annotate bin/labels.pl @ 12320:9c7eb9899d95 draft

<fizzie> le/rn karma//All living beings have actions (karma) as their own, their inheritance, their congenital cause, their kinsman, their refuge. It is karma that differentiates beings into low and high states.
author HackEso <hackeso@esolangs.org>
date Fri, 06 Mar 2020 23:08:37 +0000
parents b413473a9ec3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12012
b413473a9ec3 <kspalaiologos> ` cp tmp/asmbf-1.1.1/labels.pl /hackenv/bin
HackEso <hackeso@esolangs.org>
parents:
diff changeset
1 #!/usr/bin/perl
b413473a9ec3 <kspalaiologos> ` cp tmp/asmbf-1.1.1/labels.pl /hackenv/bin
HackEso <hackeso@esolangs.org>
parents:
diff changeset
2
b413473a9ec3 <kspalaiologos> ` cp tmp/asmbf-1.1.1/labels.pl /hackenv/bin
HackEso <hackeso@esolangs.org>
parents:
diff changeset
3 # asm2bf label preprocessor.
b413473a9ec3 <kspalaiologos> ` cp tmp/asmbf-1.1.1/labels.pl /hackenv/bin
HackEso <hackeso@esolangs.org>
parents:
diff changeset
4 # C'mon, who doesn't love regexes?
b413473a9ec3 <kspalaiologos> ` cp tmp/asmbf-1.1.1/labels.pl /hackenv/bin
HackEso <hackeso@esolangs.org>
parents:
diff changeset
5
b413473a9ec3 <kspalaiologos> ` cp tmp/asmbf-1.1.1/labels.pl /hackenv/bin
HackEso <hackeso@esolangs.org>
parents:
diff changeset
6 # Released to the public domain by Krzysztof Szewczyk.
b413473a9ec3 <kspalaiologos> ` cp tmp/asmbf-1.1.1/labels.pl /hackenv/bin
HackEso <hackeso@esolangs.org>
parents:
diff changeset
7
b413473a9ec3 <kspalaiologos> ` cp tmp/asmbf-1.1.1/labels.pl /hackenv/bin
HackEso <hackeso@esolangs.org>
parents:
diff changeset
8 $n=0;%o=();$_=do{local$/;<>};s/^[ \t]*@([A-Za-z_]+).*$/$o{$1}=++$n;'lbl '.$n."\n";/gem;
b413473a9ec3 <kspalaiologos> ` cp tmp/asmbf-1.1.1/labels.pl /hackenv/bin
HackEso <hackeso@esolangs.org>
parents:
diff changeset
9 s/(%[A-Za-z_]+|"[^"\n]*%[A-Za-z_]+)/substr($1,0,1)eq'"'?$1:%o{substr$1,1}/ge;print;