From 7a781b0849eaafd55e08352620200c497602138a Mon Sep 17 00:00:00 2001 From: Aer Iz Date: Tue, 13 Feb 2024 18:10:08 +0200 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B9=D0=B9=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/execute.c | 10 +++++----- tests/test.lb | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 tests/test.lb diff --git a/src/execute.c b/src/execute.c index 35bd391..b7ee263 100644 --- a/src/execute.c +++ b/src/execute.c @@ -27,11 +27,11 @@ typedef enum static void prefix_operator(Stack *stack, char op) { - // if (NAME[0] != '@' && (NAME[1] == '\0' || NAME[1] == '\n')) - // { - // printf("%c\n", op); - // kms(stack, "Invalid usage of prefix operators"); - // } + if (NAME[0] != '@' && (NAME[1] == '\0' || NAME[1] == '\n')) + { + printf("%c\n", op); + kms(stack, "Invalid usage of prefix operators"); + } switch (op) { diff --git a/tests/test.lb b/tests/test.lb new file mode 100644 index 0000000..a66f1b4 --- /dev/null +++ b/tests/test.lb @@ -0,0 +1,18 @@ +; Лабашки ооп + + +@ 4441 ; Класс + + @ 4442 ; Поле + сеттер + |field + |jmp 0 + + @ 4443 ; Поле + сеттер + |field + |jmp 0 + + @ 44411 ; Метод + push 444111 ; Метка для возвращения + push 2 + jmp 4442 + @ 444111 ; ^^^ \ No newline at end of file