changeset 12012:b413473a9ec3 draft

<kspalaiologos> ` cp tmp/asmbf-1.1.1/labels.pl /hackenv/bin
author HackEso <hackeso@esolangs.org>
date Thu, 14 Nov 2019 16:13:19 +0000
parents 76de149fb2be
children 45938be0e4ea
files bin/labels.pl
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/labels.pl	Thu Nov 14 16:13:19 2019 +0000
@@ -0,0 +1,9 @@
+#!/usr/bin/perl
+
+# asm2bf label preprocessor.
+# C'mon, who doesn't love regexes?
+
+# Released to the public domain by Krzysztof Szewczyk.
+
+$n=0;%o=();$_=do{local$/;<>};s/^[ \t]*@([A-Za-z_]+).*$/$o{$1}=++$n;'lbl '.$n."\n";/gem;
+s/(%[A-Za-z_]+|"[^"\n]*%[A-Za-z_]+)/substr($1,0,1)eq'"'?$1:%o{substr$1,1}/ge;print;