mirror of https://gitee.com/bigwinds/arangodb
41 lines
1.2 KiB
Bash
Executable File
41 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
FLEX="$1"
|
|
OUTPUT="$2"
|
|
INPUT="$3"
|
|
|
|
if test "x$FLEX" = "x" -o "x$OUTPUT" = "x" -o "x$INPUT" = "x"; then
|
|
echo "usage: $0 <flex> <output> <input>"
|
|
exit 1
|
|
fi
|
|
|
|
#############################################################################
|
|
## flex
|
|
#############################################################################
|
|
|
|
${FLEX} -L -o${OUTPUT} ${INPUT}
|
|
|
|
#############################################################################
|
|
## sanity checks
|
|
#############################################################################
|
|
|
|
test -f ${OUTPUT} || exit 1
|
|
|
|
#############################################################################
|
|
## fix casts
|
|
#############################################################################
|
|
|
|
cat ${OUTPUT} \
|
|
| sed -e 's:yy_n_chars, (size_t) num_to_read );:yy_n_chars, (int) num_to_read );:' \
|
|
| sed -e 's:register ::g' \
|
|
> ${OUTPUT}.tmp
|
|
|
|
echo "#define DUMMY_FUNC(a) dummy ## a" >> ${OUTPUT}.tmp
|
|
echo "void DUMMY_FUNC(__FILE__) (yyconst char* msg , yyscan_t yyscanner) {yy_fatal_error(msg,yyscanner);}" >> ${OUTPUT}.tmp
|
|
|
|
# give some information
|
|
diff -u ${OUTPUT} ${OUTPUT}.tmp
|
|
|
|
# and move the files to the final destination
|
|
mv ${OUTPUT}.tmp ${OUTPUT} || exit 1
|