Compare commits
1 Commits
comment-le
...
multiline-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30fbde8c31 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -3,3 +3,4 @@ out/
|
|||||||
*.zip
|
*.zip
|
||||||
prg/**/*.ast
|
prg/**/*.ast
|
||||||
prg/**/*.out
|
prg/**/*.out
|
||||||
|
prg/**/*.pins25
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
//1234567890
|
|
||||||
//12345678901
|
|
||||||
@@ -246,15 +246,38 @@ public class LexAn implements AutoCloseable {
|
|||||||
buffToken = new Token(start, Token.Symbol.DIV, "/");
|
buffToken = new Token(start, Token.Symbol.DIV, "/");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nextChar();
|
|
||||||
|
|
||||||
int length = 0;
|
|
||||||
while (buffChar != '\n' && buffChar != -1) {
|
|
||||||
length++;
|
|
||||||
if (length > 10) {
|
|
||||||
throw new Report.Error(currentLocation(), "Comments can only be 10 characters long");
|
|
||||||
}
|
|
||||||
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 {
|
||||||
|
while (buffChar != '\n' && buffChar != -1) {
|
||||||
|
nextChar();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nextToken();
|
nextToken();
|
||||||
|
|||||||
Reference in New Issue
Block a user