Skip to main content

rl_lang/checker/operators/
mod.rs

1//! Operator type-checking - binary, unary, and index-assign.
2
3mod binary;
4mod index_assign;
5mod unary;
6
7use crate::lexer::tokentypes::TokenType;
8
9/// Returns the display string for a binary operator token, used in error messages.
10pub fn op_str(op: &TokenType) -> &'static str {
11    match op {
12        TokenType::Plus => "+",
13        TokenType::Minus => "-",
14        TokenType::Star => "*",
15        TokenType::Slash => "/",
16        TokenType::Less => "<",
17        TokenType::Greater => ">",
18        TokenType::LessEqual => "<=",
19        TokenType::GreaterEqual => ">=",
20        TokenType::Compare => "==",
21        TokenType::BangEqual => "!=",
22        _ => "?",
23    }
24}