summaryrefslogtreecommitdiff
path: root/src/cmd/go/test.bash
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-09-26 17:03:31 -0400
committerRuss Cox <rsc@golang.org>2014-09-26 17:03:31 -0400
commite6c761db0debeb8baa6f29927c68a061bbee8410 (patch)
tree9a3ce64be4e3d3f3914c41d2d6632609ae49b7c7 /src/cmd/go/test.bash
parentf6e9e244a0d0affe3c967bdabae71d6e370ee0a4 (diff)
downloadgo-e6c761db0debeb8baa6f29927c68a061bbee8410.tar.gz
cmd/yacc: fix parsing of character tokens
From issue 7967 I learned: 1) yacc accepts either 'x' or "x" to mean token value 0x78 2) yacc also accepts 'xyz' and "XYZ" to mean token value 0x78 Use strconv.Unquote to simplify the handling of quoted strings and check that each has only one rune. Although this does clean things up, it makes 'x' and "x" treated as different internally (now they are stored as `'x'` and `"x"`; before they were both ` x`). Grammars that use both interchangeably will now die with an error similar to the one from issue 7967: yacc bug -- cannot have 2 different Ts with same value "+" and '+' The echoing of the quotes should make clear what is going on. The other semantic change caused by using strconv.Unquote is that '\"' and "\'" are no longer valid. Like in Go, they must be spelled without the backslash: '"' and "'". On the other hand, now yacc and Go agree about what character and string literals mean. LGTM=r R=r CC=golang-codereviews https://codereview.appspot.com/149110043
Diffstat (limited to 'src/cmd/go/test.bash')
0 files changed, 0 insertions, 0 deletions