Skip to content

Commit 72e4f20

Browse files
committed
scanner: Don't call unread() after reading EOF.
This fixes the TestScanDigitsUnread() unit test.
1 parent 4b89a44 commit 72e4f20

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

hcl/scanner/scanner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ func (s *Scanner) scanDigits(ch rune, base, n int) rune {
551551
s.err("illegal char escape")
552552
}
553553

554-
if n != start {
554+
if n != start && ch != eof {
555555
// we scanned all digits, put the last non digit char back,
556556
// only if we read anything at all
557557
s.unread()

0 commit comments

Comments
 (0)