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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/// A input token, presumably from a parsed stream defining an arithmetic-like expression in human-readable ("infix") order.
///
/// Note that there is no `UnaryOp` arm; it is assumed that unary operators have already been encoded as a single [`Operand`](InfixToken::Operand).
/// An output token.
///
/// This is the subset of an [`InfixToken`] excluding the [`GroupStart`](InfixToken::GroupStart`) and [`GroupEnd`](InfixToken::GroupEnd) arms.
///
/// Those arms are unnecessary in a postfix expression because operators are immediately applied to the top values on the evaluation stack.
/// Trait required for values used as the `BinaryOp` arm of an [`InfixToken`] or [`PostfixToken`].
///
/// # Example
///
/// ```
/// enum MyBinaryOp {
/// Add,
/// Sub,
/// Mul,
/// Div,
/// }
///
///
/// impl fixit::BinaryOperator for MyBinaryOp {
/// fn precedence(&self) -> u8 {
/// match self {
/// MyBinaryOp::Add => 1,
/// MyBinaryOp::Sub => 1,
/// MyBinaryOp::Mul => 2,
/// MyBinaryOp::Div => 2,
/// }
/// }
/// }
/// ```
pub