commit 7cea2dba5ea08598017dc8cecd6178ad6733e112
parent e5b37f9d526697e5c799da7145cb25124571a756
Author: Sebastian <sebastian@sebsite.pw>
Date: Sat, 20 Apr 2024 22:21:23 -0400
mime: return done from next_param
Signed-off-by: Sebastian <sebastian@sebsite.pw>
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mime/parse.ha b/mime/parse.ha
@@ -30,9 +30,9 @@ export fn parse(in: str) ((str, type_params) | errors::invalid) = {
};
// Returns the next parameter as a (key, value) tuple from a [[type_params]]
-// object that was prepared via [[parse]], void if there are no remaining
+// object that was prepared via [[parse]], done if there are no remaining
// parameters, and [[errors::invalid]] if a syntax error was encountered.
-export fn next_param(in: *type_params) ((str, str) | void | errors::invalid) = {
+export fn next_param(in: *type_params) ((str, str) | done | errors::invalid) = {
const tok = match (strings::next_token(in: *strings::tokenizer)) {
case let s: str =>
if (s == "") {
@@ -41,7 +41,7 @@ export fn next_param(in: *type_params) ((str, str) | void | errors::invalid) = {
};
yield s;
case done =>
- return;
+ return done;
};
const items = strings::cut(tok, "=");
@@ -104,7 +104,7 @@ fn typevalid(in: str) (void | errors::invalid) = {
assert(param.0 == "charset" && param.1 == "utf-8");
const param = next_param(¶ms)! as (str, str);
assert(param.0 == "foo" && param.1 == "bar baz");
- assert(next_param(¶ms) is void);
+ assert(next_param(¶ms) is done);
assert(parse("hi") is errors::invalid);
assert(parse("text/ spaces ") is errors::invalid);