tidb: Check reduce/reduce conflicts in Makefile

This commit is contained in:
Shen Li
2015-11-15 17:36:22 +08:00
parent 9620eb0d53
commit 31d0dbd222

View File

@ -24,13 +24,14 @@ build:
install:
$(GO) install ./...
TEMP_FILE = temp_parser_file
parser:
go get github.com/qiuyesuifeng/goyacc
go get github.com/qiuyesuifeng/golex
a=`mktemp temp.XXXXXX`; \
goyacc -o /dev/null -xegen $$a parser/parser.y; \
goyacc -o parser/parser.go -xe $$a parser/parser.y 2>&1 | grep "shift/reduce" | awk '{print} END {if (NR > 0) {print "Find conflict in parser.y. Please check y.output for more information."; exit 1;}}'; \
rm -f $$a; \
goyacc -o /dev/null -xegen $(TEMP_FILE) parser/parser.y; \
goyacc -o parser/parser.go -xe $(TEMP_FILE) parser/parser.y 2>&1 | egrep "(shift|reduce)/reduce" | awk '{print} END {if (NR > 0) {print "Find conflict in parser.y. Please check y.output for more information."; system("rm -f $(TEMP_FILE)"); exit 1;}}';
rm -f $(TEMP_FILE); \
rm -f y.output
@if [ $(ARCH) = $(LINUX) ]; \