mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-30 03:10:06 +00:00
Core library clean up: Make range expressions more consistent and replace uses of .. with ..=
This commit is contained in:
@@ -139,18 +139,18 @@ append_token :: proc(a, b: ^Token) -> ^Token {
|
||||
|
||||
is_hex_digit :: proc(x: byte) -> bool {
|
||||
switch x {
|
||||
case '0'..'9', 'a'..'f', 'A'..'F':
|
||||
case '0'..='9', 'a'..='f', 'A'..='F':
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
from_hex :: proc(x: byte) -> i32 {
|
||||
switch x {
|
||||
case '0'..'9':
|
||||
case '0'..='9':
|
||||
return i32(x) - '0';
|
||||
case 'a'..'f':
|
||||
case 'a'..='f':
|
||||
return i32(x) - 'a' + 10;
|
||||
case 'A'..'F':
|
||||
case 'A'..='F':
|
||||
return i32(x) - 'A' + 10;
|
||||
}
|
||||
return 16;
|
||||
|
||||
@@ -5,9 +5,9 @@ import "core:unicode/utf8"
|
||||
unquote_char :: proc(str: string, quote: byte) -> (r: rune, multiple_bytes: bool, tail_string: string, success: bool) {
|
||||
hex_to_int :: proc(c: byte) -> int {
|
||||
switch c {
|
||||
case '0'..'9': return int(c-'0');
|
||||
case 'a'..'f': return int(c-'a')+10;
|
||||
case 'A'..'F': return int(c-'A')+10;
|
||||
case '0'..='9': return int(c-'0');
|
||||
case 'a'..='f': return int(c-'a')+10;
|
||||
case 'A'..='F': return int(c-'A')+10;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ unquote_char :: proc(str: string, quote: byte) -> (r: rune, multiple_bytes: bool
|
||||
case '"': r = '"';
|
||||
case '\'': r = '\'';
|
||||
|
||||
case '0'..'7':
|
||||
case '0'..='7':
|
||||
v := int(c-'0');
|
||||
if len(s) < 2 {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user