Skip to content
This repository was archived by the owner on Apr 2, 2026. It is now read-only.

Commit 726bfaa

Browse files
zeichenreihezeichenreihe
andauthored
shorten the comment lines in the pratt module (#926)
this fixes #705 Co-authored-by: zeichenreihe <zeichenreihe@noreply.codeberg.org>
1 parent 145f128 commit 726bfaa

1 file changed

Lines changed: 10 additions & 7 deletions

File tree

src/pratt.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,20 @@
6363
//! let op = |c| just(c).padded();
6464
//!
6565
//! let expr = atom.pratt((
66-
//! // We want factorial to happen before any negation, so we need its precedence to be higher than `Expr::Neg`.
66+
//! // We want factorial to happen before any negation, so we
67+
//! // need its precedence to be higher than `Expr::Neg`.
6768
//! postfix(4, op('!'), |lhs, _, _| Expr::Factorial(Box::new(lhs))),
68-
//! // Just like in math, we want that if we write -x^2, our parser parses that as -(x^2), so we need it to have
69-
//! // exponents bind tighter than our prefix operators.
69+
//! // Just like in math, we want that if we write -x^2, our parser
70+
//! // parses that as -(x^2), so we need it to have exponents bind
71+
//! // tighter than our prefix operators.
7072
//! infix(right(3), op('^'), |l, _, r, _| Expr::Pow(Box::new(l), Box::new(r))),
71-
//! // Notice the conflict with our `Expr::Sub`. This will still parse correctly. We want negation to happen before
72-
//! // `+` and `-`, so we set its precedence higher.
73+
//! // Notice the conflict with our `Expr::Sub`. This will still
74+
//! // parse correctly. We want negation to happen before `+` and
75+
//! // `-`, so we set its precedence higher.
7376
//! prefix(2, op('-'), |_, rhs, _| Expr::Neg(Box::new(rhs))),
7477
//! prefix(2, op('*'), |_, rhs, _| Expr::Deref(Box::new(rhs))),
75-
//! // Our `-` and `+` bind the weakest, meaning that even if they occur first in an expression, they will be the
76-
//! // last executed.
78+
//! // Our `-` and `+` bind the weakest, meaning that even if they
79+
//! // occur first in an expression, they will be the last executed.
7780
//! infix(left(1), op('+'), |l, _, r, _| Expr::Add(Box::new(l), Box::new(r))),
7881
//! infix(left(1), op('-'), |l, _, r, _| Expr::Sub(Box::new(l), Box::new(r))),
7982
//! ))

0 commit comments

Comments
 (0)