An operator trait, to help with parsing of operators
| 580 | |
| 581 | /// An operator trait, to help with parsing of operators |
| 582 | trait Operator: Sized { |
| 583 | /// Looks up the corresponding operator for a token, if one exists |
| 584 | fn from(token: &Token) -> Option<Self>; |
| 585 | /// Augments an operator by allowing it to parse any modifiers. |
| 586 | fn augment(self, parser: &mut Parser) -> Result<Self>; |
| 587 | /// Returns the operator's associativity |
| 588 | fn assoc(&self) -> u8; |
| 589 | /// Returns the operator's precedence |
| 590 | fn prec(&self) -> u8; |
| 591 | } |
| 592 | |
| 593 | const ASSOC_LEFT: u8 = 1; |
| 594 | const ASSOC_RIGHT: u8 = 0; |
nothing calls this directly
no outgoing calls
no test coverage detected