Skip to main content

rustik_highlight/
lib.rs

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.
17extern crate serde as microserde;
18
19mod blob;
20mod error;
21mod grammar;
22mod raw;
23mod registry;
24mod theme;
25mod util;
26
27pub mod json;
28
29pub use blob::{BlobHighlighter, LineBuffer, LineTokens, OwnedLineTokens, StyledLine};
30pub use error::Error;
31pub use grammar::{Grammar, GrammarKind, LineState, LineTokenizer, ScopeId, ScopeSpan};
32pub use raw::{RawCapture, RawGrammar, RawPattern, RawStyle, RawTheme, RawThemeRule};
33pub use registry::{GrammarQuery, Registry};
34pub use theme::{FontStyle, Rgb, Style, StyleSpan, Theme};
35
36/// Maximum include depth when expanding `$self`, `$base`, and repository rules.
37pub const MAX_INCLUDE_DEPTH: usize = 8;
38
39#[cfg(test)]
40#[allow(clippy::unwrap_used)]
41mod tests;