wrap up yacc cleanup

This commit is contained in:
Jean-Francois Dockes 2015-08-06 08:21:17 +02:00
parent 53befc5399
commit 8c24e63808
5 changed files with 13 additions and 20 deletions

View file

@ -86,7 +86,7 @@ src/query/position.hh
src/query/recollq src/query/recollq
src/query/stack.hh src/query/stack.hh
src/query/wasaparse.cpp src/query/wasaparse.cpp
src/query/wasaparse.hpp src/query/wasaparse.h
src/query/xadump src/query/xadump
src/recollinstall src/recollinstall
src/sampleconf/rclmon.sh src/sampleconf/rclmon.sh

View file

@ -8,7 +8,7 @@
#include "searchdata.h" #include "searchdata.h"
#include "wasaparserdriver.h" #include "wasaparserdriver.h"
#include "wasaparse.hpp" #include "wasaparse.h"
using namespace std; using namespace std;

View file

@ -26,7 +26,7 @@
#define YYDEBUG 1 #define YYDEBUG 1
// bison-generated file // bison-generated file
#include "wasaparse.hpp" #include "wasaparse.h"
using namespace std; using namespace std;
using namespace Rcl; using namespace Rcl;

View file

@ -1,13 +0,0 @@
// Bogus file to solve the following problem:
// Bison generates y.tab.h and inserts a line in the generated cpp
// file to include it
// However, we tell automake to use wasaparse.cpp and wasaparse.hpp as
// names for the generated files. This does not fix the #include
// y.tab.h line, so it fails.
// This workaround file just includes the appropriate file as
// generated by automake
#include "wasaparse.hpp"

View file

@ -1,7 +1,7 @@
#! /bin/sh #! /bin/sh
# ylwrap - wrapper for lex/yacc invocations. Local version, the # ylwrap - wrapper for lex/yacc invocations. Local version, the
# autotools scriptversion=2015-08-05.09; # UTC doesnt work for us # autotools scriptversion=2015-08-06.06; # UTC doesnt work for us
# because it does not move location.hh position.hh stack.hh into the # because it does not move location.hh position.hh stack.hh into the
# appropriate directory (which is a bug, but it's simpler to rewrite a # appropriate directory (which is a bug, but it's simpler to rewrite a
# simple version for our needs than to fix the original). # simple version for our needs than to fix the original).
@ -11,7 +11,7 @@ fatal() {
exit 1 exit 1
} }
usage() { usage() {
fatal "Usage: ylwrap query/wasaparse.ypp" fatal "Usage: ylwrap query/wasaparse.y"
} }
test $# -ge 1 || usage test $# -ge 1 || usage
@ -42,7 +42,13 @@ for f in location.hh position.hh stack.hh; do
cmp -s "${tmpdir}"/$f "${inputdir}"/$f || cp -p "${tmpdir}"/$f "${inputdir}" cmp -s "${tmpdir}"/$f "${inputdir}"/$f || cp -p "${tmpdir}"/$f "${inputdir}"
done done
# Fix the include line in y.tab.c (it wants to include y.tab.h, but we already
# include it as wasaparse.h
(cd "${tmpdir}"; \
sed -e 's/#include "y.tab.h"//' < y.tab.c > toto; \
mv -f toto y.tab.c)
cmp -s "${tmpdir}"/y.tab.c "${inputdir}"/wasaparse.cpp || \ cmp -s "${tmpdir}"/y.tab.c "${inputdir}"/wasaparse.cpp || \
cp -p "${tmpdir}"/y.tab.c "${inputdir}"/wasaparse.cpp cp -p "${tmpdir}"/y.tab.c "${inputdir}"/wasaparse.cpp
cmp -s "${tmpdir}"/y.tab.h "${inputdir}"/wasaparse.hpp || \ cmp -s "${tmpdir}"/y.tab.h "${inputdir}"/wasaparse.h || \
cp -p "${tmpdir}"/y.tab.h "${inputdir}"/wasaparse.hpp cp -p "${tmpdir}"/y.tab.h "${inputdir}"/wasaparse.h