summaryrefslogtreecommitdiffstats
path: root/src/repl/validator.rs
blob: 21a7a3c5edaabd6068a51b17c409ff87eb87188e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use super::EDIT_RE;

use reedline::{ValidationResult, Validator};

/// A default validator which checks for mismatched quotes and brackets
pub struct ReplValidator;

impl Validator for ReplValidator {
    fn validate(&self, line: &str) -> ValidationResult {
        if let Ok(true) = EDIT_RE.is_match(line) {
            ValidationResult::Incomplete
        } else {
            ValidationResult::Complete
        }
    }
}