From 6d41cc4dede71b9e8c1e754e3f87693aae0e3ec0 Mon Sep 17 00:00:00 2001 From: Natapat Samutpong Date: Sun, 3 Apr 2022 15:07:25 +0700 Subject: [PATCH] remove semicolons part 2 --- example/69.hz | 14 -------------- example/err/define_wrong_type.hz | 6 +++--- example/err/do_end_scope.hz | 10 +++++----- example/err/match_no_default.hz | 12 ------------ example/err/throw.hz | 4 ++-- example/err/unknown_intrinsic.hz | 4 ++-- example/export.hz | 5 ++--- example/fibonacci.hz | 12 ++++++------ example/if.hz | 16 ++++++++-------- example/iter.hz | 24 ++++++++++++------------ example/pipe.hz | 12 ++++++------ example/pipe2.hz | 16 ++++++++-------- 12 files changed, 54 insertions(+), 81 deletions(-) delete mode 100644 example/69.hz delete mode 100644 example/err/match_no_default.hz diff --git a/example/69.hz b/example/69.hz deleted file mode 100644 index 303c6c5..0000000 --- a/example/69.hz +++ /dev/null @@ -1,14 +0,0 @@ -fun add2 (lhs: int) (rhs: int): int = do - return lhs + rhs -end - -fun main: void = do - let result: int = add2(34, 35) - @write(result) - @write("\n") - if result == 69 then - @write("big cool") - else - @write("not cool") - end -end diff --git a/example/err/define_wrong_type.hz b/example/err/define_wrong_type.hz index ced8320..6d0cfb6 100644 --- a/example/err/define_wrong_type.hz +++ b/example/err/define_wrong_type.hz @@ -1,3 +1,3 @@ -let foo: int = "123"; -let bar: string = 69; -let baz: bool = "true"; \ No newline at end of file +let foo: int = "123" +let bar: string = 69 +let baz: bool = "true" \ No newline at end of file diff --git a/example/err/do_end_scope.hz b/example/err/do_end_scope.hz index eb68631..49f3cb0 100644 --- a/example/err/do_end_scope.hz +++ b/example/err/do_end_scope.hz @@ -1,7 +1,7 @@ fun main: void = do do - let foo: string = "Hello"; - @write(foo); - end; - @write(foo); -- TODO: This is a runtime error -end; \ No newline at end of file + let foo: string = "Hello" + @write(foo) + end + @write(foo) -- TODO: This is a runtime error +end \ No newline at end of file diff --git a/example/err/match_no_default.hz b/example/err/match_no_default.hz deleted file mode 100644 index 43ec8a0..0000000 --- a/example/err/match_no_default.hz +++ /dev/null @@ -1,12 +0,0 @@ -fun main: void = do - let foo: int = 69; - - match foo with - | 1 -> @write("One"); - | 2 -> @write("Two"); - | 3 -> do - @write("Three"); - end; - -- \ @write("idk"); - end; -end; diff --git a/example/err/throw.hz b/example/err/throw.hz index c82d8c9..4a34e26 100644 --- a/example/err/throw.hz +++ b/example/err/throw.hz @@ -1,3 +1,3 @@ fun main: void = do - @throw("woopsie"); -end; + @throw("woopsie") +end \ No newline at end of file diff --git a/example/err/unknown_intrinsic.hz b/example/err/unknown_intrinsic.hz index 515349d..81ee0e4 100644 --- a/example/err/unknown_intrinsic.hz +++ b/example/err/unknown_intrinsic.hz @@ -1,3 +1,3 @@ fun main: void = do - @writse(); -- Unknown intrinsic -end; \ No newline at end of file + @writse() -- Unknown intrinsic +end \ No newline at end of file diff --git a/example/export.hz b/example/export.hz index 6dba127..48a74a3 100644 --- a/example/export.hz +++ b/example/export.hz @@ -1,4 +1,3 @@ -pub fun print_something: void = @emit("console.log('something')"); +pub fun print_something: void = @emit("console.log('something')") -fun main: void = do -end; +fun main: void = do end \ No newline at end of file diff --git a/example/fibonacci.hz b/example/fibonacci.hz index 7c93d1e..586653f 100644 --- a/example/fibonacci.hz +++ b/example/fibonacci.hz @@ -1,11 +1,11 @@ fun fib (n: int): int = do if n < 2 then - return n; + return n else - return fib(n - 1) + fib(n - 2); - end; -end; + return fib(n - 1) + fib(n - 2) + end +end fun main: void = do - fib(5) |> @write(_); -end; + fib(5) |> @write(_) +end \ No newline at end of file diff --git a/example/if.hz b/example/if.hz index 175442f..0702348 100644 --- a/example/if.hz +++ b/example/if.hz @@ -1,15 +1,15 @@ fun main: void = do if true then - @write("True"); + @write("True") else - @write("False"); - end; + @write("False") + end if true then do - @write("True"); - end; + @write("True") + end else - @write("False"); - end; -end; \ No newline at end of file + @write("False") + end +end \ No newline at end of file diff --git a/example/iter.hz b/example/iter.hz index ca94b07..9e58769 100644 --- a/example/iter.hz +++ b/example/iter.hz @@ -1,23 +1,23 @@ fun iter_ (vec: vec_int) (current: int): void = do if current == @len(vec) then - do end; + do end else do -- iter logic -- TODO: function as argument - @get(vec current) |> @write(_); - @write("\n"); + @get(vec, current) |> @write(_) + @write("\n") - iter_(vec, current + 1); - end; - end; -end; + iter_(vec, current + 1) + end + end +end fun iter (vec: vec_int): void = do - iter_(vec, 0); -end; + iter_(vec, 0) +end fun main: void = do - let foo: vec_int = [69, 420, 727, 1337, 42069, 69420]; - iter(foo); -end; + let foo: vec_int = [69, 420, 727, 1337, 42069, 69420] + iter(foo) +end \ No newline at end of file diff --git a/example/pipe.hz b/example/pipe.hz index 95baadc..e7641ef 100644 --- a/example/pipe.hz +++ b/example/pipe.hz @@ -1,14 +1,14 @@ -fun foo (xs: int): int = return xs + 1; -fun bar (xs: int) (x: int): int = return xs - x; +fun foo (xs: int): int = return xs + 1 +fun bar (xs: int) (x: int): int = return xs - x fun main: void = do foo(69) -- 69 + 1 => 70 |> bar(_, 1) -- '70 - 1 => 69 - |> @write(_); -- '69 => stdout + |> @write(_) -- '69 => stdout - @write("\n"); + @write("\n") foo(60) -- 60 + 1 => 61 |> bar(130, _) -- 130 - '61 => 69 - |> @write(_); -- '69 => stdout -end; \ No newline at end of file + |> @write(_) -- '69 => stdout +end \ No newline at end of file diff --git a/example/pipe2.hz b/example/pipe2.hz index fe3ee08..83c1cef 100644 --- a/example/pipe2.hz +++ b/example/pipe2.hz @@ -1,8 +1,8 @@ -fun foo (xs: int) : int = return xs + 1; -fun bar (xs: int) (ys: int) : int = return xs + ys; -fun baz (xs: int) (ys: int) (zs: int): int = return xs + ys + zs; -fun qux (xs: int) : int = return xs - 1; -fun quux (xs: int) (xy: int) : int = return xs - 2 + xy; +fun foo (xs: int) : int = return xs + 1 +fun bar (xs: int) (ys: int) : int = return xs + ys +fun baz (xs: int) (ys: int) (zs: int): int = return xs + ys + zs +fun qux (xs: int) : int = return xs - 1 +fun quux (xs: int) (xy: int) : int = return xs - 2 + xy fun main: void = do 66 @@ -11,9 +11,9 @@ fun main: void = do |> baz(1, 2, _) |> qux(_) |> quux(1, _) - |> @write(_); + |> @write(_) 210 |> bar(_, _) - |> @write(_); -end; \ No newline at end of file + |> @write(_) +end \ No newline at end of file