#!/bin/awk -f # # Copyright © 2023 Nick Bowler # # Helper script used by the RRace makefile to combine gen-tree.awk and # gen-strtab.awk inputs into a single source file and build rule. # # Usage: awk -f mkstrtab.awk -f gen-strtab.awk input.dat # # License WTFPL2: Do What The Fuck You Want To Public License, version 2. # This is free software: you are free to do what the fuck you want to. # There is NO WARRANTY, to the extent permitted by law. { if (sub(/^#&/, "\\&")) { # Lines beginning with #& are taken verbatim (with the # removed) explicit[$1] = 1; } else if (sub(/,$/, "", $1) && !("&"$1 in explicit)) { # Put tree node ids into the strtab, unless explicitly defined earlier. $0 = "&&" $1 " " $1; } else { next; } }