diff --git a/src/pins25/phase/LexAn.java b/src/pins25/phase/LexAn.java index 888f692..c85c711 100644 --- a/src/pins25/phase/LexAn.java +++ b/src/pins25/phase/LexAn.java @@ -247,8 +247,37 @@ public class LexAn implements AutoCloseable { return; } - while (buffChar != '\n' && buffChar != -1) { + 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();