Fixed logic for REPEAT..UNTIL
authorEdouard Tisserant
Tue, 15 Feb 2022 10:34:23 +0100
changeset 1098 84bbafb4fb26
parent 1097 520a4b937f13
child 1099 cdb045e8be20
Fixed logic for REPEAT..UNTIL

In Stage4, C code generator, REPEAT statement was generating a while loop with inverted logic
stage4/generate_c/generate_c_st.cc
--- a/stage4/generate_c/generate_c_st.cc	Tue Dec 14 09:02:38 2021 +0100
+++ b/stage4/generate_c/generate_c_st.cc	Tue Feb 15 10:34:23 2022 +0100
@@ -1341,9 +1341,9 @@
   s4o.indent_right();
   symbol->statement_list->accept(*this);
   s4o.indent_left();
-  s4o.print(s4o.indent_spaces); s4o.print("} while(");
+  s4o.print(s4o.indent_spaces); s4o.print("} while(!(");
   symbol->expression->accept(*this);
-  s4o.print(")");
+  s4o.print("))");
   return NULL;
 }