Added single line comments

This commit is contained in:
2024-06-28 20:29:07 +02:00
parent 3664e74074
commit 2520681ad3
3 changed files with 104 additions and 0 deletions

View File

@ -75,6 +75,20 @@ func Tokenize(buffer []byte) List {
case '\n':
tokens = append(tokens, Token{NewLine, i, newLineBytes})
// Comment
case '/':
if i+1 >= len(buffer) || buffer[i+1] != '/' {
tokens = append(tokens, Token{Operator, i, buffer[i : i+1]})
i++
continue
}
for i < len(buffer) && buffer[i] != '\n' {
i++
}
continue
default:
// Identifiers
if isIdentifierStart(buffer[i]) {