1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
//! Highlights Rust code.

#![warn(missing_debug_implementations, rust_2018_idioms)]

mod grammar;
mod lexer;
mod parser;

use lexer::{lex, Token, TokenKind};
use parser::Parser;

#[derive(Debug, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
pub struct Highlighter;

impl dialect::Highlight for Highlighter {
    fn highlight(&self, input: &str) -> Vec<dialect::HighlightedSpan> {
        Parser::new(input).parse()
    }
}