1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
use crateTokenKind;
/// Returns the left and right binding power for an infix (binary) operator token,
/// or `None` if the token is not an infix operator.
///
/// Binding powers are used by the Pratt expression parser to determine operator
/// precedence and associativity. Each pair `(left_bp, right_bp)` satisfies
/// `left_bp < right_bp`, making all operators **left-associative**.
///
/// ## Precedence Table (lowest → highest)
///
/// | BP (L, R) | Operators |
/// |-----------|----------------------------------|
/// | (1, 2) | `OR` |
/// | (3, 4) | `AND` |
/// | (5, 6) | `=`, `!=` / `<>` |
/// | (7, 8) | `<`, `<=`, `>`, `>=` |
/// | (9, 10) | `+`, `-` |
/// | (11, 12) | `*`, `/`, `%` |
/// | (13, 14) | `\|\|` (string concatenation) |
/// | (15, 16) | `::` (PostgreSQL-style cast) |
/// | (17, 18) | `.` (qualified name / member) |
/// Returns the right binding power for a prefix (unary) operator token,
/// or `None` if the token is not a prefix operator.
///
/// Supported prefix operators:
/// - `NOT` — logical negation (bp 5, binds tighter than `OR`/`AND` but below comparisons)
/// - `-` — arithmetic negation (bp 13, binds tighter than `+`/`-` but below `*`/`/`)