0
0
Fork 0

tweak queryparser 'go generate' lines (portablity)

sed is used to massage the .go files output from nex and yacc.
However, the -i (in-place) option works slightly differently
between gnu (eg Linux) and bsd (eg OSX) sed.
This change should make it work on both flavours.
This commit is contained in:
Ben Campbell 2015-08-10 12:50:16 +12:00
parent c9471d5739
commit 0e9230178f
2 changed files with 10 additions and 4 deletions

2
.gitignore vendored
View File

@ -5,6 +5,8 @@
.project
.settings
.DS_Store
query_string.nn.go.tmp
query_string.y.go.tmp
/analysis/token_filters/cld2/cld2-read-only
/analysis/token_filters/cld2/libcld2_full.a
/utils/bleve_create/bleve_create

View File

@ -8,12 +8,16 @@
// and limitations under the License.
//go:generate nex query_string.nex
//go:generate sed -i "" -e s/Lexer/lexer/g query_string.nn.go
//go:generate sed -i "" -e s/Newlexer/newLexer/g query_string.nn.go
//go:generate sed -i "" -e s/debuglexer/debugLexer/g query_string.nn.go
//go:generate sed -i.tmp -e s/Lexer/lexer/g query_string.nn.go
//go:generate sed -i.tmp -e s/Newlexer/newLexer/g query_string.nn.go
//go:generate sed -i.tmp -e s/debuglexer/debugLexer/g query_string.nn.go
//go:generate go fmt query_string.nn.go
//go:generate go tool yacc -o query_string.y.go query_string.y
//go:generate sed -i "" -e 1d query_string.y.go
//go:generate sed -i.tmp -e 1d query_string.y.go
// note: OSX sed and gnu sed handle the -i (in-place) option differently.
// using -i.tmp works on both, at the expense of leaving a couple of
// unsightly .tmp files littering the directory...
package bleve