This repository was archived by the owner on Apr 2, 2026. It is now read-only.
Group all operators used in Pratt parsing in error messages #886
Answered
by
zesterer
jimmycuadra
asked this question in
Q&A
|
I'm using the Is there a way to group these together in such a way that the error message in this case would show something like this instead? The arguments passed to infix(
left(2),
just(Token::And),
|lhs: Spanned<Expr>, _, rhs, extra| {
(
Expr::Operation(Box::new(lhs), Operator::And, Box::new(rhs)),
extra.span(),
)
},
),I can provide more context from my code if needed. |
Answered by
zesterer
Oct 17, 2025
Replies: 1 comment 1 reply
|
Yep! You can use |
1 reply
Answer selected by
jimmycuadra
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yep! You can use
.labelled(...)to replace the name of a parser pattern. For example,just(Token::And).labelled("operator")should do the job.