Group all operators used in Pratt parsing in error messages #886
-
|
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. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Yep! You can use |
Beta Was this translation helpful? Give feedback.
Yep! You can use
.labelled(...)to replace the name of a parser pattern. For example,just(Token::And).labelled("operator")should do the job.