shithub: mc

ref: bdf0ed62196f1e67d65b3346ae45d1a0e322bd00
dir: /test/fmtnest.myr/

View raw version
use std

type foo = struct
        f2 : uint8
        f3 : (uint8, flt64)
;;

const main = {
        var f : foo = [  .f2 = 2, .f3 = (3, 4.4) ]
        var str = std.fmt("{}", f)
        for var j = 0; j < str.len; ++j
                /* Try not to accidentally create any shell characters */
                if str[j] == ('(' : byte) || str[j] == (')' : byte) || str[j] == ('[' : byte) || str[j] == (']' : byte) || str[j] == (' ' : byte) || str[j] == ('=' : byte)
                        str[j] = ('_' : byte)
                ;;
        ;;
        std.put("{}\n", str)
}