aboutsummaryrefslogtreecommitdiff
path: root/lib/Lexer
diff options
context:
space:
mode:
authorov-4 <hausemasterstream@gmail.com>2026-01-30 02:06:37 +0000
committerov-4 <hausemasterstream@gmail.com>2026-01-30 02:06:37 +0000
commit766a4b8e5236bffb40984439a79186c5ee823ff8 (patch)
treea4226690b4b95c916908afa0047899ff60e63c81 /lib/Lexer
parent943ed04b775949e8bc4948bcb8d762a32ab14f76 (diff)
Added runtime check for array index and division
Diffstat (limited to 'lib/Lexer')
-rw-r--r--lib/Lexer/Lexer.cc4
1 files changed, 3 insertions, 1 deletions
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;