Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions cmd/goyacc/yacc.go
Original file line number Diff line number Diff line change
Expand Up @@ -3156,6 +3156,13 @@ func ungetrune(f *bufio.Reader, c rune) {
if f != finput {
panic("ungetc - not finput")
}
if c == EOF {
// getrune keeps EOF sticky in peekrune, so re-ungetting EOF (e.g.
// from gettok's IDENTIFIER/IDENTCOLON look-ahead at end of file)
// must not trip the single-slot check; an exhausted reader returns
// EOF again anyway.
return
}
if peekrune != 0 {
panic("ungetc - 2nd unget")
}
Expand Down