This commit is contained in:
2026-02-20 09:35:50 +11:00
parent 315c3a6e08
commit b98487caaf
3 changed files with 40 additions and 1 deletions

View File

@@ -16,7 +16,7 @@ bash build.c
- [x] char
- [x] bool
- [x] Lex keywords
- [ ] Ignore comments (//, /**/, #)
- [x] Ignore comments (//, /**/, #)
- [ ] Lex delimiters
- [x] ()
- [x] {}

View File

@@ -371,6 +371,43 @@ ResultType(voidptr, charptr) lex(SolsLexer* lexer) {
break;
}
if (chr.as.success == '/' && !inString) {
ResultType(char, Nothing) peek = lexerPeek(lexer, 1);
if (!peek.error && peek.as.success == '/') {
chr = lexerConsume(lexer);
for (;;) {
chr = lexerConsume(lexer);
if (chr.error) return Success(voidptr, charptr, NULL);
if (chr.as.success == '\n') {
chr = lexerConsume(lexer);
break;
}
}
} else if (!peek.error && peek.as.success == '*') {
for (;;) {
chr = lexerConsume(lexer);
if (chr.error) return Success(voidptr, charptr, NULL);
if (chr.as.success == '*') {
peek = lexerPeek(lexer, 1);
if (!peek.error && peek.as.success == '/') {
chr = lexerConsume(lexer);
break;
}
}
}
}
}
if (chr.as.success == '#' && !inString) {
for (;;) {
chr = lexerConsume(lexer);
if (chr.error) return Success(voidptr, charptr, NULL);
if (chr.as.success == '\n') {
chr = lexerConsume(lexer);
break;
}
}
}
if (chr.as.success == '\n') {
for (; lineStart < lexer->inputsize; lineStart++) {
if (lexer->input[lineStart] == '\n') {

View File

@@ -1,3 +1,5 @@
// heheheha comment
puts "dinglefart"
if 3 == 3 {