From 30fbde8c31c826d15cd44ccc0190c1bd9badb0ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C5=A1per=20Dobrovoljc?= Date: Tue, 3 Jun 2025 17:45:56 +0200 Subject: [PATCH] Added multiline comments --- src/pins25/phase/LexAn.java | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) 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();