shaniqua-smeggdrop/procs/005a3f83529ce91e2b4dc4717504bac4fd7784b4
radical_honesty on #flashsupport c43404514c Evaluated rename csplit csplit_fuckyou
2023-01-13 11:30:43 -08:00

54 lines
1.1 KiB
Plaintext

s {
set f 0;
set r [list];
set a [list];
set e [list];
set i 0;
foreach c [split $s ""] {
switch -- $f {
0 {
switch -- $c {
{set f 1;set b }
{lappend e [list $i ]}
{lappend e [list $i ]}
{lappend e [list $i ]}
{lappend e [list $i ]}
default {lappend a $c;incr i}
}
}
1 {
switch -regexp -- $c {
\\d {append b $c;incr f}
default {lappend e [list $i $b];lappend a $c;incr i;set f 0}
}
}
2 {
switch -regexp -- $c {
\\d {append b $c;incr f}
, {append b $c;set f 4}
default {lappend e [list $i $b];lappend a $c;incr i;set f 0}
}
}
3 {
switch -- $c {
, {append b $c;incr f}
default {lappend e [list $i $b];lappend a $c;incr i;set f 0}
}
}
4 {
switch -regexp -- $c {
\\d {append b $c;incr f}
default {lappend e [list $i $b];lappend a $c;incr i;set f 0}
}
}
5 {
switch -regexp -- $c {
\\d {append b $c;lappend e [list $i $b];set f 0}
default {lappend e [list $i $b];lappend a $c;incr i;set f 0}
}
}
}
}
return [list $a $e]
}