From 647c26db9ad47711f008e3201cebcf71fa65c640 Mon Sep 17 00:00:00 2001 From: Anton Date: Tue, 29 Oct 2024 17:51:58 +0100 Subject: [PATCH] Initializacia --- a1/main | Bin 16336 -> 16336 bytes a1/program.c | 7 +++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/a1/main b/a1/main index 5bc851cc3d552394b9de71f11fe1d97c3af4ec6b..f534ddc294f0d7c03622541afe8241e288ce91e9 100755 GIT binary patch delta 759 zcmcamf1!Q@2P3B;D+3r9P8MX;=QLn~@C-J4GU_u5u26t*;q>HAruQQMkGeBk?5|b3 z*<)_A`+?)qkF$0tZ0=#s=Ve^6`H#Q@Mn>DocZG6APXP6L^s?^d0aBgEUl{-W|No`- zvkZkd+Ht_*?A18V`jmE&>ujI$h& z74QH5?*MXc0O<`t`UQ{%#e&6$|NjeswBpDA{~rM95FpLK$iUDJq!oblZ6NIcr2l`O zd`>}2>Htui8c-R73%dY_QUPKUAb#;~vXG*hqykVHEDn+b0udlC0b+^Cfr{dcmXk9T z&R{^CfS3ZF@CTCtYk7j0OVJ04S4h9Apps)bY=Eq{GRE(S%23I@f^TDHrW03u=<;{X5v delta 707 zcmYLHO=uHA7~R=4ZPISLiA{*XLUxs;v7v;Rg0Vy_wxL__Pz33*E!2aE+Cu~nY9cY! zkQSpKg$RO*Ab5~AtUm#h5E1|Il3uhIp{R!~QKBMJXzcjSrqO}jH}mGb_kA-=C02CTs7wRU;(l8nB}Aw3oPw9 zc5#bm%?i^^GH_uZpPOYOvZaB$RYSn^Al%ZZB%0M$J)& z+cwX{q>r63k|`ZWnw_$XX_Mt>FJqMj`vX1WJ=^-cN$IN*V@5YHVi9jdFR7%DZD6>q z8Gcjkv43fYGQabND6L?MU&E3hKF+|RI< zz}`os%QD9gceW}CgJF{hZ6=OmE(_MVr`mTXI$*ZV3)%h<5!99bB?D=JOMy`mhqr+b zNZs8h5+Xn@I6p6dJ-oktb$hicseK3U G^M3)3RuDP> diff --git a/a1/program.c b/a1/program.c index bd9dc62..4cd5e11 100644 --- a/a1/program.c +++ b/a1/program.c @@ -44,11 +44,14 @@ void check_brackets(const char *line) { return; } } else if (is_closing(ch)) { - if (stack_top >= 0 && stack[stack_top].bracket == matching_bracket(ch)) { + if (stack_top == -1) { + printf("Unexpected closing bracket %c in %d\n", ch, i); + return; + } else if (stack[stack_top].bracket == matching_bracket(ch)) { stack_top--; } else { printf("Crossed bracket %c in %d, expected %c\n", ch, i, - stack_top >= 0 ? matching_bracket(stack[stack_top].bracket) : '#'); + matching_bracket(stack[stack_top].bracket)); return; } }