1
0
mirror of https://github.com/golang/go synced 2024-10-05 09:21:22 -06:00
go/src/cmd/yacc
Russ Cox 2e78447baf cmd/yacc: adjust expansion of $n to be more useful in errors
When the compiler echoes back an expression, it shows the
generated yacc expression. Change the generated code to
use a slice so that $3 shows up as yyDollar[3] in such messages.

Consider changing testdata/expr/expr.y to say:

	$$.Sub(float64($1), $3)

(The float64 conversion is incorrect.)

Before:
expr.y:70[expr.go:486]: cannot convert exprS[exprpt - 2].num (type *big.Rat) to type float64

After:
expr.y:70[expr.go:492]: cannot convert exprDollar[1].num (type *big.Rat) to type float64

Change-Id: I74e494069df588e62299d1fccb282f3658d8f8f4
Reviewed-on: https://go-review.googlesource.com/4630
Reviewed-by: Rob Pike <r@golang.org>
2015-02-13 17:29:36 +00:00
..
testdata/expr cmd/yacc: fix handling of tokens that don't start with letters 2014-09-29 13:32:14 -07:00
doc.go cmd/yacc: move cmd/yacc/expr to cmd/yacc/testdata/expr 2014-09-06 15:27:52 -04:00
yacc.go cmd/yacc: adjust expansion of $n to be more useful in errors 2015-02-13 17:29:36 +00:00