.cargo/
crates/
brain/
diff/
files/
highlight/
benches/
src/
grammar/
blob.rs
14.3 KiB
error.rs
1.3 KiB
grammar.rs
10.3 KiB
json.rs
5.4 KiB
lib.rs
1.4 KiB
raw.rs
7.0 KiB
registry.rs
3.0 KiB
syntaxes.rs
2.2 KiB
tests.rs
33.4 KiB
theme.rs
18.7 KiB
util.rs
1.8 KiB
syntaxes/
tests/
Cargo.toml
492 B
repo/
signals/
tui/
tui-core/
tui-termion/
tui-widgets/
scripts/
src/
.gitignore
30 B
.gitsigners
198 B
AGENTS.md
1.9 KiB
CONTRIBUTING
1.7 KiB
Cargo.lock
5.4 KiB
Cargo.toml
1.9 KiB
LICENSE
1.1 KiB
README.md
245 B
STYLE
3.7 KiB
clippy.toml
213 B
crates/highlight/src/lib.rs
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; |