diff --git a/source/lexer/lexer.hon b/source/lexer/lexer.hon index 710d95b..74e45f4 100644 --- a/source/lexer/lexer.hon +++ b/source/lexer/lexer.hon @@ -18,7 +18,7 @@ ErrorCode :: enum { SourceError :: enum { source_too_large } -keywords strmap.StringMap(TokenKind) :: strmap.init([ +keywords strmap.StaticStringMap(TokenKind) :: strmap.init([ { "proc", .proc }, { "return", .return }, { "if", .if }, diff --git a/source/main.hon b/source/main.hon index 5799cb2..d9f0687 100644 --- a/source/main.hon +++ b/source/main.hon @@ -9,7 +9,7 @@ import "@source/parser" ast_renderer :: import "@source/ast/renderer" -test import "@std/enums/enummap" +test import "@std/enummap" test import "@std/arraylist" test import "@std/hashmap" test import "@std/strmap" diff --git a/std/enums/enummap/enummap.hon b/std/enummap/enummap.hon similarity index 100% rename from std/enums/enummap/enummap.hon rename to std/enummap/enummap.hon diff --git a/std/enums/enummap/enummap.test.hon b/std/enummap/enummap.test.hon similarity index 100% rename from std/enums/enummap/enummap.test.hon rename to std/enummap/enummap.test.hon diff --git a/std/enums/enums.hon b/std/enums/enums.hon deleted file mode 100644 index e69de29..0000000 diff --git a/std/enums/enums.test.hon b/std/enums/enums.test.hon deleted file mode 100644 index e69de29..0000000 diff --git a/std/std.hon b/std/std.hon deleted file mode 100644 index b500fa8..0000000 --- a/std/std.hon +++ /dev/null @@ -1,11 +0,0 @@ -import "io" -import "enums/enummap" -import "hashmap" -import "arraylist" -import "strmap" - -Io :: alias io.Io -EnumMap :: alias enummap.EnumMap -ArrayList :: alias arraylist.ArrayList -StringHashMap :: alias hashmap.StringHashMap -StringMap :: alias strmap.StringMap diff --git a/std/strmap/strmap.hon b/std/strmap/strmap.hon index aa0c238..4d0f469 100644 --- a/std/strmap/strmap.hon +++ b/std/strmap/strmap.hon @@ -1,6 +1,6 @@ import "@std/mem" -StringMap proc($V type) type { +StaticStringMap proc($V type) type { return struct { keys [][]u8 values []V @@ -16,7 +16,7 @@ Pair proc($V type) type { } #! initializes a static string map from a list of key-value pairs (constructed at compile-time). -init proc($V type, $N usize, $entries [N]Pair(V)) StringMap(V) { +init proc($V type, $N usize, $entries [N]Pair(V)) StaticStringMap(V) { if N > usize(maxval!(u32)) { compile_error!("static string map has too many entries") } @@ -40,7 +40,7 @@ init proc($V type, $N usize, $entries [N]Pair(V)) StringMap(V) { if N == 0 { len_indexes [0]u32 := undefined - return StringMap(V){ + return StaticStringMap(V){ keys = keys[..], values = values[..], len_indexes = len_indexes[..], @@ -71,7 +71,7 @@ init proc($V type, $N usize, $entries [N]Pair(V)) StringMap(V) { len_indexes[length] = u32(entry_index) } - return StringMap(V) { + return StaticStringMap(V) { keys = keys[..], values = values[..], len_indexes = len_indexes[..], @@ -80,7 +80,7 @@ init proc($V type, $N usize, $entries [N]Pair(V)) StringMap(V) { } } -get proc($V type, map @StringMap(V), key []u8) ?V { +get proc($V type, map @StaticStringMap(V), key []u8) ?V { if (map.keys.len == 0 or key.len > maxval!(u32)) return null length := u32(key.len) diff --git a/std/strmap/strmap.test.hon b/std/strmap/strmap.test.hon deleted file mode 100644 index 044a482..0000000 --- a/std/strmap/strmap.test.hon +++ /dev/null @@ -1 +0,0 @@ -# todo