1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-05-08 22:37:04 +08:00
CMake/Utilities/Scripts/regenerate-parsers.bash
Christoph Grüninger c95442b9b1 LexerParser: Manual removing code from Bison is no longer needed
This was needed to avoid warnings while compiling the sources generated
by older versions of GNU Bison, but is not with GNU Bison 3.7.4.
2021-01-25 12:05:36 -05:00

33 lines
720 B
Bash
Executable File

#!/usr/bin/env bash
set -e
forced=1
if [[ "${1}" = "make" ]]; then
forced=0
fi
pushd "${BASH_SOURCE%/*}/../../Source/LexerParser" > /dev/null
for parser in \
CommandArgument \
DependsJava \
Expr \
Fortran
do
in_file=cm${parser}Parser.y
cxx_file=cm${parser}Parser.cxx
h_file=cm${parser}ParserTokens.h
prefix=cm${parser}_yy
if [[ (${in_file} -nt ${cxx_file}) || (${in_file} -nt ${h_file}) || (${forced} -gt 0) ]]; then
echo "Generating Parser ${parser}"
bison --name-prefix=${prefix} --defines=${h_file} -o${cxx_file} ${in_file}
else
echo "Skipped generating Parser ${parser}"
fi
done
popd > /dev/null