1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use crate::{parser::*, session::SessionParserConfig};
use reedline::{ValidationResult, Validator};

impl Validator for Localization {
    fn validate(&self, line: &str) -> ValidationResult {
        let res = self.parse_input(line);
        match res {
            Ok(_) => ValidationResult::Complete,
            Err(_) => ValidationResult::Incomplete,
        }
    }
}

impl Validator for SessionParserConfig {
    fn validate(&self, line: &str) -> ValidationResult {
        let res = self.locale.parse_input_with(line, self);
        match res {
            Ok(_) => ValidationResult::Complete,
            Err(_) => ValidationResult::Incomplete,
        }
    }
}