view lib/kps/labels.pl @ 12488:d0ee4187003f draft

<b_jonas> slashlearn password//The password of the month contains chemicals known to the State of California to cause cancer and birth defects or other reproductive harm.
author HackEso <hackeso@esolangs.org>
date Tue, 07 Nov 2023 13:12:53 +0000
parents 3c04e9ef7a3a
children
line wrap: on
line source

#!/usr/bin/perl

# asm2bf label preprocessor.
# C'mon, who doesn't love regexes?

$n=0;%o=();$_=do{local$/;<>};s/^[ \t]*@([A-Za-z_]+[A-Za-z0-9_]*).*$/$o{$1}=++$n;'lbl '.$n."\n";/gem;
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;