Fix single line comment bug

Comments which were on the last line of an SQL query would cause the scanner to never reach the end of the reader stream, hangining indefinitely.

This fix ensures that the single line comment is ended when an EOF is reached.
This commit is contained in:
Tobie Morgan Hitchcock 2016-11-04 10:04:31 +00:00
parent 6e4a229a96
commit 4d9f9b297e

View file

@ -300,7 +300,9 @@ func (s *scanner) scanCommentSingle(chp ...rune) (tok Token, lit string, val int
// Read subsequent characters
for {
if ch := s.next(); ch == '\n' || ch == '\r' {
if ch := s.next(); ch == eof {
break
} else if ch == '\n' || ch == '\r' {
buf.WriteRune(ch)
break
} else {