Skip to main content

just_lsp/
function_kind.rs

1use super::*;
2
3#[derive(Debug, Clone, Copy)]
4pub enum FunctionKind {
5  Binary,
6  BinaryPlus,
7  Nullary,
8  Ternary,
9  Unary,
10  UnaryOpt,
11  UnaryPlus,
12}
13
14impl FunctionKind {
15  #[must_use]
16  pub fn argument_range(self) -> RangeInclusive<usize> {
17    match self {
18      Self::Binary => 2..=2,
19      Self::BinaryPlus => 2..=usize::MAX,
20      Self::Nullary => 0..=0,
21      Self::Ternary => 3..=3,
22      Self::Unary => 1..=1,
23      Self::UnaryOpt => 1..=2,
24      Self::UnaryPlus => 1..=usize::MAX,
25    }
26  }
27}