From 74be407bfc9c0459c6a97c1aeabb624a09121b51 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Fri, 26 Jun 2020 15:06:26 -0500 Subject: [PATCH] Stage 1 done; added test file for break/continue --- docs/plan | 4 ++-- progs/break_test.onyx | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) create mode 100644 progs/break_test.onyx diff --git a/docs/plan b/docs/plan index 109dcf6b..26de694b 100644 --- a/docs/plan +++ b/docs/plan @@ -59,8 +59,8 @@ HOW: [X] Comparison operators [X] Proper boolean type [X] Conditional branching works as expected - XX] Simple while loop is functioning as expected - [ ] break and continue semantics + [X] Simple while loop is functioning as expected + [X] break and continue semantics [X] Function calling works for the builtin types [X] Function return values are type checked diff --git a/progs/break_test.onyx b/progs/break_test.onyx new file mode 100644 index 00000000..a9023830 --- /dev/null +++ b/progs/break_test.onyx @@ -0,0 +1,40 @@ + +print :: foreign "host" "print" proc (val i32) --- + +export main :: proc { + + x := 0; + while x < 10 { + + if x == 4 { + + x := 1; + while x < 1000000 { + print(x); + + if x > 4 { break; } + + x = x + 1; + } + + } + + if x == 2 { + + x := 1; + while x <= 5 { + if x == 3 { + x = x + 1; + continue; + } + + print(x); + x = x + 1; + } + + } + + x = x + 1; + } + +} -- 2.25.1