Skip to content

Commit

Permalink
Refactor some parsing code
Browse files Browse the repository at this point in the history
Makes the parse module a bit easier to read. Also makes the struct attr
and field attr parsing methods more similar and prepares for additional
struct attributes.
  • Loading branch information
LukasKalbertodt committed Oct 11, 2024
1 parent 9de8d67 commit c11c8ba
Show file tree
Hide file tree
Showing 2 changed files with 217 additions and 194 deletions.
11 changes: 11 additions & 0 deletions macro/src/ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,14 @@ pub(crate) enum MapKey {
Float(syn::LitFloat),
Bool(syn::LitBool),
}

impl From<MapKey> for Expr {
fn from(src: MapKey) -> Self {
match src {
MapKey::Str(v) => Self::Str(v),
MapKey::Int(v) => Self::Int(v),
MapKey::Float(v) => Self::Float(v),
MapKey::Bool(v) => Self::Bool(v),
}
}
}
Loading

0 comments on commit c11c8ba

Please sign in to comment.