diff options
| author | ov-4 <hausemasterstream@gmail.com> | 2026-01-29 12:23:18 +0000 |
|---|---|---|
| committer | ov-4 <hausemasterstream@gmail.com> | 2026-01-29 12:23:18 +0000 |
| commit | 73634b66d412735c292b3941d1281ff0a3c9e5a1 (patch) | |
| tree | 9f1916dc2263fa001f1db4aa965088e62ed05c38 | |
| parent | 0f92a54ba91023e7e88d6cabc8f2f78901f62a40 (diff) | |
Added support for comments using //
| -rw-r--r-- | lib/Lexer/Lexer.cc | 15 |
1 files changed, 14 insertions, 1 deletions
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(); |
