commit 0c655f09ef19ac5a3a45d84ea64edaf51dd3f5ea
parent 16b3595b96c41c694008891e0e72ce8b836f9e6b
Author: Sebastian <sebastian@sebsite.pw>
Date: Sat, 14 May 2022 22:46:41 -0400
ascii: style
The style guide requires whitespace around binary operators.
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/ascii/ctype.ha b/ascii/ctype.ha
@@ -34,49 +34,49 @@ const cclass: []u8 = [
// Returns true if an ASCII character is a letter.
export fn isalpha(c: rune) bool =
- if (!valid(c)) false else cclass[c: u32]&(U|L) > 0;
+ if (!valid(c)) false else cclass[c: u32] & (U | L) > 0;
// Returns true if an ASCII character is uppercase.
export fn isupper(c: rune) bool =
- if (!valid(c)) false else cclass[c: u32]&U > 0;
+ if (!valid(c)) false else cclass[c: u32] & U > 0;
// Returns true if an ASCII character is lowercase.
export fn islower(c: rune) bool =
- if (!valid(c)) false else cclass[c: u32]&L > 0;
+ if (!valid(c)) false else cclass[c: u32] & L > 0;
// Returns true if an ASCII character is a digit.
export fn isdigit(c: rune) bool =
- if (!valid(c)) false else cclass[c: u32]&N > 0;
+ if (!valid(c)) false else cclass[c: u32] & N > 0;
// Returns true if an ASCII character is a hexadecimal digit.
export fn isxdigit(c: rune) bool =
- if (!valid(c)) false else cclass[c: u32]&X > 0;
+ if (!valid(c)) false else cclass[c: u32] & X > 0;
// Returns true if an ASCII character is a white-space character -
// one of '\f', '\n', '\r', '\t', '\v', ' '.
export fn isspace(c: rune) bool =
- if (!valid(c)) false else cclass[c: u32]&S > 0;
+ if (!valid(c)) false else cclass[c: u32] & S > 0;
// Returns true if an ASCII character is punctuation.
export fn ispunct(c: rune) bool =
- if (!valid(c)) false else cclass[c: u32]&P > 0;
+ if (!valid(c)) false else cclass[c: u32] & P > 0;
// Returns true if an ASCII character is alphanumeric.
export fn isalnum(c: rune) bool =
- if (!valid(c)) false else cclass[c: u32]&(U|L|N) > 0;
+ if (!valid(c)) false else cclass[c: u32] & (U | L | N) > 0;
// Returns true if an ASCII character is printable.
export fn isprint(c: rune) bool =
- if (!valid(c)) false else cclass[c: u32]&(P|U|L|N|B) > 0;
+ if (!valid(c)) false else cclass[c: u32] & (P | U | L | N | B ) > 0;
// Returns true if an ASCII character is any printable character other than
// space.
export fn isgraph(c: rune) bool =
- if (!valid(c)) false else cclass[c: u32]&(P|U|L|N) > 0;
+ if (!valid(c)) false else cclass[c: u32] & (P | U | L | N) > 0;
// Returns true if an ASCII character is a control character.
export fn iscntrl(c: rune) bool =
- if (!valid(c)) false else cclass[c: u32]&C > 0;
+ if (!valid(c)) false else cclass[c: u32] & C > 0;
// Returns true if a rune is a space or a tab.
export fn isblank(c: rune) bool = (c == ' ' || c == '\t');