kul_core/parser/premade/
default_classifier.rs

1use crate::parser::CharClassifier;
2
3
4/// A [`CharClassifier`](trait.CharClassifier.html) that uses the common `{`,
5/// `}`, and `\` characters and the Unicode whitespace property.
6#[derive(Debug)]
7#[allow(missing_copy_implementations)]
8pub struct DefaultCharClassifier;
9
10impl CharClassifier for DefaultCharClassifier {
11    #[inline]
12    fn is_nest_start(&self, c: char) -> bool {
13        '{' == c
14    }
15
16    #[inline]
17    fn is_nest_end(&self, c: char) -> bool {
18        '}' == c
19    }
20
21    #[inline]
22    fn is_nest_escape(&self, c: char) -> bool {
23        '\\' == c
24    }
25
26    #[inline]
27    fn is_whitespace(&self, c: char) -> bool {
28        c.is_whitespace()
29    }
30}