shithub: oai

ref: 745c5d5e5058f5e4ffb40425be424be467add1da
dir: /tools/gencode.awk/

View raw version
#!/bin/awk -f

BEGIN{
	printf "#line 0 \"tools/%s\"\n", ENVIRON["file"]
}

$1 == "%%json" {
	convert = 1
	next
}

$1 == "%/json" {
	convert = 0
	next
}

{
	if (!convert) {
		print
		next
	}
	gsub(/"/, "\\\"")
	gsub(/^/, "\"")
	gsub(/$/, "\"")
	print
}