Enable comments in SQL code
This commit is contained in:
parent
f57e042aa4
commit
8431079025
2 changed files with 14 additions and 2 deletions
|
@ -196,8 +196,12 @@ func (p *Parser) unscan() { p.buf.n = 1 }
|
||||||
// scanIgnoreWhitespace scans the next non-whitespace token.
|
// scanIgnoreWhitespace scans the next non-whitespace token.
|
||||||
func (p *Parser) scanIgnoreWhitespace() (tok Token, lit string) {
|
func (p *Parser) scanIgnoreWhitespace() (tok Token, lit string) {
|
||||||
tok, lit = p.scan()
|
tok, lit = p.scan()
|
||||||
if tok == WS {
|
for {
|
||||||
tok, lit = p.scan()
|
if tok == WS {
|
||||||
|
tok, lit = p.scan()
|
||||||
|
} else {
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,6 +106,14 @@ func (s *Scanner) Scan() (tok Token, lit string) {
|
||||||
case '-':
|
case '-':
|
||||||
if chn := s.read(); chn == '>' {
|
if chn := s.read(); chn == '>' {
|
||||||
return OEDGE, "->"
|
return OEDGE, "->"
|
||||||
|
case '/':
|
||||||
|
chn := s.next()
|
||||||
|
switch {
|
||||||
|
case chn == '*':
|
||||||
|
return s.scanCommentMultiple(ch)
|
||||||
|
default:
|
||||||
|
s.unread()
|
||||||
|
return s.scanRegexp(ch)
|
||||||
}
|
}
|
||||||
s.unread()
|
s.unread()
|
||||||
if chn := s.read(); chn == '=' {
|
if chn := s.read(); chn == '=' {
|
||||||
|
|
Loading…
Reference in a new issue