From 1fd8b2bd7feebea5eec0dbc09b202fa1e81dad75 Mon Sep 17 00:00:00 2001 From: Ian Piumarta Date: Mon, 3 Feb 2025 11:59:15 +0900 Subject: [PATCH] fix line number tracking --- main.leg | 4 ++-- test.txt | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/main.leg b/main.leg index dfd8522..dac6113 100644 --- a/main.leg +++ b/main.leg @@ -1,6 +1,6 @@ # main.leg -- C parser + interpreter # -# Last edited: 2025-02-03 10:47:46 by piumarta on xubuntu +# Last edited: 2025-02-03 11:58:41 by piumarta on xubuntu %{ ; @@ -1738,7 +1738,7 @@ void startInput(char *name) void endInput(void) { - if (List_size(lines)) { + if (lines && List_size(lines)) { lineNo = _integerValue(List_popLast(lines)); List_popLast(names); } diff --git a/test.txt b/test.txt index 87594ee..4c7e56b 100755 --- a/test.txt +++ b/test.txt @@ -142,8 +142,6 @@ int main(int argc, char **argv) printf("passed\n"); - float f = 42; - return 0; }