From 73634b66d412735c292b3941d1281ff0a3c9e5a1 Mon Sep 17 00:00:00 2001 From: ov-4 Date: Thu, 29 Jan 2026 12:23:18 +0000 Subject: Added support for comments using // --- lib/Lexer/Lexer.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'lib/Lexer') diff --git a/lib/Lexer/Lexer.cc b/lib/Lexer/Lexer.cc index 9ac01d9..c50897b 100644 --- a/lib/Lexer/Lexer.cc +++ b/lib/Lexer/Lexer.cc @@ -67,7 +67,20 @@ int Lexer::gettok() { return tok_eq; } - // for comments + if (LastChar == '/') { + int NextChar = getchar(); + if (NextChar == '/') { + do { + LastChar = getchar(); + } while (LastChar != EOF && LastChar != '\n' && LastChar != '\r'); + + if (LastChar != EOF) + return gettok(); + } else { + LastChar = NextChar; + return '/'; + } + } if (LastChar == ':') { LastChar = getchar(); -- cgit v1.3.1-4-g156e