Skip to content

Commit f520183

Browse files
authored
Merge pull request #95 from NuruProgramming/fh/add-shebang-support
Fh/add shebang support
2 parents e9c3aec + 5e7a29f commit f520183

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

lexer/lexer.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,11 @@ func (l *Lexer) NextToken() token.Token {
168168
} else {
169169
tok = newToken(token.MODULUS, l.line, l.ch)
170170
}
171+
case rune('#'):
172+
if l.peekChar() == rune('!') && l.line == 1 {
173+
l.skipSingleLineComment()
174+
return l.NextToken()
175+
}
171176
case 0:
172177
tok.Literal = ""
173178
tok.Type = token.EOF

token/token.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ const (
4444
ASTERISK_ASSIGN = "*="
4545
SLASH_ASSIGN = "/="
4646
MODULUS_ASSIGN = "%="
47+
SHEBANG = "#!"
4748

4849
//Delimiters
4950
COMMA = ","

0 commit comments

Comments
 (0)