Add C style block comments

This commit is contained in:
Gal 2024-02-09 01:14:02 +01:00
parent d3aa8063d2
commit e89e089af2
Signed by: gal
GPG Key ID: F035BC65003BC00B
1 changed files with 14 additions and 2 deletions

View File

@ -81,7 +81,14 @@ class Scanner {
addToken(SEMICOLON);
break;
case '*':
addToken(STAR);
if (match('/') && !isAtEnd()) {
advance();
} else if (isAtEnd()) {
break;
}
else {
addToken(STAR);
}
break;
case '!':
addToken(match('=') ? BANG_EQUAL : BANG);
@ -98,7 +105,12 @@ class Scanner {
if (match('/')) {
while (peek() != '\n' && !isAtEnd())
advance();
} else {
}
else if (match('*')) {
while (peek() != '*')
advance();
}
else {
addToken(SLASH);
}
break;