Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse block expr as verbatim in non-full mode #1478

Merged
merged 1 commit into from Jul 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/expr.rs
Expand Up @@ -1691,6 +1691,16 @@ pub(crate) mod parsing {
} else if input.is_empty() {
Err(input.error("expected an expression"))
} else {
if input.peek(token::Brace) {
let scan = input.fork();
let content;
braced!(content in scan);
if content.parse::<Expr>().is_ok() && content.is_empty() {
let expr_block = verbatim::between(input, &scan);
input.advance_to(&scan);
return Ok(Expr::Verbatim(expr_block));
}
}
Err(input.error("unsupported expression; enable syn's features=[\"full\"]"))
}
}
Expand Down