mie: implement support for custom op print formats
This commit is contained in:
@@ -26,18 +26,28 @@ static enum mie_status parse(
|
||||
b_string *str = mie_parser_get_tempstr(ctx);
|
||||
struct mie_file_span span;
|
||||
if (!mie_parser_parse_string(ctx, str, &span)) {
|
||||
return false;
|
||||
return MIE_ERR_BAD_SYNTAX;
|
||||
}
|
||||
|
||||
struct mie_attribute *v = mie_ctx_get_string(
|
||||
mie_parser_get_mie_ctx(ctx), b_string_ptr(str));
|
||||
|
||||
if (!v) {
|
||||
return false;
|
||||
return MIE_ERR_NO_MEMORY;
|
||||
}
|
||||
|
||||
*out = v;
|
||||
return true;
|
||||
return MIE_SUCCESS;
|
||||
}
|
||||
|
||||
const char *mie_string_get_cstr(const struct mie_attribute *attrib)
|
||||
{
|
||||
if (!mie_attribute_check_name(attrib, "builtin", "string")) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const struct mie_string *str = (const struct mie_string *)attrib;
|
||||
return str->str_val;
|
||||
}
|
||||
|
||||
MIE_ATTRIBUTE_DEFINITION_BEGIN(mie_builtin_string, "string")
|
||||
|
||||
Reference in New Issue
Block a user