diff options
| author | gingerBill <bill@gingerbill.org> | 2020-09-23 17:17:14 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-09-23 17:17:14 +0100 |
| commit | fc4fdd588e5bd0c45d04c792267a0f4434c6a38e (patch) | |
| tree | 59bcddc60248dd78ed1155dd7a6ae7ae3de2e07e /core/unicode | |
| parent | 4844dd4d96f0921f44e70c9960d3e4476aad7115 (diff) | |
Remove usage of `do` in core library
Diffstat (limited to 'core/unicode')
| -rw-r--r-- | core/unicode/utf16/utf16.odin | 12 | ||||
| -rw-r--r-- | core/unicode/utf8/utf8.odin | 20 |
2 files changed, 21 insertions, 11 deletions
diff --git a/core/unicode/utf16/utf16.odin b/core/unicode/utf16/utf16.odin index 847934431..a436655b4 100644 --- a/core/unicode/utf16/utf16.odin +++ b/core/unicode/utf16/utf16.odin @@ -35,19 +35,19 @@ encode :: proc(d: []u16, s: []rune) -> int { loop: for r in s { switch r { case 0..<_surr1, _surr3 ..< _surr_self: - if m+1 < n do break loop; + if m+1 < n { break loop; } d[n] = u16(r); n += 1; case _surr_self .. MAX_RUNE: - if m+2 < n do break loop; + if m+2 < n { break loop; } r1, r2 := encode_surrogate_pair(r); d[n] = u16(r1); d[n+1] = u16(r2); n += 2; case: - if m+1 < n do break loop; + if m+1 < n { break loop; } d[n] = u16(REPLACEMENT_CHAR); n += 1; } @@ -61,19 +61,19 @@ encode_string :: proc(d: []u16, s: string) -> int { loop: for r in s { switch r { case 0..<_surr1, _surr3 ..< _surr_self: - if m+1 < n do break loop; + if m+1 < n { break loop; } d[n] = u16(r); n += 1; case _surr_self .. MAX_RUNE: - if m+2 < n do break loop; + if m+2 < n { break loop; } r1, r2 := encode_surrogate_pair(r); d[n] = u16(r1); d[n+1] = u16(r2); n += 2; case: - if m+1 < n do break loop; + if m+1 < n { break loop; } d[n] = u16(REPLACEMENT_CHAR); n += 1; } diff --git a/core/unicode/utf8/utf8.odin b/core/unicode/utf8/utf8.odin index a547bd2e7..f008c3881 100644 --- a/core/unicode/utf8/utf8.odin +++ b/core/unicode/utf8/utf8.odin @@ -90,7 +90,9 @@ encode_rune :: proc(c: rune) -> ([4]u8, int) { return buf, 4; } -decode_rune_in_string :: inline proc(s: string) -> (rune, int) do return decode_rune(transmute([]u8)s); +decode_rune_in_string :: inline proc(s: string) -> (rune, int) { + return decode_rune(transmute([]u8)s); +} decode_rune :: proc(s: []u8) -> (rune, int) { n := len(s); if n < 1 { @@ -159,7 +161,9 @@ runes_to_string :: proc(runes: []rune, allocator := context.allocator) -> string } -decode_last_rune_in_string :: inline proc(s: string) -> (rune, int) do return decode_last_rune(transmute([]u8)s); +decode_last_rune_in_string :: inline proc(s: string) -> (rune, int) { + return decode_last_rune(transmute([]u8)s); +} decode_last_rune :: proc(s: []u8) -> (rune, int) { r: rune; size: int; @@ -179,7 +183,9 @@ decode_last_rune :: proc(s: []u8) -> (rune, int) { limit = max(end - UTF_MAX, 0); for start-=1; start >= limit; start-=1 { - if rune_start(s[start]) do break; + if rune_start(s[start]) { + break; + } } start = max(start, 0); @@ -287,9 +293,13 @@ valid_string :: proc(s: string) -> bool { return true; } -rune_start :: inline proc(b: u8) -> bool do return b&0xc0 != 0x80; +rune_start :: inline proc(b: u8) -> bool { + return b&0xc0 != 0x80; +} -rune_count_in_string :: inline proc(s: string) -> int do return rune_count(transmute([]u8)s); +rune_count_in_string :: inline proc(s: string) -> int { + return rune_count(transmute([]u8)s); +} rune_count :: proc(s: []u8) -> int { count := 0; n := len(s); |