only store start position for PrecedenceConflict

This commit is contained in:
Folkert 2021-03-20 15:34:08 +01:00
parent d22acb521e
commit 9208000316
4 changed files with 41 additions and 6 deletions

View file

@ -47,6 +47,18 @@ pub enum BinOp {
Backpassing,
}
impl BinOp {
/// how wide this operator is when typed out
pub fn width(self) -> u16 {
match self {
Caret | Star | Slash | Percent | Plus | Minus | LessThan | GreaterThan => 1,
DoubleSlash | DoublePercent | Equals | NotEquals | LessThanOrEq | GreaterThanOrEq
| And | Or | Pizza => 2,
Assignment | HasType | Backpassing => unreachable!(),
}
}
}
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum ArgSide {
Left,