Commit 0b26ba8a authored by ChaiShushan's avatar ChaiShushan Committed by Russ Cox

cmd/yacc: expr example support windows

1. expr append executable extension.
2. support '\r' character.

Fixes #6851.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/35330043
parent 0eaabf64
...@@ -2,9 +2,11 @@ ...@@ -2,9 +2,11 @@
# Use of this source code is governed by a BSD-style # Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file. # license that can be found in the LICENSE file.
expr: yacc.go expr.y TARG=expr$(shell go env GOEXE)
$(TARG): yacc.go expr.y
go run yacc.go -p expr expr.y go run yacc.go -p expr expr.y
go build -o expr y.go go build -o $(TARG) y.go
clean: clean:
rm -f y.go y.output expr rm -f y.go y.output $(TARG)
...@@ -125,7 +125,7 @@ func (x *exprLex) Lex(yylval *exprSymType) int { ...@@ -125,7 +125,7 @@ func (x *exprLex) Lex(yylval *exprSymType) int {
case '÷': case '÷':
return '/' return '/'
case ' ', '\t', '\n': case ' ', '\t', '\n', '\r':
default: default:
log.Printf("unrecognized character %q", c) log.Printf("unrecognized character %q", c)
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment