1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use crate::parser::CharClassifier;


/// A [`CharClassifier`](trait.CharClassifier.html) that uses the common `{`,
/// `}`, and `\` characters and the Unicode whitespace property.
#[derive(Debug)]
#[allow(missing_copy_implementations)]
pub struct DefaultCharClassifier;

impl CharClassifier for DefaultCharClassifier {
    #[inline]
    fn is_nest_start(&self, c: char) -> bool {
        '{' == c
    }

    #[inline]
    fn is_nest_end(&self, c: char) -> bool {
        '}' == c
    }

    #[inline]
    fn is_nest_escape(&self, c: char) -> bool {
        '\\' == c
    }

    #[inline]
    fn is_whitespace(&self, c: char) -> bool {
        c.is_whitespace()
    }
}