shithub: mc

ref: 8c0eb9f56edefcc15a206f8e165056803f9f5b99
dir: /compile.myr/

View raw version
use std

use "types.use"

pkg regex =
	const compile	: (re : byte[:] -> regex#)
;;

const compile = {re
	var re
	re = std.zalloc()
	re.prog = std.slalloc(4)
	/* compiled regex for a* */
	re.prog[0] = `Byte ('a' castto(byte))
	re.prog[1] = `Byte ('a' castto(byte))
	re.prog[2] = `Split (0, 3)
	re.prog[3] = `Match

	-> re
}