crates/highlight/src/lib.rs 1.4 KiB raw
1
//! Syntax tokenization and theme application.
2
//!
3
//! The crate keeps expensive work in the load/compile path. TextMate grammars
4
//! compile into Oniguruma regex sets, JSON uses a dedicated lexer, scope names
5
//! are interned, and the hot line APIs write into caller-owned buffers so
6
//! editors and pagers can reuse allocations.
7
#![allow(non_local_definitions)]
8
#![warn(missing_docs)]
9
#![warn(clippy::unwrap_used)]
10
#![warn(rustdoc::missing_crate_level_docs)]
11
#![warn(rustdoc::broken_intra_doc_links)]
12
#![warn(rustdoc::bare_urls)]
13
#![deny(unsafe_code)]
14
15
// `serde` is the local alias for the `microserde` crate; the derive macro emits
16
// `microserde::*` paths so the original crate name must remain in scope.
17
extern crate serde as microserde;
18
19
mod blob;
20
mod error;
21
mod grammar;
22
mod raw;
23
mod registry;
24
mod theme;
25
mod util;
26
27
pub mod json;
28
29
#[cfg(feature = "syntaxes")]
30
pub mod syntaxes;
31
32
pub use blob::{BlobCache, BlobHighlighter, LineBuffer, LineTokens, OwnedLineTokens, StyledLine};
33
pub use error::Error;
34
pub use grammar::{Grammar, GrammarKind, LineState, LineTokenizer, ScopeId, ScopeSpan};
35
pub use raw::{RawCapture, RawGrammar, RawPattern, RawStyle, RawTheme, RawThemeRule};
36
pub use registry::{GrammarQuery, Registry};
37
pub use theme::{FontStyle, Rgb, Style, StyleSpan, Theme};
38
39
/// Maximum active include depth followed while matching recursive pattern sets.
40
pub const MAX_INCLUDE_DEPTH: usize = 16;
41
42
#[cfg(test)]
43
#[allow(clippy::unwrap_used)]
44
mod tests;