#[pliron_attr]Expand description
#[pliron_attr(...)]: Unified macro for defining IR attributes.
This macro provides a simplified, unified syntax for defining IR attributes by expanding into the existing attribute definition macros. It supports the following configuration options:
name = "dialect.attribute_name": The fully qualified name of the attribute (required).
Expands to def_attribute.format = "format_string": Custom format string for printing/parsing (optional).
Expands to format_attribute.verifier = "succ": Verifier implementation, currently only “succ” is supported (optional).
Expands to verify_succ.
§Examples
§Basic attribute definition:
use pliron::derive::pliron_attr;
#[pliron_attr(name = "test.string_attr", format, verifier = "succ")]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
struct StringAttr {
value: String,
}§Attribute with custom format:
use pliron::derive::pliron_attr;
#[pliron_attr(
name = "test.string_attr",
format = "`attr` `(` $value `)`",
verifier = "succ"
)]
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
struct StringAttr {
value: String,
}