mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 23:58:50 +00:00
Keep -vet happy
This commit is contained in:
+18
-18
@@ -116,10 +116,10 @@ is_nil :: proc(v: any) -> bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
index :: proc(v: any, i: int, loc := #caller_location) -> any {
|
index :: proc(val: any, i: int, loc := #caller_location) -> any {
|
||||||
if v == nil do return nil;
|
if val == nil do return nil;
|
||||||
|
|
||||||
v := v;
|
v := val;
|
||||||
v.id = runtime.typeid_base(v.id);
|
v.id = runtime.typeid_base(v.id);
|
||||||
switch a in v {
|
switch a in v {
|
||||||
case runtime.Type_Info_Array:
|
case runtime.Type_Info_Array:
|
||||||
@@ -238,17 +238,17 @@ struct_tag_get :: proc(tag: Struct_Tag, key: string) -> (value: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct_tag_lookup :: proc(tag: Struct_Tag, key: string) -> (value: string, ok: bool) {
|
struct_tag_lookup :: proc(tag: Struct_Tag, key: string) -> (value: string, ok: bool) {
|
||||||
for tag := tag; tag != ""; /**/ {
|
for t := tag; t != ""; /**/ {
|
||||||
i := 0;
|
i := 0;
|
||||||
for i < len(tag) && tag[i] == ' ' { // Skip whitespace
|
for i < len(t) && t[i] == ' ' { // Skip whitespace
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
tag = tag[i:];
|
t = t[i:];
|
||||||
if len(tag) == 0 do break;
|
if len(t) == 0 do break;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
loop: for i < len(tag) {
|
loop: for i < len(t) {
|
||||||
switch tag[i] {
|
switch t[i] {
|
||||||
case ':', '"':
|
case ':', '"':
|
||||||
break loop;
|
break loop;
|
||||||
case 0x00 ..< ' ', 0x7f .. 0x9f: // break if control character is found
|
case 0x00 ..< ' ', 0x7f .. 0x9f: // break if control character is found
|
||||||
@@ -258,24 +258,24 @@ struct_tag_lookup :: proc(tag: Struct_Tag, key: string) -> (value: string, ok: b
|
|||||||
}
|
}
|
||||||
|
|
||||||
if i == 0 do break;
|
if i == 0 do break;
|
||||||
if i+1 >= len(tag) do break;
|
if i+1 >= len(t) do break;
|
||||||
|
|
||||||
if tag[i] != ':' || tag[i+1] != '"' {
|
if t[i] != ':' || t[i+1] != '"' {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
name := string(tag[:i]);
|
name := string(t[:i]);
|
||||||
tag = tag[i+1:];
|
t = t[i+1:];
|
||||||
|
|
||||||
i = 1;
|
i = 1;
|
||||||
for i < len(tag) && tag[i] != '"' { // find closing quote
|
for i < len(t) && t[i] != '"' { // find closing quote
|
||||||
if tag[i] == '\\' do i += 1; // Skip escaped characters
|
if t[i] == '\\' do i += 1; // Skip escaped characters
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if i >= len(tag) do break;
|
if i >= len(t) do break;
|
||||||
|
|
||||||
val := string(tag[:i+1]);
|
val := string(t[:i+1]);
|
||||||
tag = tag[i+1:];
|
t = t[i+1:];
|
||||||
|
|
||||||
if key == name {
|
if key == name {
|
||||||
return val[1:i], true;
|
return val[1:i], true;
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package main
|
|||||||
import "core:fmt"
|
import "core:fmt"
|
||||||
import "core:mem"
|
import "core:mem"
|
||||||
import "core:os"
|
import "core:os"
|
||||||
import "core:runtime"
|
|
||||||
import "core:reflect"
|
import "core:reflect"
|
||||||
|
|
||||||
when os.OS == "windows" {
|
when os.OS == "windows" {
|
||||||
|
|||||||
Reference in New Issue
Block a user