diff --git a/sql/parser.go b/sql/parser.go index ccc76b0c..7c6aa6a3 100644 --- a/sql/parser.go +++ b/sql/parser.go @@ -196,8 +196,12 @@ func (p *Parser) unscan() { p.buf.n = 1 } // scanIgnoreWhitespace scans the next non-whitespace token. func (p *Parser) scanIgnoreWhitespace() (tok Token, lit string) { tok, lit = p.scan() - if tok == WS { - tok, lit = p.scan() + for { + if tok == WS { + tok, lit = p.scan() + } else { + break + } } return } diff --git a/sql/scanner.go b/sql/scanner.go index 93d77b0e..3232512d 100644 --- a/sql/scanner.go +++ b/sql/scanner.go @@ -106,6 +106,14 @@ func (s *Scanner) Scan() (tok Token, lit string) { case '-': if chn := s.read(); chn == '>' { return OEDGE, "->" + case '/': + chn := s.next() + switch { + case chn == '*': + return s.scanCommentMultiple(ch) + default: + s.unread() + return s.scanRegexp(ch) } s.unread() if chn := s.read(); chn == '=' {