summaryrefslogtreecommitdiffstats
path: root/src/repl/validator.rs
blob: 1a5f4054d3fcae381f6a10d9b40fd358517811c0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use reedline::{ValidationResult, Validator};

/// A default validator which checks for mismatched quotes and brackets
#[allow(clippy::module_name_repetitions)]
pub struct ReplValidator;

impl Validator for ReplValidator {
    fn validate(&self, line: &str) -> ValidationResult {
        if line.ends_with('\\') {
            ValidationResult::Incomplete
        } else {
            ValidationResult::Complete
        }
    }
}