Author SHA1 Message Date
Gašper Dobrovoljc b325647ad9 Limited comment length to 10 characters 2025-06-03 22:20:10 +02:00
3 changed files with 8 additions and 30 deletions

No files matched your search

-1
View File
@@ -3,4 +3,3 @@ out/
*.zip
prg/**/*.ast
prg/**/*.out
prg/**/*.pins25
+2
View File
@@ -0,0 +1,2 @@
//1234567890
//12345678901
+6 -29
View File
@@ -246,38 +246,15 @@ public class LexAn implements AutoCloseable {
buffToken = new Token(start, Token.Symbol.DIV, "/");
return;
}
nextChar();
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 {
int length = 0;
while (buffChar != '\n' && buffChar != -1) {
nextChar();
length++;
if (length > 10) {
throw new Report.Error(currentLocation(), "Comments can only be 10 characters long");
}
nextChar();
}
nextToken();