You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I'm working on a macro where I want to parse the basic structure of a match expression, but then I want to provide my own custom parser for the body of each match arm:
let match_token: syn::Token![match] = input.parse()?;
let expr: syn::Expr = input.parse()?; // <--- issue
let content;
let brace_token = syn::braced!(content in input);
let mut arms = Vec::new();
while !content.is_empty() {
arms.push(content.call(MyMatchArm::parse)?);
}
match foo { pat => ... } is now incorrectly parsed, because expr: Expr consumes all of foo { pat => ... }. What I need is some way to invoke expr_no_struct, which I think will correctly parse this, but it's not exposed as a public API, and I'd like to avoid copy/pasting hundreds of lines :)
Perhaps a way to do this could be to introduce a public newtype like ExprNoStruct(Expr) and implement Parse for that?
The text was updated successfully, but these errors were encountered:
Hi, I'm working on a macro where I want to parse the basic structure of a
match
expression, but then I want to provide my own custom parser for the body of each match arm:match foo { pat => ... }
is now incorrectly parsed, becauseexpr: Expr
consumes all offoo { pat => ... }
. What I need is some way to invoke expr_no_struct, which I think will correctly parse this, but it's not exposed as a public API, and I'd like to avoid copy/pasting hundreds of lines :)Perhaps a way to do this could be to introduce a public newtype like
ExprNoStruct(Expr)
and implement Parse for that?The text was updated successfully, but these errors were encountered: