parser: support greater than

This commit is contained in:
Ryan Chandler 2022-07-28 19:36:06 +01:00
parent 8f5a00b16d
commit 8a515e760f
No known key found for this signature in database
GPG Key ID: F113BCADDB3B0CCA
2 changed files with 3 additions and 1 deletions

View File

@ -303,6 +303,7 @@ pub enum InfixOp {
Mul,
Concat,
LessThan,
GreaterThan,
Equals,
Identical,
NotEquals,
@ -319,6 +320,7 @@ impl From<TokenKind> for InfixOp {
TokenKind::Asterisk => Self::Mul,
TokenKind::Slash => Self::Div,
TokenKind::LessThan => Self::LessThan,
TokenKind::GreaterThan => Self::GreaterThan,
TokenKind::Dot => Self::Concat,
TokenKind::DoubleEquals => Self::Equals,
TokenKind::TripleEquals => Self::Identical,

View File

@ -1195,7 +1195,7 @@ fn infix_binding_power(t: &TokenKind) -> Option<(u8, u8)> {
TokenKind::Asterisk | TokenKind::Slash => (13, 14),
TokenKind::Plus | TokenKind::Minus => (11, 12),
TokenKind::Dot => (11, 11),
TokenKind::LessThan => (9, 10),
TokenKind::LessThan | TokenKind::GreaterThan => (9, 10),
TokenKind::DoubleEquals | TokenKind::TripleEquals | TokenKind::BangEquals | TokenKind::BangDoubleEquals => (7, 8),
TokenKind::BooleanAnd => (5, 6),
TokenKind::BooleanOr => (3, 4),