mirror of
https://github.com/odin-lang/Odin.git
synced 2026-05-01 10:34:41 +00:00
Core library clean up: Make range expressions more consistent and replace uses of .. with ..=
This commit is contained in:
@@ -201,9 +201,9 @@ next_token :: proc(p: ^Parser) -> Token {
|
||||
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;
|
||||
}
|
||||
@@ -241,7 +241,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;
|
||||
|
||||
@@ -232,7 +232,7 @@ get_pos :: proc(t: ^Tokenizer) -> Pos {
|
||||
|
||||
is_letter :: proc(r: rune) -> bool {
|
||||
switch r {
|
||||
case 'a'..'z', 'A'..'Z', '_':
|
||||
case 'a'..='z', 'A'..='Z', '_':
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -240,7 +240,7 @@ is_letter :: proc(r: rune) -> bool {
|
||||
|
||||
is_digit :: proc(r: rune) -> bool {
|
||||
switch r {
|
||||
case '0'..'9':
|
||||
case '0'..='9':
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -273,9 +273,9 @@ scan_identifier :: proc(t: ^Tokenizer) -> string {
|
||||
|
||||
digit_value :: proc(r: rune) -> int {
|
||||
switch r {
|
||||
case '0'..'9': return int(r - '0');
|
||||
case 'a'..'f': return int(r - 'a' + 10);
|
||||
case 'A'..'F': return int(r - 'A' + 10);
|
||||
case '0'..='9': return int(r - '0');
|
||||
case 'a'..='f': return int(r - 'a' + 10);
|
||||
case 'A'..='F': return int(r - 'A' + 10);
|
||||
}
|
||||
return 16;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user