cusel/yacc-grammar/yacc-wrapper.sh

14 lines
297 B
Shell
Executable file

#!/bin/sh
# There is no standard way to make yacc(1) fail if it encounters
# conflicts, so error out if there's any warnings.
trap 'rm -- "${tempfile?}"' EXIT
tempfile="$(mktemp)"
${YACC?} ${YFLAGS?} "$@" 2> "${tempfile:?}"
if [ -s "${tempfile:?}" ]
then
cat -- "${tempfile:?}" >&2
exit 1
fi