Skip to content

Commit

Permalink
Comment the Precedence variants
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed May 16, 2024
1 parent 5acab0f commit 2bc0bf9
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/precedence.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,33 @@
use crate::op::BinOp;
use std::cmp::Ordering;

// Reference: https://doc.rust-lang.org/reference/expressions.html#expression-precedence
pub(crate) enum Precedence {
// return, break, closures
Any,
// = += -= *= /= %= &= |= ^= <<= >>=
Assign,
// .. ..=
Range,
// ||
Or,
// &&
And,
// == != < > <= >=
Compare,
// |
BitOr,
// ^
BitXor,
// &
BitAnd,
// << >>
Shift,
// + -
Arithmetic,
// * / %
Term,
// as
Cast,
}

Expand Down

0 comments on commit 2bc0bf9

Please sign in to comment.