From 5e7a29f1bd0682cc20207ab48f871c736b7ced19 Mon Sep 17 00:00:00 2001 From: Fuad Date: Wed, 30 Oct 2024 18:13:15 +0300 Subject: [PATCH] tokenize shebang --- lexer/lexer.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lexer/lexer.go b/lexer/lexer.go index b191794..7d83728 100644 --- a/lexer/lexer.go +++ b/lexer/lexer.go @@ -168,6 +168,11 @@ func (l *Lexer) NextToken() token.Token { } else { tok = newToken(token.MODULUS, l.line, l.ch) } + case rune('#'): + if l.peekChar() == rune('!') && l.line == 1 { + l.skipSingleLineComment() + return l.NextToken() + } case 0: tok.Literal = "" tok.Type = token.EOF