Skip to content

Commit

Permalink
Merge pull request #95 from NuruProgramming/fh/add-shebang-support
Browse files Browse the repository at this point in the history
Fh/add shebang support
  • Loading branch information
AvicennaJr authored Oct 30, 2024
2 parents e9c3aec + 5e7a29f commit f520183
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lexer/lexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions token/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ const (
ASTERISK_ASSIGN = "*="
SLASH_ASSIGN = "/="
MODULUS_ASSIGN = "%="
SHEBANG = "#!"

//Delimiters
COMMA = ","
Expand Down

0 comments on commit f520183

Please sign in to comment.