add support for multi-line comments
This commit is contained in:
parent
63ed021695
commit
9b1f2b8c9a
1 changed files with 10 additions and 0 deletions
10
lexer.go
10
lexer.go
|
|
@ -185,6 +185,16 @@ func (l *Lexer) NextToken() (Token, error) {
|
|||
case '*':
|
||||
return l.makeToken(TokenStar), nil
|
||||
case '/':
|
||||
if l.match('*') {
|
||||
for !l.isAtEnd() {
|
||||
if l.match('*') && l.match('/') {
|
||||
break
|
||||
}
|
||||
l.advance()
|
||||
}
|
||||
return l.NextToken()
|
||||
}
|
||||
|
||||
return l.makeToken(TokenSlash), nil
|
||||
case '(':
|
||||
return l.makeToken(TokenOpenParenthesis), nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue