comments
This commit is contained in:
@@ -16,7 +16,7 @@ bash build.c
|
||||
- [x] char
|
||||
- [x] bool
|
||||
- [x] Lex keywords
|
||||
- [ ] Ignore comments (//, /**/, #)
|
||||
- [x] Ignore comments (//, /**/, #)
|
||||
- [ ] Lex delimiters
|
||||
- [x] ()
|
||||
- [x] {}
|
||||
|
||||
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user