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:
parent
6e4a229a96
commit
4d9f9b297e
1 changed files with 3 additions and 1 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue