1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
//! Provides utilities for implementing Syntax Highlight

/// A interface of syntax highlight
/// This is called just before buffer is displayed.
pub trait Syntaxer: Send + Sync {
    /// syntax highlight buffer
    fn highlight(&self, buf: &str, pos: usize) -> Option<(String, usize)>;
}

/// It is default syntax highlight
pub struct DummySyntaxer;

impl Syntaxer for DummySyntaxer {
    fn highlight(&self, _buf: &str, _pos: usize) -> Option<(String, usize)> {
        None
    }
}