standard library changes for optional semicolons
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 5 Feb 2024 22:57:37 +0000 (16:57 -0600)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 5 Feb 2024 22:57:37 +0000 (16:57 -0600)
12 files changed:
core/container/array.onyx
core/container/bucket_array.onyx
core/container/heap.onyx
core/container/set.onyx
core/hash/sha256.onyx
core/io/reader.onyx
core/math/math.onyx
core/misc/arg_parse.onyx
core/string/char_utils.onyx
core/string/string.onyx
core/string/string_pool.onyx
core/time/time.onyx

index 421345c07ca1eaa229132f19da27c4cdc809e2d1..5b9abc7bfb31385122fbb52288af45a0db748269 100644 (file)
@@ -152,7 +152,9 @@ push :: (arr: &[..] $T, x: T) -> bool {
 }
 
 // Semi-useful shortcut for adding something to an array.
-#operator << macro (arr: [..] $T, v: T) do #this_package.push(&arr, v);
+#operator << macro (arr: [..] $T, v: T) {
+    #this_package.push(&arr, v)
+}
 
 
 #doc """
index 5c5750dfd197747a06bd3ac719fbb69ef473aeaf..47ef1cd302c863d391a2deb2631a8a5a2cb7c550 100644 (file)
@@ -86,7 +86,9 @@ push :: (use b: &Bucket_Array($T), elem: T) -> bool {
     }
 }
 
-#operator << macro (b: Bucket_Array($T), elem: T) do #this_package.push(&b, elem);
+#operator << macro (b: Bucket_Array($T), elem: T) {
+    #this_package.push(&b, elem)
+}
 
 pop :: (use b: &Bucket_Array($T)) {
     last_bucket := &buckets[buckets.count - 1];
index 3ff0837d22ffe698de8fa96f6cc4b5955f742e16..5db9bbcd4da40c3a3edd0329b6797b1fa591529f 100644 (file)
@@ -23,7 +23,9 @@ insert :: (use heap: &Heap, v: heap.T) {
     shift_up(heap, data.count - 1);
 }
 
-#operator << macro (heap: Heap($T), v: T) do #this_package.insert(&heap, v);
+#operator << macro (heap: Heap($T), v: T) {
+    #this_package.insert(&heap, v)
+}
 
 remove_top :: (use heap: &Heap) -> heap.T {
     x := data[0];
index 9a28755fe1b61bbde9e928db36e3f206f6eae602..c7cda96c08f390d8fc482e3c6e9bf8b811e4a2b1 100644 (file)
@@ -84,7 +84,9 @@ insert :: (use set: &Set, value: set.Elem_Type) {
     if full(set) do grow(set);
 }
 
-#operator << macro (set: Set($T), value: T) do #this_package.insert(&set, value);
+#operator << macro (set: Set($T), value: T) {
+    #this_package.insert(&set, value)
+}
 
 has :: (use set: &Set, value: set.Elem_Type) -> bool {
     lr := lookup(set, value);
index 1492f52e4aab7718536b42b12d028ddf7188cacc..9ff449f77c49ca5d7f9e3370fef30c5b88dfc7bb 100644 (file)
@@ -106,10 +106,10 @@ do_cycle :: (self: &Hasher, data: [] u8) {
 
     for i in 0 .. 16 {
         j := 4 * i;
-        m[i] = (cast(u32, data[j]) << 24)
-             | (cast(u32, data[j + 1]) << 16)
-             | (cast(u32, data[j + 2]) << 8)
-             | (cast(u32, data[j + 3]));
+        m[i] = (cast(u32, data[j]) << 24) |
+               (cast(u32, data[j + 1]) << 16) |
+               (cast(u32, data[j + 2]) << 8) |
+               (cast(u32, data[j + 3]));
     }
 
     for i in 16 .. 64 {
index 4d25f06372d5350acdfb6a8727857200bffb4b21..e5f0c3a7f2d7ae0104f5363181acf7a8fe169613 100644 (file)
@@ -393,9 +393,9 @@ read_word :: (use reader: &Reader, numeric_allowed := false, allocator := contex
 
         while count < end {
             curr := buffer[count];
-            if     (curr >= #char "a" && curr <= #char "z")
-                || (curr >= #char "A" && curr <= #char "Z")
-                || curr == #char "_" {
+            if  (curr >= #char "a" && curr <= #char "z") ||
+                (curr >= #char "A" && curr <= #char "Z") ||
+                 curr == #char "_" {
                 count += 1;
             } elseif numeric_allowed && (curr >= #char "0" && curr <= #char "9") {
                 count += 1;
@@ -413,9 +413,9 @@ read_word :: (use reader: &Reader, numeric_allowed := false, allocator := contex
         count := start;
         while count < end {
             curr := buffer[count];
-            if     (curr >= #char "a" && curr <= #char "z")
-                || (curr >= #char "A" && curr <= #char "Z")
-                || curr == #char "_" {
+            if  (curr >= #char "a" && curr <= #char "z") ||
+                (curr >= #char "A" && curr <= #char "Z") ||
+                 curr == #char "_" {
                 count += 1;
             } elseif numeric_allowed && (curr >= #char "0" && curr <= #char "9") {
                 count += 1;
index e313ad05c20822aecba1adacf234efbbf431181c..76b5b37cb81cadeb14b096f5e9cd22e4c586b466 100644 (file)
@@ -370,16 +370,16 @@ is_nan :: #match #local {}
 is_nan :: (x: f32) -> bool {
     v := x;
     i := *cast(&u32) &v;
-    return (i & 0x7f800000) == 0x7f800000
-        && (i & 0x007fffff) != 0;
+    return (i & 0x7f800000) == 0x7f800000 &&
+           (i & 0x007fffff) != 0;
 }
 
 #overload
 is_nan :: (x: f64) -> bool {
     v := x;
     i := *cast(&u64) &v;
-    return (i & 0x7ff0000000000000) == 0x7ff0000000000000
-        && (i & 0x000fffffffffffff) != 0;
+    return (i & 0x7ff0000000000000) == 0x7ff0000000000000 &&
+           (i & 0x000fffffffffffff) != 0;
 }
 
 
@@ -389,16 +389,16 @@ is_inf :: #match #local {}
 is_inf :: (x: f32) -> bool {
     v := x;
     i := *cast(&u32) &v;
-    return (i & 0x7f800000) == 0x7f800000
-        && (i & 0x007fffff) == 0;
+    return (i & 0x7f800000) == 0x7f800000 &&
+           (i & 0x007fffff) == 0;
 }
 
 #overload
 is_inf :: (x: f64) -> bool {
     v := x;
     i := *cast(&u64) &v;
-    return (i & 0x7ff0000000000000) == 0x7ff0000000000000
-        && (i & 0x000fffffffffffff) == 0;
+    return (i & 0x7ff0000000000000) == 0x7ff0000000000000 &&
+           (i & 0x000fffffffffffff) == 0;
 }
 
 
index edc8c547c029d11a38839c4b212ccee100c9ee62..2a7837c34f1896adb404e40c0164cf0c9ba9dc3a 100644 (file)
@@ -28,8 +28,8 @@ use runtime
     false and are true if one or more of the option values are present.
 """ 
 arg_parse :: (c_args: [] cstr, output: any) -> bool {
-    arg_iter := iter.as_iter(c_args)
-             |> iter.map(string.from_cstr);
+    arg_iter := iter.as_iter(c_args) |>
+                iter.map(string.from_cstr);
     defer arg_iter.close(arg_iter.data);
 
     use runtime.info {*};
index 0a79830d2dba5001617fe63610eef1e58456c0f5..d6b3c2cfb1db78d11a0c7f0109cccda614290b28 100644 (file)
@@ -2,8 +2,8 @@ package core.string
 
 #inject u8 {
     is_alpha :: (c: u8) -> bool {
-        return (c >= #char "A" && c <= #char "Z")
-            || (c >= #char "a" && c <= #char "z");
+        return (c >= #char "A" && c <= #char "Z") ||
+               (c >= #char "a" && c <= #char "z");
     }
 
     is_num :: (c: u8) -> bool {
index 034a4aa2a0d7447a93b24f4188ac35e149be999e..565f8f4b569ff840e36cc9c928e224113eea3bef 100644 (file)
@@ -322,8 +322,7 @@ strip_whitespace :: (s: &str) {
 
 #overload
 strip_whitespace :: (s:  str) =>
-    s |> strip_leading_whitespace()
-      |> strip_trailing_whitespace()
+    s |> strip_leading_whitespace() |> strip_trailing_whitespace()
 
 
 strip_leading_whitespace :: #match #local {}
index ecf77ee1e27615c4de62de5379a11b9c020f6c82..3822ed315b6d84702cfb06204af704d0498dfff2 100644 (file)
@@ -27,8 +27,8 @@ StringPool :: struct {
 //
 // Creates a StringPool capable of storing a string of at
 // most `maximum_string_length` bytes.
-pool_make :: (maximum_string_length := 16384, allocator := context.allocator)
-    => StringPool.{
+pool_make :: (maximum_string_length := 16384, allocator := context.allocator) =>
+    StringPool.{
         arena.make(allocator, maximum_string_length)
     }
 
index c02f57cfd44171225b783e62e39ffb19ad783bd9..9043928382a1553c2940c492e39eb9673d781660 100644 (file)
@@ -556,10 +556,10 @@ tm_to_time :: (tm: Timestamp) -> i64 {
     mi := cast(i64, tm.min);
     s := cast(i64, tm.sec);
 
-    return (365 * y + y / 4 - y / 100 + y / 400 + 3 * (m + 1) / 5 + 30 * m + d - 719561) * 86400
-        + 3600 * h
-        + 60 * mi
-        s;
+    return (365 * y + y / 4 - y / 100 + y / 400 + 3 * (m + 1) / 5 + 30 * m + d - 719561) * 86400 +
+        3600 * h +
+        60 * mi +
+        s;
 }