scanner: Don't call unread() after reading EOF.

This fixes the TestScanDigitsUnread() unit test.
This commit is contained in:
Florian Forster 2018-03-19 14:51:49 +01:00 committed by Florian Forster
parent cade852d47
commit 23ed7ba25b

View File

@ -552,7 +552,7 @@ func (s *Scanner) scanDigits(ch rune, base, n int) rune {
s.err("illegal char escape")
}
if n != start {
if n != start && ch != eof {
// we scanned all digits, put the last non digit char back,
// only if we read anything at all
s.unread()