]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/yacc: expr example support windows
authorChaiShushan <chaishushan@gmail.com>
Thu, 19 Dec 2013 17:14:07 +0000 (12:14 -0500)
committerRuss Cox <rsc@golang.org>
Thu, 19 Dec 2013 17:14:07 +0000 (12:14 -0500)
1. expr append executable extension.
2. support '\r' character.

Fixes #6851.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/35330043

src/cmd/yacc/Makefile
src/cmd/yacc/expr.y

index 480844805ff1962c4ecfc3ec8953167e673900ed..f8c8169bd1a3a340e2d4679c16654f369d940072 100644 (file)
@@ -2,9 +2,11 @@
 # Use of this source code is governed by a BSD-style
 # 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 build -o expr y.go
+       go build -o $(TARG) y.go
 
 clean:
-       rm -f y.go y.output expr
+       rm -f y.go y.output $(TARG)
index 3afffe7ee8daa2cb78b911d0db4b52028c3ea889..77e9259daedf026771d35cc7fab258561339114f 100644 (file)
@@ -125,7 +125,7 @@ func (x *exprLex) Lex(yylval *exprSymType) int {
                case 'รท':
                        return '/'
 
-               case ' ', '\t', '\n':
+               case ' ', '\t', '\n', '\r':
                default:
                        log.Printf("unrecognized character %q", c)
                }