Added multiline comments

This commit is contained in:
Gašper Dobrovoljc 2025-06-03 17:45:56 +02:00
parent 1b45d6a0f9
commit 30fbde8c31
No known key found for this signature in database
GPG Key ID: 0E7E037018CFA5A5

View File

@ -247,9 +247,38 @@ public class LexAn implements AutoCloseable {
return;
}
nextChar();
if (buffChar == '{') {
int depth = 1;
nextChar();
while (depth > 0) {
switch (buffChar) {
case '}':
nextChar();
if (buffChar != '/') continue;
nextChar();
if (buffChar != '/') continue;
depth--;
break;
case '/':
nextChar();
if (buffChar != '/') continue;
nextChar();
if (buffChar != '{') continue;
depth++;
break;
case -1:
throw new Report.Error(currentLocation(), "Unterminated multiline comment");
default:
nextChar();
}
}
} else {
while (buffChar != '\n' && buffChar != -1) {
nextChar();
}
}
nextToken();
return;