* lexer: added a function to scan version digits * lexer: removed special comment scanner Instead, simply strip off '/*!' and the pairing '*/'. Temporarily disabled handling of /*+ ... */ * lexer: support collecting the entire /*+ ... */ as a single token This new token has type `hintComment`. The actual hint will be parsed lazily. * lexer,yy_parser: move lastErrorAsWarn() from Parser into Scanner * goyacc: do not allow conflict, support changing parser type name change the "DO NOT EDIT" line to fit the Go standard * parser,hintparser: created a new parser just for parsing optimizer hints deleted all optimizer hint rules from parser.go refactor the Makefile to support building both parsers (also deleted some outdated fixup of *parser.go) * lexer: fix comment parser * codecov: don't wait for integration test before showing the coverage * lexer: fix comment parsing again * hintparser: TiDB still expects `HASH_JOIN(@qb1 foo@qb2)` to be valid :( * parser,hintparser: provide the true line/column offset in the warnings cache the hintparser in the main parser to avoid repeated allocation * lexer: delete unused sqlOffsetInComment()
31 lines
889 B
Makefile
31 lines
889 B
Makefile
.PHONY: all parser clean
|
|
|
|
all: fmt parser
|
|
|
|
test: fmt parser
|
|
sh test.sh
|
|
|
|
parser: parser.go hintparser.go
|
|
|
|
%arser.go: prefix = $(@:parser.go=)
|
|
%arser.go: %arser.y bin/goyacc
|
|
@echo "bin/goyacc -o $@ -p yy$(prefix) -t $(prefix)Parser $<"
|
|
@bin/goyacc -o $@ -p yy$(prefix) -t $(prefix)Parser $< || ( rm -f $@ && echo 'Please check y.output for more information' && exit 1 )
|
|
@rm -f y.output
|
|
|
|
%arser_golden.y: %arser.y
|
|
@bin/goyacc -fmt -fmtout $@ $<
|
|
@(git diff --no-index --exit-code $< $@ && rm $@) || (mv $@ $< && >&2 echo "formatted $<" && exit 1)
|
|
|
|
bin/goyacc: goyacc/main.go goyacc/format_yacc.go
|
|
GO111MODULE=on go build -o bin/goyacc goyacc/main.go goyacc/format_yacc.go
|
|
|
|
fmt: bin/goyacc parser_golden.y hintparser_golden.y
|
|
@echo "gofmt (simplify)"
|
|
@gofmt -s -l -w . 2>&1 | awk '{print} END{if(NR>0) {exit 1}}'
|
|
|
|
clean:
|
|
go clean -i ./...
|
|
rm -rf *.out
|
|
rm -f parser.go hintparser.go
|