From 766a4b8e5236bffb40984439a79186c5ee823ff8 Mon Sep 17 00:00:00 2001 From: ov-4 Date: Fri, 30 Jan 2026 02:06:37 +0000 Subject: Added runtime check for array index and division --- lib/Lexer/Lexer.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/Lexer/Lexer.cc') diff --git a/lib/Lexer/Lexer.cc b/lib/Lexer/Lexer.cc index fdaa3a5..780c79a 100644 --- a/lib/Lexer/Lexer.cc +++ b/lib/Lexer/Lexer.cc @@ -9,8 +9,10 @@ using namespace cps; int Lexer::gettok() { static int LastChar = ' '; - while (isspace(LastChar)) + while (isspace(LastChar)) { + if (LastChar == '\n') CurrentLine++; LastChar = getchar(); + } if (isalpha(LastChar)) { IdentifierStr = LastChar; -- cgit v1.3.1-4-g156e