mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-03 22:28:46 +00:00
Deprecate a..b based ranges in favour of ..=
This commit is contained in:
@@ -231,16 +231,16 @@ xml_decode_entity :: proc(entity: string) -> (decoded: rune, ok: bool) {
|
|||||||
for len(entity) > 0 {
|
for len(entity) > 0 {
|
||||||
r := entity[0]
|
r := entity[0]
|
||||||
switch r {
|
switch r {
|
||||||
case '0'..'9':
|
case '0'..='9':
|
||||||
val *= base
|
val *= base
|
||||||
val += int(r - '0')
|
val += int(r - '0')
|
||||||
|
|
||||||
case 'a'..'f':
|
case 'a'..='f':
|
||||||
if base == 10 { return -1, false }
|
if base == 10 { return -1, false }
|
||||||
val *= base
|
val *= base
|
||||||
val += int(r - 'a' + 10)
|
val += int(r - 'a' + 10)
|
||||||
|
|
||||||
case 'A'..'F':
|
case 'A'..='F':
|
||||||
if base == 10 { return -1, false }
|
if base == 10 { return -1, false }
|
||||||
val *= base
|
val *= base
|
||||||
val += int(r - 'A' + 10)
|
val += int(r - 'A' + 10)
|
||||||
|
|||||||
@@ -198,7 +198,7 @@ is_valid_identifier_rune :: proc(r: rune) -> bool {
|
|||||||
switch r {
|
switch r {
|
||||||
case '_', '-', ':': return true
|
case '_', '-', ':': return true
|
||||||
case 'A'..='Z', 'a'..='z': return true
|
case 'A'..='Z', 'a'..='z': return true
|
||||||
case '0'..'9': return true
|
case '0'..='9': return true
|
||||||
case -1: return false
|
case -1: return false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1428,6 +1428,7 @@ Token expect_operator(AstFile *f) {
|
|||||||
LIT(p));
|
LIT(p));
|
||||||
}
|
}
|
||||||
if (f->curr_token.kind == Token_Ellipsis) {
|
if (f->curr_token.kind == Token_Ellipsis) {
|
||||||
|
syntax_warning(f->curr_token, "'..' for ranges has now be deprecated, prefer '..='");
|
||||||
f->tokens[f->curr_token_index].flags |= TokenFlag_Replace;
|
f->tokens[f->curr_token_index].flags |= TokenFlag_Replace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user