Skip to content

Commit

Permalink
[#36] Handle complex enum
Browse files Browse the repository at this point in the history
  • Loading branch information
Orchaldir committed Sep 10, 2023
1 parent ecaf8b8 commit 4fad14c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions macro_ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ fn handle_enum(name: &Ident, data: &DataEnum) -> TokenStream2 {
let t = parser.get_str(&format!("{}.type", path)).unwrap_or("");
println!("{}type '{}'", spaces, t);

match parser.get_str(&format!("{}.type", path)).unwrap_or("") {
match t {

#parsed_fields

Expand Down Expand Up @@ -228,12 +228,12 @@ fn visit_tuple_field(field: &Field, field_name: &str) -> TokenStream2 {
fn parse_tuple_field(field: &Field, field_name: &str) -> TokenStream2 {
if is_integer(field) {
quote! {
parser.parse_u32(&format!("{}.{}", path, stringify!(#field_name)), 0)
parser.parse_u32(&format!("{}.{}", path, #field_name), 0)
}
} else {
let name = &get_field_type(field);
quote! {
#name::parse(parser, &format!("{}.{}", path, stringify!(#field_name)), &format!(" {}", spaces))
#name::parse(parser, &format!("{}.{}", path, #field_name), &format!(" {}", spaces))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion rpg_tools_core/examples/parser_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn main() {
("test.inner.c", "4"),
("test.simple", "B"),
("test.complex.type", "D"),
("test.complex.c", "5"),
("test.complex.c", "6"),
]));
let test = Test::parse(&parser, "test", "");
println!("Values:{:?}", test);
Expand Down

0 comments on commit 4fad14c

Please sign in to comment.